Skip to main content

Crate dag_executor

Crate dag_executor 

Source
Expand description

§dag-executor

A production-ready DAG (directed acyclic graph) executor with stateful task execution, file-based persistence and recovery, advanced workflow patterns (conditional, fan-out/fan-in, loops, event-driven), and fault-tolerance primitives (circuit breaker, retries, dead-letter queue).

§Quick start

use std::sync::Arc;
use dag_executor::prelude::*;

let mut dag = Dag::new();
dag.add_task(Arc::new(BasicTask::new("a", |_ctx| async { Ok(serde_json::json!(1)) })))?;
dag.add_task(Arc::new(
    BasicTask::new("b", |_ctx| async { Ok(serde_json::json!(2)) }).with_deps(["a"]),
))?;

let executor = DagExecutor::builder().build();
let report = executor.run(dag).await?;
assert!(report.is_success());

See the prelude module for the most commonly used types.

Modules§

advanced
Fault-tolerance and workflow-pattern building blocks.
context
Shared execution context passed to every task.
dag
The DAG engine: graph, scheduler, worker pool, and the executor that drives them.
error
Error types used throughout the crate.
metrics
Observability: metrics collection and (optional) Prometheus export.
prelude
Common imports for working with the executor.
state
Task state model and validation.
storage
Persistence layer.
tasks
Task abstraction and built-in task types.
utils
Cross-cutting utilities: configuration and tracing setup.