Skip to content

# Yaml Loader

## `` dagpipe.yaml_loader

### Summary

Loads dagpipe pipelines from YAML configuration.

Creates fully configured pipeline objects from declarative YAML definitions, including `Schema`, `State` subclasses, `Node` instances, `Graph` topology, and initial payloads.

### Classes

#### `` Pipeline `dataclass`

    1

    Pipeline(engine: Engine, state_cls: Type[State], initial_payload: Payload)

Executable pipeline created from YAML configuration.

Attributes:

Name | Type | Description
--- | --- | ---
`engine` | `Engine` | Execution engine responsible for running the pipeline.
`state_cls` | `Type[State]` | Dynamically created `State` subclass with configured schema.
`initial_payload` | `Payload` | Default payload used when execution begins.

Notes

Responsibilities:

    1
    2
    3

    - Encapsulates engine, state type, and initial payload.
    - Provides a simplified interface for executing configured pipelines.
    - Safe for concurrent execution if underlying nodes are thread-safe.

##### Functions

###### `` run

    1

    run(payload_override: Optional[Mapping[str, Any]] = None) -> list[State]

Execute the pipeline.

Parameters:

Name | Type | Description | Default
--- | --- | --- | ---
`payload_override` | `Mapping[str, Any]` | Payload values overriding initial payload. | `None`

Returns:

Type | Description
--- | ---
`list[State]` | list[State]: Terminal execution states.

Notes

Responsibilities:

    1
    2

    - Merges override payload with initial payload.
    - Creates root `State` and executes engine.

### Functions

#### `` load_pipeline

    1

    load_pipeline(path: str) -> Pipeline

Load pipeline from YAML file.

Parameters:

Name | Type | Description | Default
--- | --- | --- | ---
`path` | `str` | Path to YAML configuration file. | required

Returns:

Name | Type | Description
--- | --- | ---
`Pipeline` | `Pipeline` | Executable pipeline instance.

Notes

Responsibilities:

    1
    2
    3

    - Loads YAML configuration and builds schema.
    - Creates `State` subclass and loads `Node` instances.
    - Builds `Graph` topology and initializes `Engine`.