Expand description
Task dependency graph with topological scheduling and critical-path analysis.
This module provides a directed-acyclic-graph (DAG) model for expressing computational tasks with explicit data dependencies, plus a suite of schedulers that exploit the structure for efficient execution.
§Overview
| Type | Description |
|---|---|
TaskGraph | DAG container: add tasks, declare dependencies |
TaskNode | Individual task with a boxed compute closure |
TaskResult<T> | Outcome of a single task with timing metadata |
TopologicalScheduler | Execute tasks in dependency order (parallel-ready) |
CriticalPath | Find the longest dependency chain |
ResourceConstrainedScheduler | Schedule with CPU-core and memory limits |
§Example
use scirs2_core::task_graph::{TaskGraph, TaskNode, TopologicalScheduler};
use std::sync::Arc;
let mut g = TaskGraph::new();
let t1 = g.add_task("fetch_data", || 42u64);
let t2 = g.add_task("process", || 0u64);
g.add_dependency(t2, t1).expect("valid dep");
let scheduler = TopologicalScheduler::new(g);
let results = scheduler.run_serial().expect("run");
assert!(results.iter().any(|r| r.task_name == "fetch_data"));Modules§
- dependency_
graph - Task dependency graph with topological scheduling, cycle detection, and critical-path analysis.
Structs§
- Critical
Path - Critical path analysis for a
TaskGraph. - Resource
Constrained Scheduler - A scheduler that respects CPU-core and memory limits.
- Resource
Constraints - Constraints for
ResourceConstrainedScheduler. - Task
Graph - A directed-acyclic graph (DAG) of tasks with typed outputs.
- TaskId
- Opaque identifier for a task in a
TaskGraph. - Task
Node - A single node in a
TaskGraph. - Task
Result - The result of executing one task.
- Topological
Scheduler - Execute tasks in topological order.
Enums§
- Task
Status - Execution status of a
TaskResult.