context
Per-unit-of-work chain execution state.
A ChainExecutionContext tracks each stage node's execution state for one unit of work. It is descriptive: the
owning orchestration performs the actual work and reports progress here, either by marking nodes directly or by
feeding generation-progress values through advance_for_progress.
ChainConsistencyError
ChainExecutionContext
Thread-safe execution state for one traversal of a ChainFlow.
Source code in horde_sdk/worker/chaining/context.py
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 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 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 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 | |
__init__
Initialize all nodes as pending.
Parameters:
-
flow(ChainFlow) –The flow being traversed.
Source code in horde_sdk/worker/chaining/context.py
node_state
node_errors
node_duration
Seconds a node spent executing, or None when it has not both started and finished.
Source code in horde_sdk/worker/chaining/context.py
snapshot
Return a point-in-time view of every node's state, keyed by node name.
ready_nodes
Return the nodes eligible to start: pending or ready, with all dependencies satisfied.
Source code in horde_sdk/worker/chaining/context.py
mark_executing
Mark a node as executing.
Optional pending predecessors are skipped implicitly; a required predecessor that has not finished is a routing contradiction.
Parameters:
-
handle(ChainNodeHandle) –The node that started executing.
Raises:
-
ChainConsistencyError–If the node is already terminal or a required dependency has not finished.
Source code in horde_sdk/worker/chaining/context.py
mark_completed
Mark a node as completed and return the nodes that became eligible as a result.
Parameters:
-
handle(ChainNodeHandle) –The node that finished.
Returns:
-
tuple[ChainNodeHandle, ...]–tuple[ChainNodeHandle, ...]: The successors that are now eligible to start.
Raises:
-
ChainConsistencyError–If the node is already terminal.
Source code in horde_sdk/worker/chaining/context.py
mark_failed
Mark a node as failed and skip everything downstream of it.
Parameters:
-
handle(ChainNodeHandle) –The node that failed.
-
error(str | None, default:None) –A description of the failure. Defaults to None.
Source code in horde_sdk/worker/chaining/context.py
mark_skipped
Mark a node as skipped.
Parameters:
-
handle(ChainNodeHandle) –The node to skip.
-
reason(str | None, default:None) –Why the node was skipped. Defaults to None.
Raises:
-
ChainConsistencyError–If the node is not optional or is already terminal.
Source code in horde_sdk/worker/chaining/context.py
advance_for_progress
Advance the chain state from a generation-progress observation.
This is the bridge that lets an orchestrator drive the chain purely from the generation's state machine:
a stage's entry_progress marks its node executing, a stage's completion_progress marks its node
completed, and a terminal failure progress fails whichever node is executing.
Parameters:
-
progress(GENERATION_PROGRESS) –The progress value the generation just reached.
Returns:
-
tuple[ChainNodeHandle, ...]–tuple[ChainNodeHandle, ...]: The nodes that became eligible to start due to this observation.