Skip to content

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:pyflightstream.results.tables.parse_run_loads uses on the manifest: a swept case names its outputs per point (loads_{point}.txt), so no single literal could name them all, and the content is what identifies the file anyway.

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 loads_file follows and for the same reason: a swept case names its outputs per point, so no single literal could name them all.

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:

  1. The file named by loads_file is 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.
  2. No loads_file was 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.
  3. The loads spreadsheet is unparseable or truncated.
  4. The export is evidence of a different operating point from the one the case requested, beyond tolerance (REV010-001).
  5. The loads footer prints a solver mode this package has not been taught (REV010-002).
  6. The file named by log_file is not among the collected outputs; or log_file was 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.
  7. The solver log is present but no residual history can be read from it.
  8. 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 -hidden flag for a windowless run; this is the batch mode that writes FlightStreamLog.txt on abnormal termination (FSM-26.120 p.280). Disable only for local debugging with the interface visible.

True
forced_local bool

Keyword only. Whether the local switch kept this run on a machine that would otherwise have submitted (pyfs-matrix run --local): a cluster carrying a profile. Recorded on every point's executor entry; it changes nothing about how the solver is called.

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 export_log = false: that machine's build aborts at EXPORT_LOG whether the job is submitted or run where it is, so the profile's decision applies to the machine. No scheduler writes the log of a local run, so the run writes the declared log from what this executor captured of the solver, its standard output then its standard error; with nothing captured the point is judged from its loads export and its record says why it has no log.

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 FlightStreamLog.txt appears on abnormal termination.

required
timeout_s float

Wall-clock limit; on expiry the process is killed and the result reports timed_out.

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 fs_version is resolved to canonical and every dry-run script is validated against it.

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:run_campaign.

None
write_plan bool

Write the JSON summary as plan.json, under post/<matrix>/ for a campaign converted from a run matrix and in the campaign root otherwise (overwritten on each call; a convenience report, never an identity source). Default True.

True
name_from str

Where the campaign name came from, option or directory, recorded in the plan; None when the caller does not say.

None
builds mapping of str to SolverBuild

As in :func:run_campaign, and pre-flighting is where it earns its keep: a case sent to a second build has its dry-run script validated against THAT build's version, so a command the second installation does not carry blocks the point here rather than failing after the first one has already run. A case naming a build the mapping does not carry is refused, exactly as the campaign loop refuses it, so the pre-flight cannot pass a configuration the run will reject.

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: plan_matrix and run_matrix both read it off the build registry for the build each row named (_row_versions), so a row naming a second build has its dry-run script validated against that build's grammar away from the licensed machine (PFS-2009.05). A row on 26.123 in a matrix defaulting to 26.120 is checked against 26.123's grammar, including commands absent from 26.120. builds wins where both name a build.

None
matrix_path str or Path

The matrix file the campaign was converted from. Its SHA-256 is written into plan.json so run can refuse a plan that measured a different study; None for a campaign authored in Python.

None
accept_unregistered_build bool

Recorded in plan.json so the plan rehearses the command line run executes; no solver is launched here, so no check changes. Default False.

False
setup_inspections sequence of dict

The setup inspections to carry into the plan and its plan.json; None for none.

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 inputs/executables.local.toml accepts their installed build (FR-998), a build id or "" for the campaign's own. plan.json then states the acceptance, the builds it holds for and its file, as the run's records will. Default empty.

()
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 --sims/--points selection before planning (FR-326): run id aliases are numbered against the whole sweep, as run numbers them (FR-395). None reads it off campaign, which is the whole sweep when nothing was selected. Written into plan.json as planned_order and onto :attr:CampaignPlan.planned_order.

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:PointPlan per point; inspect blocked before running, or print summary().

Raises:

Type Description
ExecutorConfigurationError

When a case names an fs_build that builds does not carry.

WorkspaceError

When :meth:CampaignWorkspace.read_manifest refuses a recorded row, for example a surface averaging window that does not validate.

Warns:

Type Description
PyflightstreamWarning

