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/internals/checkpoint.pyβCheckpointStorewith HMAC-SHA256 signed pickle plus zstd compression.workflow/internals/ledger.pyβ DuckDB ledger of executed steps.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βWorkflowManifestsummary for the lockfile.workflow/runner.pyβPipelinerunner that chains steps, manages the ledger, the optional checkpoint store, and 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, ExportStep, DisplayStep.
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.checkpoint.CheckpointStorehydromodpy.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 catalog.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/build_geographic.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.