hydromodpy.workflow.internals.state#

Pipeline state - the object that flows between pipeline steps.

PipelineState is a frozen, generic dataclass that each step receives as input and returns a new version of as output. Steps must never mutate a state instance; instead they produce a successor via PipelineState.advance().

The state is parameterised by the payload type T. Concrete payloads are the typed dataclasses defined below (ValidatedState, ResolvedState, GeographicState, LoadedState …), one per pipeline step transition. The generic parameter defaults to Mapping[str, Any] for callers that prefer state.data["key"] style access.

Typed state hierarchy#

Each step refines the payload by adding fields. The payloads form an inheritance chain so a step that consumes ResolvedState will also accept a GeographicState (which IS-A ResolvedState):

ValidatedState
└── ResolvedState
    └── GeographicState
        └── LoadedState
            └── MeshedState
                └── SetupState
                    └── OpenStoreState
                        └── SolverRanState
                            └── ExtractedState
                                └── DerivedState
                                    └── ExportedState

Classes

DerivedState(config[, workspace, ...])

Payload after step 09 (derive).

ExportedState(config[, workspace, ...])

Payload after step 10 (export).

ExtractedState(config[, workspace, ...])

Payload after step 08 (extract).

GeographicState(config[, workspace, ...])

Payload after the geographic/domain runtime has been built.

LoadedState(config[, workspace, ...])

Payload after data managers have loaded and bound external data.

MeshedState(config[, workspace, ...])

Payload after the mesh has been built or imported.

OpenStoreState(config[, workspace, ...])

Payload after step 06 (prepare_solver).

PipelineState(run_id[, step_index, ...])

State traversing the pipeline, immutable between steps.

ResolvedState(config[, workspace, ...])

Payload after step 01 (resolve).

SetupState(config[, workspace, config_path, ...])

Payload after step 05 (setup_process).

SolverRanState(config[, workspace, ...])

Payload after step 07 (run_solver).

ValidatedState(config[, workspace, config_path])

Payload after step 00 (validate).