pyflightstream.run (stable)¶
Generated from the docstrings at build time: every one of the 38 names in the __all__ of pyflightstream.run has an entry below. The names a guide or an example uses come first; the others follow under Advanced.
Execution of FlightStream and the campaign loop.
Pipeline role: runs the solver headless on rendered scripts and lands
every campaign point in the manifest with exactly one terminal status.
:func:run_campaign composes an :class:Executor with the managed
workspace of :mod:pyflightstream.workspace; there is no code path
from "point started" to "loop continued" that does not write a status,
so silent skips are structurally impossible (PP-5, FR-14). Failures
accumulate into :class:CampaignErrors, raised after the loop.
Before any execution, :func:plan_campaign pre-flights the same
campaign: it resolves every recipe, allocates the managed folders,
verifies the geometry files exist, and builds every script in dry run
(the builder validates phase, version, and entity references without a
solver), returning one status per point and writing the plan summary
into the campaign root. Re-running a campaign into the same root uses
run_campaign(..., resume=True), which skips the points already
recorded in the manifest; the manifest's append-only duplicate
rejection is what makes the skip safe, and with resume=False a
duplicate point raises before anything executes.
A call that submitted points to a scheduler writes no product: a queued point
has no outputs yet, so the call names the pyfs-matrix collect command that
posts once they land. The campaign leaves no table of its own; the family and
group files of each polar hold every point.
The local mechanism is the documented command-line script execution:
FlightStream.exe -script <file>, with the
-hidden flag for windowless batch runs. ONE dash on the script
argument, and the spelling is the module constant
:data:SCRIPT_ARGUMENT rather than a literal here: FSM-26.120
pp.279-280 documents the two-dash form, the 25 series does not accept
it, and one dash is the spelling every registered build accepts
(RPT-023). In hidden mode an
abnormal termination writes FlightStreamLog.txt into the command
execution directory, which is why the executor runs the solver inside
the point's own datapoint folder and captures that file (FSM-26.120 p.280);
a steady row of several points is one job and runs in the simulation
folder. A cluster route shares the executor interface:
:class:SubmittingExecutor hands the script to a scheduler and returns
once the record is written SUBMITTED, and the collect stage of
:mod:pyflightstream.run.collect completes that record when the
declared outputs have landed (FR-99). FR-15, the cluster submission
requirement, is implemented through that executor interface.
On Windows, :mod:pyflightstream.run._solver_windows inspects only the
launched solver PID. A visible standard dialog, a modal window whose owned
parent is disabled, or a titled error window fails that point. Its text goes
to pyfs-modal-error.log and the execution record; the executor terminates
only its own process and never clicks a dialog. Custom GUI messages outside
these recognizable forms remain subject to the configured execution timeout.
Judging solver quality (converged, iteration limited, diverged) needs
the solver outputs, so :func:run_campaign takes an
:class:OutcomeAssessor; the standard implementation is
:class:LoadsAssessor, built on the anchor-based parsers of
:mod:pyflightstream.results.
Afterwards, :func:reconstruct reads one manifest record back into the
invocation that produced it: the command line, the working directory,
the effective timeout and the script text, with a per-artifact verdict
on whether each file still hashes to what the record says. That is the
collectable half of NFR-07's promise, and :func:package_vcs_state
supplies the other end of it, recording which commit of this package
ran.
, :mod:pyflightstream.run.records holds the operations on the
records themselves: which manifest a command reads (runs.json, or
another file of the workspace root named by --runs; resolved in
:mod:pyflightstream.workspace.naming ), the exact restore
of a records file from the workspace's archive (pyfs-workspace restore),
and the rebuild of run records from the folders under sims/
(pyfs-workspace rebuild), which runs each row again in a throwaway copy
with nothing submitted, accepts a record only when the executed script is
the one this version renders, completes it read-only and marks it
REBUILT. It also assembles the in-memory records of
pyfs-matrix post --from-sims.
THIS ROOT IS A FACADE (AD-14): the definitions are in private
modules of the package, in this order from the top, each importing only the
ones after it: :mod:~pyflightstream.run._campaign (the loop),
_sweep (a steady row run as one job), _points (one point),
_pending (the files written before the solver starts), _plan (the
plan, its cost and its receipt), _continuation, _identity (the
package and the solver build, and :func:reconstruct), _assessment,
_executors and _ids (the run ids and :class:CampaignErrors). Every
name keeps its public path here.
The records family is cut the same way (AD-11):
:mod:pyflightstream.run.records keeps the restore and the mark-failed and
re-exports the rest from _rebuild (the rebuild), _rebuild_evidence
(what a rebuild reads and compares), _assemble (the in-memory records of
--runs and --from-sims) and _record_files (the record files,
their archives and lease), and it registers its rebuild with
:mod:pyflightstream.workspace.storage when it loads, so the workspace row
never imports this one. The pyfs-matrix argument parser, every
subcommand, option and help text, is _cli_parsers, built by one _add_<family>_parsers
function per family of subcommands
(AD-18); the printing of plan and of the storage commands is
_cli_print; :mod:pyflightstream.run.cli keeps the commands.
Used in the guides¶
pyflightstream.run.LoadsAssessor
¶
LoadsAssessor(
loads_file: str | None = None,
*,
log_file: str | None = None,
requested_version: str | FsVersion | None = None,
)
The standard solver-quality judgment, built on the run outputs.
Reads the collected loads spreadsheet and, when available, the
exported solver log. Its judgments are CONVERGED, COMPLETED_MAX_ITER,
MAX_ITER_REACHED, FAILED_DIVERGED and FAILED_INCOMPLETE_OUTPUT.
Other execution and submission outcomes belong to the run orchestration;
:class:pyflightstream.workspace.manifest.RunStatus defines the full set.
The Notes below explain refusals to judge the collected evidence.
- NaN or infinite Total coefficients: FAILED_DIVERGED.
- A native log with consecutive frozen time steps: FAILED_DIVERGED.
- With a log: the final velocity and pressure residuals against the run's convergence limit (FSM-26.120 p.200). A NaN or infinite residual in EITHER column is a divergence, judged before the two are combined: reducing them first cannot preserve the invalidity of one of them.
- A steady run at its requested iteration limit with a final residual above the convergence limit is MAX_ITER_REACHED. The counter comes from the log or the loads footer; the footer alone cannot supply the residual verdict. Forced iterations and unsteady runs do not receive this status.
- Without a log, steady mode: an iteration counter below the requested limit means the threshold stopped the solver (CONVERGED); reaching the limit means COMPLETED_MAX_ITER. Unless the run forced all iterations, which disables that threshold: an early stop is then a refusal, because the one mechanism that could have ended the loop legitimately was off (PYFS-008).
- Without a log, unsteady mode: the time loop always runs to its prescribed end, so completion is recorded as COMPLETED_MAX_ITER. EXPORTING a log is what changes that; naming it is not required, because a collected file that parses as a residual history is found by content.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
loads_file
|
str
|
Name of the loads spreadsheet among the collected outputs, by
file name (any directory part of the declared name is dropped
by collection). None, the default, finds the collected output
that parses as a loads table, the same rule
:func: |
None
|
log_file
|
str
|
Name of the exported solver log (EXPORT_LOG). None, the default,
finds the collected output that parses as a residual history,
the same rule NAMING IT IS STRICTER, not weaker: a named file that was not collected is a refusal, while the default falls back to the iteration-count judgment when nothing parses. Name it when the run must not be judged without residuals. |
None
|
requested_version
|
str or FsVersion
|
Version the campaign requested; enables the FR-18 cross-check against the version printed in the loads footer. |
None
|
Notes
A refusal to judge missing, unusable or mismatched evidence carries
FAILED_INCOMPLETE_OUTPUT. It must not look like a judged result.
COMPLETED_MAX_ITER records an ended run without evidence of
convergence, including an unsteady run reaching its prescribed end.
MAX_ITER_REACHED records the steady limit and residual evidence
described above (FR-434). Both are ended runs, not failures and not
claims of convergence. CONVERGED is the threshold verdict;
FAILED_DIVERGED records divergence evidence.
The refusals, in the order they are tested:
- The file named by
loads_fileis not among the collected outputs. The error lists what was collected, because the usual cause is a swept case whose recipe names its outputs per point. - No
loads_filewas named and no single collected output reads as a loads table, either because none parses or because several do. Choosing one would be a guess about which point ran. - The loads spreadsheet is unparseable or truncated.
- The export is evidence of a different operating point from the one the case requested, beyond tolerance (REV010-001).
- The loads footer prints a solver mode this package has not been taught (REV010-002).
- The file named by
log_fileis not among the collected outputs; orlog_filewas not named and SEVERAL collected outputs parse as a residual history, because choosing one would be a guess about which is this point's. Zero candidates is not a refusal: it is the iteration-count judgment, which is what every campaign that exports no log has always received. - The solver log is present but no residual history can be read from it.
- Steady mode with all iterations forced, and the solver stopped early (PYFS-008), as described above.
Items 4 and 5 prevent success from being inferred from a valid export belonging to another case or from an unrecognised solver mode. Parsing alone cannot establish operating-point identity or choose the correct convergence rule.
Item 4 is also tested BEFORE divergence, deliberately. Divergence is a physical outcome, and attributing one to a case that never produced the file is a worse error than reporting that the evidence could not be matched to the case.
Examples:
The assessor is built once per campaign and handed to the loop, which calls it for each executed point; building it reads nothing:
>>> from pyflightstream.run import LoadsAssessor
>>> assess = LoadsAssessor(log_file="solver_log.txt")
>>> (assess.loads_file, assess.log_file, assess.requested_version)
(None, 'solver_log.txt', None)
pyflightstream.run.LocalExecutor
¶
LocalExecutor(
fs_exe: str | Path,
hidden: bool = True,
*,
forced_local: bool = False,
export_log: bool = True,
progress_every: int = PROGRESS_EVERY_DEFAULT,
)
Runs FlightStream as a local subprocess (FSM-26.120 pp.279-280).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fs_exe
|
str or Path
|
Explicit path of the FlightStream executable; it must exist. Never read from environment variables or guessed. |
required |
hidden
|
bool
|
Pass the |
True
|
forced_local
|
bool
|
Keyword only. Whether the local switch kept this run on a machine
that would otherwise have submitted ( |
False
|
export_log
|
bool
|
Keyword only. Whether the scripts this executor runs export the
solver log. False on a run the local switch kept on a cluster whose
HPC profile states |
True
|
progress_every
|
int
|
Keyword only. Time steps between two progress lines; 0 says nothing. A negative value is refused. |
PROGRESS_EVERY_DEFAULT
|
Examples:
The executable is only checked for existence, so a stand-in file shows the constructor offline:
>>> import tempfile
>>> from pathlib import Path
>>> from pyflightstream.run import LocalExecutor
>>> with tempfile.TemporaryDirectory() as folder:
... exe = Path(folder) / "FlightStream.exe"
... _ = exe.write_text("stand-in")
... executor = LocalExecutor(exe)
... (executor.fs_exe.name, executor.hidden, executor.forced_local)
('FlightStream.exe', True, False)
runtime_environment
property
writable
¶
runtime_environment: dict[str, str]
Launch environment of the case this thread resolved last; empty when none.
runtime_affinity
property
writable
¶
runtime_affinity: str | None
Affinity policy of the case this thread resolved last; None when none.
resolve_case_runtime
¶
resolve_case_runtime(case: SimCase) -> SimCase
Resolve an explicit setup runtime block on this launch host before emission.
run_script
¶
run_script(
script_path: Path,
working_dir: Path,
timeout_s: float | None = None,
) -> ExecutionResult
Run one rendered script to completion.
The process runs inside working_dir so that the hidden-mode
error log lands next to the run's files and can be captured.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
script_path
|
Path
|
Rendered ASCII script to execute. |
required |
working_dir
|
Path
|
Execution directory of the process; also where
|
required |
timeout_s
|
float
|
Wall-clock limit; on expiry the process is killed and the
result reports |
None
|
Returns:
| Type | Description |
|---|---|
ExecutionResult
|
Typed outcome; no exception is raised for solver failure, the campaign loop decides the manifest status. |
pyflightstream.run.PlanStatus
¶
Bases: StrEnum
Pre-flight status of one campaign point (no execution involved).
READY: the recipe resolved, the geometry exists, and the script
built and rendered in dry run. BLOCKED: something failed before any
solver could run; the plan carries the error text.
ALREADY_RECORDED: the manifest already holds this run_id, so
run_campaign(..., resume=True) would skip it.
Examples:
>>> from pyflightstream.run import PlanStatus
>>> [status.value for status in PlanStatus]
['READY', 'BLOCKED', 'ALREADY_RECORDED']
>>> PlanStatus.READY == "READY"
True
pyflightstream.run.plan_campaign
¶
plan_campaign(
campaign: Campaign,
workspace: CampaignWorkspace,
*,
recipes: dict[str, ScriptRecipe] | None = None,
write_plan: bool = True,
name_from: str | None = None,
builds: Mapping[str, SolverBuild] | None = None,
versions: Mapping[str, str] | None = None,
matrix_path: str | Path | None = None,
accept_unregistered_build: bool = False,
setup_inspections: Sequence[dict[str, object]]
| None = None,
inflow_fft: bool = False,
accepted_builds: Collection[str] = (),
planned_order: Mapping[str, Sequence[str]]
| None = None,
row_builds: Sequence[str | None] | None = None,
) -> CampaignPlan
Pre-flight a campaign: validate every point without executing any.
inflow_fft (pyfs-matrix plan --inflow-fft) adds to each
quasi-steady wheel point in a custom inflow the harmonic content of that
inflow as one blade meets it
(:func:pyflightstream.cases.workflows.qsteady_inflow_fft).
Per case, in order: allocate the managed simulation folders,
resolve the recipe, and verify the geometry file exists; per
point: render the output names through the naming template and
build the whole script in dry run (the builder validates phase,
version, and entity references without a solver, and the dry-run
script is not written to scripts/, so the files of a later
real run stay the only scripts on disk). Points whose run_id
is already in the manifest, and the points a recorded job of their
steady row ran, are marked ALREADY_RECORDED, which is exactly what
run_campaign(..., resume=True) would skip; this pairing is what
lets a sweep grow points and re-run safely. The new points of a row
whose job is recorded are READY, and resume runs them one each.
Nothing is executed and nothing is appended to the manifest: a broken recipe or a missing geometry surfaces here, before any solver time is spent, instead of as a FAILED_SCRIPT record inside the campaign loop.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
campaign
|
Campaign
|
What would run; its |
required |
workspace
|
CampaignWorkspace
|
The managed campaign root; folders are allocated, the manifest is read, nothing else is touched. |
required |
recipes
|
dict of str to ScriptRecipe
|
Named recipe registry, as in :func: |
None
|
write_plan
|
bool
|
Write the JSON summary as |
True
|
name_from
|
str
|
Where the campaign name came from, |
None
|
builds
|
mapping of str to SolverBuild
|
As in :func: |
None
|
versions
|
mapping of str to str
|
Per simulation id, the version its scripts are emitted under,
for a pre-flight that binds no executable: |
None
|
matrix_path
|
str or Path
|
The matrix file the campaign was converted from. Its SHA-256 is
written into |
None
|
accept_unregistered_build
|
bool
|
Recorded in |
False
|
setup_inspections
|
sequence of dict
|
The setup inspections to carry into the plan and its
|
None
|
inflow_fft
|
bool
|
With True, each quasi-steady wheel point in a custom inflow also carries the harmonic content of that inflow. Default False. |
False
|
accepted_builds
|
collection of str
|
The installations whose own entry of |
()
|
planned_order
|
mapping of str to sequence of str
|
Per simulation id, the point names of its WHOLE sweep in sweep order,
for a campaign narrowed to a |
None
|
row_builds
|
sequence of str or None
|
Resolved installation keys, in campaign simulation order, for the plan/run effective-build contract. None uses each case's build key. |
None
|
Returns:
| Type | Description |
|---|---|
CampaignPlan
|
One :class: |
Raises:
| Type | Description |
|---|---|
ExecutorConfigurationError
|
When a case names an |
WorkspaceError
|
When :meth: |
Warns:
| Type | Description |
|---|---|
PyflightstreamWarning
|
A row whose actuator disc is RELAXED and names a loading profile
(FR-332, :func: |
PyflightstreamWarning
|
A rotor point whose wake may not reach the length it asks, or whose
wake end plane is the solver's default or sits before it (FR-325,
:func: |
PyflightstreamWarning
|
Once per artifact, key and name, a name a row's setup or pproc cites that its reference's study holds and its model lacks, naming every such row (FR-987); the plan status is what it would be without it. |
pyflightstream.run.reconstruct
¶
reconstruct(
run: RunRecord | str, *, workspace: CampaignWorkspace
) -> Reconstruction
Rebuild one recorded run's invocation from the manifest.
The promise of NFR-07 is that the record plus the staged inputs reproduce the run. Until PYFS-015 the record held neither the command line, nor the working directory, nor the effective timeout, so "reproduce" meant re-deriving all three from executor code that may have changed in between. This reads them back instead.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
run
|
RunRecord or str
|
A manifest row, as :meth: |
required |
workspace
|
CampaignWorkspace
|
The workspace the run belongs to. Keyword-only, so this cannot
be confused with
:func: |
required |
Returns:
| Type | Description |
|---|---|
Reconstruction
|
The invocation, the script text, and a per-artifact verdict on
whether the files still hash to what the record says. Each
recorded input is checked where the run read it: at the path the
script names for it, among the simulation's staged inputs, or in
the folder the run ran in (the record's |
Raises:
| Type | Description |
|---|---|
WorkspaceError
|
If no record carries the given |
pyflightstream.run.run_campaign
¶
run_campaign(
campaign: Campaign,
executor: Executor,
workspace: CampaignWorkspace,
*,
assess: OutcomeAssessor,
recipes: dict[str, ScriptRecipe] | None = None,
resume: bool = False,
force_rerun: Sequence[str] | None = None,
preflight: bool = True,
builds: Mapping[str, SolverBuild] | None = None,
name_from: str | None = None,
quiet: bool = False,
accept_unregistered_build: bool = False,
sweep_csv: object = None,
accepted_builds: Collection[str] = (),
redo_submitted: bool = False,
parallel: int | str | None = None,
) -> list[RunRecord]
Run every point of a campaign, recording each in the manifest.
Per point, in order: specialize the case (sweep point and staged
geometry), build the script through the recipe (failure:
FAILED_SCRIPT), execute it (failure or timeout:
FAILED_EXECUTION), collect the declared outputs into that point's
own datapoints/DP-<point>/
(missing output: FAILED_INCOMPLETE_OUTPUT), and judge the solver
quality through assess (CONVERGED, COMPLETED_MAX_ITER,
MAX_ITER_REACHED, FAILED_DIVERGED or FAILED_INCOMPLETE_OUTPUT). Only
the FAILED_* statuses make :class:CampaignErrors raise; the others
are recorded and returned. Exactly one record per point is appended to the
manifest; an unexpected internal error crashes the loop loudly
instead of masquerading as a solver status.
Afterwards each simulation is posted as its last point is recorded, and the
campaign leaves no table of its own: the polars' family and group files hold
every point, and :func:pyflightstream.results.sweep_table derives the frame
from the manifest when one is wanted.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
campaign
|
Campaign
|
What to run; its |
required |
executor
|
Executor
|
How to run it, for example :class: |
required |
workspace
|
CampaignWorkspace
|
The managed campaign root receiving folders, scripts, outputs, and the manifest; its naming template renders the generated script names and any placeholders in the declared output names. |
required |
assess
|
OutcomeAssessor
|
Solver-quality judgment; required because the loop refuses to invent convergence evidence it cannot see. |
required |
recipes
|
dict of str to ScriptRecipe
|
Named recipe registry consulted before treating
:attr: |
None
|
force_rerun
|
sequence of str
|
The points to REDO rather than refuse, each by its point name, by
its full IT NAMES POINTS AND IS NOT A SWITCH. Redoing every recorded point of a matrix because one row was wrong spends a licensed seat per point, and a seat is the one thing here that archiving cannot give back (FIX-0212). A name that matches no recorded point is refused rather than
ignored. Refused together with A point of a row stating RESTART is not superseded -- that row CONTINUES what is recorded, so its records are its subject rather than a fork -- and naming one says so rather than passing over it. |
None
|
resume
|
bool
|
With True, points whose |
False
|
builds
|
mapping of str to SolverBuild
|
One entry per solver installation the campaign's cases name in
:attr: |
None
|
preflight
|
bool
|
With True (the default), every installation that still has work is asked which build it is before the first point executes, and the whole campaign is refused when one answers wrongly. With False the identity check is skipped; the parse-time cross-check of each result against the registered build still applies. |
True
|
name_from
|
str
|
Where the campaign name came from, |
None
|
quiet
|
bool
|
With True, the progress lines, the per-row lines and the closing summary table are not printed; the activity log still receives them. Default False. |
False
|
accept_unregistered_build
|
bool
|
With True, an installed build other than the one registered for the version a row names is accepted instead of refused by the identity check, and every record of the run says the flag was used. Default False. |
False
|
sweep_csv
|
object
|
Retired with the table it named; any value but None is refused naming the successor. |
None
|
accepted_builds
|
collection of str
|
The installations whose own entry of |
()
|
redo_submitted
|
bool
|
Redo a point named by |
False
|
parallel
|
int or str
|
Solver runs of the campaign alive at once, each case on its own worker:
a positive count (cut at 8) or |
None
|
Returns:
| Type | Description |
|---|---|
list of RunRecord
|
The records executed by this call, in execution order; points
skipped by |
Raises:
| Type | Description |
|---|---|
CampaignErrors
|
After the loop, when at least one executed point failed. |
WorkspaceError
|
On the first already-recorded point when |
ExecutorConfigurationError
|
When a case names an |
InputArtifactError
|
When |
Advanced¶
pyflightstream.run.ACCEPT_UNREGISTERED_BUILD_FLAG
module-attribute
¶
ACCEPT_UNREGISTERED_BUILD_FLAG = (
"--accept-unregistered-build"
)
pyflightstream.run.Assessment
dataclass
¶
Assessment(
status: RunStatus,
iterations: int | None = None,
residual: float | None = None,
error: str | None = None,
fs_version_reported: str | None = None,
fs_build: str | None = None,
conditions: list[dict] | None = None,
log_file_used: str | None = None,
residual_note: str | None = None,
solver_run_time_s: float | None = None,
solver_initialization_s: float | None = None,
time_steps: int | None = None,
clocking_verdicts: list[dict[str, object]]
| None = None,
warnings: list[str] | None = None,
iterations_requested: int | None = None,
)
Judgment of one successfully executed point.
Attributes:
| Name | Type | Description |
|---|---|---|
status |
RunStatus
|
|
iterations |
(int, optional)
|
Solver iterations reached, when the assessor parsed them. |
residual |
(float, optional)
|
Final residual, when parsed. |
error |
(str, optional)
|
Explanation for a diverged judgment. |
fs_version_reported |
(str, optional)
|
Version string printed in the assessed output, verbatim (FR-18). |
fs_build |
(str, optional)
|
Build number printed in the assessed output. |
conditions |
list of dict, optional
|
The operating-point binding, one entry per requested axis the
export prints back: |
log_file_used |
(str, optional)
|
Name of the solver log the residual verdict was read from, or
None where none was read and the judgment fell to the iteration
count. Recorded because the two are DIFFERENT CLAIMS about a
result: an unsteady point with no log is recorded
Carried into the run manifest so readers can distinguish these sources of convergence evidence. |
residual_note |
(str, optional)
|
Where a final residual did not fit its printed field and was read from an earlier iteration instead, which column, which iteration and what value; None where every final residual was printed. |
solver_run_time_s, solver_initialization_s, time_steps |
optional
|
The solver's own run time and initialization time in seconds and the time steps of an unsteady run, read from the log the verdict read; None where no log was read or it prints no such line. |
clocking_verdicts |
list of dict, optional
|
A quasi-steady rotor wheel solved at several clockings: one
entry per clocking, in the order the run solved them, with its
|
iterations_requested |
(int, optional)
|
The iteration limit the run requested (FR-434); set only for a
|
warnings |
list of str, optional
|
What the judgment could not use and did without, for the point's
record's |
pyflightstream.run.CampaignErrors
¶
CampaignErrors(
failures: list[RunRecord],
records: list[RunRecord] | None = None,
)
Bases: PyflightstreamError, RuntimeError
One or more campaign points failed; raised after the loop.
Every failed point is listed with its status and error text, and all points, failed or not, are already in the manifest: the exception reports, it never hides.
Attributes:
| Name | Type | Description |
|---|---|---|
failures |
list of RunRecord
|
The manifest records of the failed points. |
records |
list of RunRecord
|
Every record the call wrote, failed or not, in the order it wrote them; the failures alone when the raiser did not pass them. |
pyflightstream.run.CampaignPlan
dataclass
¶
CampaignPlan(
campaign: str,
fs_version: str,
points: list[PointPlan] = list(),
campaign_name_from: str | None = None,
plan_file: Path | None = None,
build_groups: dict[str, list[str]] = dict(),
costs: list[PlannedPointCost] = list(),
guides: list[Path] = list(),
setup_inspections: list[dict[str, object]] = list(),
grouping: GroupingReceipt | None = None,
planned_order: dict[str, list[str]] = dict(),
)
The pre-flight plan of one campaign: statuses per point, no execution.
Attributes:
| Name | Type | Description |
|---|---|---|
campaign |
str
|
Campaign name. |
fs_version |
str
|
Canonical FlightStream version the scripts were validated against. |
points |
list of PointPlan
|
One entry per campaign point, in campaign order. |
plan_file |
Path or None
|
Where the JSON summary was written: |
build_groups |
dict of str to list of str
|
Which cases run on which solver installation, keyed by
:attr: |
pyflightstream.run.ExecutionResult
dataclass
¶
ExecutionResult(
return_code: int | None,
wall_time_s: float,
timed_out: bool,
log_text: str | None,
stdout: str,
stderr: str,
argv: tuple[str, ...] = (),
cwd: str | None = None,
timeout_s: float | None = None,
started_at: str | None = None,
finished_at: str | None = None,
)
Typed outcome of one solver process.
Attributes:
| Name | Type | Description |
|---|---|---|
return_code |
int or None
|
Process return code; None when a local run timed out and the
process was killed. A submit command that did not return in time
reports 124. |
wall_time_s |
float
|
Wall-clock duration of the process in seconds. |
timed_out |
bool
|
Whether the timeout expired before the process finished. |
log_text |
str or None
|
Content of |
stdout |
str
|
Captured standard output of the process. |
stderr |
str
|
Captured standard error of the process. |
argv |
tuple of str
|
The exact command line the executor ran, argument by argument. Empty for an executor that does not report one; recorded so a run can be reproduced without re-deriving the flags from the executor's code (PYFS-015). |
cwd |
(str, optional)
|
Working directory the process ran in. |
timeout_s |
(float, optional)
|
The wall-clock limit actually applied, which is the case's limit resolved rather than the default a reader would assume. |
started_at |
(str, optional)
|
When the process was started, ISO 8601 in UTC to the second
(PFS-2012.08.01). |
finished_at |
(str, optional)
|
When the process ended, or was killed on timeout, the same way. [REF-03] |
captured_output
¶
captured_output() -> str
Return what the solver printed, as a scheduler's job log holds it.
Standard output, then standard error, one after the other. The text a
run writes as the declared log on a machine whose HPC profile states
export_log = false, where no scheduler writes one for a run kept
local, and the text the build-identity pre-flight reads the build from
there. An empty string when the solver printed nothing on either.
diagnosis
¶
diagnosis() -> str
Say what happened, from every channel this run captured.
Every caller uses this diagnostic; a tier 1 AST guard enforces that. Standard output carries pre-script evidence, including successful licence checkout when an unrecognised script argument leaves the solver waiting without an exported log or standard error (RPT-023). Include it so a timeout does not hide the evidence needed to distinguish those outcomes.
Returns:
| Type | Description |
|---|---|
str
|
One line naming the outcome, then each non-empty captured channel, most specific first. With nothing captured, still report the outcome. |
pyflightstream.run.Executor
¶
Bases: Protocol
Anything that can run one rendered script to completion.
Implementations must be interchangeable without touching the campaign model (FR-15), whether executing locally or submitting to HPC.
run_script
¶
run_script(
script_path: Path,
working_dir: Path,
timeout_s: float | None = None,
) -> ExecutionResult
Run one script and return the typed outcome.
pyflightstream.run.ExecutorConfigurationError
¶
Bases: PyflightstreamError, ValueError
The executor cannot run as configured.
Raised at construction time, because a missing solver executable must surface before a campaign starts, not at its first point. The FlightStream path is always explicit input (SAD Section 5): nothing is read from environment variables or guessed.
pyflightstream.run.ExecutorRecord
¶
Bases: TypedDict
How the solver was called, as the run layer read it off the run.
The JSON shape of the executor entry of a manifest row
(PFS-2012.04). class_name is the executor's class as it ran
(LocalExecutor today; an HPC executor the day FR-15 lands) and
argv the command line it returned, which is the same list as the
row's own argv and travels here as well so the entry is one
self-contained fact a report can be built from. Both keys are
required: the entry is written whole or, on a point where no solver
ran, not at all, and the row says None. forced_local is
present, and true, only on a point the run's local switch kept on a
machine that would otherwise have submitted; a record
written before it, or by a run that did not ask, has no key, and a legacy reader refuses a
manifest that carries one.
pyflightstream.run.FS_VERSION_FROM_DEFAULT
module-attribute
¶
FS_VERSION_FROM_DEFAULT = 'campaign_default'
pyflightstream.run.OutcomeAssessor
¶
Bases: Protocol
Judges solver quality from the outputs of one executed point.
The campaign loop already handled execution failure and missing
declared outputs; the assessor inspects the collected outputs (in
sim_dir / "outputs", and legacy sim_dir / "raw" folders, FR-84)
and decides between
converged, iteration limited, and diverged. The standard
implementation lands with the results parsers.
pyflightstream.run.PLAN_REQUIRED_MESSAGE
module-attribute
¶
PLAN_REQUIRED_MESSAGE = "no plan for this matrix, and a run needs one. Run `pyfs-matrix plan <matrix>` first: it pre-flights every point without spending any solver time, reports which are blocked and which are already recorded, and writes the receipt this refusal is asking for. Add --cost for what the run is expected to cost."
pyflightstream.run.PlannedPointCost
dataclass
¶
PlannedPointCost(
run_id: str,
panels: int | None,
trailing_edges: int | None,
farfield_layers: int | None,
viscous_coupling: bool,
unsteady: bool,
time_iterations: int | None,
processors: int | None,
seconds: float | None,
samples: int,
basis: str,
)
What one point is expected to cost, and what that expectation rests on.
Named for the point that has not run. In contrast,
:class:pyflightstream.qa.cost.PointCost represents one point measured
on two solver builds and is exported from pyflightstream.qa.
FR-82. Every field but seconds and samples is READ from the row, the
mesh and the setup: they are measurements of the thing about to be run. The
two that are not are marked as such, because the difference between a
figure a reader can check and a figure fitted from history is the whole
question when someone is deciding whether to spend a seat.
Attributes:
| Name | Type | Description |
|---|---|---|
run_id |
str
|
The point this row is about. |
panels |
int or None
|
Mesh size: the ELEMENT COUNT the geometry's mesh block states, which
one campaign geometry overstates by about a percent ( |
trailing_edges |
int or None
|
How many of the families the row marks for vorticity drag the opened geometry actually carries. ZERO is a measured none; None means the geometry could not be read, so the intersection this column promises could not be performed at all. |
farfield_layers |
int or None
|
The farfield layer setting, None when the setup states none. |
viscous_coupling |
bool
|
Whether viscous coupling is on. |
unsteady |
bool
|
Steady or unsteady, which is the single largest term in the cost. |
time_iterations |
int or None
|
Time steps for an unsteady row; None for a steady one. |
processors |
int or None
|
|
seconds |
float or None
|
EXPECTED wall time. None where no comparable run has been recorded. |
samples |
int
|
How many recorded runs the estimate was fitted from. ZERO means the
estimate is absent rather than uncertain, and the table prints
|
basis |
str
|
One sentence naming what the estimate rests on, carried into the report so the figure is never read without it. |
pyflightstream.run.PointPlan
dataclass
¶
PointPlan(
run_id: str,
sim_id: str,
point: dict[str, float],
script_name: str | None,
status: PlanStatus,
error: str | None = None,
waived_commands: tuple[str, ...] = (),
raw: bool = False,
march_strategy: MarchStrategy | None = None,
rotor_mach: dict[str, dict[str, object]] = dict(),
qsteady_validity: dict[str, object] = dict(),
continuation: str | None = None,
wake_termination: dict[str, object] = dict(),
run_wake_length: dict[str, object] = dict(),
streamlines: int = 0,
farfield: dict[str, object] = dict(),
fsi: dict[str, object] = dict(),
inflow_harmonics: list[str] = list(),
angles_not_stated: tuple[str, ...] = (),
boundaries_file: str | None = None,
)
Pre-flight judgment of one campaign point.
Attributes:
| Name | Type | Description |
|---|---|---|
run_id |
str
|
Manifest identity the point would run under. |
sim_id |
str
|
Simulation identity of the case. |
point |
dict of str to float
|
Sweep point coordinates (alpha and beta in deg, advance_ratio dimensionless). |
script_name |
str or None
|
File name the generated script would take (from the naming template); None when the name itself could not be rendered. |
status |
PlanStatus
|
The pre-flight status. |
error |
str or None
|
What blocks the point, for BLOCKED entries. |
waived_commands |
tuple of str
|
Commands the point's script emits under an |
raw |
bool
|
Whether the point's script used the |
march_strategy |
str or None
|
How the point's unsteady run is marched on its build, |
rotor_mach |
dict of str to dict
|
On a point of an |
qsteady_validity |
dict of str to object
|
On a point of a |
continuation |
str or None
|
On a point of a row stating |
wake_termination |
dict of str to object
|
On a point of an |
run_wake_length |
dict of str to object
|
On a point of an |
angles_not_stated |
tuple of str
|
The flow angles ( |
streamlines |
int
|
The off-body streamlines the point's pproc traces (FR-1079):
every seed line's count and every tube's |
pyflightstream.run.Reconstruction
dataclass
¶
Reconstruction(
argv: tuple[str, ...],
cwd: str,
timeout_s: float | None,
script_text: str,
verified: dict[str, str],
fs_version_requested: str | None = None,
fs_version_reported: str | None = None,
fs_build: str | None = None,
package_version: str | None = None,
package_commit: str | None = None,
package_dirty: bool | None = None,
solver_setup: dict | None = None,
)
Everything needed to re-run one recorded point (PYFS-015, NFR-07).
Built by :func:reconstruct from a manifest record and the
workspace it names. Every field is what the run ACTUALLY used, read
back from the record rather than re-derived from today's code.
Attributes:
| Name | Type | Description |
|---|---|---|
argv |
tuple of str
|
The command line, argument by argument. |
cwd |
str
|
Working directory the process ran in. |
timeout_s |
float or None
|
Wall-clock limit that was applied. |
script_text |
str
|
Text of the generated script, read from the workspace. |
verified |
dict of str to str
|
One entry per artifact whose recorded hash was checked against
the file on disk today: the script, each recorded input (keyed
|
fs_version_requested, fs_version_reported, fs_build |
str or None
|
Recorded target version, reported version and vendor build. Missing historical values remain None; they are not resolved from today's registry. |
package_version, package_commit |
str or None
|
Recorded package version and source revision. |
package_dirty |
bool or None
|
Recorded source-tree state, unknown for a wheel installation. |
solver_setup |
dict or None
|
Independent copy of the recorded solver-setup snapshot, or None when no snapshot was recorded. Mutating it does not change the manifest view. |
pyflightstream.run.SolverBuild
dataclass
¶
SolverBuild(
fs_exe: Path, fs_version: str, executor: Executor
)
One solver installation a campaign may send some of its cases to.
A campaign declares ONE fs_version and ONE fs_exe by default.
For a study across solver builds, this class selects the build per case
through :attr:pyflightstream.cases.SimCase.fs_build and the
builds mapping of :func:run_campaign and :func:plan_campaign.
Every field is stated rather than derived, and that is the point of the class. Nothing here infers a command-database version from an executable path or from a build id: which version a build's scripts are emitted under is a declaration the caller makes, so the manifest records what was asked for rather than what was guessed.
Attributes:
| Name | Type | Description |
|---|---|---|
fs_exe |
Path
|
The executable of this build, recorded in every point's
|
fs_version |
str
|
FlightStream version the scripts of this build are emitted
under, canonical identifier (26.120) or a vendor release name
that resolves to exactly one registered build. Recorded in
|
executor |
Executor
|
How to run this build's scripts; one per build, because an executor is bound to an executable at construction. |
pyflightstream.run.SubmittingExecutor
¶
SubmittingExecutor(
profile: HpcProfile,
*,
values: Mapping[str, object],
submit: bool = True,
)
Hands a script to a scheduler and does NOT wait for it (FR-15, FR-99).
Return as soon as the scheduler has taken the job and the record is written SUBMITTED.
A collect stage completes it. pyfs-matrix collect
watches the workspace for the outputs this point declared, waits until
every one of them is present AND settled, then collects, assesses and
rewrites this record with what the run actually did (FR-99,
run/collect.py).
THE DESCRIPTOR IS WRITTEN WHETHER OR NOT IT IS SUBMITTED, which is the predecessor's shape and worth keeping: a descriptor you can read without spending anything is how the profile gets checked.
bind_point
¶
bind_point(
values: Mapping[str, object], *, replace: bool = False
) -> None
Give THIS point's values to the executor.
One executor serves a whole campaign and a descriptor names one point, so the campaign's values are set once at construction and the row's arrive per point. The run stage calls this; a caller driving the executor directly may call it too.
replace REBUILDS on the campaign's values rather than merging
into the last point's, which is what the run stage asks for: a row
that resolves neither a processor count nor a wall clock must not
inherit the previous row's and submit resources it never asked for
(GEO-047-C07).
build_alias_refusal
¶
build_alias_refusal(builds) -> str | None
Why this executor's profile cannot name builds to its scheduler, or None.
PFS-2010.01.06. Asked once for every build a campaign names, before
any point is submitted, so a build the profile's [builds] table
does not map is refused for the whole campaign rather than at the
first descriptor after earlier rows have spent the queue.
submission_record
¶
submission_record() -> dict | None
Return what this executor handed to the scheduler, or None.
THE EXECUTOR ANSWERS FOR ITSELF, so the run stage does not reach
through it into the profile's field names. It did, guarding those
fields with getattr defaults that could only ever fire for
something that is not a profile, where they would turn a loud
AttributeError into a record claiming an empty path (the architect
lens, round two).
None before run_script has written a descriptor, which is what
tells a submitting executor that has submitted from one that has
not yet.
run_script
¶
run_script(
script_path: Path,
working_dir: Path,
timeout_s: float | None = None,
) -> ExecutionResult
Write the descriptor, submit it, and return without waiting.
A REFUSAL IS THIS POINT'S FAILURE (PFS-2094.037): a build the profile maps nothing for, a steady coupled script, a placeholder the row does not resolve, or a submit command that does not return in time is a failed result for this point, never an exception that ended the campaign with the point unrecorded and every later row unrun.
pyflightstream.run.SurfaceMeshExportError
¶
Bases: PyflightstreamError, RuntimeError
The pre-processing surface-mesh export did not produce its file.
Raised by :func:export_surface_mesh when the solver run failed
or finished without writing the requested mesh file; the message
carries the process outcome and the captured log excerpt, because
hidden-mode failures are otherwise silent (FSM-26.120 p.280).
pyflightstream.run.action_count
¶
action_count(path: Path) -> int | None
Read the count the point's counter program reached, or None when it never wrote.
The program writes its state as one JSON object per invocation,
replacing the previous one, and count is the number of times the
solver ran it, which is the number of time steps it completed
(RPT-041 finding 2).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Path
|
The JSON file the counter program writes. |
required |
Returns:
| Type | Description |
|---|---|
int or None
|
The number of times the solver ran the program, or None when the file does not exist. |
pyflightstream.run.bind_submission_values
¶
bind_submission_values(executor, case, point_case) -> None
Give a submitting executor the values THIS point's descriptor needs.
A descriptor names the simulation, the build, the wall clock and the processor count, and every one of those is the ROW's. The executor is built once for the campaign, so the per-point half arrives here.
THE PROCESSOR COUNT FALLS BACK TO THE SETUP, exactly as the script's own count does. Passing None there was the whole of FR-93 reopened and inverted: a row that states no NCPUS column, which is EVERY upgraded row, would have reserved an empty field from the scheduler and solved on the setup's eight. The requirement's own evidence sentence is a job reserving forty-eight processors and solving on eight, and this made it true again in the other direction (the architect lens, round two).
A VALUE THAT CANNOT BE RESOLVED IS OMITTED, never written empty. An
absent key makes render_descriptor refuse by name, which is a
message; an empty string is a scheduler field with nothing in it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
executor
|
Executor
|
The campaign's executor. Nothing happens unless it submits through a scheduler. |
required |
case
|
SimCase
|
The row's case; supplies the simulation id, the build and the solver's thread count. |
required |
point_case
|
SimCase
|
The case specialized to this point; supplies the point name, the processor count and the wall clock the row states. |
required |
Returns:
| Type | Description |
|---|---|
None
|
The executor is updated in place with the values for this point's descriptor. |
pyflightstream.run.check_solver_identity
¶
check_solver_identity(
executor: Executor,
version: FsVersion,
workdir: Path,
*,
timeout_s: float = 60.0,
accept_unregistered_build: bool = False,
accepted_by: str | None = None,
) -> None
Refuse before the campaign runs if the wrong solver build is configured.
The build-time refusal of an ambiguous vendor name settles which
build a campaign ASKED for; it cannot show which one is installed at
fs_exe, and the version string the solver prints cannot either,
because every registered 26.1x prints the same one. This runs the
cheapest possible script (a PRINT sentinel, a log export, and close)
and reads the build number out of the exported log, so a campaign
pointed at the wrong installation stops before its first point
instead of after its last.
Layered rather than sole: a mismatch is refused HERE, on positive evidence, and every parsed result is still cross-checked against the registered build afterwards. So an identity this cannot read degrades to the parse-time check rather than to nothing, which is why the unreadable case warns instead of refusing. Refusing there would make the guard's own failure mode "no campaign runs at all".
Does nothing at all when the version has no registered build: there is nothing to compare, so no solver process is spent.
On a machine that cannot export the log (an executor whose HPC profile
states export_log = false) the sentinel script exports none and
the build is read from what the solver printed; a build it did not print
is warned about, naming the profile, and never refused.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
executor
|
Executor
|
The executor the campaign will use, so the check exercises the same executable. |
required |
version
|
FsVersion
|
Version the campaign declares. |
required |
workdir
|
Path
|
Scratch directory for the sentinel script and its log. |
required |
timeout_s
|
(float, keyword - only)
|
Wall-clock limit for the sentinel run, in seconds. |
60.0
|
accept_unregistered_build
|
(bool, keyword - only)
|
With True, an installed build other than the registered one is warned about and accepted instead of refused. Default False. |
False
|
accepted_by
|
(str, keyword - only)
|
The file that stated the acceptance (FR-998): |
None
|
Raises:
| Type | Description |
|---|---|
ExecutorConfigurationError
|
When the exported log names a build that is not the registered
build of |
Warns:
| Type | Description |
|---|---|
VersionMismatchWarning
|
When the log carries no readable build number, so the installed build could be confirmed neither right nor wrong. |
pyflightstream.run.describe_invocation
¶
describe_invocation(
record: ExecutorRecord | None = None,
*,
hidden: bool = True,
markdown: bool = False,
) -> str
Return the one-line description of the solver invocation.
Single home of the sentence every report prints about how the
solver was called, so the script argument it names is the one
:func:LocalExecutor._argv passes (NFR-11).
READ FROM THE RUN WHEN A RECORD IS GIVEN (PFS-2012.04), asserted
otherwise, and the two sentences differ by construction so a reader
of committed evidence can tell which one it holds. With a record the
class name and the flags are the record's own: the flags are every
argv token between the executable and the script path, which is the
windowless flag and the script argument for :class:LocalExecutor
and whatever another executor passes, a path token reduced to its
last component so the sentence carries no machine path. Without one the sentence
describes the executor the QA layer builds by default, a hidden
:class:LocalExecutor, which is true of every report written before
the runs carried a record and is the stated fallback for a run that
carries none.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
record
|
ExecutorRecord
|
The invocation as :func: |
None
|
hidden
|
bool
|
Whether the ASSERTED description covers a windowless run; ignored when a record is given, the record saying what ran. Keyword-only: two adjacent booleans read as nothing at a call site, and this value is written verbatim into committed evidence. |
True
|
markdown
|
bool
|
Wrap the flags in a markdown code span, for the rendered table
of a report; the machine-readable field takes them plain. Named
for the output format rather than for the span, |
False
|
Returns:
| Type | Description |
|---|---|
str
|
Description naming the executor class and its flags, for the
|
pyflightstream.run.estimate_point_cost
¶
estimate_point_cost(
case,
*,
run_id: str,
recorded: list[dict],
steps_by_run: dict[str, int | None] | None = None,
) -> PlannedPointCost
Table one point's cost, and fit its time from comparable recorded runs.
FR-82. EVERY FIGURE BUT THE TIME IS A MEASUREMENT of the row, the mesh and the setup. The time is an extrapolation and the row says so, carrying the number of samples it was fitted from and one sentence naming the basis.
COMPARABLE MEANS THE SAME RUN TYPE, because steady and unsteady differ by more than any other term: an unsteady point runs its solve once per time step. Within a run type the fit is linear in the work the point asks for, which is the time steps for an unsteady row and one solve for a steady one.
There is no processor term. The processor count is read and printed for comparison across rows; it is not multiplied into anything. The fit is linear in the time steps and in nothing else.
IT IS DELIBERATELY A CRUDE MODEL and the docstring says so rather than the code implying otherwise. A fuller scalability study is planned and will calibrate it; until then the instruction is to estimate from whatever the workspace already holds, so a reader gets a number with its sample size attached, or no number at all.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
case
|
SimCase
|
The point's case, specialized to the point; supplies the run type, the geometry, the solver settings and the time steps. |
required |
run_id
|
str
|
Manifest identity of the point, carried into the row. |
required |
recorded
|
list of dict
|
The workspace's recorded runs, as manifest rows; those of the same
run type that state a wall time ( |
required |
steps_by_run
|
dict of str to int or None
|
Time steps of each run id the plan holds, used to scale an unsteady sample; a run id mapped to None, or absent, is left out of the fit. |
None
|
Returns:
| Type | Description |
|---|---|
PlannedPointCost
|
The point's row: the measured figures, the expected time in seconds (None when no comparable run exists), the number of samples and the sentence naming the basis. |
pyflightstream.run.export_surface_mesh
¶
export_surface_mesh(
fsm_path: str | Path,
workdir: str | Path,
*,
version: str | FsVersion,
executor: Executor | None = None,
fs_exe: str | Path | None = None,
file_type: str = "OBJ",
surface: int = -1,
timeout_s: float | None = 600.0,
) -> Path
Export the simulation surface mesh in a pre-processing solver run.
Builds and runs the minimal version-validated script (OPEN the simulation, EXPORT_SURFACE_MESH, close), so the probe planner's geometry gate can test candidate probes against the real body when no mesh file exists yet (FSM-26.120 pp.282, 307-308). When a mesh file already exists, skip this and hand it to the gate directly.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fsm_path
|
str or Path
|
Input simulation file to open. |
required |
workdir
|
str or Path
|
Execution directory; the script, the exported mesh, and any hidden-mode log land here. |
required |
version
|
str or FsVersion
|
Target FlightStream version; emission is validated against it. |
required |
executor
|
Executor
|
Executor to run the script with; alternatively give
|
None
|
fs_exe
|
str or Path
|
FlightStream executable path (explicit input, never guessed),
read only when no |
None
|
file_type
|
str
|
Export format token, one of STL, TRI, OBJ (FSM-26.120 p.307); OBJ is the geometry gate default. |
'OBJ'
|
surface
|
int
|
Surface index to export; -1 exports all geometry surfaces. |
-1
|
timeout_s
|
float
|
Wall-clock limit of the pre-processing run. |
600.0
|
Returns:
| Type | Description |
|---|---|
Path
|
The exported mesh file. |
Raises:
| Type | Description |
|---|---|
ExecutorConfigurationError
|
If neither executor nor a valid |
SurfaceMeshExportError
|
If the run fails or leaves no mesh file behind. |
pyflightstream.run.format_cost_table
¶
format_cost_table(costs: list[PlannedPointCost]) -> str
Render the cost table FR-82 asks for, with its basis under it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
costs
|
list of PlannedPointCost
|
One row per point, as :func: |
required |
Returns:
| Type | Description |
|---|---|
str
|
The fixed-width table, one line per point, followed by one basis line per distinct run type; an empty list gives the header alone. The point column is as wide as the longest run id (38 at least), so no run id is shortened and distinct points never print alike. |
pyflightstream.run.invocation_record
¶
invocation_record(
executor: Executor, result: ExecutionResult
) -> ExecutorRecord
Record how the solver was called, read off the executor and its result.
The half of the invocation the run record did not carry (PFS-2012.04):
argv said which command line ran and nothing said which executor
built it, so a report could only ASSERT the class name. The class
name is read off the object that ran, and the argv off the result it
returned, so neither is a description of what the package usually
does.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
executor
|
Executor
|
The executor that ran the script. |
required |
result
|
ExecutionResult
|
What it returned; |
required |
Returns:
| Type | Description |
|---|---|
ExecutorRecord
|
The class name and the argv, in the shape the run manifest and the evidence reports carry. |
pyflightstream.run.on_a_cluster
¶
on_a_cluster() -> bool
Whether this machine submits rather than executes (FR-99).
Returns:
| Type | Description |
|---|---|
bool
|
True on Linux, where a cluster scheduler takes the job, and False on any other platform, where the solver runs as a local process. |
pyflightstream.run.package_vcs_state
cached
¶
package_vcs_state() -> tuple[str | None, bool | None]
Return the commit this package's code came from, and whether it is dirty.
PYFS-017. package_version reads the installed distribution's
metadata, a static string in pyproject.toml. Git identity distinguishes
a development tree from the release named by that metadata.
Two of the three clauses that finding asks for are a versioning scheme change (a dev version carrying the sha, and a guard refusing a final version string off a tag), which is a release-mechanics decision for the owning seat and is registered rather than taken. This is the third: the manifest says which commit ran and whether the tree was clean, which is the part that needs no decision because it adds evidence without changing what anything claims.
Returns:
| Type | Description |
|---|---|
tuple of (str or None, bool or None)
|
Commit sha and dirty flag, or |
Notes
The package directory must be TRACKED, not merely inside a work tree. A wheel installed into a virtualenv that happens to sit inside the repository is not this repository's code, and reporting the repository's HEAD for it would be a confident wrong answer.
pyflightstream.run.plan_receipt_error
¶
plan_receipt_error(
workspace: CampaignWorkspace,
matrix_path: str | Path | None,
matrix_stem: str | None,
*,
fs_exe: str | Path | None = None,
effective_builds: Mapping[str, object] | None = None,
) -> str | None
Return why this run may not proceed on the plan it has, or None.
FOUR ANSWERS, and the last two are the ones the pins exist for:
- no matrix: a campaign authored in Python is not planned through a file and this gate does not apply to it.
- no plan file: refused, naming the command that writes one.
- a plan neither of whose matrix digests answers for the matrix on disk
(
matrix_sha256, ormatrix_form_sha256where it holds one): refused, because the plan measured a different study. A plan that predates the pin carries None and is refused the same way, which is right: it cannot say what it read. The matrix is read without itsIDENTIFIERS(FR-3561), which do nothing in a run, and the second digest also ignores the spaces around its pairs and ending a row. - an instrument or an input that changed after planning (NL-EXEC-1,
FR-1556): refused when
fs_exeis not the executable the plan measured, when an executable the plan read now has another SHA-256, or when a geometry file the plan read does.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
workspace
|
CampaignWorkspace
|
The campaign root whose plan folder is searched for |
required |
matrix_path
|
str or Path
|
The matrix file the run reads; None for a campaign authored in Python. |
required |
matrix_stem
|
str
|
The matrix file name without extension, which names the plan
folder under |
required |
fs_exe
|
str or Path
|
The executable the run names for the campaign's own installation, when it names one; None leaves the comparison to the digests. |
None
|
effective_builds
|
mapping
|
Resolved per-simulation build, version and acceptance to compare with the plan after workspace and executable-entry defaults are applied. |
None
|
Returns:
| Type | Description |
|---|---|
str or None
|
The refusal text, or None when the run may proceed. |
pyflightstream.run.point_costs
¶
point_costs(
plan: CampaignPlan,
cases_by_sim_id: Mapping[str, SimCase],
workspace,
) -> list[PlannedPointCost]
One cost row per planned point (FR-82).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
plan
|
CampaignPlan
|
The plan whose points are to be tabled. |
required |
cases_by_sim_id
|
mapping
|
The resolved case, KEYED ON THE SIMULATION ID and not on the run id. The name carries the key because choosing the other one produces an empty result and no refusal. A point whose simulation is absent gets no row rather than a row of blanks. |
required |
workspace
|
CampaignWorkspace
|
Where the recorded wall times are read from. |
required |
Returns:
| Type | Description |
|---|---|
list of PlannedPointCost
|
In plan order. |
Notes
THE POINT IS FILLED IN, exactly as the campaign loop fills it before it
builds a script. A swept row states ADVANCE_RATIO: sweep and the
VALUE is the point's, so the un-filled row names no rotor speed and its
clock reported a blank; the column that was asked for is the per-POINT
cost, and a row is not a point.
THE STEP COUNT OF EVERY POINT IS RESOLVED ONCE and handed to the fit, so a RECORDED run of one of these points can be weighed by the work it did. Read off the manifest instead, it is null for every run whose reductions were skipped, and the rate comes out by the factor of the steps: the reference rotor point was tabled at 7013.5s against a recorded run of 194.8s of that same point.
pyflightstream.run.render_descriptor
¶
render_descriptor(
profile, values: Mapping[str, object]
) -> str
Render one submission descriptor from a profile and this point's values.
THE PROFILE OWNS THE KEYS and this owns none: every line comes from
the profile's own field table, so a cluster that spells cpus or
queue or account is served by editing that table and nothing
else. A substitution the values cannot supply is refused rather than
written empty, because a descriptor with a blank where a job name goes
is a job the scheduler names for you.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
profile
|
HpcProfile
|
The cluster profile: its field table, its descriptor format
( |
required |
values
|
mapping of str to object
|
This point's values, keyed by the placeholder names the profile's
templates use (for example |
required |
Returns:
| Type | Description |
|---|---|
str
|
The descriptor text, newline terminated, in the profile's format. |
Raises:
| Type | Description |
|---|---|
CampaignConfigError
|
When a field of the profile asks for a placeholder that |