A row whose actuator disc is RELAXED and names a loading profile (FR-332, :func:_warn_on_relaxed_discs_naming_a_profile); the point plans as it would without the warning.

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:_warn_on_short_wakes); the plan is what it would be without it.

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:CampaignWorkspace.read_manifest returns it, or the run_id of one. The id form exists so a caller can name the run they mean instead of reaching it by list position, which is what a reader of the manifest actually has.

required
workspace CampaignWorkspace

The workspace the run belongs to. Keyword-only, so this cannot be confused with :func:~pyflightstream.results.tables.parse_run_loads, whose two positional arguments are the same pair in the other order.

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 cwd), where the run writes the files it parks beside the script (the trailing-edge node file, the actuator profile's copy, the unsteady action programs). It reads "missing" only when the file is not where the run read it.

Raises:

Type Description
WorkspaceError

If no record carries the given run_id, if the record was written under a manifest schema this version does not know, or carries no usable argv or script path, or the script is not where it says. Refusing beats reconstructing something that is not the run.

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 fs_version is resolved to canonical for the manifest.

required
executor Executor

How to run it, for example :class:LocalExecutor built from campaign.fs_exe.

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:SimCase.recipe as a module:function reference; the run-matrix entry (:func:pyflightstream.run.matrix.run_matrix) forwards its recipe registry here.

None
force_rerun sequence of str

The points to REDO rather than refuse, each by its point name, by its full run_id, or by the job id of a swept row, which names every point of it because a job is indivisible. For a row that was WRONG, where the correction does not change the point's name and the identity is therefore the same: the manifest is copied into archive/, the named records leave it, and each point's collected outputs move into that point's own archive/<stamp>/.

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 resume, which SKIPS a recorded point instead: a caller asking for both has not said which.

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 run_id is already in the manifest are skipped without execution, so a campaign can grow sweep points and re-run into the same root; the manifest's append-only duplicate rejection is what makes the skip safe. A case with nothing left to run is not prepared at all, so a resume that executes nothing also STAGES nothing: skipping is a read-only operation on the simulation folder. A case with some points recorded and some pending is prepared, and is refused when its staged input no longer hashes to what the recorded points ran against, because re-staging would retire the evidence those records point at. With False (the default) a duplicate point raises :class:~pyflightstream.workspace.WorkspaceError before anything executes or is staged, because silently redoing recorded evidence would fork the run identity.

False
builds mapping of str to SolverBuild

One entry per solver installation the campaign's cases name in :attr:~pyflightstream.cases.SimCase.fs_build. A case naming none runs on executor, campaign.fs_exe and campaign.fs_version; a case naming one runs on that build's executor and is RECORDED against that build's executable, its digest and its version, so a study across two builds records which one produced a point. A case naming a build this mapping does not carry is refused before anything executes.

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, option or directory, recorded in every run record; None when the caller does not say.

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 inputs/executables.local.toml accepts their installed build (FR-998), a build id or "" for the campaign's own; each accepts that build only, warns as the flag does, and its records say so and name the file. Default empty.

()
redo_submitted bool

Redo a point named by force_rerun that is recorded as SUBMITTED or belongs to a batch whose job has not ended, instead of refusing it, warning that its job is not cancelled. run_matrix sets it for force_rerun_all.

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 "auto". None reads parallel of the setup's [runtime] block, and without one runs the cases one at a time. Only local runs are concurrent; a submitting or grouping executor runs one at a time.

None

Returns:

Type Description
list of RunRecord

The records executed by this call, in execution order; points skipped by resume keep their existing manifest records and are not repeated here.

Raises:

Type Description
CampaignErrors

After the loop, when at least one executed point failed.

WorkspaceError

On the first already-recorded point when resume is False; or, with resume True, when a partially recorded case's declared input no longer matches the hash its recorded points were run against.

ExecutorConfigurationError

When a case names an fs_build that builds does not carry; or when the identity pre-flight finds the wrong build installed at any installation the campaign still has work for. The second is raised ONCE, naming every failing installation and the cases that asked for it, before the first point of ANY of them executes, so a misconfigured build cannot spend the licensed seats of a healthy one first (PFS-2009.09.02).

InputArtifactError

When sweep_csv is given: the keyword is removed with the campaign sweep table it named (0.58.0, D30), and the refusal names its successor before anything runs.

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

CONVERGED, COMPLETED_MAX_ITER, MAX_ITER_REACHED, FAILED_DIVERGED or FAILED_INCOMPLETE_OUTPUT (an export that is missing, unreadable or lacks what the case declared); execution failures are decided by the loop before the assessor runs.

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: axis, requested, reported, deviation, tolerance, unit and within (REV010-001). Empty when the assessor had no case to compare against; None when the assessor does not perform the comparison at all. Recorded on EVERY outcome rather than only on a refusal, because "checked and agreed" and "never checked" are different claims about a result and a later reader cannot otherwise tell them apart.

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 COMPLETED_MAX_ITER whatever the solver did, and a later reader of the manifest cannot otherwise tell that from a point whose residuals were actually read and missed the threshold.

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 index, clocking_deg, status, iterations, residual and, where it has one, note or error, each judged from that clocking's own solve in the one log the run exports. The point's status, residual and iterations are then the worst case: the worst status, the largest final residual, and the iterations of clocking 0, the solve its loads export is of. None on every other point.

iterations_requested (int, optional)

The iteration limit the run requested (FR-434); set only for a MAX_ITER_REACHED point, whose iterations is the counter reached.

warnings list of str, optional

What the judgment could not use and did without, for the point's record's warnings: a quasi-steady point whose record cannot be read (:class:~pyflightstream.cases.qsteady.QsteadyRecordError) has its solver log judged as one solve, and says so here. None where there is nothing to say.

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: post/<matrix>/plan.json for a campaign converted from a run matrix, plan.json in the campaign root otherwise (PFS-2031.04); None when writing was disabled.

build_groups dict of str to list of str

Which cases run on which solver installation, keyed by :attr:~pyflightstream.cases.SimCase.fs_build with the empty string standing for the campaign's own. Reported here because how many installations a study actually spans is usually a surprise, and the pre-flight is the one place it can be learned without spending a licensed seat (PFS-2009.09.01).

blocked property

blocked: list[PointPlan]

The points that cannot run as planned.

ready property

ready: list[PointPlan]

The points that built cleanly in dry run.

already_recorded property

already_recorded: list[PointPlan]

The points the manifest already holds (resume would skip them).

installation_label staticmethod

installation_label(key: str) -> str

Name one of :attr:build_groups the way a message should say it.

summary

summary() -> str

Return the one-paragraph human summary of the plan.

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. timed_out is the authority on a timeout, never the code.

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 FlightStreamLog.txt from the execution directory when the solver wrote one (hidden-mode abnormal termination, FSM-26.120 p.280); None otherwise.

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). wall_time_s says how long the solver ran and nothing said WHEN, which a provenance document states as the activity's start and end. None for an executor that reports no clock, and the record keeps that rather than filling it.

