Crucible.Pipeline.Runner (CrucibleFramework v0.5.2)
View SourceExecutes experiment pipelines stage-by-stage.
Location and Ownership
This is the authoritative pipeline runner for the Crucible ecosystem.
It lives in crucible_framework and is the only component that executes
experiment pipelines. crucible_ir defines specs only; it does not execute.
Public Entrypoint
Users should call CrucibleFramework.run/2 rather than this module directly:
{:ok, ctx} = CrucibleFramework.run(experiment)Pipeline Execution
The runner:
- Initializes a
%Crucible.Context{}from the experiment - Optionally persists run state to the database
- Executes each
%CrucibleIR.StageDef{}in sequence - Resolves stage modules via
Crucible.Registryor explicit:modulefield - Optionally validates stage options against
describe/1schema - Calls
stage_module.run(context, opts)for each stage - Marks stages complete and emits trace events
- Finalizes the run with success or failure status
Stage Resolution
Stages are resolved in order:
- If
StageDef.moduleis set, use that module directly - Otherwise, look up
StageDef.nameinCrucible.Registry
Options Validation
The runner supports opt-in validation of stage options against the schema
returned by each stage's describe/1 callback:
CrucibleFramework.run(experiment, validate_options: :error):off(default) - No validation:warn- Log warnings for invalid options but continue execution:error- Fail immediately on invalid options
Trace Integration
When :enable_trace is passed, the runner emits stage lifecycle events
via Crucible.TraceIntegration for observability and debugging.
Summary
Functions
Runs an experiment, optionally persisting run state.
Functions
@spec run( CrucibleIR.Experiment.t(), keyword() ) :: {:ok, Crucible.Context.t()} | {:error, term()}
Runs an experiment, optionally persisting run state.
Options
:run_id- Custom run ID (defaults to UUID):persist- Whether to persist run state (default: true):enable_trace- Enable trace integration (default: false):assigns- Initial context assigns (default: %{}):validate_options- Options validation mode::off(default) - No validation:warn- Log warnings but continue:error- Fail on validation errors