Task State
State management for DAG tasks.
Task state tracking for DAG contexts, including completion and retry logic.
AsyncTaskState
Asynchronous wrapper for task state operations.
Source code in shutils/dag/task_state.py
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 | |
__init__(task_state)
Initialize with the underlying task state mixin.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
task_state
|
TaskStateMixin
|
The mixin instance to wrap. |
required |
Source code in shutils/dag/task_state.py
131 132 133 134 135 136 137 | |
avaliable_task()
Return available tasks via async read wrapper.
Source code in shutils/dag/task_state.py
152 153 154 | |
read_wrapper(func, *args, **kwargs)
async
Execute a function under an async read lock.
Source code in shutils/dag/task_state.py
139 140 141 142 | |
retry(task)
async
Increment and return the retry count for a task.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
task
|
TaskBase
|
The task being retried. |
required |
Returns:
| Type | Description |
|---|---|
|
The new retry count. |
Source code in shutils/dag/task_state.py
156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 | |
write_wrapper(func, *args, **kwargs)
async
Execute a function under an async write lock.
Source code in shutils/dag/task_state.py
144 145 146 147 | |
ErrorInfo
dataclass
Information about an error that occurred during task execution.
Attributes:
| Name | Type | Description |
|---|---|---|
has_error |
bool
|
Whether an error occurred. |
exception |
Exception | None
|
The exception instance, if any. |
error_node |
str | None
|
The ID of the task that caused the error. |
Source code in shutils/dag/task_state.py
21 22 23 24 25 26 27 28 29 30 31 32 | |
SyncTaskState
Synchronous thread-safe wrapper for task state operations.
Source code in shutils/dag/task_state.py
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | |
__init__(task_state)
Initialize with the underlying task state mixin.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
task_state
|
TaskStateMixin
|
The mixin instance to wrap. |
required |
Source code in shutils/dag/task_state.py
109 110 111 112 113 114 115 | |
avaliable_task()
Return a list of currently available tasks under a read lock.
Source code in shutils/dag/task_state.py
121 122 123 124 | |
TaskStateMixin
Mixin providing task completion tracking and available-task discovery.
Source code in shutils/dag/task_state.py
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | |
async_task_state
property
Lazy accessor for the async task state wrapper.
available_tasks
property
Set of tasks whose upstream dependencies are all completed.
sync_task_state
property
Lazy accessor for the sync task state wrapper.
__init__()
Initialize task state with empty completion and availability sets.
Source code in shutils/dag/task_state.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 | |
is_destory()
Check if this context has been destroyed.
Source code in shutils/dag/task_state.py
56 57 58 | |
set_destory(value)
Set the destroyed flag.
Source code in shutils/dag/task_state.py
60 61 62 | |