Execution
zenml.execution
Step and pipeline execution.
Modules
context
In-process execution context.
Classes
ExecutionContext(pipeline_run: Optional[PipelineRunResponse] = None)
Bases: BaseContext
Execution context.
Initialize the execution context.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pipeline_run
|
Optional[PipelineRunResponse]
|
The pipeline run to seed the context with. |
None
|
Source code in src/zenml/execution/context.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | |
Functions:
record_step_run(step_run: StepRunResponse) -> None
Record a successful step run in the active execution context.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
step_run
|
StepRunResponse
|
The step run to record. |
required |
Source code in src/zenml/execution/context.py
72 73 74 75 76 77 78 79 80 81 82 | |
setup_execution_context(pipeline_run: Optional[PipelineRunResponse] = None) -> ContextManager[Any]
Set up an execution context unless disabled via environment variable.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pipeline_run
|
Optional[PipelineRunResponse]
|
The pipeline run to seed the context with. |
None
|
Returns:
| Type | Description |
|---|---|
ContextManager[Any]
|
The execution context or a no-op context manager. |
Source code in src/zenml/execution/context.py
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | |
Modules
pipeline
Pipeline execution.
Modules
dynamic
Dynamic pipeline execution.
compilation
Compilation helpers for dynamic pipelines.
compile_child_pipeline(pipeline: DynamicPipeline, args: Tuple[Any, ...], kwargs: Dict[str, Any], parent_snapshot: PipelineSnapshotResponse) -> PipelineSnapshotResponse
Compile and persist a snapshot for a dynamic child pipeline run.
The child snapshot inherits the parent build/code context so child execution runs in the same orchestration environment.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pipeline
|
DynamicPipeline
|
The child dynamic pipeline |
required |
args
|
Tuple[Any, ...]
|
Positional arguments for the child pipeline. |
required |
kwargs
|
Dict[str, Any]
|
Keyword arguments for the child pipeline. |
required |
parent_snapshot
|
PipelineSnapshotResponse
|
Snapshot of the parent dynamic run. |
required |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If the parent snapshot has no stack. |
Returns:
| Type | Description |
|---|---|
PipelineSnapshotResponse
|
The persisted child snapshot. |
Source code in src/zenml/execution/pipeline/dynamic/compilation.py
229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 | |
compile_dynamic_step_invocation(snapshot: PipelineSnapshotResponse, pipeline: DynamicPipeline, step: BaseStep, invocation_id: str, inputs: Dict[str, Any], upstream_steps: Set[str], pipeline_docker_settings: DockerSettings, config: Optional[StepConfigurationUpdate] = None) -> Step
Compile a dynamic step invocation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
snapshot
|
PipelineSnapshotResponse
|
The snapshot. |
required |
pipeline
|
DynamicPipeline
|
The dynamic pipeline. |
required |
step
|
BaseStep
|
The step to compile. |
required |
invocation_id
|
str
|
The invocation ID of the step. |
required |
inputs
|
Dict[str, Any]
|
The awaited inputs for the step function. |
required |
upstream_steps
|
Set[str]
|
The upstream step invocation IDs. |
required |
pipeline_docker_settings
|
DockerSettings
|
The Docker settings of the parent pipeline. |
required |
config
|
Optional[StepConfigurationUpdate]
|
The configuration for the step. |
None
|
Returns:
| Type | Description |
|---|---|
Step
|
The compiled step. |
Source code in src/zenml/execution/pipeline/dynamic/compilation.py
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 | |
get_config_template(snapshot: PipelineSnapshotResponse, step: BaseStep, pipeline: DynamicPipeline) -> Optional[Step]
Get the config template for a step executed in a dynamic pipeline.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
snapshot
|
PipelineSnapshotResponse
|
The snapshot of the pipeline. |
required |
step
|
BaseStep
|
The step to get the config template for. |
required |
pipeline
|
DynamicPipeline
|
The dynamic pipeline that the step is being executed in. |
required |
Returns:
| Type | Description |
|---|---|
Optional[Step]
|
The config template for the step. |
Source code in src/zenml/execution/pipeline/dynamic/compilation.py
336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 | |
get_step_runtime(step_config: StepConfiguration, pipeline_docker_settings: DockerSettings, orchestrator: Optional[BaseOrchestrator] = None) -> StepRuntime
Determine if a step should be run in process.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
step_config
|
StepConfiguration
|
The step configuration. |
required |
pipeline_docker_settings
|
DockerSettings
|
The Docker settings of the parent pipeline. |
required |
orchestrator
|
Optional[BaseOrchestrator]
|
The orchestrator to use. If not provided, the orchestrator will be inferred from the active stack. |
None
|
Returns:
| Type | Description |
|---|---|
StepRuntime
|
The runtime for the step. |
Source code in src/zenml/execution/pipeline/dynamic/compilation.py
298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 | |
is_valid_parameter(step: BaseStep, name: str, value: Any, size_threshold: int) -> bool
Check whether a raw step input can be passed as a parameter.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
step
|
BaseStep
|
The step that the input belongs to. |
required |
name
|
str
|
The name of the input. |
required |
value
|
Any
|
The input value. |
required |
size_threshold
|
int
|
The maximum serialized parameter size in bytes. Zero disables step parameters, a negative value disables the size check. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
Whether the input can be passed as a parameter. |
Source code in src/zenml/execution/pipeline/dynamic/compilation.py
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 | |
future_registry
Future registry for dynamic pipeline execution.
FutureRegistry()
Registry for user futures.
Initialize the future registry.
Source code in src/zenml/execution/pipeline/dynamic/future_registry.py
38 39 40 41 42 43 | |
await_all_no_raise() -> None
Wait for all tracked futures to finish without raising.
Source code in src/zenml/execution/pipeline/dynamic/future_registry.py
254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 | |
bind_map_child_futures(map_id: str, child_futures: List[StepFuture]) -> None
Bind expanded child futures to a map.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
map_id
|
str
|
The map ID. |
required |
child_futures
|
List[StepFuture]
|
The child step futures created for the map. |
required |
Source code in src/zenml/execution/pipeline/dynamic/future_registry.py
200 201 202 203 204 205 206 207 208 209 210 211 | |
bind_step_execution_future(invocation_id: str, future: StepExecutionFuture) -> None
Bind the step execution future to a step invocation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
invocation_id
|
str
|
The step invocation ID. |
required |
future
|
StepExecutionFuture
|
The future that represents the started step execution. |
required |
Source code in src/zenml/execution/pipeline/dynamic/future_registry.py
174 175 176 177 178 179 180 181 182 183 184 185 | |
get_all_futures() -> List[Union[StepFuture, MapResultsFuture, PipelineFuture]]
Return all tracked futures.
Returns:
| Type | Description |
|---|---|
List[Union[StepFuture, MapResultsFuture, PipelineFuture]]
|
A snapshot of all tracked futures. |
Source code in src/zenml/execution/pipeline/dynamic/future_registry.py
239 240 241 242 243 244 245 246 247 248 249 250 251 252 | |
get_map_future(map_id: str) -> MapResultsFuture
Get a map future.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
map_id
|
str
|
The map ID. |
required |
Raises:
| Type | Description |
|---|---|
KeyError
|
If the future does not exist. |
Returns:
| Type | Description |
|---|---|
MapResultsFuture
|
The map future. |
Source code in src/zenml/execution/pipeline/dynamic/future_registry.py
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 | |
get_pipeline_future(node_id: str) -> PipelineFuture
Get a child pipeline future.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
node_id
|
str
|
Dependency-graph node ID of the child pipeline call. |
required |
Raises:
| Type | Description |
|---|---|
KeyError
|
If the future does not exist. |
Returns:
| Type | Description |
|---|---|
PipelineFuture
|
The pipeline future. |
Source code in src/zenml/execution/pipeline/dynamic/future_registry.py
156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 | |
get_step_future(invocation_id: str) -> StepFuture
Get a step future.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
invocation_id
|
str
|
The step invocation ID. |
required |
Raises:
| Type | Description |
|---|---|
KeyError
|
If the future does not exist. |
Returns:
| Type | Description |
|---|---|
StepFuture
|
The step future. |
Source code in src/zenml/execution/pipeline/dynamic/future_registry.py
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | |
has_in_progress_work() -> bool
Check whether any tracked future is still running.
Returns:
| Type | Description |
|---|---|
bool
|
True if any tracked future is still running, False otherwise. |
Source code in src/zenml/execution/pipeline/dynamic/future_registry.py
292 293 294 295 296 297 298 | |
rebind_step_execution_future(invocation_id: str, future: StepExecutionFuture) -> None
Rebind the step execution future to a new attempt of the step.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
invocation_id
|
str
|
The step invocation ID. |
required |
future
|
StepExecutionFuture
|
The future that represents the new step execution attempt. |
required |
Source code in src/zenml/execution/pipeline/dynamic/future_registry.py
187 188 189 190 191 192 193 194 195 196 197 198 | |
register_map_future(map_id: str, future: MapResultsFuture) -> MapResultsFuture
Register the future for a map invocation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
map_id
|
str
|
The map ID. |
required |
future
|
MapResultsFuture
|
The map future. |
required |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If a future already exists for the map. |
Returns:
| Type | Description |
|---|---|
MapResultsFuture
|
The registered map future. |
Source code in src/zenml/execution/pipeline/dynamic/future_registry.py
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | |
register_pipeline_future(node_id: str, future: PipelineFuture) -> PipelineFuture
Register a child pipeline future.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
node_id
|
str
|
Dependency-graph node ID of the child pipeline call (e.g.
|
required |
future
|
PipelineFuture
|
The pipeline future. |
required |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If a future already exists for the node. |
Returns:
| Type | Description |
|---|---|
PipelineFuture
|
The registered pipeline future. |
Source code in src/zenml/execution/pipeline/dynamic/future_registry.py
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 | |
register_step_future(invocation_id: str, future: StepFuture) -> StepFuture
Register a step invocation future.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
invocation_id
|
str
|
The step invocation ID. |
required |
future
|
StepFuture
|
The step future. |
required |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If a future already exists for the invocation. |
Returns:
| Type | Description |
|---|---|
StepFuture
|
The registered step future. |
Source code in src/zenml/execution/pipeline/dynamic/future_registry.py
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 | |
set_startup_exception(invocation_id: str, exception: BaseException) -> None
Set the startup exception for any registered future.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
invocation_id
|
str
|
The invocation ID of the future. |
required |
exception
|
BaseException
|
The exception to record on the future. |
required |
Raises:
| Type | Description |
|---|---|
KeyError
|
If no future is registered for |
Source code in src/zenml/execution/pipeline/dynamic/future_registry.py
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 | |
StartupCancelled
Bases: Exception
Exception raised when an invocation startup is cancelled.
inputs
Input resolution helpers for dynamic pipeline execution.
await_step_inputs(inputs: Dict[str, Any]) -> Dict[str, Any]
Await the inputs of a step.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
inputs
|
Dict[str, Any]
|
The inputs of the step. |
required |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If a step run future or a child pipeline future referring to multiple output artifacts is passed as an input. |
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
The awaited inputs. |
Source code in src/zenml/execution/pipeline/dynamic/inputs.py
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 | |
collect_start_upstream_node_ids(start_after: Union[AnyOutputFuture, Sequence[AnyOutputFuture], None]) -> List[str]
Collect start-upstream node IDs from start_after futures.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
start_after
|
Union[AnyOutputFuture, Sequence[AnyOutputFuture], None]
|
Optional upstream futures for start ordering. |
required |
Returns:
| Type | Description |
|---|---|
List[str]
|
The start-upstream node IDs. |
Source code in src/zenml/execution/pipeline/dynamic/inputs.py
223 224 225 226 227 228 229 230 231 232 233 234 235 236 | |
collect_upstream_node_ids(inputs: Dict[str, Any], after: Union[AnyOutputFuture, Sequence[AnyOutputFuture], None]) -> List[str]
Collect upstream node IDs from step inputs and after futures.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
inputs
|
Dict[str, Any]
|
The step inputs. |
required |
after
|
Union[AnyOutputFuture, Sequence[AnyOutputFuture], None]
|
Optional upstream futures for explicit ordering. |
required |
Returns:
| Type | Description |
|---|---|
List[str]
|
The upstream node IDs. |
Source code in src/zenml/execution/pipeline/dynamic/inputs.py
204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 | |
convert_to_keyword_arguments(func: Callable[..., Any], args: Tuple[Any, ...], kwargs: Dict[str, Any], apply_defaults: bool = False) -> Dict[str, Any]
Convert function arguments to keyword arguments.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
func
|
Callable[..., Any]
|
The function to convert the arguments to keyword arguments for. |
required |
args
|
Tuple[Any, ...]
|
The arguments to convert to keyword arguments. |
required |
kwargs
|
Dict[str, Any]
|
The keyword arguments to convert to keyword arguments. |
required |
apply_defaults
|
bool
|
Whether to apply the function default values. |
False
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
The keyword arguments. |
Source code in src/zenml/execution/pipeline/dynamic/inputs.py
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 | |
get_running_upstream_dependencies(inputs: Dict[str, Any], after: Union[AnyOutputFuture, Sequence[AnyOutputFuture], None]) -> List[str]
Get all running upstream dependencies for a step.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
inputs
|
Dict[str, Any]
|
The inputs of the step. |
required |
after
|
Union[AnyOutputFuture, Sequence[AnyOutputFuture], None]
|
The step run futures to wait for. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
If an unexpected future type is passed. |
Returns:
| Type | Description |
|---|---|
List[str]
|
The list of running upstream dependencies. |
Source code in src/zenml/execution/pipeline/dynamic/inputs.py
239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 | |
interactive_input_utils
Local terminal input helpers for dynamic pipeline wait conditions.
can_answer_wait_condition_interactively(orchestrator: BaseOrchestrator) -> bool
Check whether a wait condition can be answered interactively.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
orchestrator
|
BaseOrchestrator
|
The orchestrator running the dynamic pipeline. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
Whether terminal prompting should be enabled for the current process. |
Source code in src/zenml/execution/pipeline/dynamic/interactive_input_utils.py
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | |
maybe_enable_interactive_wait_prompt(orchestrator: BaseOrchestrator, condition: RunWaitConditionResponse) -> Iterator[bool]
Render and clean up the terminal prompt for interactive waiting.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
orchestrator
|
BaseOrchestrator
|
The orchestrator running the dynamic pipeline. |
required |
condition
|
RunWaitConditionResponse
|
The wait condition shown to the user. |
required |
Yields:
| Type | Description |
|---|---|
bool
|
Whether interactive input is enabled. |
Source code in src/zenml/execution/pipeline/dynamic/interactive_input_utils.py
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | |
poll_interactive_wait_condition_input(condition: RunWaitConditionResponse, poll_interval: int) -> None
Poll interactive input for a wait condition.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
condition
|
RunWaitConditionResponse
|
The wait condition to resolve. |
required |
poll_interval
|
int
|
Maximum number of seconds to wait. |
required |
Source code in src/zenml/execution/pipeline/dynamic/interactive_input_utils.py
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 | |
print_wait_condition_details(condition: RunWaitConditionResponse) -> None
Print wait-condition details for interactive terminal input.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
condition
|
RunWaitConditionResponse
|
The wait condition shown to the user. |
required |
Source code in src/zenml/execution/pipeline/dynamic/interactive_input_utils.py
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | |
read_stdin_line_with_timeout(timeout: float) -> Tuple[bool, Optional[str]]
Read a line from stdin with a timeout.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
timeout
|
float
|
Maximum number of seconds to wait. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
A tuple indicating whether input was received and the entered value. |
Optional[str]
|
Empty input is returned as an empty string. |
Source code in src/zenml/execution/pipeline/dynamic/interactive_input_utils.py
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 | |
invocation_dependency_graph
Invocation dependency graph.
BaseNode(*, node_id: str, state: NodeState = NodeState.PENDING, upstream_ids: Set[str] = set(), start_upstream_ids: Set[str] = set(), downstream_ids: Set[str] = set(), start_downstream_ids: Set[str] = set(), implicit_upstream_steps: Set[str] = set())
dataclass
Base node in the dependency graph.
has_started: bool
property
Whether the node has started running.
Returns:
| Type | Description |
|---|---|
bool
|
True if the node has started running, False otherwise. |
is_terminal: bool
property
Whether the node is terminal.
Returns:
| Type | Description |
|---|---|
bool
|
True if the node is terminal, False otherwise. |
ChildPipelineNode(*, node_id: str, state: NodeState = NodeState.PENDING, upstream_ids: Set[str] = set(), start_upstream_ids: Set[str] = set(), downstream_ids: Set[str] = set(), start_downstream_ids: Set[str] = set(), implicit_upstream_steps: Set[str] = set(), pipeline: DynamicPipeline, args: Sequence[Any] = tuple(), kwargs: Dict[str, Any] = dict())
dataclass
GraphUpdate(*, nodes_ready: bool = False, cascaded: List[AnyNode] = list())
dataclass
Graph update.
merge(other: GraphUpdate) -> None
Merge another update into this one.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
other
|
GraphUpdate
|
The update to merge. |
required |
Source code in src/zenml/execution/pipeline/dynamic/invocation_dependency_graph.py
156 157 158 159 160 161 162 163 | |
InvocationDependencyGraph()
Invocation dependency graph.
Initialize the graph.
Source code in src/zenml/execution/pipeline/dynamic/invocation_dependency_graph.py
169 170 171 172 | |
attach_map_children(map_node_id: str, child_node_ids: Sequence[str]) -> GraphUpdate
Attach expanded child nodes to a map node.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
map_node_id
|
str
|
The map node ID. |
required |
child_node_ids
|
Sequence[str]
|
The child step node IDs created by the expansion. |
required |
Returns:
| Type | Description |
|---|---|
GraphUpdate
|
The resulting graph update. |
Source code in src/zenml/execution/pipeline/dynamic/invocation_dependency_graph.py
381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 | |
get_child_pipeline_node(node_id: str) -> ChildPipelineNode
Get a child pipeline node by ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
node_id
|
str
|
The node ID. |
required |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If the node does not exist or is not a child pipeline node. |
Returns:
| Type | Description |
|---|---|
ChildPipelineNode
|
The child pipeline node. |
Source code in src/zenml/execution/pipeline/dynamic/invocation_dependency_graph.py
360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 | |
get_map_node(node_id: str) -> MapNode
Get a map node by ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
node_id
|
str
|
The node ID. |
required |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If the node does not exist or is not a map node. |
Returns:
| Type | Description |
|---|---|
MapNode
|
The map node. |
Source code in src/zenml/execution/pipeline/dynamic/invocation_dependency_graph.py
330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 | |
get_node(node_id: str) -> Optional[AnyNode]
Get a node by ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
node_id
|
str
|
The node ID. |
required |
Returns:
| Type | Description |
|---|---|
Optional[AnyNode]
|
The node, or |
Source code in src/zenml/execution/pipeline/dynamic/invocation_dependency_graph.py
348 349 350 351 352 353 354 355 356 357 358 | |
get_node_state(node_id: str) -> NodeState
Get the current state of a node.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
node_id
|
str
|
The node ID. |
required |
Returns:
| Type | Description |
|---|---|
NodeState
|
The current state of the node. |
Source code in src/zenml/execution/pipeline/dynamic/invocation_dependency_graph.py
523 524 525 526 527 528 529 530 531 532 533 | |
get_ready_node() -> Optional[AnyNode]
Get one ready node in insertion order.
Step nodes are prioritized over child pipeline nodes over map nodes.
Returns:
| Type | Description |
|---|---|
Optional[AnyNode]
|
A ready node if one exists, otherwise |
Source code in src/zenml/execution/pipeline/dynamic/invocation_dependency_graph.py
442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 | |
get_step_node(node_id: str) -> StepNode
Get a step node by ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
node_id
|
str
|
The node ID. |
required |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If the node does not exist or is not a step node. |
Returns:
| Type | Description |
|---|---|
StepNode
|
The step node. |
Source code in src/zenml/execution/pipeline/dynamic/invocation_dependency_graph.py
312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 | |
list_nodes(states: Optional[Collection[NodeState]] = None) -> List[AnyNode]
List graph nodes in insertion order.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
states
|
Optional[Collection[NodeState]]
|
Optional node states to filter by. |
None
|
Returns:
| Type | Description |
|---|---|
List[AnyNode]
|
The graph nodes in insertion order. |
Source code in src/zenml/execution/pipeline/dynamic/invocation_dependency_graph.py
424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 | |
mark_node_failed(node_id: str) -> GraphUpdate
Mark a node as failed and skip all non-terminal downstream nodes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
node_id
|
str
|
The node ID. |
required |
Returns:
| Type | Description |
|---|---|
GraphUpdate
|
The resulting graph update. |
Source code in src/zenml/execution/pipeline/dynamic/invocation_dependency_graph.py
501 502 503 504 505 506 507 508 509 510 | |
mark_node_paused(node_id: str) -> GraphUpdate
Mark a node as paused and cascade to all downstream nodes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
node_id
|
str
|
The node ID. |
required |
Returns:
| Type | Description |
|---|---|
GraphUpdate
|
The resulting graph update. |
Source code in src/zenml/execution/pipeline/dynamic/invocation_dependency_graph.py
512 513 514 515 516 517 518 519 520 521 | |
mark_node_running(node_id: str) -> GraphUpdate
Mark a node as running.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
node_id
|
str
|
The node ID. |
required |
Returns:
| Type | Description |
|---|---|
GraphUpdate
|
The resulting graph update. |
Source code in src/zenml/execution/pipeline/dynamic/invocation_dependency_graph.py
479 480 481 482 483 484 485 486 487 488 | |
mark_node_starting(node_id: str) -> GraphUpdate
Mark a node as starting.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
node_id
|
str
|
The node ID. |
required |
Returns:
| Type | Description |
|---|---|
GraphUpdate
|
The resulting graph update. |
Source code in src/zenml/execution/pipeline/dynamic/invocation_dependency_graph.py
468 469 470 471 472 473 474 475 476 477 | |
mark_node_succeeded(node_id: str) -> GraphUpdate
Mark a node as successful.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
node_id
|
str
|
The node ID. |
required |
Returns:
| Type | Description |
|---|---|
GraphUpdate
|
The resulting graph update. |
Source code in src/zenml/execution/pipeline/dynamic/invocation_dependency_graph.py
490 491 492 493 494 495 496 497 498 499 | |
node_has_started(node_id: str) -> bool
Whether a node has started running.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
node_id
|
str
|
The node ID. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if the node has started running, False otherwise. |
Source code in src/zenml/execution/pipeline/dynamic/invocation_dependency_graph.py
535 536 537 538 539 540 541 542 543 544 545 | |
register_child_pipeline_node(node_id: str, pipeline: DynamicPipeline, args: Optional[Sequence[Any]] = None, kwargs: Optional[Dict[str, Any]] = None, upstream_ids: Optional[Sequence[str]] = None, start_upstream_ids: Optional[Sequence[str]] = None, state: Optional[NodeState] = None) -> Tuple[ChildPipelineNode, bool]
Register a child pipeline node.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
node_id
|
str
|
The node ID. |
required |
pipeline
|
DynamicPipeline
|
The child pipeline payload for startup. |
required |
args
|
Optional[Sequence[Any]]
|
Optional positional payload for startup. |
None
|
kwargs
|
Optional[Dict[str, Any]]
|
Optional keyword payload for startup. |
None
|
upstream_ids
|
Optional[Sequence[str]]
|
Upstream node IDs that must succeed. |
None
|
start_upstream_ids
|
Optional[Sequence[str]]
|
Upstream node IDs that must start. |
None
|
state
|
Optional[NodeState]
|
Optional initial state for the node. |
None
|
Returns:
| Type | Description |
|---|---|
ChildPipelineNode
|
The registered child pipeline node and whether the registration |
bool
|
caused any newly ready nodes. |
Source code in src/zenml/execution/pipeline/dynamic/invocation_dependency_graph.py
272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 | |
register_map_node(node_id: str, step: BaseStep, inputs: Dict[str, Any], product: bool, upstream_ids: Optional[Sequence[str]] = None, start_upstream_ids: Optional[Sequence[str]] = None, state: Optional[NodeState] = None, after: Optional[Union[AnyOutputFuture, Sequence[AnyOutputFuture]]] = None, implicit_upstream_steps: Optional[Set[str]] = None) -> Tuple[MapNode, bool]
Register a map aggregate node.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
node_id
|
str
|
The graph node ID. |
required |
upstream_ids
|
Optional[Sequence[str]]
|
Upstream node IDs that must succeed. |
None
|
start_upstream_ids
|
Optional[Sequence[str]]
|
Upstream node IDs that must start. |
None
|
state
|
Optional[NodeState]
|
Optional initial state for the node. |
None
|
step
|
BaseStep
|
The mapped step payload for startup. |
required |
inputs
|
Dict[str, Any]
|
The input payload for startup. |
required |
after
|
Optional[Union[AnyOutputFuture, Sequence[AnyOutputFuture]]]
|
Optional |
None
|
product
|
bool
|
The map expansion mode. |
required |
implicit_upstream_steps
|
Optional[Set[str]]
|
Optional implicit upstream step invocation IDs for startup. |
None
|
Returns:
| Type | Description |
|---|---|
MapNode
|
The registered map node and whether the registration caused |
bool
|
any newly ready nodes. |
Source code in src/zenml/execution/pipeline/dynamic/invocation_dependency_graph.py
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 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 | |
register_step_node(node_id: str, upstream_ids: Optional[Sequence[str]] = None, start_upstream_ids: Optional[Sequence[str]] = None, state: Optional[NodeState] = None, step: Optional[BaseStep] = None, inputs: Optional[Dict[str, Any]] = None, after: Optional[Union[AnyOutputFuture, Sequence[AnyOutputFuture]]] = None, config_overrides: Optional[StepConfigurationUpdate] = None, implicit_upstream_steps: Optional[Set[str]] = None) -> Tuple[StepNode, bool]
Register a step node.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
node_id
|
str
|
The node ID. |
required |
upstream_ids
|
Optional[Sequence[str]]
|
Upstream node IDs that must succeed. |
None
|
start_upstream_ids
|
Optional[Sequence[str]]
|
Upstream node IDs that must start. |
None
|
state
|
Optional[NodeState]
|
Optional initial state for the node. |
None
|
step
|
Optional[BaseStep]
|
Optional step payload for startup. |
None
|
inputs
|
Optional[Dict[str, Any]]
|
Optional input payload for startup. |
None
|
after
|
Optional[Union[AnyOutputFuture, Sequence[AnyOutputFuture]]]
|
Optional |
None
|
config_overrides
|
Optional[StepConfigurationUpdate]
|
Optional config overrides for startup. |
None
|
implicit_upstream_steps
|
Optional[Set[str]]
|
Optional implicit upstream step invocation IDs for startup. |
None
|
Returns:
| Type | Description |
|---|---|
StepNode
|
The registered step node and whether the registration caused |
bool
|
any newly ready nodes. |
Source code in src/zenml/execution/pipeline/dynamic/invocation_dependency_graph.py
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 | |
MapNode(*, node_id: str, state: NodeState = NodeState.PENDING, upstream_ids: Set[str] = set(), start_upstream_ids: Set[str] = set(), downstream_ids: Set[str] = set(), start_downstream_ids: Set[str] = set(), implicit_upstream_steps: Set[str] = set(), child_node_ids: Set[str] = set(), step: BaseStep, inputs: Dict[str, Any], after: Union[AnyOutputFuture, Sequence[AnyOutputFuture], None], product: bool)
dataclass
NodeState
Bases: StrEnum
Invocation dependency graph node state.
is_terminal: bool
property
Whether the state is terminal.
Returns:
| Type | Description |
|---|---|
bool
|
True if the state is terminal, False otherwise. |
StepNode(*, node_id: str, state: NodeState = NodeState.PENDING, upstream_ids: Set[str] = set(), start_upstream_ids: Set[str] = set(), downstream_ids: Set[str] = set(), start_downstream_ids: Set[str] = set(), implicit_upstream_steps: Set[str] = set(), parent_id: Optional[str] = None, step: Optional[BaseStep] = None, inputs: Optional[Dict[str, Any]] = None, after: Optional[Union[AnyOutputFuture, Sequence[AnyOutputFuture]]] = None, config_overrides: Optional[StepConfigurationUpdate] = None)
dataclass
outputs
Dynamic pipeline execution outputs.
ArtifactFuture(parent: StepFuture, index: int)
Bases: BaseStepFuture
Future for a step run output artifact.
Initialize the future.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parent
|
StepFuture
|
The parent step future object. |
required |
index
|
int
|
The index of the output artifact. |
required |
Source code in src/zenml/execution/pipeline/dynamic/outputs.py
415 416 417 418 419 420 421 422 423 424 425 426 427 428 | |
chunk(index: int) -> OutputArtifact
Get a chunk of the output artifact.
This method will wait for the future to complete and then return the artifact chunk.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
index
|
int
|
The index of the chunk. |
required |
Returns:
| Type | Description |
|---|---|
OutputArtifact
|
The artifact chunk. |
Source code in src/zenml/execution/pipeline/dynamic/outputs.py
475 476 477 478 479 480 481 482 483 484 485 486 487 | |
load(disable_cache: bool = False) -> Any
Load the step run output artifact data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
disable_cache
|
bool
|
Whether to disable the artifact cache. |
False
|
Returns:
| Type | Description |
|---|---|
Any
|
The step run output artifact data. |
Source code in src/zenml/execution/pipeline/dynamic/outputs.py
464 465 466 467 468 469 470 471 472 473 | |
result() -> OutputArtifact
Get the output artifact this future represents.
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If the future returned an invalid output. |
Returns:
| Type | Description |
|---|---|
OutputArtifact
|
The output artifact. |
Source code in src/zenml/execution/pipeline/dynamic/outputs.py
438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 | |
running() -> bool
Check if the artifact future is running.
Returns:
| Type | Description |
|---|---|
bool
|
True if the artifact future is running, False otherwise. |
Source code in src/zenml/execution/pipeline/dynamic/outputs.py
430 431 432 433 434 435 436 | |
wait() -> None
Wait for the artifact future to complete.
Source code in src/zenml/execution/pipeline/dynamic/outputs.py
489 490 491 | |
BaseFuture
Bases: ABC
Base future.
result() -> Any
abstractmethod
Get the result of the future.
Returns:
| Type | Description |
|---|---|
Any
|
The result of the future. |
Source code in src/zenml/execution/pipeline/dynamic/outputs.py
160 161 162 163 164 165 166 | |
running() -> bool
abstractmethod
Check if the future is running.
Returns:
| Type | Description |
|---|---|
bool
|
True if the future is running, False otherwise. |
Source code in src/zenml/execution/pipeline/dynamic/outputs.py
152 153 154 155 156 157 158 | |
BaseStepFuture(invocation_id: str, **kwargs: Any)
Bases: BaseFuture, ABC
Base step future.
Initialize the dynamic step run future.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
invocation_id
|
str
|
The invocation ID of the future. |
required |
**kwargs
|
Any
|
Additional keyword arguments. |
{}
|
Source code in src/zenml/execution/pipeline/dynamic/outputs.py
385 386 387 388 389 390 391 392 393 394 395 396 | |
invocation_id: str
property
The step run invocation ID.
Returns:
| Type | Description |
|---|---|
str
|
The step run invocation ID. |
wait() -> None
abstractmethod
Wait for the future to finish.
Source code in src/zenml/execution/pipeline/dynamic/outputs.py
407 408 409 | |
MapResultsFuture(invocation_id: str)
Bases: BaseFuture
Future that represents the results of a step.map/product(...) call.
Initialize an empty map results future.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
invocation_id
|
str
|
Stable invocation ID for the map expansion. |
required |
Source code in src/zenml/execution/pipeline/dynamic/outputs.py
911 912 913 914 915 916 917 918 | |
futures: List[StepFuture]
property
Get the child step futures for the map.
Returns:
| Type | Description |
|---|---|
List[StepFuture]
|
The child step futures. |
invocation_id: str
property
Stable invocation ID for this map expansion.
Returns:
| Type | Description |
|---|---|
str
|
The invocation ID. |
startup_failed: bool
property
Whether the map startup failed.
Returns:
| Type | Description |
|---|---|
bool
|
Whether the map startup failed. |
startup_succeeded: bool
property
Whether map startup completed successfully with child futures.
Returns:
| Type | Description |
|---|---|
bool
|
Whether the startup completed successfully. |
load(disable_cache: bool = False) -> List[Any]
Load the step run output artifacts.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
disable_cache
|
bool
|
Whether to disable the artifact cache. |
False
|
Returns:
| Type | Description |
|---|---|
List[Any]
|
The step run output artifacts. |
Source code in src/zenml/execution/pipeline/dynamic/outputs.py
1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 | |
result() -> List[StepRunOutputs]
Get the step run outputs this future represents.
Returns:
| Type | Description |
|---|---|
List[StepRunOutputs]
|
The step run outputs. |
Source code in src/zenml/execution/pipeline/dynamic/outputs.py
997 998 999 1000 1001 1002 1003 | |
running() -> bool
Check if the map results future is running.
Returns:
| Type | Description |
|---|---|
bool
|
True if the map results future is running, False otherwise. |
Source code in src/zenml/execution/pipeline/dynamic/outputs.py
980 981 982 983 984 985 986 987 988 989 990 | |
unpack() -> Tuple[List[ArtifactFuture], ...]
Unpack the map results future.
This method can be used to get lists of artifact futures that represent the outputs of all the step runs that are part of this map result.
Example:
from zenml import pipeline, step
@step
def create_int_list() -> list[int]:
return [1, 2]
@step
def do_something(a: int) -> Tuple[int, int]:
return a * 2, a * 3
@pipeline
def map_pipeline():
int_list = create_int_list()
results = do_something.map(a=int_list)
double, triple = results.unpack()
# [future.load() for future in double] will return [2, 4]
# [future.load() for future in triple] will return [3, 6]
Returns:
| Type | Description |
|---|---|
Tuple[List[ArtifactFuture], ...]
|
The unpacked map results. |
Source code in src/zenml/execution/pipeline/dynamic/outputs.py
1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 | |
wait() -> None
Wait for the map results future to complete.
Source code in src/zenml/execution/pipeline/dynamic/outputs.py
992 993 994 995 | |
OutputArtifact
Bases: ArtifactVersionResponse
Dynamic step run output artifact.
chunk(index: int) -> OutputArtifact
Get a chunk of the output artifact.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
index
|
int
|
The index of the chunk. |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the output artifact can not be chunked or the index is out of range. |
Returns:
| Type | Description |
|---|---|
OutputArtifact
|
The artifact chunk. |
Source code in src/zenml/execution/pipeline/dynamic/outputs.py
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 | |
PipelineFuture(invocation_id: str, declared_output_names: Optional[List[str]] = None)
Bases: BaseFuture
Future for a child pipeline run output.
Initialize the future.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
invocation_id
|
str
|
Invocation ID of the child pipeline node. |
required |
declared_output_names
|
Optional[List[str]]
|
Output names declared on the child pipeline entrypoint (from its return-type annotation). Empty if the entrypoint is unannotated; in that case effective names are derived from the actual outputs after execution. |
None
|
Source code in src/zenml/execution/pipeline/dynamic/outputs.py
719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 | |
invocation_id: str
property
Invocation ID of this child pipeline future.
Returns:
| Type | Description |
|---|---|
str
|
The invocation ID. |
artifacts() -> PipelineRunOutputs
Get the child pipeline output artifacts.
Returns:
| Type | Description |
|---|---|
PipelineRunOutputs
|
The child pipeline output artifacts. |
Source code in src/zenml/execution/pipeline/dynamic/outputs.py
804 805 806 807 808 809 810 | |
get_artifact(key: str) -> ArtifactVersionResponse
Get an output artifact by output name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
str
|
The output name. |
required |
Raises:
| Type | Description |
|---|---|
KeyError
|
If no output exists for the key. |
Returns:
| Type | Description |
|---|---|
ArtifactVersionResponse
|
The output artifact. |
Source code in src/zenml/execution/pipeline/dynamic/outputs.py
812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 | |
result() -> PipelineRunOutputs
Get the child pipeline outputs.
Returns:
| Type | Description |
|---|---|
PipelineRunOutputs
|
The child pipeline outputs. |
Source code in src/zenml/execution/pipeline/dynamic/outputs.py
790 791 792 793 794 795 796 797 798 799 800 801 802 | |
running() -> bool
Check if the child pipeline future is running.
Returns:
| Type | Description |
|---|---|
bool
|
True if the future is running, False otherwise. |
Source code in src/zenml/execution/pipeline/dynamic/outputs.py
772 773 774 775 776 777 778 779 780 781 782 783 | |
wait() -> None
Wait for the child pipeline to finish.
Source code in src/zenml/execution/pipeline/dynamic/outputs.py
785 786 787 788 | |
StepFuture(invocation_id: str, output_keys: List[str], execution_future: Optional[StepExecutionFuture] = None)
Bases: BaseStepFuture
Future for a step run output.
Initialize the future.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
invocation_id
|
str
|
The invocation ID of the step run. |
required |
output_keys
|
List[str]
|
The output keys of the step run. |
required |
execution_future
|
Optional[StepExecutionFuture]
|
Optional execution future if the startup has already completed. |
None
|
Source code in src/zenml/execution/pipeline/dynamic/outputs.py
497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 | |
artifacts() -> StepRunOutputs
Get the step run output artifacts.
Returns:
| Type | Description |
|---|---|
StepRunOutputs
|
The step run output artifacts. |
Source code in src/zenml/execution/pipeline/dynamic/outputs.py
558 559 560 561 562 563 564 | |
get_artifact(key: str) -> ArtifactFuture
Get an artifact future by key.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
str
|
The key of the artifact future. |
required |
Raises:
| Type | Description |
|---|---|
KeyError
|
If no artifact for the given name exists. |
Returns:
| Type | Description |
|---|---|
ArtifactFuture
|
The artifact future. |
Source code in src/zenml/execution/pipeline/dynamic/outputs.py
517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 | |
load(disable_cache: bool = False) -> Any
Get the step run output artifact data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
disable_cache
|
bool
|
Whether to disable the artifact cache. |
False
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If the step run output is invalid. |
Returns:
| Type | Description |
|---|---|
Any
|
The step run output artifact data. |
Source code in src/zenml/execution/pipeline/dynamic/outputs.py
579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 | |
result() -> StepRunOutputs
Get the step run outputs this future represents.
Returns:
| Type | Description |
|---|---|
StepRunOutputs
|
The step run outputs. |
Source code in src/zenml/execution/pipeline/dynamic/outputs.py
566 567 568 569 570 571 572 573 574 575 576 577 | |
running() -> bool
Check if the step future is running.
Returns:
| Type | Description |
|---|---|
bool
|
True if the step future is running, False otherwise. |
Source code in src/zenml/execution/pipeline/dynamic/outputs.py
540 541 542 543 544 545 546 547 548 549 550 551 552 | |
wait() -> None
Wait for the step to finish.
Source code in src/zenml/execution/pipeline/dynamic/outputs.py
554 555 556 | |
wrap_step_failure(exception: BaseException, invocation_id: Optional[str] = None) -> StepExecutionException
Wrap a step failure that was not explicitly awaited.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
exception
|
BaseException
|
The original step failure. |
required |
invocation_id
|
Optional[str]
|
The invocation ID of the failed step, if known. |
None
|
Returns:
| Type | Description |
|---|---|
StepExecutionException
|
The exception unchanged if it already is a |
StepExecutionException
|
otherwise a new |
Source code in src/zenml/execution/pipeline/dynamic/outputs.py
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 | |
pipeline_output_utils
Helpers for dynamic pipeline output validation and normalization.
get_pipeline_entrypoint_output_names(pipeline_entrypoint: Callable[..., Any]) -> List[str]
Output names from the entrypoint's return-type annotation.
Returns the Empty if the entrypoint has no annotated returns.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pipeline_entrypoint
|
Callable[..., Any]
|
The dynamic pipeline entrypoint function. |
required |
Returns:
| Type | Description |
|---|---|
List[str]
|
Output names from the entrypoint annotation. |
Source code in src/zenml/execution/pipeline/dynamic/pipeline_output_utils.py
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | |
prepare_pipeline_output_artifacts(value: Any, pipeline_entrypoint: Callable[..., Any]) -> Dict[str, UUID]
Build the output ID payload for a pipeline run status update.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
Any
|
The dynamic pipeline return value. |
required |
pipeline_entrypoint
|
Callable[..., Any]
|
Dynamic pipeline entrypoint for output naming. |
required |
Returns:
| Type | Description |
|---|---|
Dict[str, UUID]
|
Output artifact version IDs keyed by effective output name. |
Source code in src/zenml/execution/pipeline/dynamic/pipeline_output_utils.py
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 | |
resolve_pipeline_output_names(declared_names: List[str], count: int) -> List[str]
Resolve effective output names for persisted dynamic pipeline outputs.
Used by both server-side persistence and client-side PipelineFuture so
that the names always agree. Falls back to SINGLE_RETURN_OUT_NAME for a
single unnamed output and output_0, output_1, ... for unnamed
multi-output pipelines.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
declared_names
|
List[str]
|
Output names declared on the pipeline entrypoint, if any. |
required |
count
|
int
|
Number of output artifacts actually produced. |
required |
Returns:
| Type | Description |
|---|---|
List[str]
|
Output names in deterministic order. |
Source code in src/zenml/execution/pipeline/dynamic/pipeline_output_utils.py
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 | |
validate_pipeline_outputs(value: Any) -> List[ArtifactVersionResponse]
Validate a child pipeline return value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
Any
|
The pipeline return value. |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
If outputs are not valid. |
Returns:
| Type | Description |
|---|---|
List[ArtifactVersionResponse]
|
A list of artifact responses. |
Source code in src/zenml/execution/pipeline/dynamic/pipeline_output_utils.py
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 | |
run_context
Dynamic pipeline run context.
DynamicPipelineRunContext(pipeline: DynamicPipeline, snapshot: PipelineSnapshotResponse, run: PipelineRunResponse, runner: DynamicPipelineRunner)
Bases: BaseContext
Dynamic pipeline run context.
Initialize the dynamic pipeline run context.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pipeline
|
DynamicPipeline
|
The dynamic pipeline that is being executed. |
required |
snapshot
|
PipelineSnapshotResponse
|
The snapshot of the pipeline. |
required |
run
|
PipelineRunResponse
|
The pipeline run. |
required |
runner
|
DynamicPipelineRunner
|
The dynamic pipeline runner. |
required |
Source code in src/zenml/execution/pipeline/dynamic/run_context.py
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | |
pipeline: DynamicPipeline
property
The pipeline that is being executed.
Returns:
| Type | Description |
|---|---|
DynamicPipeline
|
The pipeline that is being executed. |
run: PipelineRunResponse
property
runner: DynamicPipelineRunner
property
The runner executing the pipeline.
Returns:
| Type | Description |
|---|---|
DynamicPipelineRunner
|
The runner executing the pipeline. |
snapshot: PipelineSnapshotResponse
property
The snapshot of the pipeline.
Returns:
| Type | Description |
|---|---|
PipelineSnapshotResponse
|
The snapshot of the pipeline. |
next_wait_condition_name() -> str
Get the next deterministic wait condition name for this run.
Returns:
| Type | Description |
|---|---|
str
|
A deterministic wait condition name. |
Source code in src/zenml/execution/pipeline/dynamic/run_context.py
94 95 96 97 98 99 100 101 102 103 | |
runner
Dynamic pipeline runner.
DynamicPipelineRunner(snapshot: PipelineSnapshotResponse, run: Optional[PipelineRunResponse], orchestrator: Optional[BaseOrchestrator] = None, pause_coordinator: Optional[_PauseCoordinator] = None, parent_runner: Optional[DynamicPipelineRunner] = None)
Dynamic pipeline runner.
Initialize the dynamic pipeline runner.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
snapshot
|
PipelineSnapshotResponse
|
The snapshot of the pipeline. |
required |
run
|
Optional[PipelineRunResponse]
|
The pipeline run. |
required |
orchestrator
|
Optional[BaseOrchestrator]
|
The orchestrator to use. If not provided, the orchestrator will be inferred from the snapshot stack. |
None
|
pause_coordinator
|
Optional[_PauseCoordinator]
|
The pause coordinator for the run tree. The
root runner passes |
None
|
parent_runner
|
Optional[DynamicPipelineRunner]
|
The parent runner, if this is a child pipeline.
Used to cascade |
None
|
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If the snapshot has no associated stack. |
Source code in src/zenml/execution/pipeline/dynamic/runner.py
299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 | |
orchestrator: BaseOrchestrator
property
orchestrator_run_id: str
property
The orchestrator run ID associated with this runner.
Returns:
| Type | Description |
|---|---|
str
|
The orchestrator run ID. |
pipeline: DynamicPipeline
property
The pipeline that the runner is executing.
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If the pipeline can't be loaded. |
Returns:
| Type | Description |
|---|---|
DynamicPipeline
|
The pipeline that the runner is executing. |
run: PipelineRunResponse
property
snapshot: PipelineSnapshotResponse
property
The snapshot executed by this runner.
Returns:
| Type | Description |
|---|---|
PipelineSnapshotResponse
|
The pipeline snapshot. |
allocate_invocation_id(base_name: str, allow_suffix: bool = True) -> str
Allocate a new invocation ID with the given base name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
base_name
|
str
|
Base name for the invocation ID. |
required |
allow_suffix
|
bool
|
Whether to allow suffixing the invocation ID. |
True
|
Returns:
| Type | Description |
|---|---|
str
|
The allocated invocation ID. |
Source code in src/zenml/execution/pipeline/dynamic/runner.py
1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 | |
apply_graph_update(update: GraphUpdate, exception: Optional[BaseException] = None) -> None
Settle the futures of cascaded nodes and propagate readiness changes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
update
|
GraphUpdate
|
The graph update to apply. |
required |
exception
|
Optional[BaseException]
|
The exception that caused the cascade, if any. |
None
|
Source code in src/zenml/execution/pipeline/dynamic/runner.py
1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 | |
has_active_work() -> bool
Whether this runner is currently doing active work.
Returns:
| Type | Description |
|---|---|
bool
|
True if this runner has any active work, False otherwise. |
Source code in src/zenml/execution/pipeline/dynamic/runner.py
1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 | |
launch_step(step: BaseStep, id: Optional[str], args: Tuple[Any, ...], kwargs: Dict[str, Any], after: Union[AnyOutputFuture, Sequence[AnyOutputFuture], None] = None, start_after: Union[AnyOutputFuture, Sequence[AnyOutputFuture], None] = None, group: Optional[GroupInfo] = None, concurrent: bool = False, implicit_upstream_steps: Optional[Set[str]] = None) -> Union[StepRunOutputs, StepFuture]
launch_step(
step: BaseStep,
id: Optional[str],
args: Tuple[Any, ...],
kwargs: Dict[str, Any],
after: Union[
AnyOutputFuture, Sequence[AnyOutputFuture], None
] = None,
start_after: Union[
AnyOutputFuture, Sequence[AnyOutputFuture], None
] = None,
group: Optional[GroupInfo] = None,
concurrent: Literal[False] = False,
implicit_upstream_steps: Optional[Set[str]] = None,
) -> StepRunOutputs
launch_step(
step: BaseStep,
id: Optional[str],
args: Tuple[Any, ...],
kwargs: Dict[str, Any],
after: Union[
AnyOutputFuture, Sequence[AnyOutputFuture], None
] = None,
start_after: Union[
AnyOutputFuture, Sequence[AnyOutputFuture], None
] = None,
group: Optional[GroupInfo] = None,
concurrent: Literal[True] = True,
implicit_upstream_steps: Optional[Set[str]] = None,
) -> StepFuture
Launch a step.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
step
|
BaseStep
|
The step to launch. |
required |
id
|
Optional[str]
|
The invocation ID of the step. |
required |
args
|
Tuple[Any, ...]
|
The arguments for the step function. |
required |
kwargs
|
Dict[str, Any]
|
The keyword arguments for the step function. |
required |
after
|
Union[AnyOutputFuture, Sequence[AnyOutputFuture], None]
|
The step run output futures to wait for. |
None
|
start_after
|
Union[AnyOutputFuture, Sequence[AnyOutputFuture], None]
|
The step run output futures to wait for the start of. |
None
|
group
|
Optional[GroupInfo]
|
The group information for this step. |
None
|
concurrent
|
bool
|
Whether to launch the step concurrently. |
False
|
implicit_upstream_steps
|
Optional[Set[str]]
|
Implicit upstream step invocation IDs. If not given, defaults to the last successful sync step. |
None
|
Raises:
| Type | Description |
|---|---|
BaseException
|
If the step failed. |
Returns:
| Type | Description |
|---|---|
Union[StepRunOutputs, StepFuture]
|
The step run outputs or a future for the step run outputs. |
Source code in src/zenml/execution/pipeline/dynamic/runner.py
1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 | |
map(step: BaseStep, args: Tuple[Any, ...], kwargs: Dict[str, Any], after: Union[AnyOutputFuture, Sequence[AnyOutputFuture], None] = None, start_after: Union[AnyOutputFuture, Sequence[AnyOutputFuture], None] = None, product: bool = False) -> MapResultsFuture
Map over step inputs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
step
|
BaseStep
|
The step to run. |
required |
args
|
Tuple[Any, ...]
|
The arguments for the step function. |
required |
kwargs
|
Dict[str, Any]
|
The keyword arguments for the step function. |
required |
after
|
Union[AnyOutputFuture, Sequence[AnyOutputFuture], None]
|
The step run output futures to wait for before executing the steps. |
None
|
start_after
|
Union[AnyOutputFuture, Sequence[AnyOutputFuture], None]
|
The step run output futures to wait for the start of before executing the steps. |
None
|
product
|
bool
|
Whether to produce a cartesian product of the mapped inputs. |
False
|
Returns:
| Type | Description |
|---|---|
MapResultsFuture
|
A future that represents the map results. |
Source code in src/zenml/execution/pipeline/dynamic/runner.py
1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 | |
mark_node_running(node_id: str) -> None
Mark a graph node as running and propagate readiness changes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
node_id
|
str
|
The node ID. |
required |
Source code in src/zenml/execution/pipeline/dynamic/runner.py
1085 1086 1087 1088 1089 1090 1091 1092 1093 | |
mark_node_starting(node_id: str) -> None
Mark a graph node as starting and propagate readiness changes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
node_id
|
str
|
The node ID. |
required |
Source code in src/zenml/execution/pipeline/dynamic/runner.py
1075 1076 1077 1078 1079 1080 1081 1082 1083 | |
mark_node_succeeded(node_id: str) -> None
Mark a graph node as succeeded and propagate readiness changes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
node_id
|
str
|
The node ID. |
required |
Source code in src/zenml/execution/pipeline/dynamic/runner.py
1095 1096 1097 1098 1099 1100 1101 1102 1103 | |
notify_graph_changed(nodes_ready: bool) -> None
Wake up the startup loop if new nodes became ready.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
nodes_ready
|
bool
|
Whether any new nodes are ready. |
required |
Source code in src/zenml/execution/pipeline/dynamic/runner.py
1050 1051 1052 1053 1054 1055 1056 1057 | |
raise_if_startup_cancelled() -> None
Abort startup work once a failure has been detected.
Raises:
| Type | Description |
|---|---|
StartupCancelled
|
If a failure has been detected. |
Source code in src/zenml/execution/pipeline/dynamic/runner.py
2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 | |
record_failure(exception: BaseException) -> None
Trigger the pipeline-level failure cascade.
Marks the runner as failed (idempotent), cancels in-flight startup work, stops isolated steps in fail-fast mode and forwards shutdown to running child pipelines.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
exception
|
BaseException
|
The failure exception. |
required |
Source code in src/zenml/execution/pipeline/dynamic/runner.py
1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 | |
request_shutdown(reason: BaseException) -> None
Ask the runner to shut down.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
reason
|
BaseException
|
Exception describing why shutdown is being requested. |
required |
Source code in src/zenml/execution/pipeline/dynamic/runner.py
2109 2110 2111 2112 2113 2114 2115 | |
run_pipeline() -> None
Run the pipeline.
Raises:
| Type | Description |
|---|---|
BaseException
|
If the init hook fails. |
Exception
|
If loading the pipeline fails. |
Source code in src/zenml/execution/pipeline/dynamic/runner.py
825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 | |
submit_child_pipeline(pipeline: DynamicPipeline, args: Sequence[Any], kwargs: Dict[str, Any], after: Union[AnyOutputFuture, Sequence[AnyOutputFuture], None] = None, start_after: Union[AnyOutputFuture, Sequence[AnyOutputFuture], None] = None, *, concurrent: bool = False) -> Union[PipelineFuture, PipelineRunOutputs]
submit_child_pipeline(
pipeline: DynamicPipeline,
args: Sequence[Any],
kwargs: Dict[str, Any],
after: Union[
AnyOutputFuture, Sequence[AnyOutputFuture], None
] = None,
start_after: Union[
AnyOutputFuture, Sequence[AnyOutputFuture], None
] = None,
*,
concurrent: Literal[True],
) -> PipelineFuture
submit_child_pipeline(
pipeline: DynamicPipeline,
args: Sequence[Any],
kwargs: Dict[str, Any],
after: Union[
AnyOutputFuture, Sequence[AnyOutputFuture], None
] = None,
start_after: Union[
AnyOutputFuture, Sequence[AnyOutputFuture], None
] = None,
*,
concurrent: Literal[False] = False,
) -> PipelineRunOutputs
Submit a child pipeline.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pipeline
|
DynamicPipeline
|
Child pipeline to execute. |
required |
args
|
Sequence[Any]
|
Positional pipeline arguments. |
required |
kwargs
|
Dict[str, Any]
|
Keyword pipeline arguments. |
required |
after
|
Union[AnyOutputFuture, Sequence[AnyOutputFuture], None]
|
Optional dependency futures. |
None
|
start_after
|
Union[AnyOutputFuture, Sequence[AnyOutputFuture], None]
|
Optional start-ordering futures. |
None
|
concurrent
|
bool
|
Whether to run the child pipeline concurrently. |
False
|
Returns:
| Type | Description |
|---|---|
Union[PipelineFuture, PipelineRunOutputs]
|
A |
Union[PipelineFuture, PipelineRunOutputs]
|
|
Source code in src/zenml/execution/pipeline/dynamic/runner.py
2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 | |
wait(schema: Optional[Any] = None, type: RunWaitConditionType = RunWaitConditionType.EXTERNAL_INPUT, timeout: int = 600, poll_interval: int = 5, question: Optional[str] = None, metadata: Optional[Dict[str, Any]] = None, name: Optional[str] = None, after: Union[AnyOutputFuture, Sequence[AnyOutputFuture], None] = None) -> Any
wait(
schema: Type[T],
type: RunWaitConditionType = RunWaitConditionType.EXTERNAL_INPUT,
timeout: int = 600,
poll_interval: int = 5,
question: Optional[str] = None,
metadata: Optional[Dict[str, Any]] = None,
name: Optional[str] = None,
after: Union[
AnyOutputFuture, Sequence[AnyOutputFuture], None
] = None,
) -> T
wait(
schema: object = None,
type: RunWaitConditionType = RunWaitConditionType.EXTERNAL_INPUT,
timeout: int = 600,
poll_interval: int = 5,
question: Optional[str] = None,
metadata: Optional[Dict[str, Any]] = None,
name: Optional[str] = None,
after: Union[
AnyOutputFuture, Sequence[AnyOutputFuture], None
] = None,
) -> Any
Create and poll a run wait condition.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
schema
|
Optional[Any]
|
Optional expected output type for the resolved result. |
None
|
type
|
RunWaitConditionType
|
Wait condition type. |
EXTERNAL_INPUT
|
timeout
|
int
|
Earliest time in seconds at which polling may give up and pause the run. The actual pause is deferred until all active work in this pipeline (or any parent/child pipelines) has finished. |
600
|
poll_interval
|
int
|
Poll interval in seconds. |
5
|
question
|
Optional[str]
|
Optional question shown to external actors. |
None
|
metadata
|
Optional[Dict[str, Any]]
|
Optional metadata attached to the condition. |
None
|
name
|
Optional[str]
|
Optional deterministic wait condition name. |
None
|
after
|
Union[AnyOutputFuture, Sequence[AnyOutputFuture], None]
|
Optional upstream futures that must finish before waiting. |
None
|
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If called outside the dynamic pipeline function. |
_WaitConditionAborted
|
If the wait condition was aborted. |
RunPaused
|
If the wait condition polling timed out and the run was transitioned to PAUSED. |
KeyboardInterrupt
|
If interrupted while waiting. |
BaseException
|
If polling fails after the lease is abandoned. |
Returns:
| Type | Description |
|---|---|
Any
|
The resolved wait condition value. |
Source code in src/zenml/execution/pipeline/dynamic/runner.py
1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 | |
RunPaused
Bases: Exception
Raised when a run (or one of its descendants) entered a paused state.
utils
Dynamic pipeline execution utilities.
collect_futures(inputs: Optional[Dict[str, Any]] = None, after: Union[AnyOutputFuture, Sequence[AnyOutputFuture], None] = None, expand_map_results: bool = False) -> List[AnyOutputFuture]
collect_futures(
inputs: Optional[Dict[str, Any]] = ...,
after: Union[
AnyOutputFuture, Sequence[AnyOutputFuture], None
] = ...,
expand_map_results: Literal[True] = ...,
) -> List[AnyOutputFuture]
collect_futures(
inputs: Optional[Dict[str, Any]] = ...,
after: Union[
AnyOutputFuture, Sequence[AnyOutputFuture], None
] = ...,
expand_map_results: Literal[False] = ...,
) -> List[AnyOutputFuture]
Collect futures referenced in step inputs and after.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
inputs
|
Optional[Dict[str, Any]]
|
Optional step inputs to inspect for futures. |
None
|
after
|
Union[AnyOutputFuture, Sequence[AnyOutputFuture], None]
|
Optional explicit upstream dependencies. Must be a future or a sequence containing only futures. |
None
|
expand_map_results
|
bool
|
Whether map futures should be expanded into their child step futures. |
False
|
Raises:
| Type | Description |
|---|---|
TypeError
|
If |
Returns:
| Type | Description |
|---|---|
List[AnyOutputFuture]
|
The collected futures. |
Source code in src/zenml/execution/pipeline/dynamic/utils.py
307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 | |
expand_mapped_inputs(inputs: Dict[str, Any], product: bool = False) -> List[Dict[str, Any]]
Find the mapped and unmapped inputs of a step.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
inputs
|
Dict[str, Any]
|
The step function inputs. |
required |
product
|
bool
|
Whether to produce a cartesian product of the mapped inputs. |
False
|
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If no mapped inputs are found or the input combinations are not valid. |
Returns:
| Type | Description |
|---|---|
List[Dict[str, Any]]
|
The step inputs. |
Source code in src/zenml/execution/pipeline/dynamic/utils.py
382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 | |
get_latest_step_run(pipeline_run_id: UUID, invocation_id: str, hydrate: bool = False) -> StepRunResponse
Get the latest step run for a step.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pipeline_run_id
|
UUID
|
The ID of the pipeline run. |
required |
invocation_id
|
str
|
The invocation ID of the step. |
required |
hydrate
|
bool
|
Whether to hydrate the step run. |
False
|
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If no step run exists for the given invocation ID. |
Returns:
| Type | Description |
|---|---|
StepRunResponse
|
The latest step run. |
Source code in src/zenml/execution/pipeline/dynamic/utils.py
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 | |
get_remaining_retries(step_run: StepRunResponse) -> int
Get the remaining retries for a step run.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
step_run
|
StepRunResponse
|
The step run to get the remaining retries for. |
required |
Returns:
| Type | Description |
|---|---|
int
|
The remaining retries for the step run. |
Source code in src/zenml/execution/pipeline/dynamic/utils.py
497 498 499 500 501 502 503 504 505 506 507 508 509 | |
load_pipeline_run_outputs(run: PipelineRunResponse) -> PipelineRunOutputs
Load output artifacts from a finished pipeline run.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
run
|
PipelineRunResponse
|
The finished pipeline run. |
required |
Returns:
| Type | Description |
|---|---|
PipelineRunOutputs
|
The pipeline outputs. |
Source code in src/zenml/execution/pipeline/dynamic/utils.py
272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 | |
load_step_run_outputs(step_run: StepRunResponse) -> StepRunOutputs
Load the outputs of a step run.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
step_run
|
StepRunResponse
|
The step run. |
required |
Returns:
| Type | Description |
|---|---|
StepRunOutputs
|
The outputs of the step run. |
Source code in src/zenml/execution/pipeline/dynamic/utils.py
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 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 | |
unmapped(value: T) -> _Unmapped[T]
Helper function to pass an input without mapping over it.
Wrap any step input with this function and then pass it to step.map(...)
to pass the full value to all steps.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
T
|
The value to wrap. |
required |
Returns:
| Type | Description |
|---|---|
_Unmapped[T]
|
The wrapped value. |
Source code in src/zenml/execution/pipeline/dynamic/utils.py
72 73 74 75 76 77 78 79 80 81 82 83 84 | |
wait(schema: Optional[Any] = None, type: RunWaitConditionType = RunWaitConditionType.EXTERNAL_INPUT, timeout: int = 600, poll_interval: int = 5, question: Optional[str] = None, metadata: Optional[Dict[str, Any]] = None, after: Optional[Sequence[AnyOutputFuture]] = None, name: Optional[str] = None) -> Any
wait(
schema: Type[T],
type: RunWaitConditionType = RunWaitConditionType.EXTERNAL_INPUT,
timeout: int = 600,
poll_interval: int = 5,
question: Optional[str] = None,
metadata: Optional[Dict[str, Any]] = None,
after: Optional[Sequence[AnyOutputFuture]] = None,
name: Optional[str] = None,
) -> T
wait(
schema: object = None,
type: RunWaitConditionType = RunWaitConditionType.EXTERNAL_INPUT,
timeout: int = 600,
poll_interval: int = 5,
question: Optional[str] = None,
metadata: Optional[Dict[str, Any]] = None,
after: Optional[Sequence[AnyOutputFuture]] = None,
name: Optional[str] = None,
) -> Any
Pause dynamic execution on an external wait condition.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
schema
|
Optional[Any]
|
Optional expected output type for the resolved result. |
None
|
type
|
RunWaitConditionType
|
Wait condition type. |
EXTERNAL_INPUT
|
timeout
|
int
|
Maximum time in seconds to poll before pausing. |
600
|
poll_interval
|
int
|
Poll interval in seconds. |
5
|
question
|
Optional[str]
|
Optional question shown to external actors. |
None
|
metadata
|
Optional[Dict[str, Any]]
|
Optional metadata attached to the condition. |
None
|
after
|
Optional[Sequence[AnyOutputFuture]]
|
Optional upstream futures that must finish before waiting. |
None
|
name
|
Optional[str]
|
Optional deterministic wait condition name. |
None
|
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If called outside of dynamic pipeline execution. |
Returns:
| Type | Description |
|---|---|
Any
|
The resolved wait condition value. |
Source code in src/zenml/execution/pipeline/dynamic/utils.py
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 | |
wait_for_step_run_to_finish(step_run_id: UUID) -> StepRunResponse
Wait until a step run is finished.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
step_run_id
|
UUID
|
The ID of the step run. |
required |
Returns:
| Type | Description |
|---|---|
StepRunResponse
|
The finished step run. |
Source code in src/zenml/execution/pipeline/dynamic/utils.py
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 | |
utils
Pipeline execution utilities.
compute_invocation_id(existing_invocations: Set[str], base_name: str, allow_suffix: bool = True) -> str
Compute the invocation ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
existing_invocations
|
Set[str]
|
The existing invocation IDs. |
required |
base_name
|
str
|
Base name for the invocation. Used as the ID directly when
unique, otherwise suffixed with |
required |
allow_suffix
|
bool
|
Whether a suffix can be appended to the invocation ID. |
True
|
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If no ID suffix is allowed and an invocation for the same ID already exists, or if no unique invocation ID can be found. |
Returns:
| Type | Description |
|---|---|
str
|
The invocation ID. |
Source code in src/zenml/execution/pipeline/utils.py
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 | |
prevent_pipeline_execution() -> Generator[None, None, None]
Context manager to prevent pipeline execution.
Yields:
| Type | Description |
|---|---|
None
|
None. |
Source code in src/zenml/execution/pipeline/utils.py
54 55 56 57 58 59 60 61 62 63 64 65 | |
should_prevent_pipeline_execution() -> bool
Whether to prevent pipeline execution.
Returns:
| Type | Description |
|---|---|
bool
|
Whether to prevent pipeline execution. |
Source code in src/zenml/execution/pipeline/utils.py
45 46 47 48 49 50 51 | |
skip_steps_and_prune_snapshot(snapshot: PipelineSnapshotResponse, pipeline_run: PipelineRunResponse) -> bool
Skip steps and prune the snapshot.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
snapshot
|
PipelineSnapshotResponse
|
The snapshot to prune. |
required |
pipeline_run
|
PipelineRunResponse
|
The pipeline run to skip steps for. |
required |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If the pipeline run is not a replayed run, if a step has an upstream step that is not skipped, or if a step run request cannot be populated. |
Returns:
| Type | Description |
|---|---|
bool
|
Whether a pipeline run is still required. |
Source code in src/zenml/execution/pipeline/utils.py
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 252 253 254 255 256 257 258 259 260 | |
submit_pipeline(snapshot: PipelineSnapshotResponse, stack: Stack, placeholder_run: Optional[PipelineRunResponse] = None) -> None
Submit a snapshot for execution.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
snapshot
|
PipelineSnapshotResponse
|
The snapshot to submit. |
required |
stack
|
Stack
|
The stack on which to submit the snapshot. |
required |
placeholder_run
|
Optional[PipelineRunResponse]
|
An optional placeholder run for the snapshot. |
None
|
Raises:
| Type | Description |
|---|---|
BaseException
|
Any exception that happened while submitting or running (in case it happens synchronously) the pipeline. |
Source code in src/zenml/execution/pipeline/utils.py
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 | |
step
Step execution.
Modules
utils
Step execution utilities.
launch_step(snapshot: PipelineSnapshotResponse, step: Step, orchestrator_run_id: str, retry: bool = False, remaining_retries: Optional[int] = None, wait: bool = True) -> StepRunResponse
Launch a step.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
snapshot
|
PipelineSnapshotResponse
|
The snapshot. |
required |
step
|
Step
|
The step to run. |
required |
orchestrator_run_id
|
str
|
The orchestrator run ID. |
required |
retry
|
bool
|
Whether to retry the step if it fails. |
False
|
remaining_retries
|
Optional[int]
|
The number of remaining retries. If not passed, this will be read from the step configuration. |
None
|
wait
|
bool
|
Whether to wait for the step to complete. |
True
|
Raises:
| Type | Description |
|---|---|
RunStoppedException
|
If the run was stopped. |
BaseException
|
If the step failed all retries. |
Returns:
| Type | Description |
|---|---|
StepRunResponse
|
The step run response. |
Source code in src/zenml/execution/step/utils.py
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 | |
utils
Execution utilities.
Classes
DebugModeContext()
Bases: BaseContext
Context manager for enabling debug mode.
When debug mode is enabled, a local orchestrator is used instead of the actual orchestrator.
Source code in src/zenml/utils/context_utils.py
42 43 44 | |