upxo.meshing.gbconformant.pipeline.checkpoints module
Stage results saved in a run folder, and restored into a fresh pipeline state.
Each finished stage writes <run>/checkpoints/<stage_id>/ holding the
results it produced (portable files, see serialize), its report and
status, and a signature of the settings and inputs up to and including that
stage. A restore trusts a stage only when its files read back, their format
version is known and the signature still matches the current settings, so a
changed setting upstream makes everything after it stale instead of silently
reusing results built on other settings.
state is any object with artefacts, artefact_writer, reports,
config and stage_ids; statuses are set through a callback.
- upxo.meshing.gbconformant.pipeline.checkpoints.canonical_signature(parts)[source]
Short hash of
parts(numbers, text, lists and dictionaries in any order).
- upxo.meshing.gbconformant.pipeline.checkpoints.chain_signatures(stage_ids, own)[source]
Signature per stage that also depends on every earlier stage’s own part.
- class upxo.meshing.gbconformant.pipeline.checkpoints.CheckpointStore(run_folder, keep_history=True)[source]
Bases:
objectStage results in
<run_folder>/checkpoints.With
keep_history(the default) every stage keeps the results it wrote, so a stage can be run again from the results of the stage before it. Without it a newer stage’s result replaces the older copy of the same artefact, which takes less disk; a restore then returns only a prefix of stages whose results are all still complete.- save_stage(state, stage_id, signature, status='OK', report=None, config_changes=None)[source]
Write the results
stage_idproduced; return its meta dictionary.config_changesare the settings the stage itself changed while running (the hierarchy level it found, the spacing after an upscale); a restore applies them again.
- save_marker(stage_id, signature, status, report=None, config_changes=None)[source]
A stage with no results of its own (for instance a skipped one).
- history_bytes(order)[source]
Disk the older copies of artefacts take: every artefact kept by more than one stage, less its newest copy.
- drop_history(order)[source]
Keep each artefact only in the last stage of
orderthat wrote it; returns the bytes freed.A run that finished still restores as a whole afterwards (its results are the newest copies); what is lost is running a stage again from the results of the stage before it.
- restore(state, stage_ids, signatures, set_status, set_config=None)[source]
Load every stage that is still valid, in order; later stages follow earlier ones.
set_status(stage_id, text)receives'OK','Skipped'or'Stale';set_config(stage_id, changes)receives the settings a restored stage changed. Returns{'restored': [...], 'stale': [...], 'bytes': n, 'problems': [...]}.