orxtra v0.13.0 /scheduler.src.orxtra.scheduler._graph
On this page

Workflow dependency graph utilities: build_graph, topological_sort (Kahn's algorithm, raises CycleError on cycles), and find_parallel_groups for same-depth concurrent tasks.

#scheduler.src.orxtra.scheduler._graph

#scheduler.src.orxtra.scheduler._graph

#CycleError

Raised when the dependency graph contains a cycle.

#build_graph

python
def build_graph(tasks: list[TaskSpec], dependencies: dict[str, list[str]]) -> dict[str, set[str]]

Build adjacency list: task_name -> set of task names it depends on.

#topological_sort

python
def topological_sort(graph: dict[str, set[str]]) -> list[str]

Return task names in execution order. Raises CycleError on cycles.

Uses Kahn's algorithm.

#_find_cycle

python
def _find_cycle(graph: dict[str, set[str]], remaining: set[str]) -> list[str]

Extract one cycle from the remaining nodes in a graph with cycles.

#find_parallel_groups

python
def find_parallel_groups(graph: dict[str, set[str]], order: list[str]) -> list[set[str]]

Group tasks that can run in parallel (same depth in the DAG).

Search