workflow#
hydromodpy.workflow provides composable steps and an immutable
PipelineState payload that flows from one step to the next. The
Project facade and every workflow launcher (simulation,
calibration, batch, comparison, testbed) reuse these steps so the
same TOML always drives the same lifecycle.
Sub-modules#
workflow/internals/state.pyβPipelineState[TPayload]generic dataclass, immutable, specialised by step (ValidatedState,ResolvedState,GeographicState,LoadedState,MeshedState,SetupState,OpenStoreState,SolverRanState,ExtractedState,DerivedState,ExportedState). Transit throughstate.advance(...).workflow/internals/step.pyβStep[TIn, TOut]Protocol (name,run(state) -> state, optionalconfig_sections).workflow/tracking/journal.pyβWorkflowJournal, the DuckDB journal of executed steps;workflow/tracking/resume.pyandworkflow/tracking/heartbeat.pysit beside it. There is no checkpoint store and no pickle layer: resume reads artefacts, see Pipeline resume from artefacts.workflow/internals/dependencies.pyβearliest_affected_stepresolves the first pipeline index affected by a dotted-path override (used by calibration to skip shared phases).workflow/internals/derived.pyβDerivedRegistryfor ordered post-extraction calculations.workflow/internals/manifest.pyβResolvedRunManifest, the step blueprint plus config digest written under.hmp/checkpoints/<run_id>/resolved_manifest.jsonand verified on resume.workflow/runner.pyβPipelinerunner that chains steps, manages the journal, and raises typed errors (StepErrorexposesstep_nameandrun_id).workflow/steps/β the canonical step library.workflow/pipelines/β pre-assembled pipelines for the standard workflows.
Twelve canonical steps#
Defined under workflow/steps/ and re-exported from
workflow/steps/__init__.py:
ValidateStep, ResolveStep, LoadDataStep,
BuildGeographicStep, BuildMeshStep,
SetupProcessStep, PrepareSolverStep, RunSolverStep,
ExtractStep, DeriveStep, DisplayStep, ExportStep.
DisplayStep runs before ExportStep: figures are the last reader
of a run, so they draw from the open store while the intermediate fields
are still there. ExportStep then drops what reconciliation forced on
(the per-cell budget) and seals the store.
Step contract#
class XyzStep:
name: ClassVar[str] = "xyz"
tin: ClassVar[type] = InputPayloadType
tout: ClassVar[type] = OutputPayloadType
config_sections: ClassVar[tuple[str, ...]] = ("flow.param",)
def run(self, state: PipelineState) -> PipelineState:
...
return state.advance(
step_index=...,
step_name=self.name,
payload=...,
)
The config_sections annotation declares which TOML subtrees the
step reads. earliest_affected_step walks every stepβs
declarations to decide which phases can be skipped per calibration
trial.
Key public symbols#
hydromodpy.workflow.internals.state.PipelineStatehydromodpy.workflow.internals.step.Stephydromodpy.workflow.internals.manifest.ResolvedRunManifesthydromodpy.workflow.internals.dependencies.earliest_affected_stephydromodpy.workflow.internals.derived.DerivedRegistryhydromodpy.workflow.runner.Pipelinehydromodpy.workflow.steps.{ValidateStep, ResolveStep, ..., DisplayStep}
The v1 StepsLedger module is removed; workflow steps are now
recorded in the project index (.hmp/index.duckdb) under the
workflow_steps table (see Storage Layout).
Recommended reading path#
hydromodpy/workflow/internals/state.pyhydromodpy/workflow/internals/step.pyhydromodpy/workflow/runner.pyhydromodpy/workflow/steps/__init__.pyto see the registered steps.one step (
hydromodpy/workflow/steps/setup.py).hydromodpy/workflow/internals/dependencies.pyfor the skip-aware logic used by calibration.
Layer-matrix neighbours#
Allowed targets:
core,schema,config,physics,data,spatial,simulation,solver,calibration,results,display,analysis,reportingandworkflow.Allowed sources:
projectandcli.
See also#
simulation β the simulation runner that the steps wrap.
calibration β the calibration loop that reuses
earliest_affected_step.Mental Model & Design Choices β the design rationale behind the workflow layer.