metaflow-stubs 2.18.1__py2.py3-none-any.whl → 2.18.2__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of metaflow-stubs might be problematic. Click here for more details.

Files changed (166) hide show
  1. metaflow-stubs/__init__.pyi +489 -489
  2. metaflow-stubs/cards.pyi +2 -2
  3. metaflow-stubs/cli.pyi +2 -2
  4. metaflow-stubs/cli_components/__init__.pyi +2 -2
  5. metaflow-stubs/cli_components/utils.pyi +2 -2
  6. metaflow-stubs/client/__init__.pyi +2 -2
  7. metaflow-stubs/client/core.pyi +4 -4
  8. metaflow-stubs/client/filecache.pyi +3 -3
  9. metaflow-stubs/events.pyi +2 -2
  10. metaflow-stubs/exception.pyi +2 -2
  11. metaflow-stubs/flowspec.pyi +4 -4
  12. metaflow-stubs/generated_for.txt +1 -1
  13. metaflow-stubs/includefile.pyi +3 -3
  14. metaflow-stubs/meta_files.pyi +2 -2
  15. metaflow-stubs/metadata_provider/__init__.pyi +2 -2
  16. metaflow-stubs/metadata_provider/heartbeat.pyi +2 -2
  17. metaflow-stubs/metadata_provider/metadata.pyi +2 -2
  18. metaflow-stubs/metadata_provider/util.pyi +2 -2
  19. metaflow-stubs/metaflow_config.pyi +2 -2
  20. metaflow-stubs/metaflow_current.pyi +23 -23
  21. metaflow-stubs/metaflow_git.pyi +2 -2
  22. metaflow-stubs/multicore_utils.pyi +2 -2
  23. metaflow-stubs/packaging_sys/__init__.pyi +6 -6
  24. metaflow-stubs/packaging_sys/backend.pyi +4 -4
  25. metaflow-stubs/packaging_sys/distribution_support.pyi +4 -4
  26. metaflow-stubs/packaging_sys/tar_backend.pyi +6 -6
  27. metaflow-stubs/packaging_sys/utils.pyi +2 -2
  28. metaflow-stubs/packaging_sys/v1.pyi +2 -2
  29. metaflow-stubs/parameters.pyi +3 -3
  30. metaflow-stubs/plugins/__init__.pyi +13 -13
  31. metaflow-stubs/plugins/airflow/__init__.pyi +2 -2
  32. metaflow-stubs/plugins/airflow/airflow_decorator.pyi +2 -2
  33. metaflow-stubs/plugins/airflow/airflow_utils.pyi +2 -2
  34. metaflow-stubs/plugins/airflow/exception.pyi +2 -2
  35. metaflow-stubs/plugins/airflow/sensors/__init__.pyi +2 -2
  36. metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +2 -2
  37. metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +2 -2
  38. metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +2 -2
  39. metaflow-stubs/plugins/argo/__init__.pyi +2 -2
  40. metaflow-stubs/plugins/argo/argo_client.pyi +2 -2
  41. metaflow-stubs/plugins/argo/argo_events.pyi +2 -2
  42. metaflow-stubs/plugins/argo/argo_workflows.pyi +2 -2
  43. metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +3 -3
  44. metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +3 -3
  45. metaflow-stubs/plugins/argo/argo_workflows_deployer_objects.pyi +2 -2
  46. metaflow-stubs/plugins/argo/exit_hooks.pyi +2 -2
  47. metaflow-stubs/plugins/aws/__init__.pyi +2 -2
  48. metaflow-stubs/plugins/aws/aws_client.pyi +2 -2
  49. metaflow-stubs/plugins/aws/aws_utils.pyi +2 -2
  50. metaflow-stubs/plugins/aws/batch/__init__.pyi +2 -2
  51. metaflow-stubs/plugins/aws/batch/batch.pyi +2 -2
  52. metaflow-stubs/plugins/aws/batch/batch_client.pyi +2 -2
  53. metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +2 -2
  54. metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +2 -2
  55. metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +3 -3
  56. metaflow-stubs/plugins/aws/step_functions/__init__.pyi +2 -2
  57. metaflow-stubs/plugins/aws/step_functions/dynamo_db_client.pyi +2 -2
  58. metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +2 -2
  59. metaflow-stubs/plugins/aws/step_functions/schedule_decorator.pyi +2 -2
  60. metaflow-stubs/plugins/aws/step_functions/step_functions.pyi +2 -2
  61. metaflow-stubs/plugins/aws/step_functions/step_functions_client.pyi +2 -2
  62. metaflow-stubs/plugins/aws/step_functions/step_functions_decorator.pyi +2 -2
  63. metaflow-stubs/plugins/aws/step_functions/step_functions_deployer.pyi +3 -3
  64. metaflow-stubs/plugins/aws/step_functions/step_functions_deployer_objects.pyi +3 -3
  65. metaflow-stubs/plugins/azure/__init__.pyi +2 -2
  66. metaflow-stubs/plugins/azure/azure_credential.pyi +2 -2
  67. metaflow-stubs/plugins/azure/azure_exceptions.pyi +2 -2
  68. metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +3 -3
  69. metaflow-stubs/plugins/azure/azure_utils.pyi +2 -2
  70. metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +2 -2
  71. metaflow-stubs/plugins/azure/includefile_support.pyi +2 -2
  72. metaflow-stubs/plugins/cards/__init__.pyi +2 -2
  73. metaflow-stubs/plugins/cards/card_client.pyi +3 -3
  74. metaflow-stubs/plugins/cards/card_creator.pyi +2 -2
  75. metaflow-stubs/plugins/cards/card_datastore.pyi +2 -2
  76. metaflow-stubs/plugins/cards/card_decorator.pyi +2 -2
  77. metaflow-stubs/plugins/cards/card_modules/__init__.pyi +2 -2
  78. metaflow-stubs/plugins/cards/card_modules/basic.pyi +2 -2
  79. metaflow-stubs/plugins/cards/card_modules/card.pyi +2 -2
  80. metaflow-stubs/plugins/cards/card_modules/components.pyi +3 -3
  81. metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +2 -2
  82. metaflow-stubs/plugins/cards/card_modules/renderer_tools.pyi +2 -2
  83. metaflow-stubs/plugins/cards/card_modules/test_cards.pyi +2 -2
  84. metaflow-stubs/plugins/cards/card_resolver.pyi +2 -2
  85. metaflow-stubs/plugins/cards/component_serializer.pyi +2 -2
  86. metaflow-stubs/plugins/cards/exception.pyi +2 -2
  87. metaflow-stubs/plugins/catch_decorator.pyi +3 -3
  88. metaflow-stubs/plugins/datatools/__init__.pyi +2 -2
  89. metaflow-stubs/plugins/datatools/local.pyi +2 -2
  90. metaflow-stubs/plugins/datatools/s3/__init__.pyi +2 -2
  91. metaflow-stubs/plugins/datatools/s3/s3.pyi +3 -3
  92. metaflow-stubs/plugins/datatools/s3/s3tail.pyi +2 -2
  93. metaflow-stubs/plugins/datatools/s3/s3util.pyi +2 -2
  94. metaflow-stubs/plugins/debug_logger.pyi +2 -2
  95. metaflow-stubs/plugins/debug_monitor.pyi +2 -2
  96. metaflow-stubs/plugins/environment_decorator.pyi +2 -2
  97. metaflow-stubs/plugins/events_decorator.pyi +2 -2
  98. metaflow-stubs/plugins/exit_hook/__init__.pyi +2 -2
  99. metaflow-stubs/plugins/exit_hook/exit_hook_decorator.pyi +2 -2
  100. metaflow-stubs/plugins/frameworks/__init__.pyi +2 -2
  101. metaflow-stubs/plugins/frameworks/pytorch.pyi +2 -2
  102. metaflow-stubs/plugins/gcp/__init__.pyi +2 -2
  103. metaflow-stubs/plugins/gcp/gcp_secret_manager_secrets_provider.pyi +3 -3
  104. metaflow-stubs/plugins/gcp/gs_exceptions.pyi +2 -2
  105. metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +2 -2
  106. metaflow-stubs/plugins/gcp/gs_utils.pyi +2 -2
  107. metaflow-stubs/plugins/gcp/includefile_support.pyi +2 -2
  108. metaflow-stubs/plugins/kubernetes/__init__.pyi +2 -2
  109. metaflow-stubs/plugins/kubernetes/kube_utils.pyi +2 -2
  110. metaflow-stubs/plugins/kubernetes/kubernetes.pyi +2 -2
  111. metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +2 -2
  112. metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +2 -2
  113. metaflow-stubs/plugins/kubernetes/kubernetes_job.pyi +2 -2
  114. metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +2 -2
  115. metaflow-stubs/plugins/kubernetes/spot_monitor_sidecar.pyi +2 -2
  116. metaflow-stubs/plugins/parallel_decorator.pyi +2 -2
  117. metaflow-stubs/plugins/project_decorator.pyi +2 -2
  118. metaflow-stubs/plugins/pypi/__init__.pyi +2 -2
  119. metaflow-stubs/plugins/pypi/conda_decorator.pyi +2 -2
  120. metaflow-stubs/plugins/pypi/conda_environment.pyi +5 -5
  121. metaflow-stubs/plugins/pypi/parsers.pyi +2 -2
  122. metaflow-stubs/plugins/pypi/pypi_decorator.pyi +2 -2
  123. metaflow-stubs/plugins/pypi/pypi_environment.pyi +2 -2
  124. metaflow-stubs/plugins/pypi/utils.pyi +2 -2
  125. metaflow-stubs/plugins/resources_decorator.pyi +2 -2
  126. metaflow-stubs/plugins/retry_decorator.pyi +2 -2
  127. metaflow-stubs/plugins/secrets/__init__.pyi +3 -3
  128. metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +2 -2
  129. metaflow-stubs/plugins/secrets/secrets_decorator.pyi +2 -2
  130. metaflow-stubs/plugins/secrets/secrets_func.pyi +2 -2
  131. metaflow-stubs/plugins/secrets/secrets_spec.pyi +2 -2
  132. metaflow-stubs/plugins/secrets/utils.pyi +2 -2
  133. metaflow-stubs/plugins/storage_executor.pyi +2 -2
  134. metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +3 -3
  135. metaflow-stubs/plugins/timeout_decorator.pyi +3 -3
  136. metaflow-stubs/plugins/uv/__init__.pyi +2 -2
  137. metaflow-stubs/plugins/uv/uv_environment.pyi +3 -3
  138. metaflow-stubs/pylint_wrapper.pyi +2 -2
  139. metaflow-stubs/runner/__init__.pyi +2 -2
  140. metaflow-stubs/runner/deployer.pyi +32 -32
  141. metaflow-stubs/runner/deployer_impl.pyi +2 -2
  142. metaflow-stubs/runner/metaflow_runner.pyi +4 -4
  143. metaflow-stubs/runner/nbdeploy.pyi +2 -2
  144. metaflow-stubs/runner/nbrun.pyi +2 -2
  145. metaflow-stubs/runner/subprocess_manager.pyi +2 -2
  146. metaflow-stubs/runner/utils.pyi +4 -4
  147. metaflow-stubs/system/__init__.pyi +2 -2
  148. metaflow-stubs/system/system_logger.pyi +2 -2
  149. metaflow-stubs/system/system_monitor.pyi +2 -2
  150. metaflow-stubs/tagging_util.pyi +2 -2
  151. metaflow-stubs/tuple_util.pyi +2 -2
  152. metaflow-stubs/user_configs/__init__.pyi +2 -2
  153. metaflow-stubs/user_configs/config_options.pyi +2 -2
  154. metaflow-stubs/user_configs/config_parameters.pyi +6 -6
  155. metaflow-stubs/user_decorators/__init__.pyi +2 -2
  156. metaflow-stubs/user_decorators/common.pyi +2 -2
  157. metaflow-stubs/user_decorators/mutable_flow.pyi +5 -5
  158. metaflow-stubs/user_decorators/mutable_step.pyi +5 -5
  159. metaflow-stubs/user_decorators/user_flow_decorator.pyi +4 -4
  160. metaflow-stubs/user_decorators/user_step_decorator.pyi +4 -4
  161. metaflow-stubs/version.pyi +2 -2
  162. {metaflow_stubs-2.18.1.dist-info → metaflow_stubs-2.18.2.dist-info}/METADATA +2 -2
  163. metaflow_stubs-2.18.2.dist-info/RECORD +166 -0
  164. metaflow_stubs-2.18.1.dist-info/RECORD +0 -166
  165. {metaflow_stubs-2.18.1.dist-info → metaflow_stubs-2.18.2.dist-info}/WHEEL +0 -0
  166. {metaflow_stubs-2.18.1.dist-info → metaflow_stubs-2.18.2.dist-info}/top_level.txt +0 -0
