hydromodpy.core.contracts.workflow_step#

Canonical Step Protocol shared by every workflow concern.

The runtime-checkable WorkflowStep Protocol enforces the minimum contract every pipeline step must honour: a stable name and a run method that maps an input state to an output state. Two extra hooks are honoured opportunistically:

depends_on() -> tuple[str, ...]

Names of upstream steps whose output state must exist. The Kahn DAG sort consumes this method to compute parallel cohorts.

rebuild_state(prior_state, workspace, run_id)

Reconstruct an output state from durable artefacts only. Used at resume time so heavy work (solver runs, extraction) is not redone.

artifacts(state_out) -> tuple[str, ...]

Workspace-relative paths persisted by the step. The runner hashes the set to produce outputs_hash rows in the workflow ledger.

Concrete implementations live under hydromodpy.workflow.steps and re-expose this Protocol via hydromodpy.workflow.internals.step.

Functions

step_depends_on(step)

Read the depends_on() declaration of a step, defaulting to ().

step_name(step)

Return the canonical name of a workflow step (class attribute).

Classes

ResumableWorkflowStep(*args, **kwargs)

Workflow step that persists durable artefacts and supports resume.

WorkflowStep(*args, **kwargs)

Canonical workflow step contract with DAG dependency hooks.