finished_at (str, optional)

When the process ended, or was killed on timeout, the same way. [REF-03]

failed property

failed: bool

Whether the process timed out or returned a nonzero code.

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.FS_VERSION_FROM_ROW module-attribute

FS_VERSION_FROM_ROW = 'row'

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 (_mesh_size carries the measurement). None where the geometry states none or could not be read. This is an element count, not a boundary count.

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

SET_MAX_PARALLEL_THREADS, the number of processors set.

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 unknown rather than a number.

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 allow_broken waiver. Known at plan time, because the dry run builds the same script, and reported here so an operator learns the campaign leans on a command a probe measured broken BEFORE spending solver time rather than from the manifest afterwards. The former name broken_commands is gone from the point and from plan.json (PFS-2022.01.05); pyfs-workspace migrate renames it in old files.

raw bool

Whether the point's script used the raw() escape hatch. Same reason.

march_strategy str or None

How the point's unsteady run is marched on its build, "actions" or "single_march" (GOAL-023); None for a steady point or one that is BLOCKED.

rotor_mach dict of str to dict

On a point of an unsteady_rotor row, a steady row stating RPM or a row naming an actuator disc, each rotor's and disc's tip and helical Mach numbers keyed by its alias or disc name, as :meth:pyflightstream.cases.workflows.RotorMach.record states them, with a note naming the row where they are not known (M1). Empty on every other point.

