Execution
zenml.execution
Step and pipeline execution.
Modules
pipeline
Pipeline execution.
Modules
dynamic
Dynamic pipeline execution.
outputs
Dynamic pipeline execution outputs.
ArtifactFuture(wrapped: Union[_InlineStepFuture, _IsolatedStepFuture], index: int)
Bases: BaseStepFuture
Future for a step run output artifact.
Initialize the future.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
wrapped
|
Union[_InlineStepFuture, _IsolatedStepFuture]
|
The wrapped future object. |
required |
index
|
int
|
The index of the output artifact. |
required |
Source code in src/zenml/execution/pipeline/dynamic/outputs.py
227 228 229 230 231 232 233 234 235 236 237 238 239 | |
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
278 279 280 281 282 283 284 285 286 287 288 289 290 | |
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
267 268 269 270 271 272 273 274 275 276 | |
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
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 | |
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
84 85 86 87 88 89 90 | |
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
76 77 78 79 80 81 82 | |
BaseStepFuture(wrapped: Union[_InlineStepFuture, _IsolatedStepFuture], **kwargs: Any)
Bases: BaseFuture
Base step future.
Initialize the dynamic step run future.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
wrapped
|
Union[_InlineStepFuture, _IsolatedStepFuture]
|
The wrapped future object. |
required |
**kwargs
|
Any
|
Additional keyword arguments. |
{}
|
Source code in src/zenml/execution/pipeline/dynamic/outputs.py
193 194 195 196 197 198 199 200 201 202 203 204 | |
invocation_id: str
property
The step run invocation ID.
Returns:
| Type | Description |
|---|---|
str
|
The step run invocation ID. |
running() -> bool
Check if the step run future is running.
Returns:
| Type | Description |
|---|---|
bool
|
True if the step run future is running, False otherwise. |
Source code in src/zenml/execution/pipeline/dynamic/outputs.py
215 216 217 218 219 220 221 | |
MapResultsFuture(futures: List[StepFuture])
Bases: BaseFuture
Future that represents the results of a step.map/product(...) call.
Initialize the map results future.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
futures
|
List[StepFuture]
|
The step run futures. |
required |
Source code in src/zenml/execution/pipeline/dynamic/outputs.py
454 455 456 457 458 459 460 | |
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
478 479 480 481 482 483 484 485 486 487 488 489 | |
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
470 471 472 473 474 475 476 | |
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
462 463 464 465 466 467 468 | |
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
491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 | |
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
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 | |
StepFuture(wrapped: Union[_InlineStepFuture, _IsolatedStepFuture], output_keys: List[str])
Bases: BaseStepFuture
Future for a step run output.
Initialize the future.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
wrapped
|
Union[_InlineStepFuture, _IsolatedStepFuture]
|
The wrapped future object. |
required |
output_keys
|
List[str]
|
The output keys of the step run. |
required |
Source code in src/zenml/execution/pipeline/dynamic/outputs.py
296 297 298 299 300 301 302 303 304 305 306 307 308 | |
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
337 338 339 340 341 342 343 | |
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
310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 | |
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
358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 | |
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
345 346 347 348 349 350 351 352 353 354 355 356 | |
wait() -> None
Wait for the step to finish.
Source code in src/zenml/execution/pipeline/dynamic/outputs.py
333 334 335 | |
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
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | |
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. |
runner
Dynamic pipeline runner.
DynamicPipelineRunner(snapshot: PipelineSnapshotResponse, run: Optional[PipelineRunResponse], orchestrator: Optional[BaseOrchestrator] = 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
|
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If the snapshot has no associated stack. |
Source code in src/zenml/execution/pipeline/dynamic/runner.py
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 | |
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. |
await_all_step_futures() -> None
Await all step futures.
Source code in src/zenml/execution/pipeline/dynamic/runner.py
872 873 874 875 876 | |
launch_step(step: BaseStep, id: Optional[str], args: Tuple[Any, ...], kwargs: Dict[str, Any], after: Union[AnyStepFuture, Sequence[AnyStepFuture], None] = None, group: Optional[GroupInfo] = None, concurrent: bool = False) -> Union[StepRunOutputs, StepFuture]
launch_step(
step: BaseStep,
id: Optional[str],
args: Tuple[Any, ...],
kwargs: Dict[str, Any],
after: Union[
AnyStepFuture, Sequence[AnyStepFuture], None
] = None,
group: Optional[GroupInfo] = None,
concurrent: Literal[False] = False,
) -> StepRunOutputs
launch_step(
step: BaseStep,
id: Optional[str],
args: Tuple[Any, ...],
kwargs: Dict[str, Any],
after: Union[
AnyStepFuture, Sequence[AnyStepFuture], None
] = None,
group: Optional[GroupInfo] = None,
concurrent: Literal[True] = True,
) -> 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[AnyStepFuture, Sequence[AnyStepFuture], None]
|
The step run output futures to wait for. |
None
|
group
|
Optional[GroupInfo]
|
The group information for this step. |
None
|
concurrent
|
bool
|
Whether to launch the step concurrently. |
False
|
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
564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 | |
map(step: BaseStep, args: Tuple[Any, ...], kwargs: Dict[str, Any], after: Union[AnyStepFuture, Sequence[AnyStepFuture], 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[AnyStepFuture, Sequence[AnyStepFuture], None]
|
The step run output futures to wait for 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
822 823 824 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 | |
run_pipeline() -> None
Run the pipeline.
Raises:
| Type | Description |
|---|---|
Exception
|
If the pipeline run failed. |
Source code in src/zenml/execution/pipeline/dynamic/runner.py
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 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 | |
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 with 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/runner.py
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 | |
compile_dynamic_step_invocation(snapshot: PipelineSnapshotResponse, pipeline: DynamicPipeline, step: BaseStep, invocation_id: str, inputs: Dict[str, Any], pipeline_docker_settings: DockerSettings, after: Union[AnyStepFuture, Sequence[AnyStepFuture], None] = None, 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 inputs for the step function. |
required |
pipeline_docker_settings
|
DockerSettings
|
The Docker settings of the parent pipeline. |
required |
after
|
Union[AnyStepFuture, Sequence[AnyStepFuture], None]
|
The step run output futures to wait for. |
None
|
config
|
Optional[StepConfigurationUpdate]
|
The configuration for the step. |
None
|
Returns:
| Type | Description |
|---|---|
Step
|
The compiled step. |
Source code in src/zenml/execution/pipeline/dynamic/runner.py
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 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 | |
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/runner.py
1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 | |
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/runner.py
1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 | |
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/runner.py
1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 | |
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/runner.py
1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 | |
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/runner.py
1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 | |
utils
Dynamic pipeline execution utilities.
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
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 | |
load_step_run_outputs(step_run_id: UUID) -> StepRunOutputs
Load the outputs of a step run.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
step_run_id
|
UUID
|
The ID of the step run. |
required |
Returns:
| Type | Description |
|---|---|
StepRunOutputs
|
The outputs of the 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 189 190 191 192 193 194 195 196 197 198 199 | |
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
49 50 51 52 53 54 55 56 57 58 59 60 61 | |
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
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 | |
wait_for_step_to_finish(pipeline_run_id: UUID, step_name: str) -> StepRunResponse
Wait until a step is finished.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pipeline_run_id
|
UUID
|
The ID of the pipeline run. |
required |
step_name
|
str
|
The name of the step. |
required |
Returns:
| Type | Description |
|---|---|
StepRunResponse
|
The finished step run. |
Source code in src/zenml/execution/pipeline/dynamic/utils.py
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 | |
utils
Pipeline execution utilities.
compute_invocation_id(existing_invocations: Set[str], step: BaseStep, custom_id: Optional[str] = None, allow_suffix: bool = True) -> str
Compute the invocation ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
existing_invocations
|
Set[str]
|
The existing invocation IDs. |
required |
step
|
BaseStep
|
The step for which to compute the ID. |
required |
custom_id
|
Optional[str]
|
Custom ID to use for the invocation. |
None
|
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. |
RuntimeError
|
If no unique invocation ID can be found. |
Returns:
| Type | Description |
|---|---|
str
|
The invocation ID. |
Source code in src/zenml/execution/pipeline/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 | |
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
55 56 57 58 59 60 61 62 63 64 65 66 | |
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
46 47 48 49 50 51 52 | |
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. |
RuntimeError
|
If a step has an upstream step that is not skipped. |
RuntimeError
|
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
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
|
noqa: DAR401
Raises: 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
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 | |
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 | |