pyflightstream.run.matrix (stable)¶
Generated from the docstrings at build time: every one of the 9 names in the __all__ of pyflightstream.run.matrix has an entry below. The names a guide or an example uses come first; the others follow under Advanced.
Planning and running a bound run matrix.
Pipeline role: the run-layer half of the run matrix, and the one-call
first-class entry of the file-managed modality. :func:plan_matrix
pre-flights a matrix without executing anything and :func:run_matrix
takes it all the way to manifest records, composing the binding step of
:mod:pyflightstream.workspace.matrix with the campaign loop of
:mod:pyflightstream.run.
It sits here rather than beside the reader because that is where its
dependencies are. The reader in :mod:pyflightstream.cases.matrix
carried these two entry points and imported the campaign loop inside
their bodies, which recorded the upward dependency without declaring it
(OPS-2007.01, PFS-2009.05); at this layer the same imports are ordinary
module-level ones. Nothing about the matrix format, the flags or the
records moved with them.
it also carries the ADDITIONAL POST (G12):
:func:plan_additional_post and :func:run_additional_post reopen each
recorded point's final saved simulation and extract a second pproc from it
with no solve, choosing the executor as :func:run_matrix does.
:mod:pyflightstream.run deliberately does NOT import this module, so
importing it can never be part of an import cycle: the dependency runs
one way, from here into the campaign loop.
Size exemption: the plan, run and additional-post entry points share one resolved-matrix binding. Each binds the matrix rows to builds, executors and recipes the same way; parting the additional post from the run is a cut of its own, not the facade cut (AD-14).
Used in the guides¶
pyflightstream.run.matrix.run_matrix
¶
run_matrix(
path: str | Path,
workspace: CampaignWorkspace,
*,
warning_refusals: bool | None = None,
name: str,
recipes: Mapping[str, str],
assess: OutcomeAssessor,
default_fs_version: str | None = None,
fs_exe: str | Path | None = None,
executor: Executor | None = None,
recipe_registry: dict[str, ScriptRecipe] | None = None,
resume: bool = False,
force_rerun: Sequence[str] | None = None,
force_rerun_all: bool = False,
sims: Sequence[str] | None = None,
points: Sequence[str] | None = None,
progress_every: int = PROGRESS_EVERY_DEFAULT,
hidden: bool | None = None,
fs_version: str | None = None,
name_from: str | None = None,
ignore_missing_families: bool = True,
accept_unregistered_build: bool = False,
sweep_csv: object = None,
local: bool = False,
require_plan: bool = False,
parallel: int | str | None = None,
) -> list[RunRecord]
Read a run matrix and run it: the one-call first-class entry.
In order: the matrix converts through the canonical campaign form,
its codes resolve against the workspace input library
(:func:pyflightstream.workspace.matrix.resolve_matrix), the whole
campaign pre-flights in dry run, and only then the points execute
through :func:pyflightstream.run.run_campaign, landing one
manifest record per point. A blocked pre-flight refuses to execute
at all, so a broken recipe or missing artifact costs no solver time.
A row whose build declares a version of its own pre-flights and runs
under that version (PFS-2009.05.02; :func:plan_matrix says how the
version is read).
A matrix whose rows build native geometry with the solver runs in three
phases, so no refusal that does not depend on the geometry spends a seat
(R28-008): first the independent pre-flight (the plan receipt when
require_plan, and, with a native row selected, every row's recipe and
its REF, SET and PPROC codes; preflight_before_native_build), then
the native build through the run's executor (a submitting executor is
refused before anything is submitted), then the pre-flight that needs the
built geometry (the binding, the receipt's per-simulation build contract
and the dry run of every point, which refuses a blocked point).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
warning_refusals
|
bool
|
Restore demoted refusals for this call; None uses the runtime option. |
None
|
path
|
str | Path
|
As in :func: |
required |
workspace
|
str | Path
|
As in :func: |
required |
name
|
str | Path
|
As in :func: |
required |
recipes
|
str | Path
|
As in :func: |
required |
fs_exe
|
str | Path
|
As in :func: |
required |
default_fs_version
|
str
|
FlightStream version for rows whose FS_BUILD column names no build; a DEFAULT rather than an override (PFS-2009.08.01). |
None
|
fs_version
|
None
|
The former name of |
None
|
assess
|
OutcomeAssessor
|
Solver-quality judgment, for example
:class: |
required |
executor
|
Executor
|
Replacement executor; by default a
:class: |
None
|
recipe_registry
|
dict of str to ScriptRecipe
|
Named recipe registry (name to callable), forwarded to the pre-flight and the campaign loop. |
None
|
force_rerun
|
sequence of str
|
The points to REDO rather than refuse, each by its point name, its
full |
None
|
force_rerun_all
|
bool
|
REDO every recorded point of the matrix (G44): each
recorded point, and each recorded steady job as a whole, is archived
and runs again, with the count of points and jobs said before
anything runs. A point recorded as SUBMITTED, or of a batch whose job
has not ended, is redone with a warning; its old job is not cancelled.
Refused together with |
False
|
progress_every
|
int
|
How often a local unsteady point says its progress, in completed time steps, read from the run's own step counter (G43); 10 by default, 0 to say nothing. |
PROGRESS_EVERY_DEFAULT
|
sims
|
sequence of str
|
The simulations to run, by their ids as the matrix spells them (leading
zeros kept); the run then touches those simulations only (FR-326). With
|
None
|
points
|
sequence of str
|
With |
None
|
resume
|
bool
|
With True, points already in the manifest are skipped, so a
grown matrix re-runs only its new points; with False (the
default) an already-recorded point raises before anything
executes, as in :func: |
False
|
ignore_missing_families
|
bool
|
Whether a pproc entry naming a family the opened mesh does not
carry is left out (the default, True) or BLOCKS the point
(False), in which case the blocked pre-flight refuses the whole
run before a seat is spent. Forwarded to
:func: |
True
|
sweep_csv
|
object
|
Retired with the table it named; any value but None is refused naming the successor. |
None
|
local
|
bool
|
Keep the run on this machine: the cluster is not asked,
so a Linux box carrying a submission profile runs the solver
itself, as Windows does, and every point's executor entry says
|
False
|
parallel
|
int or str
|
Solver runs alive at once, as |
None
|
hidden
|
bool or None
|
Windowless solver runs, forwarded to the default executor only
and ignored when |
None
|
name_from
|
str
|
Where the campaign name came from, |
None
|
accept_unregistered_build
|
bool
|
Run on an installed build other than the one registered for the version a row names instead of refusing it; the run warns and every record says the flag was used. |
False
|
require_plan
|
bool
|
Require a matching receipt after resolving the effective build and its acceptance. The CLI sets this; Python callers default to False. |
False
|
Returns:
| Type | Description |
|---|---|
list of pyflightstream.workspace.RunRecord
|
The records executed by this call, in execution order. Each one
names the installation it ran on ( The first two are PER ROW since PFS-2009.05: a row naming a build is recorded against that build's own executable, and against the version its registry entry declares where it declares one. A row that names none, and every row of a registry written as bare path strings, is recorded against the campaign default exactly as before. |
Raises:
| Type | Description |
|---|---|
MatrixError
|
Layout or build-selection problems, a blocked pre-flight (the message carries the plan summary; nothing was executed), no default version given under either spelling, or a default that strips to empty. The last names every active row whose FS_BUILD cell strips to empty too, by row number and POL, and is raised before the matrix is bound: no campaign is built, no executable is resolved and no executor is constructed (PFS-2009.08.03). |
InputArtifactError
|
A REF, SET or ENTRY code, or a |
ExecutorConfigurationError
|
When the identity pre-flight finds the wrong build installed; raised before any point executes. |
CampaignErrors
|
After the loop, when at least one executed point failed. |
Examples:
>>> from pyflightstream.run import LoadsAssessor
>>> from pyflightstream.run.matrix import run_matrix
>>> from pyflightstream.workspace import CampaignWorkspace
>>> records = run_matrix(
... "matrix.fs",
... CampaignWorkspace("campaign"),
... name="wing_steady",
... default_fs_version="26.120",
... recipes={"003": "recipes.steady_polar:build"},
... assess=LoadsAssessor(),
... )
Advanced¶
pyflightstream.run.matrix.AdditionalPointPlan
dataclass
¶
AdditionalPointPlan(
run_id: str,
sim_id: str,
point_name: str | None,
pproc: str | None,
status: str,
reason: AdditionalSkip | None = None,
message: str = "",
unsteady: bool = False,
fsm: str | None = None,
script_text: str | None = None,
context: Mapping[str, object] = dict(),
)
What the additional post will do for one recorded point.
Attributes:
| Name | Type | Description |
|---|---|---|
run_id |
str
|
The point's run id. |
sim_id |
str
|
Its simulation, the matrix POL. |
point_name |
str or None
|
Its point name. |
pproc |
str or None
|
The additional pproc id its row states, or None. |
status |
str
|
|
reason |
AdditionalSkip or None
|
Why a skipped point was skipped. |
message |
str
|
The sentence that says so, naming the path or the hashes involved. |
unsteady |
bool
|
Whether the point marched in time, so its extraction is one instant. |
fsm |
str or None
|
The saved simulation, relative to the simulation folder. |
script_text |
str or None
|
The extraction script of a READY point, built before any launch. |
pyflightstream.run.matrix.AdditionalSkip
¶
Bases: StrEnum
Why a recorded point was not extracted, one word each (G12).
pyflightstream.run.matrix.ONE_INSTANT
module-attribute
¶
ONE_INSTANT = "the saved simulation holds the LAST instant of this unsteady run (RPT-062): this extraction is that one instant and not the run's per-step history; its plots history is the run's own"
pyflightstream.run.matrix.plan_additional_post
¶
plan_additional_post(
matrix: str | Path,
workspace: CampaignWorkspace,
*,
default_fs_version: str | None = None,
recipes: Mapping[str, str] | None = None,
fs_exe: str | Path | None = None,
) -> list[AdditionalPointPlan]
Say, per recorded point of a matrix, what the additional post would do.
Nothing is written and nothing is launched. The matrix is bound exactly as
pyfs-matrix run binds it, so a key the plan refuses is refused here too;
then every record of the manifest naming this matrix, one per point, is
checked in this order: the row is active, it states ADDITIONAL_PPROC,
no continuation replaced it, it is not in a queue, its saved simulation is
on disk, that file hashes as the record says, it was not already extracted
over those bytes with that artifact into files that still hash as recorded
(the post's own test of an extraction, so an extraction whose file changed
is made again), its build is the one the row names
today, it did not average its surface in time, and the run's recorded
script created the frames and declared the boundaries the row gives today.
A point passing every check is READY with its extraction script built.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
matrix
|
str or Path
|
The run matrix; its file stem selects the records. |
required |
workspace
|
CampaignWorkspace
|
The campaign root holding |
required |
default_fs_version
|
str
|
The build a row whose FS_BUILD cell names none falls back to, as for
|
None
|
recipes
|
mapping of str to str
|
A LEGACY row's RECIPE code to its reference, so a matrix mixing them binds. |
None
|
fs_exe
|
str or Path
|
The explicit executable override, as for |
None
|
Returns:
| Type | Description |
|---|---|
list of AdditionalPointPlan
|
One per recorded point, in manifest order. |
Raises:
| Type | Description |
|---|---|
CampaignConfigError
|
An extraction script that cannot be built (a distribution citing a frame the run did not create, a family the geometry refuses), before anything is launched; and every refusal of the plan of the matrix. |
MatrixError
|
As |
InputArtifactError
|
As |
Warns:
| Type | Description |
|---|---|
PyflightstreamWarning
|
Once per READY unsteady point: its extraction is one instant, the last. |
pyflightstream.run.matrix.plan_matrix
¶
plan_matrix(
path: str | Path,
workspace: CampaignWorkspace,
*,
warning_refusals: bool | None = None,
name: str,
recipes: Mapping[str, str],
default_fs_version: str | None = None,
fs_exe: str | Path | None = None,
recipe_registry: dict[str, ScriptRecipe] | None = None,
write_plan: bool = True,
fs_version: str | None = None,
name_from: str | None = None,
ignore_missing_families: bool = True,
cost: bool = False,
accept_unregistered_build: bool = False,
inflow_fft: bool = False,
sims: Sequence[str] | None = None,
points: Sequence[str] | None = None,
) -> CampaignPlan
Pre-flight a run matrix without executing anything.
Resolution
(:func:pyflightstream.workspace.matrix.resolve_matrix) plus the
campaign pre-flight
(:func:pyflightstream.run.plan_campaign): every recipe resolves,
every script builds in dry run, and points already in the manifest
are marked ALREADY_RECORDED, exactly what
run_matrix(..., resume=True) would skip.
A row naming a build with its own registry version is pre-flighted under that version, even when no executable is bound. The campaign default does not override the row's build.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
warning_refusals
|
bool
|
Restore demoted refusals for this call; None uses the runtime option. |
None
|
path
|
str | Path
|
As in :func: |
required |
workspace
|
str | Path
|
As in :func: |
required |
name
|
str | Path
|
As in :func: |
required |
recipes
|
str | Path
|
As in :func: |
required |
fs_exe
|
str | Path
|
As in :func: |
required |
default_fs_version
|
str
|
FlightStream version for rows whose FS_BUILD column names no build; a DEFAULT rather than an override, which is what the name says (PFS-2009.08.01). Required in practice: it defaults to None only so the former spelling below can be refused by name. |
None
|
fs_version
|
None
|
The former name of |
None
|
recipe_registry
|
dict of str to ScriptRecipe
|
Named recipe registry (name to callable) consulted before
treating a recipe reference as |
None
|
write_plan
|
bool
|
Write the JSON summary as |
True
|
ignore_missing_families
|
bool
|
Whether a pproc entry naming a family the opened mesh does not
carry is left out (the default, True) or BLOCKS the point
(False). Forwarded to
:func: |
True
|
sims
|
sequence of str
|
Plan only these simulations, or these points of them (FR-326), as
:func: |
None
|
points
|
sequence of str
|
Plan only these simulations, or these points of them (FR-326), as
:func: |
None
|
inflow_fft
|
bool
|
For every quasi-steady WHEEL point in a custom inflow, read the
inflow's harmonic content as ONE BLADE meets it over a revolution
(:func: |
False
|
name_from
|
str
|
Where the campaign name came from, |
None
|
cost
|
bool
|
Also compute the cost table of every point (FR-82) into the plan's |
False
|
accept_unregistered_build
|
bool
|
Run on an installed build other than the one registered for the version a row names instead of refusing it; the run warns and every record says the flag was used. |
False
|
Returns:
| Type | Description |
|---|---|
CampaignPlan
|
One status per matrix point; inspect |
Raises:
| Type | Description |
|---|---|
MatrixError
|
Layout or build-selection problems, no default version given under either spelling, or a default that strips to empty. The last names every active row whose FS_BUILD cell strips to empty too, by row number and POL, and is raised before the matrix is bound, so no campaign is built and no executable is resolved (PFS-2009.08.03). |
InputArtifactError
|
A REF, SET or ENTRY code, or a |
Warns:
| Type | Description |
|---|---|
PyflightstreamWarning
|
Naming every |
Examples:
>>> from pyflightstream.run.matrix import plan_matrix
>>> from pyflightstream.workspace import CampaignWorkspace
>>> plan = plan_matrix(
... "matrix.fs",
... CampaignWorkspace("campaign"),
... name="wing_steady",
... default_fs_version="26.120",
... recipes={"003": "recipes.steady_polar:build"},
... )
>>> print(plan.summary())
pyflightstream.run.matrix.record_additional_extraction
¶
record_additional_extraction(
workspace: CampaignWorkspace,
base: Mapping[str, object],
*,
status: ExtractionStatus,
error: str | None,
original: Path,
outputs: list[str] | None = None,
) -> AdditionalRecord
Hash the original again, then write the record; an original that moved fails it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
workspace
|
CampaignWorkspace
|
The workspace whose manifest of additional records is appended to. |
required |
base
|
mapping of str to object
|
The record's fields so far, with the |
required |
status
|
ExtractionStatus
|
The extraction's status; FAILED_EXECUTION when the original moved. |
required |
error
|
str or None
|
What went wrong, if anything. |
required |
original
|
Path
|
The original saved simulation, hashed again. |
required |
outputs
|
list of str
|
The files the extraction wrote, in the simulation folder; each is hashed into the record. |
None
|
Returns:
| Type | Description |
|---|---|
AdditionalRecord
|
The record, appended to the workspace. |
pyflightstream.run.matrix.run_additional_post
¶
run_additional_post(
matrix: str | Path,
workspace: CampaignWorkspace,
*,
default_fs_version: str | None = None,
recipes: Mapping[str, str] | None = None,
fs_exe: str | Path | None = None,
executor: Executor | None = None,
local: bool = False,
hidden: bool | None = None,
) -> tuple[
list[AdditionalPointPlan], list[AdditionalRecord]
]
Extract every READY point's additional pproc from its saved simulation, with no solve.
The plan first (:func:plan_additional_post), so every script is built
before the first launch and a refusal costs nothing. Then, per READY point,
ONE launch: anything already in the extraction's folder moves to its
archive/<stamp>/ (nothing is deleted); the saved simulation is COPIED
there and the copy must hash as the record says; the script is written
under scripts/additional/<pid>/ and run with the extraction's folder as
the working directory; every declared output must exist and is hashed; the
copy is removed; the ORIGINAL is hashed again, and an original that moved
fails the extraction loudly. One record per launch goes to
additional.json; runs.json is never opened for writing.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
matrix
|
str | Path
|
As :func: |
required |
workspace
|
str | Path
|
As :func: |
required |
default_fs_version
|
str | Path
|
As :func: |
required |
recipes
|
str | Path
|
As :func: |
required |
fs_exe
|
str | Path
|
As :func: |
required |
executor
|
Executor
|
A caller's executor, which answers for every build; by default the one
|
None
|
local
|
bool
|
Keep the extraction on this machine, as |
False
|
hidden
|
bool or None
|
Windowless solver runs; None lets the matrix's HIDDEN column decide. |
None
|
Returns:
| Type | Description |
|---|---|
tuple of (list of AdditionalPointPlan, list of AdditionalRecord)
|
The plan of every recorded point and the record of every launch. |
Raises:
| Type | Description |
|---|---|
ExecutorConfigurationError
|
Where |
CampaignConfigError
|
As :func: |