orchestrator.Pipeline
- class orchestrator.Pipeline(id, name, tasks=<factory>, context=<factory>, metadata=<factory>, created_at=<factory>, version='1.0.0', description=None)[source]
Bases:
objectPipeline represents a collection of tasks with dependencies.
A pipeline manages the execution order of tasks based on their dependencies and provides methods for validation and execution planning.
- __init__(id, name, tasks=<factory>, context=<factory>, metadata=<factory>, created_at=<factory>, version='1.0.0', description=None)
Methods
__init__(id, name[, tasks, context, ...])add_task(task)Add a task to the pipeline.
Clear all tasks from the pipeline.
from_dict(data)Create pipeline from dictionary representation.
Get list of completed task IDs.
Get the critical path (longest path) through the pipeline.
get_dependencies(task_id)Get dependencies for a task.
get_dependents(task_id)Get tasks that depend on the given task.
Get tasks grouped by execution level (parallel groups).
Get flat execution order of tasks.
Get flat execution order of tasks.
Get list of failed task IDs.
Get pipeline execution progress.
get_ready_task_ids(completed_tasks)Get task IDs that are ready to execute (legacy interface).
get_ready_tasks(completed_tasks)Get tasks that are ready to execute.
Get list of running task IDs.
Get pipeline status summary.
get_task(task_id)Get a task by ID.
get_task_safe(task_id)Get a task by ID without raising exceptions.
get_task_strict(task_id)Get a task by ID (legacy interface that raises exceptions).
has_task(task_id)Check if pipeline has a task with given ID.
Check if all tasks are completed.
Check if any critical task has failed.
is_valid()Check if pipeline is valid.
remove_task(task_id)Remove a task from the pipeline and return it.
remove_task_strict(task_id)Remove a task from the pipeline (legacy interface that raises exceptions).
reset()Reset all tasks to pending state.
to_dict()Convert pipeline to dictionary representation.
Attributes
Get number of tasks in pipeline.
- add_task(task)[source]
Add a task to the pipeline.
- Parameters:
task (
Task) – Task to add- Raises:
ValueError – If task with same ID already exists
- Return type:
- remove_task(task_id)[source]
Remove a task from the pipeline and return it.
- Parameters:
task_id (
str) – ID of task to remove- Return type:
- Returns:
Removed task, or None if task doesn’t exist
- Raises:
ValueError – If other tasks depend on it
- remove_task_strict(task_id)[source]
Remove a task from the pipeline (legacy interface that raises exceptions).
- Parameters:
task_id (
str) – ID of task to remove- Return type:
- Returns:
Removed task
- Raises:
ValueError – If task doesn’t exist or other tasks depend on it
- get_task_strict(task_id)[source]
Get a task by ID (legacy interface that raises exceptions).
- Parameters:
task_id (
str) – Task ID- Return type:
- Returns:
Task object
- Raises:
ValueError – If task doesn’t exist
- get_ready_task_ids(completed_tasks)[source]
Get task IDs that are ready to execute (legacy interface).
- is_valid()[source]
Check if pipeline is valid.
- Return type:
- Returns:
True if valid, False otherwise
- __init__(id, name, tasks=<factory>, context=<factory>, metadata=<factory>, created_at=<factory>, version='1.0.0', description=None)