@@ -1,7 +1,7 @@
1
1
  ######################################################################################################
2
2
  # Auto-generated Metaflow stub file #
3
- # MF version: 2.18.1 #
4
- # Generated on 2025-08-29T13:35:56.240161 #
3
+ # MF version: 2.18.2 #
4
+ # Generated on 2025-09-03T10:37:45.851135 #
5
5
  ######################################################################################################
6
6
 
7
7
  from __future__ import annotations
@@ -47,8 +47,8 @@ from . import plugins as plugins
47
47
  from .plugins.datatools.s3.s3 import S3 as S3
48
48
  from . import includefile as includefile
49
49
  from .includefile import IncludeFile as IncludeFile
50
- from .plugins.pypi.parsers import conda_environment_yml_parser as conda_environment_yml_parser
51
50
  from .plugins.pypi.parsers import pyproject_toml_parser as pyproject_toml_parser
51
+ from .plugins.pypi.parsers import conda_environment_yml_parser as conda_environment_yml_parser
52
52
  from .plugins.pypi.parsers import requirements_txt_parser as requirements_txt_parser
53
53
  from . import cards as cards
54
54
  from . import client as client
@@ -152,6 +152,140 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
152
152
  """
153
153
  ...
154
154
 
155
+ @typing.overload
156
+ def resources(*, cpu: int = 1, gpu: typing.Optional[int] = None, disk: typing.Optional[int] = None, memory: int = 4096, shared_memory: typing.Optional[int] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
157
+ """
158
+ Specifies the resources needed when executing this step.
159
+
160
+ Use `@resources` to specify the resource requirements
161
+ independently of the specific compute layer (`@batch`, `@kubernetes`).
162
+
163
+ You can choose the compute layer on the command line by executing e.g.
164
+ ```
165
+ python myflow.py run --with batch
166
+ ```
167
+ or
168
+ ```
169
+ python myflow.py run --with kubernetes
170
+ ```
171
+ which executes the flow on the desired system using the
172
+ requirements specified in `@resources`.
173
+
174
+
175
+ Parameters
176
+ ----------
177
+ cpu : int, default 1
178
+ Number of CPUs required for this step.
179
+ gpu : int, optional, default None
180
+ Number of GPUs required for this step.
181
+ disk : int, optional, default None
182
+ Disk size (in MB) required for this step. Only applies on Kubernetes.
183
+ memory : int, default 4096
184
+ Memory size (in MB) required for this step.
185
+ shared_memory : int, optional, default None
186
+ The value for the size (in MiB) of the /dev/shm volume for this step.
187
+ This parameter maps to the `--shm-size` option in Docker.
188
+ """
189
+ ...
190
+
191
+ @typing.overload
192
+ def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
193
+ ...
194
+
195
+ @typing.overload
196
+ def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
197
+ ...
198
+
199
+ def resources(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, cpu: int = 1, gpu: typing.Optional[int] = None, disk: typing.Optional[int] = None, memory: int = 4096, shared_memory: typing.Optional[int] = None):
200
+ """
201
+ Specifies the resources needed when executing this step.
202
+
203
+ Use `@resources` to specify the resource requirements
204
+ independently of the specific compute layer (`@batch`, `@kubernetes`).
205
+
206
+ You can choose the compute layer on the command line by executing e.g.
207
+ ```
208
+ python myflow.py run --with batch
209
+ ```
210
+ or
211
+ ```
212
+ python myflow.py run --with kubernetes
213
+ ```
214
+ which executes the flow on the desired system using the
215
+ requirements specified in `@resources`.
216
+
217
+
218
+ Parameters
219
+ ----------
220
+ cpu : int, default 1
221
+ Number of CPUs required for this step.
222
+ gpu : int, optional, default None
223
+ Number of GPUs required for this step.
224
+ disk : int, optional, default None
225
+ Disk size (in MB) required for this step. Only applies on Kubernetes.
226
+ memory : int, default 4096
227
+ Memory size (in MB) required for this step.
228
+ shared_memory : int, optional, default None
229
+ The value for the size (in MiB) of the /dev/shm volume for this step.
230
+ This parameter maps to the `--shm-size` option in Docker.
231
+ """
232
+ ...
233
+
234
+ @typing.overload
235
+ def retry(*, times: int = 3, minutes_between_retries: int = 2) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
236
+ """
237
+ Specifies the number of times the task corresponding
238
+ to a step needs to be retried.
239
+
240
+ This decorator is useful for handling transient errors, such as networking issues.
241
+ If your task contains operations that can't be retried safely, e.g. database updates,
242
+ it is advisable to annotate it with `@retry(times=0)`.
243
+
244
+ This can be used in conjunction with the `@catch` decorator. The `@catch`
245
+ decorator will execute a no-op task after all retries have been exhausted,
246
+ ensuring that the flow execution can continue.
247
+
248
+
249
+ Parameters
250
+ ----------
251
+ times : int, default 3
252
+ Number of times to retry this task.
253
+ minutes_between_retries : int, default 2
254
+ Number of minutes between retries.
255
+ """
256
+ ...
257
+
258
+ @typing.overload
259
+ def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
260
+ ...
261
+
262
+ @typing.overload
263
+ def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
264
+ ...
265
+
266
+ def retry(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, times: int = 3, minutes_between_retries: int = 2):
267
+ """
268
+ Specifies the number of times the task corresponding
269
+ to a step needs to be retried.
270
+
271
+ This decorator is useful for handling transient errors, such as networking issues.
272
+ If your task contains operations that can't be retried safely, e.g. database updates,
273
+ it is advisable to annotate it with `@retry(times=0)`.
274
+
275
+ This can be used in conjunction with the `@catch` decorator. The `@catch`
276
+ decorator will execute a no-op task after all retries have been exhausted,
277
+ ensuring that the flow execution can continue.
278
+
279
+
280
+ Parameters
281
+ ----------
282
+ times : int, default 3
283
+ Number of times to retry this task.
284
+ minutes_between_retries : int, default 2
285
+ Number of minutes between retries.
286
+ """
287
+ ...
288
+
155
289
  @typing.overload
156
290
  def batch(*, cpu: int = 1, gpu: int = 0, memory: int = 4096, image: typing.Optional[str] = None, queue: str = 'METAFLOW_BATCH_JOB_QUEUE', iam_role: str = 'METAFLOW_ECS_S3_ACCESS_IAM_ROLE', execution_role: str = 'METAFLOW_ECS_FARGATE_EXECUTION_ROLE', shared_memory: typing.Optional[int] = None, max_swap: typing.Optional[int] = None, swappiness: typing.Optional[int] = None, aws_batch_tags: typing.Optional[typing.Dict[str, str]] = None, use_tmpfs: bool = False, tmpfs_tempdir: bool = True, tmpfs_size: typing.Optional[int] = None, tmpfs_path: typing.Optional[str] = None, inferentia: int = 0, trainium: int = None, efa: int = 0, ephemeral_storage: int = None, log_driver: typing.Optional[str] = None, log_options: typing.Optional[typing.List[str]] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
157
291
  """
