TaskContext
TaskContext
dataclass
TaskContext(workspace: Path, output_dir: Path, inputs: Mapping[str, Any], results: Mapping[str, Mapping[str, Any]])
Paths and available completed-task results supplied to a Python callback.
Attributes:
| Name | Type | Description |
|---|---|---|
workspace |
Path
|
Shared run root. Use this to locate other tasks' files. |
output_dir |
Path
|
This task's directory, |
inputs |
Mapping[str, Any]
|
Workflow-level inputs passed by execute or replay. |
results |
Mapping[str, Mapping[str, Any]]
|
Return values from earlier stages and completed earlier siblings in a sequential stage. |
Note
The runner supplies this object; do not construct it for ordinary runs. Parallel siblings cannot use each other's return values. In a sequential stage, results from earlier completed siblings are also available.
Methods:
| Name | Description |
|---|---|
result |
Read an available completed task's return value. |
Methods:
result
Read an available completed task's return value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stage
|
str
|
Earlier stage, or the current stage for a completed sequential sibling. |
required |
task
|
str
|
Task name within that stage. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
value |
Any
|
The callback value or a ProcessResult for an external process. |
Raises:
| Type | Description |
|---|---|
KeyError
|
The stage or task is not available. |