upxo.meshing.gbconformant.pipeline.state module

Settings, artefacts, status and invalidation of one pipeline run.

A PipelineState holds the settings, the result of every stage that has run (the heavy arrays live here) and the status of each stage. Invalidating a stage drops its results and those of every later stage.

class upxo.meshing.gbconformant.pipeline.state.StageStatus(*values)[source]

Bases: str, Enum

NOT_RUN = 'Not run'
RUNNING = 'Running'
OK = 'OK'
FAILED = 'Failed'
STALE = 'Stale'
SKIPPED = 'Skipped'
class upxo.meshing.gbconformant.pipeline.state.PipelineState(config: dict, stage_ids: list[str])[source]

Bases: object

Holds settings, artefacts, and per-stage status.

status: dict[str, StageStatus]
reports: dict[str, dict]
artefacts: dict[str, object]
artefact_writer: dict[str, str]
current_stage: str | None
errors: dict[str, str]
stale_reasons: dict[str, dict]
log_lines: list[str]
property busy: bool
try_begin_operation() → bool[source]
end_operation() → None[source]
request_cancel() → None[source]

Ask the current stage to stop at the next progress checkpoint.

check_cancel() → None[source]

Raise PipelineCancelled if a cancel was requested.

set_progress_handler(handler) → None[source]

handler(message, current=None, total=None) receives the progress of the running stage.

report_progress(message: str, current=None, total=None) → None[source]
append_log(message: str) → None[source]
set_status(stage_id: str, status: StageStatus) → None[source]
pop_history(stage_id: str, data: dict) → dict[source]

Move data['history'] into the stage’s history artefact; returns data without it.

The per-pass list stays out of the compact stage report (and the JSON written for it) the same way it was dropped before this existed; it is kept instead at "<stage_id>.history" for later per-pass inspection, and is invalidated together with the stage that wrote it.

store_artefact(key: str, value: object) → None[source]
get_artefact(key: str, default=None)[source]
invalidate_from(stage_id: str, reason: str = '') → list[str][source]

Mark stage_id and every later stage stale; drop their artefacts.

reason says why (it is kept for each stage that held results). Returns the list of invalidated stage ids.

invalidate_after(stage_id: str, reason: str = '') → list[str][source]

Invalidate every stage that comes after stage_id; returns their ids.

invalidation_preview(stage_id: str) → dict[source]

What invalidating from stage_id would throw away: the finished stages and the time they took.

stale_reason_text(stage_id: str) → str[source]

"<reason> (<time>)" for a stale stage, else an empty string.