@@ -308,353 +442,264 @@ def batch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
308
442
  ...
309
443
 
310
444
  @typing.overload
311
- def catch(*, var: typing.Optional[str] = None, print_exception: bool = True) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
445
+ def card(*, type: str = 'default', id: typing.Optional[str] = None, options: typing.Dict[str, typing.Any] = {}, timeout: int = 45) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
312
446
  """
313
- Specifies that the step will success under all circumstances.
447
+ Creates a human-readable report, a Metaflow Card, after this step completes.
314
448
 
315
- The decorator will create an optional artifact, specified by `var`, which
316
- contains the exception raised. You can use it to detect the presence
317
- of errors, indicating that all happy-path artifacts produced by the step
318
- are missing.
449
+ Note that you may add multiple `@card` decorators in a step with different parameters.
319
450
 
320
451
 
321
452
  Parameters
322
453
  ----------
323
- var : str, optional, default None
324
- Name of the artifact in which to store the caught exception.
325
- If not specified, the exception is not stored.
326
- print_exception : bool, default True
327
- Determines whether or not the exception is printed to
328
- stdout when caught.
454
+ type : str, default 'default'
455
+ Card type.
456
+ id : str, optional, default None
457
+ If multiple cards are present, use this id to identify this card.
458
+ options : Dict[str, Any], default {}
459
+ Options passed to the card. The contents depend on the card type.
460
+ timeout : int, default 45
461
+ Interrupt reporting if it takes more than this many seconds.
329
462
  """
330
463
  ...
331
464
 
332
465
  @typing.overload
333
- def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
466
+ def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
334
467
  ...
335
468
 
336
469
  @typing.overload
337
- def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
470
+ def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
338
471
  ...
339
472
 
340
- def catch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, var: typing.Optional[str] = None, print_exception: bool = True):
473
+ def card(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, type: str = 'default', id: typing.Optional[str] = None, options: typing.Dict[str, typing.Any] = {}, timeout: int = 45):
341
474
  """
342
- Specifies that the step will success under all circumstances.
475
+ Creates a human-readable report, a Metaflow Card, after this step completes.
343
476
 
344
- The decorator will create an optional artifact, specified by `var`, which
345
- contains the exception raised. You can use it to detect the presence
346
- of errors, indicating that all happy-path artifacts produced by the step
347
- are missing.
477
+ Note that you may add multiple `@card` decorators in a step with different parameters.
348
478
 
349
479
 
350
480
  Parameters
351
481
  ----------
352
- var : str, optional, default None
353
- Name of the artifact in which to store the caught exception.
354
- If not specified, the exception is not stored.
355
- print_exception : bool, default True
356
- Determines whether or not the exception is printed to
357
- stdout when caught.
358
- """
359
- ...
360
-
361
- @typing.overload
362
- def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
363
- """
364
- Decorator prototype for all step decorators. This function gets specialized
365
- and imported for all decorators types by _import_plugin_decorators().
366
- """
367
- ...
368
-
369
- @typing.overload
370
- def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
371
- ...
372
-
373
- def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
374
- """
375
- Decorator prototype for all step decorators. This function gets specialized
376
- and imported for all decorators types by _import_plugin_decorators().
482
+ type : str, default 'default'
483
+ Card type.
484
+ id : str, optional, default None
485
+ If multiple cards are present, use this id to identify this card.
486
+ options : Dict[str, Any], default {}
487
+ Options passed to the card. The contents depend on the card type.
488
+ timeout : int, default 45
489
+ Interrupt reporting if it takes more than this many seconds.
377
490
  """