qsteady_validity dict of str to object

On a point of a qsteady_rotor WHEEL, the 1P reduced frequency of its blade: the per cent of the span with k above 0.1, k_min, k_max and k_mean, as :func:pyflightstream.cases.workflows.qsteady_validity states them, or a note saying why the chord is not known at plan time. Empty on every other point.

continuation str or None

On a point of a row stating RESTART (FR-96), what the continuation does (continuing a CONVERGED unsteady run, <run id>, by 1 revolution(s)) or why the request cannot continue the point; None on every other point and where the resolver's refusal is the error.

wake_termination dict of str to object

On a point of an unsteady_rotor row that is not a continuation, the wake termination its script emits (FR-584): the key that stated it (default for the 4R default), the length asked in rotor radii, the steps, the rule that gave V_ax and V_ax in m/s, as :meth:pyflightstream.cases.workflows._freestream.WakeTermination.record states them. Empty on every other point.

run_wake_length dict of str to object

On a point of an unsteady_rotor row stating RUN_WAKE_LENGTH_R (FR-906), the run length resolved from it: the length asked in rotor radii, the rule and V_ax, the resulting time_iterations and the revolutions they turn. Empty on every other point, and then left out of plan.json.

angles_not_stated tuple of str

The flow angles (ALPHA, BETA) the point neither sweeps nor the row states, which take the default 0.0 degrees (FR-69). Empty where both are stated. Shown by :meth:CampaignPlan.summary, not written to plan.json.

streamlines int

The off-body streamlines the point's pproc traces (FR-1079): every seed line's count and every tube's radial * circular. 0, and left out of plan.json, where it traces none.

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 inputs/<name> by its name in inputs_sha256, and checked where the run read it, see :func:reconstruct), each collected output, and the solver executable. Three values, and the third exists because collapsing it into the second was wrong: "match", "differs" (the file is there and its bytes moved, so somebody edited a result), and "missing" (the file cannot be read at all, so the evidence is gone and the answer is to restore it from archive/). Those are different problems with different answers.

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.

faithful property

faithful: bool

Whether every checked artifact still matches its recorded hash.

pyflightstream.run.SCRIPT_ARGUMENT module-attribute

SCRIPT_ARGUMENT = '-script'

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_exe and hashed into fs_exe_sha256.

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 fs_version_requested.

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): pyfs.toml, pyfs.local.toml or executables.local.toml (a build entry of inputs/executables.local.toml), which the warning names; None where the command line typed it. Default None.

None

Raises:

Type Description
ExecutorConfigurationError

When the exported log names a build that is not the registered build of version.

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:invocation_record read it off a real run; None for the asserted sentence.

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, code being ambiguous next to :attr:ExecutionResult.return_code.

False

Returns:

Type Description
str

Description naming the executor class and its flags, for the executor field of a compat, drift, or physics report.

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 (wall_time_s, seconds) are the samples.

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 fs_exe to build a :class:LocalExecutor. Given both, the executor runs the script and fs_exe is not read.

None
fs_exe str or Path

FlightStream executable path (explicit input, never guessed), read only when no executor is given.

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 fs_exe is given.

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:estimate_point_cost returns them.

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; argv is empty for an executor that reports none, and the record keeps that emptiness rather than filling it.

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 (None, None) when the package did not come from a git work tree. A known commit with None for the flag means git status failed. None means "not knowable here" rather than "clean": a wheel install has no repository to ask, and inventing an answer is the failure this pair exists to prevent.

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, or matrix_form_sha256 where 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 its IDENTIFIERS (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_exe is 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 plan.json.

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 post/.

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 (json, text, toml or yaml) and the path it was read from.

required
values mapping of str to object

This point's values, keyed by the placeholder names the profile's templates use (for example sim, point, fs_build, ncpus).

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 values does not carry.