378
491
  ...
379
492
 
380
493
  @typing.overload
381
- def timeout(*, seconds: int = 0, minutes: int = 0, hours: int = 0) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
494
+ def pypi(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
382
495
  """
383
- Specifies a timeout for your step.
384
-
385
- This decorator is useful if this step may hang indefinitely.
386
-
387
- This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
388
- A timeout is considered to be an exception thrown by the step. It will cause the step to be
389
- retried if needed and the exception will be caught by the `@catch` decorator, if present.
496
+ Specifies the PyPI packages for the step.
390
497
 
391
- Note that all the values specified in parameters are added together so if you specify
392
- 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
498
+ Information in this decorator will augment any
499
+ attributes set in the `@pyi_base` flow-level decorator. Hence,
500
+ you can use `@pypi_base` to set packages required by all
501
+ steps and use `@pypi` to specify step-specific overrides.
393
502
 
394
503
 
395
504
  Parameters
396
505
  ----------
397
- seconds : int, default 0
398
- Number of seconds to wait prior to timing out.
399
- minutes : int, default 0
400
- Number of minutes to wait prior to timing out.
401
- hours : int, default 0
402
- Number of hours to wait prior to timing out.
506
+ packages : Dict[str, str], default: {}
507
+ Packages to use for this step. The key is the name of the package
508
+ and the value is the version to use.
509
+ python : str, optional, default: None
510
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
511
+ that the version used will correspond to the version of the Python interpreter used to start the run.
403
512
  """
404
513
  ...
405
514
 
406
515
  @typing.overload
407
- def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
516
+ def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
408
517
  ...
409
518
 
410
519
  @typing.overload
411
- def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
520
+ def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
412
521
  ...
413
522
 
414
- def timeout(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, seconds: int = 0, minutes: int = 0, hours: int = 0):
523
+ def pypi(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
415
524
  """
416
- Specifies a timeout for your step.
417
-
418
- This decorator is useful if this step may hang indefinitely.
419
-
420
- This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
421
- A timeout is considered to be an exception thrown by the step. It will cause the step to be
422
- retried if needed and the exception will be caught by the `@catch` decorator, if present.
525
+ Specifies the PyPI packages for the step.
423
526
 
424
- Note that all the values specified in parameters are added together so if you specify
425
- 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
527
+ Information in this decorator will augment any
528
+ attributes set in the `@pyi_base` flow-level decorator. Hence,
529
+ you can use `@pypi_base` to set packages required by all
530
+ steps and use `@pypi` to specify step-specific overrides.
426
531
 
427
532
 
428
533
  Parameters
429
534
  ----------
430
- seconds : int, default 0
431
- Number of seconds to wait prior to timing out.
432
- minutes : int, default 0
433
- Number of minutes to wait prior to timing out.
434
- hours : int, default 0
435
- Number of hours to wait prior to timing out.
535
+ packages : Dict[str, str], default: {}
536
+ Packages to use for this step. The key is the name of the package
537
+ and the value is the version to use.
538
+ python : str, optional, default: None
539
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
540
+ that the version used will correspond to the version of the Python interpreter used to start the run.
436
541
  """
437
542
  ...
438
543
 
439
544
  @typing.overload
440
- def retry(*, times: int = 3, minutes_between_retries: int = 2) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
545
+ def conda(*, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
441
546
  """
442
- Specifies the number of times the task corresponding
443
- to a step needs to be retried.
444
-
445
- This decorator is useful for handling transient errors, such as networking issues.
446
- If your task contains operations that can't be retried safely, e.g. database updates,
447
- it is advisable to annotate it with `@retry(times=0)`.
547
+ Specifies the Conda environment for the step.
448
548
 
449
- This can be used in conjunction with the `@catch` decorator. The `@catch`
450
- decorator will execute a no-op task after all retries have been exhausted,
451
- ensuring that the flow execution can continue.
549
+ Information in this decorator will augment any
550
+ attributes set in the `@conda_base` flow-level decorator. Hence,
551
+ you can use `@conda_base` to set packages required by all
552
+ steps and use `@conda` to specify step-specific overrides.
452
553
 
453
554
 
454
555
  Parameters
455
556
  ----------
456
- times : int, default 3
457
- Number of times to retry this task.
458
- minutes_between_retries : int, default 2
459
- Number of minutes between retries.
557
+ packages : Dict[str, str], default {}
558
+ Packages to use for this step. The key is the name of the package
559
+ and the value is the version to use.
560
+ libraries : Dict[str, str], default {}
561
+ Supported for backward compatibility. When used with packages, packages will take precedence.
562
+ python : str, optional, default None
563
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
564
+ that the version used will correspond to the version of the Python interpreter used to start the run.
565
+ disabled : bool, default False
566
+ If set to True, disables @conda.
460
567
  """
461
568
  ...
462
569
 
463
570
  @typing.overload
464
- def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
571
+ def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
465
572
  ...
466
573
 
467
574
  @typing.overload
468
- def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
575
+ def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
469
576
  ...
470
577
 
471
- def retry(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, times: int = 3, minutes_between_retries: int = 2):
578
+ def conda(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False):
472
579
  """
473
- Specifies the number of times the task corresponding
474
- to a step needs to be retried.
475
-
476
- This decorator is useful for handling transient errors, such as networking issues.
477
- If your task contains operations that can't be retried safely, e.g. database updates,
478
- it is advisable to annotate it with `@retry(times=0)`.
580
+ Specifies the Conda environment for the step.
479
581
 
480
- This can be used in conjunction with the `@catch` decorator. The `@catch`
481
- decorator will execute a no-op task after all retries have been exhausted,
482
- ensuring that the flow execution can continue.
582
+ Information in this decorator will augment any
583
+ attributes set in the `@conda_base` flow-level decorator. Hence,
584
+ you can use `@conda_base` to set packages required by all
585
+ steps and use `@conda` to specify step-specific overrides.
483
586
 
484
587
 
485
588
  Parameters
486
589
  ----------
487
- times : int, default 3
488
- Number of times to retry this task.
489
- minutes_between_retries : int, default 2
490
- Number of minutes between retries.
590
+ packages : Dict[str, str], default {}
591
+ Packages to use for this step. The key is the name of the package
592
+ and the value is the version to use.
593
+ libraries : Dict[str, str], default {}
594
+ Supported for backward compatibility. When used with packages, packages will take precedence.
595
+ python : str, optional, default None
596
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
597
+ that the version used will correspond to the version of the Python interpreter used to start the run.
598
+ disabled : bool, default False
599
+ If set to True, disables @conda.
491
600
  """
492
601
  ...
493
602
 
494
603
  @typing.overload
495
- def secrets(*, sources: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = [], role: typing.Optional[str] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
604
+ def environment(*, vars: typing.Dict[str, str] = {}) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
496
605
  """
497
- Specifies secrets to be retrieved and injected as environment variables prior to
498
- the execution of a step.
606
+ Specifies environment variables to be set prior to the execution of a step.
499
607
 
500
608
 
501
609
  Parameters
502
610
  ----------
503
- sources : List[Union[str, Dict[str, Any]]], default: []
504
- List of secret specs, defining how the secrets are to be retrieved
505
- role : str, optional, default: None
506
- Role to use for fetching secrets
611
+ vars : Dict[str, str], default {}
612
+ Dictionary of environment variables to set.
507
613
  """
508
614
  ...
509
615
 
510
616
  @typing.overload
511
- def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
617
+ def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
512
618
  ...
513
619
 
514
620
  @typing.overload
515
- def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
621
+ def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
516
622
  ...
517
623
 
518
- def secrets(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, sources: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = [], role: typing.Optional[str] = None):
624
+ def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
519
625
  """
520
- Specifies secrets to be retrieved and injected as environment variables prior to
521
- the execution of a step.
626
+ Specifies environment variables to be set prior to the execution of a step.
522
627
 
523
628
 
524
629
  Parameters
525
630
  ----------
526
- sources : List[Union[str, Dict[str, Any]]], default: []
527
- List of secret specs, defining how the secrets are to be retrieved
528
- role : str, optional, default: None
529
- Role to use for fetching secrets
631
+ vars : Dict[str, str], default {}
632
+ Dictionary of environment variables to set.
530
633
  """
531
634
  ...
532
635
 
533
636
  @typing.overload
534
- def card(*, type: str = 'default', id: typing.Optional[str] = None, options: typing.Dict[str, typing.Any] = {}, timeout: int = 45) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
637
+ def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
535
638
  """
536
- Creates a human-readable report, a Metaflow Card, after this step completes.
537
-
538
- Note that you may add multiple `@card` decorators in a step with different parameters.
539
-
540
-
541
- Parameters
542
- ----------
543
- type : str, default 'default'
544
- Card type.
545
- id : str, optional, default None
546
- If multiple cards are present, use this id to identify this card.
547
- options : Dict[str, Any], default {}
548
- Options passed to the card. The contents depend on the card type.
549
- timeout : int, default 45
550
- Interrupt reporting if it takes more than this many seconds.
639
+ Decorator prototype for all step decorators. This function gets specialized
640
+ and imported for all decorators types by _import_plugin_decorators().
551
641
  """
552
642
  ...
553
643
 
554
644
  @typing.overload
555
- def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
556
- ...
557
-
558
- @typing.overload
559
- def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
645
+ def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
560
646
  ...
561
647
 
562
- def card(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, type: str = 'default', id: typing.Optional[str] = None, options: typing.Dict[str, typing.Any] = {}, timeout: int = 45):
648
+ def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
563
649
  """
564
- Creates a human-readable report, a Metaflow Card, after this step completes.
565
-
566
- Note that you may add multiple `@card` decorators in a step with different parameters.
567
-
568
-
569
- Parameters
570
- ----------
571
- type : str, default 'default'
572
- Card type.
573
- id : str, optional, default None
574
- If multiple cards are present, use this id to identify this card.
575
- options : Dict[str, Any], default {}
576
- Options passed to the card. The contents depend on the card type.
577
- timeout : int, default 45
578
- Interrupt reporting if it takes more than this many seconds.
650
+ Decorator prototype for all step decorators. This function gets specialized
651
+ and imported for all decorators types by _import_plugin_decorators().
579
652
  """
580
653
  ...
581
654
 
582
655
  @typing.overload
583
- def resources(*, cpu: int = 1, gpu: typing.Optional[int] = None, disk: typing.Optional[int] = None, memory: int = 4096, shared_memory: typing.Optional[int] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
656
+ def catch(*, var: typing.Optional[str] = None, print_exception: bool = True) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
584
657
  """
585
- Specifies the resources needed when executing this step.
586
-
587
- Use `@resources` to specify the resource requirements
588
- independently of the specific compute layer (`@batch`, `@kubernetes`).
658
+ Specifies that the step will success under all circumstances.
589
659
 
590
- You can choose the compute layer on the command line by executing e.g.
591
- ```
592
- python myflow.py run --with batch
593
- ```
594
- or
595
- ```
596
- python myflow.py run --with kubernetes
597
- ```
598
- which executes the flow on the desired system using the
599
- requirements specified in `@resources`.
660
+ The decorator will create an optional artifact, specified by `var`, which
661
+ contains the exception raised. You can use it to detect the presence
662
+ of errors, indicating that all happy-path artifacts produced by the step
663
+ are missing.
600
664
 
601
665
 
602
666
  Parameters
603
667
  ----------
604
- cpu : int, default 1
605
- Number of CPUs required for this step.
606
- gpu : int, optional, default None
607
- Number of GPUs required for this step.
608
- disk : int, optional, default None
609
- Disk size (in MB) required for this step. Only applies on Kubernetes.
610
- memory : int, default 4096
611
- Memory size (in MB) required for this step.
612
- shared_memory : int, optional, default None
613
- The value for the size (in MiB) of the /dev/shm volume for this step.
614
- This parameter maps to the `--shm-size` option in Docker.
668
+ var : str, optional, default None
669
+ Name of the artifact in which to store the caught exception.
670
+ If not specified, the exception is not stored.
671
+ print_exception : bool, default True
672
+ Determines whether or not the exception is printed to
673
+ stdout when caught.
615
674
  """
616
675
  ...
617
676
 
618
677
  @typing.overload
619
- def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
678
+ def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
620
679
  ...
621
680
 
622
681
  @typing.overload
623
- def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
682
+ def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
624
683
  ...
625
684
 
626
- def resources(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, cpu: int = 1, gpu: typing.Optional[int] = None, disk: typing.Optional[int] = None, memory: int = 4096, shared_memory: typing.Optional[int] = None):
685
+ def catch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, var: typing.Optional[str] = None, print_exception: bool = True):
627
686
  """
628
- Specifies the resources needed when executing this step.
629
-
630
- Use `@resources` to specify the resource requirements
631
- independently of the specific compute layer (`@batch`, `@kubernetes`).
687
+ Specifies that the step will success under all circumstances.
632
688
 
633
- You can choose the compute layer on the command line by executing e.g.
634
- ```
635
- python myflow.py run --with batch
636
- ```
637
- or
638
- ```
639
- python myflow.py run --with kubernetes
640
- ```
641
- which executes the flow on the desired system using the
642
- requirements specified in `@resources`.
689
+ The decorator will create an optional artifact, specified by `var`, which
690
+ contains the exception raised. You can use it to detect the presence
691
+ of errors, indicating that all happy-path artifacts produced by the step
692
+ are missing.
643
693
 
644
694
 
645
695
  Parameters
646
696
  ----------
647
- cpu : int, default 1
648
- Number of CPUs required for this step.
649
- gpu : int, optional, default None
650
- Number of GPUs required for this step.
651
- disk : int, optional, default None
652
- Disk size (in MB) required for this step. Only applies on Kubernetes.
653
- memory : int, default 4096
654
- Memory size (in MB) required for this step.
655
- shared_memory : int, optional, default None
656
- The value for the size (in MiB) of the /dev/shm volume for this step.
657
- This parameter maps to the `--shm-size` option in Docker.
697
+ var : str, optional, default None
698
+ Name of the artifact in which to store the caught exception.
699
+ If not specified, the exception is not stored.
700
+ print_exception : bool, default True
701
+ Determines whether or not the exception is printed to
702
+ stdout when caught.
658
703
  """
659
704
  ...
660
705
 
@@ -748,188 +793,151 @@ def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: ty
748
793
  ...
749
794
 
750
795
  @typing.overload
751
- def pypi(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
796
+ def timeout(*, seconds: int = 0, minutes: int = 0, hours: int = 0) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
752
797
  """
753
- Specifies the PyPI packages for the step.
798
+ Specifies a timeout for your step.
754
799
 
755
- Information in this decorator will augment any
756
- attributes set in the `@pyi_base` flow-level decorator. Hence,
757
- you can use `@pypi_base` to set packages required by all
758
- steps and use `@pypi` to specify step-specific overrides.
800
+ This decorator is useful if this step may hang indefinitely.
801
+
802
+ This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
803
+ A timeout is considered to be an exception thrown by the step. It will cause the step to be
804
+ retried if needed and the exception will be caught by the `@catch` decorator, if present.
805
+
806
+ Note that all the values specified in parameters are added together so if you specify
807
+ 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
759
808
 
760
809
 
761
810
  Parameters
762
811
  ----------
763
- packages : Dict[str, str], default: {}
764
- Packages to use for this step. The key is the name of the package
765
- and the value is the version to use.
766
- python : str, optional, default: None
767
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
768
- that the version used will correspond to the version of the Python interpreter used to start the run.
812
+ seconds : int, default 0
813
+ Number of seconds to wait prior to timing out.
814
+ minutes : int, default 0
815
+ Number of minutes to wait prior to timing out.
816
+ hours : int, default 0
817
+ Number of hours to wait prior to timing out.
769
818
  """
770
819
  ...
771
820
 
772
821
  @typing.overload
773
- def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
822
+ def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
774
823
  ...
775
824
 
776
825
  @typing.overload
777
- def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
826
+ def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
778
827
  ...
779
828
 
780
- def pypi(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
829
+ def timeout(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, seconds: int = 0, minutes: int = 0, hours: int = 0):
781
830
  """
782
- Specifies the PyPI packages for the step.
831
+ Specifies a timeout for your step.
783
832
 
784
- Information in this decorator will augment any
785
- attributes set in the `@pyi_base` flow-level decorator. Hence,
786
- you can use `@pypi_base` to set packages required by all
787
- steps and use `@pypi` to specify step-specific overrides.
833
+ This decorator is useful if this step may hang indefinitely.
834
+
835
+ This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
836
+ A timeout is considered to be an exception thrown by the step. It will cause the step to be
837
+ retried if needed and the exception will be caught by the `@catch` decorator, if present.
838
+
839
+ Note that all the values specified in parameters are added together so if you specify
840
+ 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
788
841
 
789
842
 
790
843
  Parameters
791
844
  ----------
792
- packages : Dict[str, str], default: {}
793
- Packages to use for this step. The key is the name of the package
794
- and the value is the version to use.
795
- python : str, optional, default: None
796
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
797
- that the version used will correspond to the version of the Python interpreter used to start the run.
845
+ seconds : int, default 0
846
+ Number of seconds to wait prior to timing out.
847
+ minutes : int, default 0
848
+ Number of minutes to wait prior to timing out.
849
+ hours : int, default 0
850
+ Number of hours to wait prior to timing out.
798
851
  """
799
852
  ...
800
853
 
801
854
  @typing.overload
802
- def conda(*, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
855
+ def secrets(*, sources: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = [], role: typing.Optional[str] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
803
856
  """
804
- Specifies the Conda environment for the step.
805
-
806
- Information in this decorator will augment any
807
- attributes set in the `@conda_base` flow-level decorator. Hence,
808
- you can use `@conda_base` to set packages required by all
809
- steps and use `@conda` to specify step-specific overrides.
857
+ Specifies secrets to be retrieved and injected as environment variables prior to
858
+ the execution of a step.
810
859
 
811
860
 
812
861
  Parameters
813
862
  ----------
814
- packages : Dict[str, str], default {}
815
- Packages to use for this step. The key is the name of the package
816
- and the value is the version to use.
817
- libraries : Dict[str, str], default {}
818
- Supported for backward compatibility. When used with packages, packages will take precedence.
819
- python : str, optional, default None
820
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
821
- that the version used will correspond to the version of the Python interpreter used to start the run.
822
- disabled : bool, default False
823
- If set to True, disables @conda.
863
+ sources : List[Union[str, Dict[str, Any]]], default: []
864
+ List of secret specs, defining how the secrets are to be retrieved
865
+ role : str, optional, default: None
866
+ Role to use for fetching secrets
824
867
  """
825
868
  ...
826
869
 
827
870
  @typing.overload
828
- def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
871
+ def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
829
872
  ...
830
873
 
831
874
  @typing.overload
832
- def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
875
+ def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
833
876
  ...
834
877
 
835
- def conda(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False):
878
+ def secrets(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, sources: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = [], role: typing.Optional[str] = None):
836
879
  """
837
- Specifies the Conda environment for the step.
838
-
839
- Information in this decorator will augment any
840
- attributes set in the `@conda_base` flow-level decorator. Hence,
841
- you can use `@conda_base` to set packages required by all
842
- steps and use `@conda` to specify step-specific overrides.
880
+ Specifies secrets to be retrieved and injected as environment variables prior to
881
+ the execution of a step.
843
882
 
844
883
 
845
884
  Parameters
846
885
  ----------
847
- packages : Dict[str, str], default {}
848
- Packages to use for this step. The key is the name of the package
849
- and the value is the version to use.
850
- libraries : Dict[str, str], default {}
851
- Supported for backward compatibility. When used with packages, packages will take precedence.
852
- python : str, optional, default None
853
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
854
- that the version used will correspond to the version of the Python interpreter used to start the run.
855
- disabled : bool, default False
856
- If set to True, disables @conda.
886
+ sources : List[Union[str, Dict[str, Any]]], default: []
887
+ List of secret specs, defining how the secrets are to be retrieved
888
+ role : str, optional, default: None
889
+ Role to use for fetching secrets
857
890
  """
858
891
  ...
859
892
 
860
893
  @typing.overload
861
- def environment(*, vars: typing.Dict[str, str] = {}) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
894
+ def schedule(*, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: typing.Optional[str] = None, timezone: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
862
895
  """
863
- Specifies environment variables to be set prior to the execution of a step.
896
+ Specifies the times when the flow should be run when running on a
897
+ production scheduler.
864
898
 
865
899
 
866
900
  Parameters
867
901
  ----------
868
- vars : Dict[str, str], default {}
869
- Dictionary of environment variables to set.
902
+ hourly : bool, default False
903
+ Run the workflow hourly.
904
+ daily : bool, default True
905
+ Run the workflow daily.
906
+ weekly : bool, default False
907
+ Run the workflow weekly.
908
+ cron : str, optional, default None
909
+ Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
910
+ specified by this expression.
911
+ timezone : str, optional, default None
912
+ Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
913
+ which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
870
914
  """
871
915
  ...
872
916
 
873
917
  @typing.overload
874
- def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
875
- ...
876
-
877
- @typing.overload
878
- def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
879
- ...
880
-
881
- def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
882
- """
883
- Specifies environment variables to be set prior to the execution of a step.
884
-
885
-
886
- Parameters
887
- ----------
888
- vars : Dict[str, str], default {}
889
- Dictionary of environment variables to set.
890
- """
918
+ def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
891
919
  ...
892
920
 
893
- def airflow_external_task_sensor(*, timeout: int, poke_interval: int, mode: str, exponential_backoff: bool, pool: str, soft_fail: bool, name: str, description: str, external_dag_id: str, external_task_ids: typing.List[str], allowed_states: typing.List[str], failed_states: typing.List[str], execution_delta: "datetime.timedelta", check_existence: bool) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
921
+ def schedule(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: typing.Optional[str] = None, timezone: typing.Optional[str] = None):
894
922
  """
895
- The `@airflow_external_task_sensor` decorator attaches a Airflow [ExternalTaskSensor](https://airflow.apache.org/docs/apache-airflow/stable/_api/airflow/sensors/external_task/index.html#airflow.sensors.external_task.ExternalTaskSensor) before the start step of the flow.
896
- This decorator only works when a flow is scheduled on Airflow and is compiled using `airflow create`. More than one `@airflow_external_task_sensor` can be added as a flow decorators. Adding more than one decorator will ensure that `start` step starts only after all sensors finish.
923
+ Specifies the times when the flow should be run when running on a
924
+ production scheduler.
897
925
 
898
926
 
899
927
  Parameters
900
928
  ----------
901
- timeout : int
902
- Time, in seconds before the task times out and fails. (Default: 3600)
903
- poke_interval : int
904
- Time in seconds that the job should wait in between each try. (Default: 60)
905
- mode : str
906
- How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
907
- exponential_backoff : bool
908
- allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
909
- pool : str
910
- the slot pool this task should run in,
911
- slot pools are a way to limit concurrency for certain tasks. (Default:None)
912
- soft_fail : bool
913
- Set to true to mark the task as SKIPPED on failure. (Default: False)
914
- name : str
915
- Name of the sensor on Airflow
916
- description : str
917
- Description of sensor in the Airflow UI
918
- external_dag_id : str
919
- The dag_id that contains the task you want to wait for.
920
- external_task_ids : List[str]
921
- The list of task_ids that you want to wait for.
922
- If None (default value) the sensor waits for the DAG. (Default: None)
923
- allowed_states : List[str]
924
- Iterable of allowed states, (Default: ['success'])
925
- failed_states : List[str]
926
- Iterable of failed or dis-allowed states. (Default: None)
927
- execution_delta : datetime.timedelta
928
- time difference with the previous execution to look at,
929
- the default is the same logical date as the current task or DAG. (Default: None)
930
- check_existence: bool
931
- Set to True to check if the external task exists or check if
932
- the DAG to wait for exists. (Default: True)
929
+ hourly : bool, default False
930
+ Run the workflow hourly.
931
+ daily : bool, default True
932
+ Run the workflow daily.
933
+ weekly : bool, default False
934
+ Run the workflow weekly.
935
+ cron : str, optional, default None
936
+ Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
937
+ specified by this expression.
938
+ timezone : str, optional, default None
939
+ Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
940
+ which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
933
941
  """
934
942
  ...
935
943
 
@@ -1026,57 +1034,6 @@ def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, event: t
1026
1034
  """
1027
1035
  ...
1028
1036
 
1029
- @typing.overload
1030
- def schedule(*, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: typing.Optional[str] = None, timezone: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1031
- """
1032
- Specifies the times when the flow should be run when running on a
1033
- production scheduler.
1034
-
1035
-
1036
- Parameters
1037
- ----------
1038
- hourly : bool, default False
1039
- Run the workflow hourly.
1040
- daily : bool, default True
1041
- Run the workflow daily.
1042
- weekly : bool, default False
1043
- Run the workflow weekly.
1044
- cron : str, optional, default None
1045
- Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1046
- specified by this expression.
1047
- timezone : str, optional, default None
1048
- Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1049
- which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1050
- """
1051
- ...
1052
-
1053
- @typing.overload
1054
- def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1055
- ...
1056
-
1057
- def schedule(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: typing.Optional[str] = None, timezone: typing.Optional[str] = None):
1058
- """
1059
- Specifies the times when the flow should be run when running on a
1060
- production scheduler.
1061
-
1062
-
1063
- Parameters
1064
- ----------
1065
- hourly : bool, default False
1066
- Run the workflow hourly.
1067
- daily : bool, default True
1068
- Run the workflow daily.
1069
- weekly : bool, default False
1070
- Run the workflow weekly.
1071
- cron : str, optional, default None
1072
- Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1073
- specified by this expression.
1074
- timezone : str, optional, default None
1075
- Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1076
- which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1077
- """
1078
- ...
1079
-
1080
1037
  @typing.overload
1081
1038
  def conda_base(*, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1082
1039
  """
@@ -1128,107 +1085,6 @@ def conda_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packa
1128
1085
  """
1129
1086
  ...
1130
1087
 
1131
- @typing.overload
1132
- def trigger_on_finish(*, flow: typing.Union[typing.Dict[str, str], str, None] = None, flows: typing.List[typing.Union[str, typing.Dict[str, str]]] = [], options: typing.Dict[str, typing.Any] = {}) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1133
- """
1134
- Specifies the flow(s) that this flow depends on.
1135
-
1136
- ```
1137
- @trigger_on_finish(flow='FooFlow')
1138
- ```
1139
- or
1140
- ```
1141
- @trigger_on_finish(flows=['FooFlow', 'BarFlow'])
1142
- ```
1143
- This decorator respects the @project decorator and triggers the flow
1144
- when upstream runs within the same namespace complete successfully
1145
-
1146
- Additionally, you can specify project aware upstream flow dependencies
1147
- by specifying the fully qualified project_flow_name.
1148
- ```
1149
- @trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
1150
- ```
1151
- or
1152
- ```
1153
- @trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
1154
- ```
1155
-
1156
- You can also specify just the project or project branch (other values will be
1157
- inferred from the current project or project branch):
1158
- ```
1159
- @trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
1160
- ```
1161
-
1162
- Note that `branch` is typically one of:
1163
- - `prod`
1164
- - `user.bob`
1165
- - `test.my_experiment`
1166
- - `prod.staging`
1167
-
1168
-
1169
- Parameters
1170
- ----------
1171
- flow : Union[str, Dict[str, str]], optional, default None
1172
- Upstream flow dependency for this flow.
1173
- flows : List[Union[str, Dict[str, str]]], default []
1174
- Upstream flow dependencies for this flow.
1175
- options : Dict[str, Any], default {}
1176
- Backend-specific configuration for tuning eventing behavior.
1177
- """
1178
- ...
1179
-
1180
- @typing.overload
1181
- def trigger_on_finish(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1182
- ...
1183
-
1184
- def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, flow: typing.Union[typing.Dict[str, str], str, None] = None, flows: typing.List[typing.Union[str, typing.Dict[str, str]]] = [], options: typing.Dict[str, typing.Any] = {}):
1185
- """
1186
- Specifies the flow(s) that this flow depends on.
1187
-
1188
- ```
1189
- @trigger_on_finish(flow='FooFlow')
1190
- ```
1191
- or
1192
- ```
1193
- @trigger_on_finish(flows=['FooFlow', 'BarFlow'])
1194
- ```
1195
- This decorator respects the @project decorator and triggers the flow
1196
- when upstream runs within the same namespace complete successfully
1197
-
1198
- Additionally, you can specify project aware upstream flow dependencies
1199
- by specifying the fully qualified project_flow_name.
1200
- ```
1201
- @trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
1202
- ```
1203
- or
1204
- ```
1205
- @trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
1206
- ```
1207
-
1208
- You can also specify just the project or project branch (other values will be
1209
- inferred from the current project or project branch):
1210
- ```
1211
- @trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
1212
- ```
1213
-
1214
- Note that `branch` is typically one of:
1215
- - `prod`
1216
- - `user.bob`
1217
- - `test.my_experiment`
1218
- - `prod.staging`
1219
-
1220
-
1221
- Parameters
1222
- ----------
1223
- flow : Union[str, Dict[str, str]], optional, default None
1224
- Upstream flow dependency for this flow.
1225
- flows : List[Union[str, Dict[str, str]]], default []
1226
- Upstream flow dependencies for this flow.
1227
- options : Dict[str, Any], default {}
1228
- Backend-specific configuration for tuning eventing behavior.
1229
- """
1230
- ...
1231
-
1232
1088
  def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1233
1089
  """
1234
1090
  Specifies what flows belong to the same project.
@@ -1305,6 +1161,49 @@ def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packag
1305
1161
  """
1306
1162
  ...
1307
1163
 
1164
+ def airflow_external_task_sensor(*, timeout: int, poke_interval: int, mode: str, exponential_backoff: bool, pool: str, soft_fail: bool, name: str, description: str, external_dag_id: str, external_task_ids: typing.List[str], allowed_states: typing.List[str], failed_states: typing.List[str], execution_delta: "datetime.timedelta", check_existence: bool) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1165
+ """
1166
+ The `@airflow_external_task_sensor` decorator attaches a Airflow [ExternalTaskSensor](https://airflow.apache.org/docs/apache-airflow/stable/_api/airflow/sensors/external_task/index.html#airflow.sensors.external_task.ExternalTaskSensor) before the start step of the flow.
1167
+ This decorator only works when a flow is scheduled on Airflow and is compiled using `airflow create`. More than one `@airflow_external_task_sensor` can be added as a flow decorators. Adding more than one decorator will ensure that `start` step starts only after all sensors finish.
1168
+
1169
+
1170
+ Parameters
1171
+ ----------
1172
+ timeout : int
1173
+ Time, in seconds before the task times out and fails. (Default: 3600)
1174
+ poke_interval : int
1175
+ Time in seconds that the job should wait in between each try. (Default: 60)
1176
+ mode : str
1177
+ How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1178
+ exponential_backoff : bool
1179
+ allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1180
+ pool : str
1181
+ the slot pool this task should run in,
1182
+ slot pools are a way to limit concurrency for certain tasks. (Default:None)
1183
+ soft_fail : bool
1184
+ Set to true to mark the task as SKIPPED on failure. (Default: False)
1185
+ name : str
1186
+ Name of the sensor on Airflow
1187
+ description : str
1188
+ Description of sensor in the Airflow UI
1189
+ external_dag_id : str
1190
+ The dag_id that contains the task you want to wait for.
1191
+ external_task_ids : List[str]
1192
+ The list of task_ids that you want to wait for.
1193
+ If None (default value) the sensor waits for the DAG. (Default: None)
1194
+ allowed_states : List[str]
1195
+ Iterable of allowed states, (Default: ['success'])
1196
+ failed_states : List[str]
1197
+ Iterable of failed or dis-allowed states. (Default: None)
1198
+ execution_delta : datetime.timedelta
1199
+ time difference with the previous execution to look at,
1200
+ the default is the same logical date as the current task or DAG. (Default: None)
1201
+ check_existence: bool
1202
+ Set to True to check if the external task exists or check if
1203
+ the DAG to wait for exists. (Default: True)
1204
+ """
1205
+ ...
1206
+
1308
1207
  def airflow_s3_key_sensor(*, timeout: int, poke_interval: int, mode: str, exponential_backoff: bool, pool: str, soft_fail: bool, name: str, description: str, bucket_key: typing.Union[str, typing.List[str]], bucket_name: str, wildcard_match: bool, aws_conn_id: str, verify: bool) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1309
1208
  """
1310
1209
  The `@airflow_s3_key_sensor` decorator attaches a Airflow [S3KeySensor](https://airflow.apache.org/docs/apache-airflow-providers-amazon/stable/_api/airflow/providers/amazon/aws/sensors/s3/index.html#airflow.providers.amazon.aws.sensors.s3.S3KeySensor)
@@ -1348,3 +1247,104 @@ def airflow_s3_key_sensor(*, timeout: int, poke_interval: int, mode: str, expone
1348
1247
  """
1349
1248
  ...
1350
1249
 
1250
+ @typing.overload
1251
+ def trigger_on_finish(*, flow: typing.Union[typing.Dict[str, str], str, None] = None, flows: typing.List[typing.Union[str, typing.Dict[str, str]]] = [], options: typing.Dict[str, typing.Any] = {}) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1252
+ """
1253
+ Specifies the flow(s) that this flow depends on.
1254
+
1255
+ ```
1256
+ @trigger_on_finish(flow='FooFlow')
1257
+ ```
1258
+ or
1259
+ ```
1260
+ @trigger_on_finish(flows=['FooFlow', 'BarFlow'])
1261
+ ```
1262
+ This decorator respects the @project decorator and triggers the flow
1263
+ when upstream runs within the same namespace complete successfully
1264
+
1265
+ Additionally, you can specify project aware upstream flow dependencies
1266
+ by specifying the fully qualified project_flow_name.
1267
+ ```
1268
+ @trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
1269
+ ```
1270
+ or
1271
+ ```
1272
+ @trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
1273
+ ```
1274
+
1275
+ You can also specify just the project or project branch (other values will be
1276
+ inferred from the current project or project branch):
1277
+ ```
1278
+ @trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
1279
+ ```
1280
+
1281
+ Note that `branch` is typically one of:
1282
+ - `prod`
1283
+ - `user.bob`
1284
+ - `test.my_experiment`
1285
+ - `prod.staging`
1286
+
1287
+
1288
+ Parameters
1289
+ ----------
1290
+ flow : Union[str, Dict[str, str]], optional, default None
1291
+ Upstream flow dependency for this flow.
1292
+ flows : List[Union[str, Dict[str, str]]], default []
1293
+ Upstream flow dependencies for this flow.
1294
+ options : Dict[str, Any], default {}
1295
+ Backend-specific configuration for tuning eventing behavior.
1296
+ """
1297
+ ...
1298
+
1299
+ @typing.overload
1300
+ def trigger_on_finish(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1301
+ ...
1302
+
1303
+ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, flow: typing.Union[typing.Dict[str, str], str, None] = None, flows: typing.List[typing.Union[str, typing.Dict[str, str]]] = [], options: typing.Dict[str, typing.Any] = {}):
1304
+ """
1305
+ Specifies the flow(s) that this flow depends on.
1306
+
1307
+ ```
1308
+ @trigger_on_finish(flow='FooFlow')
1309
+ ```
1310
+ or
1311
+ ```
1312
+ @trigger_on_finish(flows=['FooFlow', 'BarFlow'])
1313
+ ```
1314
+ This decorator respects the @project decorator and triggers the flow
1315
+ when upstream runs within the same namespace complete successfully
1316
+
1317
+ Additionally, you can specify project aware upstream flow dependencies
1318
+ by specifying the fully qualified project_flow_name.
1319
+ ```
1320
+ @trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
1321
+ ```
1322
+ or
1323
+ ```
1324
+ @trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
1325
+ ```
1326
+
1327
+ You can also specify just the project or project branch (other values will be
1328
+ inferred from the current project or project branch):
1329
+ ```
1330
+ @trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
1331
+ ```
1332
+
1333
+ Note that `branch` is typically one of:
1334
+ - `prod`
1335
+ - `user.bob`
1336
+ - `test.my_experiment`
1337
+ - `prod.staging`
1338
+
1339
+
1340
+ Parameters
1341
+ ----------
1342
+ flow : Union[str, Dict[str, str]], optional, default None
1343
+ Upstream flow dependency for this flow.
1344
+ flows : List[Union[str, Dict[str, str]]], default []
1345
+ Upstream flow dependencies for this flow.
1346
+ options : Dict[str, Any], default {}
1347
+ Backend-specific configuration for tuning eventing behavior.
1348
+ """
1349
+ ...
1350
+