metaflow-stubs 2.15.1__py2.py3-none-any.whl → 2.15.3__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.
Files changed (146) hide show
  1. metaflow-stubs/__init__.pyi +698 -698
  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 +6 -6
  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 +5 -5
  12. metaflow-stubs/generated_for.txt +1 -1
  13. metaflow-stubs/includefile.pyi +4 -4
  14. metaflow-stubs/info_file.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 +3 -3
  18. metaflow-stubs/metadata_provider/util.pyi +2 -2
  19. metaflow-stubs/metaflow_config.pyi +2 -2
  20. metaflow-stubs/metaflow_current.pyi +28 -28
  21. metaflow-stubs/multicore_utils.pyi +2 -2
  22. metaflow-stubs/parameters.pyi +4 -4
  23. metaflow-stubs/plugins/__init__.pyi +19 -15
  24. metaflow-stubs/plugins/airflow/__init__.pyi +2 -2
  25. metaflow-stubs/plugins/airflow/airflow_decorator.pyi +2 -2
  26. metaflow-stubs/plugins/airflow/airflow_utils.pyi +2 -2
  27. metaflow-stubs/plugins/airflow/exception.pyi +2 -2
  28. metaflow-stubs/plugins/airflow/sensors/__init__.pyi +2 -2
  29. metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +2 -2
  30. metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +2 -2
  31. metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +2 -2
  32. metaflow-stubs/plugins/argo/__init__.pyi +2 -2
  33. metaflow-stubs/plugins/argo/argo_client.pyi +2 -2
  34. metaflow-stubs/plugins/argo/argo_events.pyi +2 -2
  35. metaflow-stubs/plugins/argo/argo_workflows.pyi +2 -2
  36. metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +3 -3
  37. metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +3 -3
  38. metaflow-stubs/plugins/argo/argo_workflows_deployer_objects.pyi +3 -3
  39. metaflow-stubs/plugins/aws/__init__.pyi +3 -3
  40. metaflow-stubs/plugins/aws/aws_client.pyi +2 -2
  41. metaflow-stubs/plugins/aws/aws_utils.pyi +2 -2
  42. metaflow-stubs/plugins/aws/batch/__init__.pyi +2 -2
  43. metaflow-stubs/plugins/aws/batch/batch.pyi +2 -2
  44. metaflow-stubs/plugins/aws/batch/batch_client.pyi +2 -2
  45. metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +2 -2
  46. metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +2 -2
  47. metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +5 -5
  48. metaflow-stubs/plugins/aws/step_functions/__init__.pyi +2 -2
  49. metaflow-stubs/plugins/aws/step_functions/dynamo_db_client.pyi +2 -2
  50. metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +2 -2
  51. metaflow-stubs/plugins/aws/step_functions/schedule_decorator.pyi +2 -2
  52. metaflow-stubs/plugins/aws/step_functions/step_functions.pyi +2 -2
  53. metaflow-stubs/plugins/aws/step_functions/step_functions_client.pyi +2 -2
  54. metaflow-stubs/plugins/aws/step_functions/step_functions_decorator.pyi +2 -2
  55. metaflow-stubs/plugins/aws/step_functions/step_functions_deployer.pyi +3 -3
  56. metaflow-stubs/plugins/aws/step_functions/step_functions_deployer_objects.pyi +4 -4
  57. metaflow-stubs/plugins/azure/__init__.pyi +2 -2
  58. metaflow-stubs/plugins/azure/azure_credential.pyi +2 -2
  59. metaflow-stubs/plugins/azure/azure_exceptions.pyi +2 -2
  60. metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +5 -5
  61. metaflow-stubs/plugins/azure/azure_utils.pyi +2 -2
  62. metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +2 -2
  63. metaflow-stubs/plugins/azure/includefile_support.pyi +2 -2
  64. metaflow-stubs/plugins/cards/__init__.pyi +2 -2
  65. metaflow-stubs/plugins/cards/card_client.pyi +3 -3
  66. metaflow-stubs/plugins/cards/card_creator.pyi +2 -2
  67. metaflow-stubs/plugins/cards/card_datastore.pyi +2 -2
  68. metaflow-stubs/plugins/cards/card_decorator.pyi +2 -2
  69. metaflow-stubs/plugins/cards/card_modules/__init__.pyi +2 -2
  70. metaflow-stubs/plugins/cards/card_modules/basic.pyi +3 -3
  71. metaflow-stubs/plugins/cards/card_modules/card.pyi +2 -2
  72. metaflow-stubs/plugins/cards/card_modules/components.pyi +4 -4
  73. metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +2 -2
  74. metaflow-stubs/plugins/cards/card_modules/renderer_tools.pyi +2 -2
  75. metaflow-stubs/plugins/cards/card_modules/test_cards.pyi +2 -2
  76. metaflow-stubs/plugins/cards/card_resolver.pyi +2 -2
  77. metaflow-stubs/plugins/cards/component_serializer.pyi +2 -2
  78. metaflow-stubs/plugins/cards/exception.pyi +2 -2
  79. metaflow-stubs/plugins/catch_decorator.pyi +2 -2
  80. metaflow-stubs/plugins/datatools/__init__.pyi +2 -2
  81. metaflow-stubs/plugins/datatools/local.pyi +2 -2
  82. metaflow-stubs/plugins/datatools/s3/__init__.pyi +2 -2
  83. metaflow-stubs/plugins/datatools/s3/s3.pyi +4 -4
  84. metaflow-stubs/plugins/datatools/s3/s3tail.pyi +2 -2
  85. metaflow-stubs/plugins/datatools/s3/s3util.pyi +2 -2
  86. metaflow-stubs/plugins/debug_logger.pyi +2 -2
  87. metaflow-stubs/plugins/debug_monitor.pyi +2 -2
  88. metaflow-stubs/plugins/environment_decorator.pyi +2 -2
  89. metaflow-stubs/plugins/events_decorator.pyi +2 -2
  90. metaflow-stubs/plugins/frameworks/__init__.pyi +2 -2
  91. metaflow-stubs/plugins/frameworks/pytorch.pyi +2 -2
  92. metaflow-stubs/plugins/gcp/__init__.pyi +2 -2
  93. metaflow-stubs/plugins/gcp/gcp_secret_manager_secrets_provider.pyi +5 -5
  94. metaflow-stubs/plugins/gcp/gs_exceptions.pyi +2 -2
  95. metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +2 -2
  96. metaflow-stubs/plugins/gcp/gs_utils.pyi +2 -2
  97. metaflow-stubs/plugins/gcp/includefile_support.pyi +2 -2
  98. metaflow-stubs/plugins/kubernetes/__init__.pyi +2 -2
  99. metaflow-stubs/plugins/kubernetes/kube_utils.pyi +3 -3
  100. metaflow-stubs/plugins/kubernetes/kubernetes.pyi +2 -2
  101. metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +2 -2
  102. metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +2 -2
  103. metaflow-stubs/plugins/kubernetes/kubernetes_job.pyi +2 -2
  104. metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +2 -2
  105. metaflow-stubs/plugins/kubernetes/spot_monitor_sidecar.pyi +2 -2
  106. metaflow-stubs/plugins/parallel_decorator.pyi +2 -2
  107. metaflow-stubs/plugins/project_decorator.pyi +2 -2
  108. metaflow-stubs/plugins/pypi/__init__.pyi +3 -3
  109. metaflow-stubs/plugins/pypi/conda_decorator.pyi +2 -2
  110. metaflow-stubs/plugins/pypi/conda_environment.pyi +4 -4
  111. metaflow-stubs/plugins/pypi/parsers.pyi +2 -2
  112. metaflow-stubs/plugins/pypi/pypi_decorator.pyi +2 -2
  113. metaflow-stubs/plugins/pypi/pypi_environment.pyi +2 -2
  114. metaflow-stubs/plugins/pypi/utils.pyi +2 -2
  115. metaflow-stubs/plugins/resources_decorator.pyi +2 -2
  116. metaflow-stubs/plugins/retry_decorator.pyi +2 -2
  117. metaflow-stubs/plugins/secrets/__init__.pyi +2 -2
  118. metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +4 -4
  119. metaflow-stubs/plugins/secrets/secrets_decorator.pyi +2 -2
  120. metaflow-stubs/plugins/storage_executor.pyi +2 -2
  121. metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +2 -2
  122. metaflow-stubs/plugins/timeout_decorator.pyi +2 -2
  123. metaflow-stubs/pylint_wrapper.pyi +2 -2
  124. metaflow-stubs/runner/__init__.pyi +2 -2
  125. metaflow-stubs/runner/deployer.pyi +7 -7
  126. metaflow-stubs/runner/deployer_impl.pyi +2 -2
  127. metaflow-stubs/runner/metaflow_runner.pyi +4 -4
  128. metaflow-stubs/runner/nbdeploy.pyi +2 -2
  129. metaflow-stubs/runner/nbrun.pyi +2 -2
  130. metaflow-stubs/runner/subprocess_manager.pyi +2 -2
  131. metaflow-stubs/runner/utils.pyi +3 -3
  132. metaflow-stubs/system/__init__.pyi +2 -2
  133. metaflow-stubs/system/system_logger.pyi +2 -2
  134. metaflow-stubs/system/system_monitor.pyi +2 -2
  135. metaflow-stubs/tagging_util.pyi +2 -2
  136. metaflow-stubs/tuple_util.pyi +2 -2
  137. metaflow-stubs/user_configs/__init__.pyi +2 -2
  138. metaflow-stubs/user_configs/config_decorators.pyi +6 -6
  139. metaflow-stubs/user_configs/config_options.pyi +3 -3
  140. metaflow-stubs/user_configs/config_parameters.pyi +3 -3
  141. metaflow-stubs/version.pyi +2 -2
  142. {metaflow_stubs-2.15.1.dist-info → metaflow_stubs-2.15.3.dist-info}/METADATA +2 -2
  143. metaflow_stubs-2.15.3.dist-info/RECORD +146 -0
  144. metaflow_stubs-2.15.1.dist-info/RECORD +0 -146
  145. {metaflow_stubs-2.15.1.dist-info → metaflow_stubs-2.15.3.dist-info}/WHEEL +0 -0
  146. {metaflow_stubs-2.15.1.dist-info → metaflow_stubs-2.15.3.dist-info}/top_level.txt +0 -0
@@ -1,7 +1,7 @@
1
1
  ######################################################################################################
2
2
  # Auto-generated Metaflow stub file #
3
- # MF version: 2.15.1 #
4
- # Generated on 2025-02-28T22:52:51.105998 #
3
+ # MF version: 2.15.3 #
4
+ # Generated on 2025-03-03T18:05:31.392412 #
5
5
  ######################################################################################################
6
6
 
7
7
  from __future__ import annotations
@@ -42,8 +42,8 @@ from . import plugins as plugins
42
42
  from .plugins.datatools.s3.s3 import S3 as S3
43
43
  from . import includefile as includefile
44
44
  from .includefile import IncludeFile as IncludeFile
45
- from .plugins.pypi.parsers import requirements_txt_parser as requirements_txt_parser
46
45
  from .plugins.pypi.parsers import pyproject_toml_parser as pyproject_toml_parser
46
+ from .plugins.pypi.parsers import requirements_txt_parser as requirements_txt_parser
47
47
  from .plugins.pypi.parsers import conda_environment_yml_parser as conda_environment_yml_parser
48
48
  from . import cards as cards
49
49
  from . import client as client
@@ -145,6 +145,65 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
145
145
  """
146
146
  ...
147
147
 
148
+ @typing.overload
149
+ 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]]]:
150
+ """
151
+ Specifies the Conda environment for the step.
152
+
153
+ Information in this decorator will augment any
154
+ attributes set in the `@conda_base` flow-level decorator. Hence,
155
+ you can use `@conda_base` to set packages required by all
156
+ steps and use `@conda` to specify step-specific overrides.
157
+
158
+
159
+ Parameters
160
+ ----------
161
+ packages : Dict[str, str], default {}
162
+ Packages to use for this step. The key is the name of the package
163
+ and the value is the version to use.
164
+ libraries : Dict[str, str], default {}
165
+ Supported for backward compatibility. When used with packages, packages will take precedence.
166
+ python : str, optional, default None
167
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
168
+ that the version used will correspond to the version of the Python interpreter used to start the run.
169
+ disabled : bool, default False
170
+ If set to True, disables @conda.
171
+ """
172
+ ...
173
+
174
+ @typing.overload
175
+ def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
176
+ ...
177
+
178
+ @typing.overload
179
+ def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
180
+ ...
181
+
182
+ 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):
183
+ """
184
+ Specifies the Conda environment for the step.
185
+
186
+ Information in this decorator will augment any
187
+ attributes set in the `@conda_base` flow-level decorator. Hence,
188
+ you can use `@conda_base` to set packages required by all
189
+ steps and use `@conda` to specify step-specific overrides.
190
+
191
+
192
+ Parameters
193
+ ----------
194
+ packages : Dict[str, str], default {}
195
+ Packages to use for this step. The key is the name of the package
196
+ and the value is the version to use.
197
+ libraries : Dict[str, str], default {}
198
+ Supported for backward compatibility. When used with packages, packages will take precedence.
199
+ python : str, optional, default None
200
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
201
+ that the version used will correspond to the version of the Python interpreter used to start the run.
202
+ disabled : bool, default False
203
+ If set to True, disables @conda.
204
+ """
205
+ ...
206
+
148
207
  @typing.overload
149
208
  def secrets(*, sources: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = []) -> 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]]]:
150
209
  """
@@ -181,64 +240,87 @@ def secrets(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None],
181
240
  ...
182
241
 
183
242
  @typing.overload
184
- 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]]]:
243
+ 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]]]:
185
244
  """
186
- Specifies the number of times the task corresponding
187
- to a step needs to be retried.
245
+ Specifies the resources needed when executing this step.
188
246
 
189
- This decorator is useful for handling transient errors, such as networking issues.
190
- If your task contains operations that can't be retried safely, e.g. database updates,
191
- it is advisable to annotate it with `@retry(times=0)`.
247
+ Use `@resources` to specify the resource requirements
248
+ independently of the specific compute layer (`@batch`, `@kubernetes`).
192
249
 
193
- This can be used in conjunction with the `@catch` decorator. The `@catch`
194
- decorator will execute a no-op task after all retries have been exhausted,
195
- ensuring that the flow execution can continue.
250
+ You can choose the compute layer on the command line by executing e.g.
251
+ ```
252
+ python myflow.py run --with batch
253
+ ```
254
+ or
255
+ ```
256
+ python myflow.py run --with kubernetes
257
+ ```
258
+ which executes the flow on the desired system using the
259
+ requirements specified in `@resources`.
196
260
 
197
261
 
198
262
  Parameters
199
263
  ----------
200
- times : int, default 3
201
- Number of times to retry this task.
202
- minutes_between_retries : int, default 2
203
- Number of minutes between retries.
264
+ cpu : int, default 1
265
+ Number of CPUs required for this step.
266
+ gpu : int, optional, default None
267
+ Number of GPUs required for this step.
268
+ disk : int, optional, default None
269
+ Disk size (in MB) required for this step. Only applies on Kubernetes.
270
+ memory : int, default 4096
271
+ Memory size (in MB) required for this step.
272
+ shared_memory : int, optional, default None
273
+ The value for the size (in MiB) of the /dev/shm volume for this step.
274
+ This parameter maps to the `--shm-size` option in Docker.
204
275
  """
205
276
  ...
206
277
 
207
278
  @typing.overload
208
- def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
279
+ def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
209
280
  ...
210
281
 
211
282
  @typing.overload
212
- def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
283
+ def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
213
284
  ...
214
285
 
215
- 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):
286
+ 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):
216
287
  """
217
- Specifies the number of times the task corresponding
218
- to a step needs to be retried.
288
+ Specifies the resources needed when executing this step.
219
289
 
220
- This decorator is useful for handling transient errors, such as networking issues.
221
- If your task contains operations that can't be retried safely, e.g. database updates,
222
- it is advisable to annotate it with `@retry(times=0)`.
290
+ Use `@resources` to specify the resource requirements
291
+ independently of the specific compute layer (`@batch`, `@kubernetes`).
223
292
 
224
- This can be used in conjunction with the `@catch` decorator. The `@catch`
225
- decorator will execute a no-op task after all retries have been exhausted,
226
- ensuring that the flow execution can continue.
293
+ You can choose the compute layer on the command line by executing e.g.
294
+ ```
295
+ python myflow.py run --with batch
296
+ ```
297
+ or
298
+ ```
299
+ python myflow.py run --with kubernetes
300
+ ```
301
+ which executes the flow on the desired system using the
302
+ requirements specified in `@resources`.
227
303
 
228
304
 
229
305
  Parameters
230
306
  ----------
231
- times : int, default 3
232
- Number of times to retry this task.
233
- minutes_between_retries : int, default 2
234
- Number of minutes between retries.
307
+ cpu : int, default 1
308
+ Number of CPUs required for this step.
309
+ gpu : int, optional, default None
310
+ Number of GPUs required for this step.
311
+ disk : int, optional, default None
312
+ Disk size (in MB) required for this step. Only applies on Kubernetes.
313
+ memory : int, default 4096
314
+ Memory size (in MB) required for this step.
315
+ shared_memory : int, optional, default None
316
+ The value for the size (in MiB) of the /dev/shm volume for this step.
317
+ This parameter maps to the `--shm-size` option in Docker.
235
318
  """
236
319
  ...
237
320
 
238
- @typing.overload
239
- 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, 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]]]:
321
+ def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: typing.Optional[str] = None, image_pull_policy: str = 'KUBERNETES_IMAGE_PULL_POLICY', service_account: str = 'METAFLOW_KUBERNETES_SERVICE_ACCOUNT', secrets: typing.Optional[typing.List[str]] = None, node_selector: typing.Union[typing.Dict[str, str], str, None] = None, namespace: str = 'METAFLOW_KUBERNETES_NAMESPACE', gpu: typing.Optional[int] = None, gpu_vendor: str = 'KUBERNETES_GPU_VENDOR', tolerations: typing.List[str] = [], labels: typing.Dict[str, str] = 'METAFLOW_KUBERNETES_LABELS', annotations: typing.Dict[str, str] = 'METAFLOW_KUBERNETES_ANNOTATIONS', use_tmpfs: bool = False, tmpfs_tempdir: bool = True, tmpfs_size: typing.Optional[int] = None, tmpfs_path: typing.Optional[str] = '/metaflow_temp', persistent_volume_claims: typing.Optional[typing.Dict[str, str]] = None, shared_memory: typing.Optional[int] = None, port: typing.Optional[int] = None, compute_pool: typing.Optional[str] = None, hostname_resolution_timeout: int = 600, qos: str = 'Burstable') -> 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]]]:
240
322
  """
241
- Specifies that this step should execute on [AWS Batch](https://aws.amazon.com/batch/).
323
+ Specifies that this step should execute on Kubernetes.
242
324
 
243
325
 
244
326
  Parameters
@@ -246,80 +328,309 @@ def batch(*, cpu: int = 1, gpu: int = 0, memory: int = 4096, image: typing.Optio
246
328
  cpu : int, default 1
247
329
  Number of CPUs required for this step. If `@resources` is
248
330
  also present, the maximum value from all decorators is used.
249
- gpu : int, default 0
250
- Number of GPUs required for this step. If `@resources` is
251
- also present, the maximum value from all decorators is used.
252
331
  memory : int, default 4096
253
332
  Memory size (in MB) required for this step. If
254
333
  `@resources` is also present, the maximum value from all decorators is
255
334
  used.
335
+ disk : int, default 10240
336
+ Disk size (in MB) required for this step. If
337
+ `@resources` is also present, the maximum value from all decorators is
338
+ used.
256
339
  image : str, optional, default None
257
- Docker image to use when launching on AWS Batch. If not specified, and
258
- METAFLOW_BATCH_CONTAINER_IMAGE is specified, that image is used. If
340
+ Docker image to use when launching on Kubernetes. If not specified, and
341
+ METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
259
342
  not, a default Docker image mapping to the current version of Python is used.
260
- queue : str, default METAFLOW_BATCH_JOB_QUEUE
261
- AWS Batch Job Queue to submit the job to.
262
- iam_role : str, default METAFLOW_ECS_S3_ACCESS_IAM_ROLE
263
- AWS IAM role that AWS Batch container uses to access AWS cloud resources.
264
- execution_role : str, default METAFLOW_ECS_FARGATE_EXECUTION_ROLE
265
- AWS IAM role that AWS Batch can use [to trigger AWS Fargate tasks]
266
- (https://docs.aws.amazon.com/batch/latest/userguide/execution-IAM-role.html).
267
- shared_memory : int, optional, default None
268
- The value for the size (in MiB) of the /dev/shm volume for this step.
269
- This parameter maps to the `--shm-size` option in Docker.
270
- max_swap : int, optional, default None
271
- The total amount of swap memory (in MiB) a container can use for this
272
- step. This parameter is translated to the `--memory-swap` option in
273
- Docker where the value is the sum of the container memory plus the
274
- `max_swap` value.
275
- swappiness : int, optional, default None
276
- This allows you to tune memory swappiness behavior for this step.
277
- A swappiness value of 0 causes swapping not to happen unless absolutely
278
- necessary. A swappiness value of 100 causes pages to be swapped very
279
- aggressively. Accepted values are whole numbers between 0 and 100.
343
+ image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
344
+ If given, the imagePullPolicy to be applied to the Docker image of the step.
345
+ service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
346
+ Kubernetes service account to use when launching pod in Kubernetes.
347
+ secrets : List[str], optional, default None
348
+ Kubernetes secrets to use when launching pod in Kubernetes. These
349
+ secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
350
+ in Metaflow configuration.
351
+ node_selector: Union[Dict[str,str], str], optional, default None
352
+ Kubernetes node selector(s) to apply to the pod running the task.
353
+ Can be passed in as a comma separated string of values e.g.
354
+ 'kubernetes.io/os=linux,kubernetes.io/arch=amd64' or as a dictionary
355
+ {'kubernetes.io/os': 'linux', 'kubernetes.io/arch': 'amd64'}
356
+ namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
357
+ Kubernetes namespace to use when launching pod in Kubernetes.
358
+ gpu : int, optional, default None
359
+ Number of GPUs required for this step. A value of zero implies that
360
+ the scheduled node should not have GPUs.
361
+ gpu_vendor : str, default KUBERNETES_GPU_VENDOR
362
+ The vendor of the GPUs to be used for this step.
363
+ tolerations : List[str], default []
364
+ The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
365
+ Kubernetes tolerations to use when launching pod in Kubernetes.
366
+ labels: Dict[str, str], default: METAFLOW_KUBERNETES_LABELS
367
+ Kubernetes labels to use when launching pod in Kubernetes.
368
+ annotations: Dict[str, str], default: METAFLOW_KUBERNETES_ANNOTATIONS
369
+ Kubernetes annotations to use when launching pod in Kubernetes.
280
370
  use_tmpfs : bool, default False
281
- This enables an explicit tmpfs mount for this step. Note that tmpfs is
282
- not available on Fargate compute environments
371
+ This enables an explicit tmpfs mount for this step.
283
372
  tmpfs_tempdir : bool, default True
284
373
  sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
285
- tmpfs_size : int, optional, default None
374
+ tmpfs_size : int, optional, default: None
286
375
  The value for the size (in MiB) of the tmpfs mount for this step.
287
376
  This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
288
377
  memory allocated for this step.
289
- tmpfs_path : str, optional, default None
290
- Path to tmpfs mount for this step. Defaults to /metaflow_temp.
291
- inferentia : int, default 0
292
- Number of Inferentia chips required for this step.
293
- trainium : int, default None
294
- Alias for inferentia. Use only one of the two.
295
- efa : int, default 0
296
- Number of elastic fabric adapter network devices to attach to container
297
- ephemeral_storage : int, default None
298
- The total amount, in GiB, of ephemeral storage to set for the task, 21-200GiB.
299
- This is only relevant for Fargate compute environments
300
- log_driver: str, optional, default None
301
- The log driver to use for the Amazon ECS container.
302
- log_options: List[str], optional, default None
303
- List of strings containing options for the chosen log driver. The configurable values
304
- depend on the `log driver` chosen. Validation of these options is not supported yet.
305
- Example: [`awslogs-group:aws/batch/job`]
378
+ tmpfs_path : str, optional, default /metaflow_temp
379
+ Path to tmpfs mount for this step.
380
+ persistent_volume_claims : Dict[str, str], optional, default None
381
+ A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
382
+ volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
383
+ shared_memory: int, optional
384
+ Shared memory size (in MiB) required for this step
385
+ port: int, optional
386
+ Port number to specify in the Kubernetes job object
387
+ compute_pool : str, optional, default None
388
+ Compute pool to be used for for this step.
389
+ If not specified, any accessible compute pool within the perimeter is used.
390
+ hostname_resolution_timeout: int, default 10 * 60
391
+ Timeout in seconds for the workers tasks in the gang scheduled cluster to resolve the hostname of control task.
392
+ Only applicable when @parallel is used.
393
+ qos: str, default: Burstable
394
+ Quality of Service class to assign to the pod. Supported values are: Guaranteed, Burstable, BestEffort
306
395
  """
307
396
  ...
308
397
 
309
398
  @typing.overload
310
- def batch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
311
- ...
312
-
313
- @typing.overload
314
- def batch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
315
- ...
316
-
317
- def batch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, 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, 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):
399
+ 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]]]:
318
400
  """
319
- Specifies that this step should execute on [AWS Batch](https://aws.amazon.com/batch/).
320
-
401
+ Specifies the PyPI packages for the step.
321
402
 
322
- Parameters
403
+ Information in this decorator will augment any
404
+ attributes set in the `@pyi_base` flow-level decorator. Hence,
405
+ you can use `@pypi_base` to set packages required by all
406
+ steps and use `@pypi` to specify step-specific overrides.
407
+
408
+
409
+ Parameters
410
+ ----------
411
+ packages : Dict[str, str], default: {}
412
+ Packages to use for this step. The key is the name of the package
413
+ and the value is the version to use.
414
+ python : str, optional, default: None
415
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
416
+ that the version used will correspond to the version of the Python interpreter used to start the run.
417
+ """
418
+ ...
419
+
420
+ @typing.overload
421
+ def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
422
+ ...
423
+
424
+ @typing.overload
425
+ def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
426
+ ...
427
+
428
+ 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):
429
+ """
430
+ Specifies the PyPI packages for the step.
431
+
432
+ Information in this decorator will augment any
433
+ attributes set in the `@pyi_base` flow-level decorator. Hence,
434
+ you can use `@pypi_base` to set packages required by all
435
+ steps and use `@pypi` to specify step-specific overrides.
436
+
437
+
438
+ Parameters
439
+ ----------
440
+ packages : Dict[str, str], default: {}
441
+ Packages to use for this step. The key is the name of the package
442
+ and the value is the version to use.
443
+ python : str, optional, default: None
444
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
445
+ that the version used will correspond to the version of the Python interpreter used to start the run.
446
+ """
447
+ ...
448
+
449
+ @typing.overload
450
+ 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]]]:
451
+ """
452
+ Specifies that the step will success under all circumstances.
453
+
454
+ The decorator will create an optional artifact, specified by `var`, which
455
+ contains the exception raised. You can use it to detect the presence
456
+ of errors, indicating that all happy-path artifacts produced by the step
457
+ are missing.
458
+
459
+
460
+ Parameters
461
+ ----------
462
+ var : str, optional, default None
463
+ Name of the artifact in which to store the caught exception.
464
+ If not specified, the exception is not stored.
465
+ print_exception : bool, default True
466
+ Determines whether or not the exception is printed to
467
+ stdout when caught.
468
+ """
469
+ ...
470
+
471
+ @typing.overload
472
+ def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
473
+ ...
474
+
475
+ @typing.overload
476
+ def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
477
+ ...
478
+
479
+ 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):
480
+ """
481
+ Specifies that the step will success under all circumstances.
482
+
483
+ The decorator will create an optional artifact, specified by `var`, which
484
+ contains the exception raised. You can use it to detect the presence
485
+ of errors, indicating that all happy-path artifacts produced by the step
486
+ are missing.
487
+
488
+
489
+ Parameters
490
+ ----------
491
+ var : str, optional, default None
492
+ Name of the artifact in which to store the caught exception.
493
+ If not specified, the exception is not stored.
494
+ print_exception : bool, default True
495
+ Determines whether or not the exception is printed to
496
+ stdout when caught.
497
+ """
498
+ ...
499
+
500
+ @typing.overload
501
+ 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]]]:
502
+ """
503
+ Creates a human-readable report, a Metaflow Card, after this step completes.
504
+
505
+ Note that you may add multiple `@card` decorators in a step with different parameters.
506
+
507
+
508
+ Parameters
509
+ ----------
510
+ type : str, default 'default'
511
+ Card type.
512
+ id : str, optional, default None
513
+ If multiple cards are present, use this id to identify this card.
514
+ options : Dict[str, Any], default {}
515
+ Options passed to the card. The contents depend on the card type.
516
+ timeout : int, default 45
517
+ Interrupt reporting if it takes more than this many seconds.
518
+ """
519
+ ...
520
+
521
+ @typing.overload
522
+ def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
523
+ ...
524
+
525
+ @typing.overload
526
+ def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
527
+ ...
528
+
529
+ 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):
530
+ """
531
+ Creates a human-readable report, a Metaflow Card, after this step completes.
532
+
533
+ Note that you may add multiple `@card` decorators in a step with different parameters.
534
+
535
+
536
+ Parameters
537
+ ----------
538
+ type : str, default 'default'
539
+ Card type.
540
+ id : str, optional, default None
541
+ If multiple cards are present, use this id to identify this card.
542
+ options : Dict[str, Any], default {}
543
+ Options passed to the card. The contents depend on the card type.
544
+ timeout : int, default 45
545
+ Interrupt reporting if it takes more than this many seconds.
546
+ """
547
+ ...
548
+
549
+ @typing.overload
550
+ 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, 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]]]:
551
+ """
552
+ Specifies that this step should execute on [AWS Batch](https://aws.amazon.com/batch/).
553
+
554
+
555
+ Parameters
556
+ ----------
557
+ cpu : int, default 1
558
+ Number of CPUs required for this step. If `@resources` is
559
+ also present, the maximum value from all decorators is used.
560
+ gpu : int, default 0
561
+ Number of GPUs required for this step. If `@resources` is
562
+ also present, the maximum value from all decorators is used.
563
+ memory : int, default 4096
564
+ Memory size (in MB) required for this step. If
565
+ `@resources` is also present, the maximum value from all decorators is
566
+ used.
567
+ image : str, optional, default None
568
+ Docker image to use when launching on AWS Batch. If not specified, and
569
+ METAFLOW_BATCH_CONTAINER_IMAGE is specified, that image is used. If
570
+ not, a default Docker image mapping to the current version of Python is used.
571
+ queue : str, default METAFLOW_BATCH_JOB_QUEUE
572
+ AWS Batch Job Queue to submit the job to.
573
+ iam_role : str, default METAFLOW_ECS_S3_ACCESS_IAM_ROLE
574
+ AWS IAM role that AWS Batch container uses to access AWS cloud resources.
575
+ execution_role : str, default METAFLOW_ECS_FARGATE_EXECUTION_ROLE
576
+ AWS IAM role that AWS Batch can use [to trigger AWS Fargate tasks]
577
+ (https://docs.aws.amazon.com/batch/latest/userguide/execution-IAM-role.html).
578
+ shared_memory : int, optional, default None
579
+ The value for the size (in MiB) of the /dev/shm volume for this step.
580
+ This parameter maps to the `--shm-size` option in Docker.
581
+ max_swap : int, optional, default None
582
+ The total amount of swap memory (in MiB) a container can use for this
583
+ step. This parameter is translated to the `--memory-swap` option in
584
+ Docker where the value is the sum of the container memory plus the
585
+ `max_swap` value.
586
+ swappiness : int, optional, default None
587
+ This allows you to tune memory swappiness behavior for this step.
588
+ A swappiness value of 0 causes swapping not to happen unless absolutely
589
+ necessary. A swappiness value of 100 causes pages to be swapped very
590
+ aggressively. Accepted values are whole numbers between 0 and 100.
591
+ use_tmpfs : bool, default False
592
+ This enables an explicit tmpfs mount for this step. Note that tmpfs is
593
+ not available on Fargate compute environments
594
+ tmpfs_tempdir : bool, default True
595
+ sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
596
+ tmpfs_size : int, optional, default None
597
+ The value for the size (in MiB) of the tmpfs mount for this step.
598
+ This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
599
+ memory allocated for this step.
600
+ tmpfs_path : str, optional, default None
601
+ Path to tmpfs mount for this step. Defaults to /metaflow_temp.
602
+ inferentia : int, default 0
603
+ Number of Inferentia chips required for this step.
604
+ trainium : int, default None
605
+ Alias for inferentia. Use only one of the two.
606
+ efa : int, default 0
607
+ Number of elastic fabric adapter network devices to attach to container
608
+ ephemeral_storage : int, default None
609
+ The total amount, in GiB, of ephemeral storage to set for the task, 21-200GiB.
610
+ This is only relevant for Fargate compute environments
611
+ log_driver: str, optional, default None
612
+ The log driver to use for the Amazon ECS container.
613
+ log_options: List[str], optional, default None
614
+ List of strings containing options for the chosen log driver. The configurable values
615
+ depend on the `log driver` chosen. Validation of these options is not supported yet.
616
+ Example: [`awslogs-group:aws/batch/job`]
617
+ """
618
+ ...
619
+
620
+ @typing.overload
621
+ def batch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
622
+ ...
623
+
624
+ @typing.overload
625
+ def batch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
626
+ ...
627
+
628
+ def batch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, 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, 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):
629
+ """
630
+ Specifies that this step should execute on [AWS Batch](https://aws.amazon.com/batch/).
631
+
632
+
633
+ Parameters
323
634
  ----------
324
635
  cpu : int, default 1
325
636
  Number of CPUs required for this step. If `@resources` is
@@ -384,6 +695,25 @@ def batch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
384
695
  """
385
696
  ...
386
697
 
698
+ @typing.overload
699
+ def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
700
+ """
701
+ Decorator prototype for all step decorators. This function gets specialized
702
+ and imported for all decorators types by _import_plugin_decorators().
703
+ """
704
+ ...
705
+
706
+ @typing.overload
707
+ def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
708
+ ...
709
+
710
+ def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
711
+ """
712
+ Decorator prototype for all step decorators. This function gets specialized
713
+ and imported for all decorators types by _import_plugin_decorators().
714
+ """
715
+ ...
716
+
387
717
  @typing.overload
388
718
  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]]]:
389
719
  """
@@ -444,463 +774,90 @@ def timeout(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None],
444
774
  ...
445
775
 
446
776
  @typing.overload
447
- def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
448
- """
449
- Decorator prototype for all step decorators. This function gets specialized
450
- and imported for all decorators types by _import_plugin_decorators().
777
+ 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]]]:
451
778
  """
452
- ...
453
-
454
- @typing.overload
455
- def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
456
- ...
457
-
458
- def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
459
- """
460
- Decorator prototype for all step decorators. This function gets specialized
461
- and imported for all decorators types by _import_plugin_decorators().
462
- """
463
- ...
464
-
465
- @typing.overload
466
- 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]]]:
467
- """
468
- Specifies the resources needed when executing this step.
469
-
470
- Use `@resources` to specify the resource requirements
471
- independently of the specific compute layer (`@batch`, `@kubernetes`).
472
-
473
- You can choose the compute layer on the command line by executing e.g.
474
- ```
475
- python myflow.py run --with batch
476
- ```
477
- or
478
- ```
479
- python myflow.py run --with kubernetes
480
- ```
481
- which executes the flow on the desired system using the
482
- requirements specified in `@resources`.
483
-
484
-
485
- Parameters
486
- ----------
487
- cpu : int, default 1
488
- Number of CPUs required for this step.
489
- gpu : int, optional, default None
490
- Number of GPUs required for this step.
491
- disk : int, optional, default None
492
- Disk size (in MB) required for this step. Only applies on Kubernetes.
493
- memory : int, default 4096
494
- Memory size (in MB) required for this step.
495
- shared_memory : int, optional, default None
496
- The value for the size (in MiB) of the /dev/shm volume for this step.
497
- This parameter maps to the `--shm-size` option in Docker.
498
- """
499
- ...
500
-
501
- @typing.overload
502
- def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
503
- ...
504
-
505
- @typing.overload
506
- def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
507
- ...
508
-
509
- 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):
510
- """
511
- Specifies the resources needed when executing this step.
512
-
513
- Use `@resources` to specify the resource requirements
514
- independently of the specific compute layer (`@batch`, `@kubernetes`).
515
-
516
- You can choose the compute layer on the command line by executing e.g.
517
- ```
518
- python myflow.py run --with batch
519
- ```
520
- or
521
- ```
522
- python myflow.py run --with kubernetes
523
- ```
524
- which executes the flow on the desired system using the
525
- requirements specified in `@resources`.
526
-
527
-
528
- Parameters
529
- ----------
530
- cpu : int, default 1
531
- Number of CPUs required for this step.
532
- gpu : int, optional, default None
533
- Number of GPUs required for this step.
534
- disk : int, optional, default None
535
- Disk size (in MB) required for this step. Only applies on Kubernetes.
536
- memory : int, default 4096
537
- Memory size (in MB) required for this step.
538
- shared_memory : int, optional, default None
539
- The value for the size (in MiB) of the /dev/shm volume for this step.
540
- This parameter maps to the `--shm-size` option in Docker.
541
- """
542
- ...
543
-
544
- @typing.overload
545
- 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]]]:
546
- """
547
- Specifies the PyPI packages for the step.
548
-
549
- Information in this decorator will augment any
550
- attributes set in the `@pyi_base` flow-level decorator. Hence,
551
- you can use `@pypi_base` to set packages required by all
552
- steps and use `@pypi` to specify step-specific overrides.
553
-
554
-
555
- Parameters
556
- ----------
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
- python : str, optional, default: None
561
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
562
- that the version used will correspond to the version of the Python interpreter used to start the run.
563
- """
564
- ...
565
-
566
- @typing.overload
567
- def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
568
- ...
569
-
570
- @typing.overload
571
- def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
572
- ...
573
-
574
- 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):
575
- """
576
- Specifies the PyPI packages for the step.
577
-
578
- Information in this decorator will augment any
579
- attributes set in the `@pyi_base` flow-level decorator. Hence,
580
- you can use `@pypi_base` to set packages required by all
581
- steps and use `@pypi` to specify step-specific overrides.
582
-
779
+ Specifies the number of times the task corresponding
780
+ to a step needs to be retried.
583
781
 
584
- Parameters
585
- ----------
586
- packages : Dict[str, str], default: {}
587
- Packages to use for this step. The key is the name of the package
588
- and the value is the version to use.
589
- python : str, optional, default: None
590
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
591
- that the version used will correspond to the version of the Python interpreter used to start the run.
592
- """
593
- ...
594
-
595
- @typing.overload
596
- 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]]]:
597
- """
598
- Specifies that the step will success under all circumstances.
782
+ This decorator is useful for handling transient errors, such as networking issues.
783
+ If your task contains operations that can't be retried safely, e.g. database updates,
784
+ it is advisable to annotate it with `@retry(times=0)`.
599
785
 
600
- The decorator will create an optional artifact, specified by `var`, which
601
- contains the exception raised. You can use it to detect the presence
602
- of errors, indicating that all happy-path artifacts produced by the step
603
- are missing.
786
+ This can be used in conjunction with the `@catch` decorator. The `@catch`
787
+ decorator will execute a no-op task after all retries have been exhausted,
788
+ ensuring that the flow execution can continue.
604
789
 
605
790
 
606
791
  Parameters
607
792
  ----------
608
- var : str, optional, default None
609
- Name of the artifact in which to store the caught exception.
610
- If not specified, the exception is not stored.
611
- print_exception : bool, default True
612
- Determines whether or not the exception is printed to
613
- stdout when caught.
793
+ times : int, default 3
794
+ Number of times to retry this task.
795
+ minutes_between_retries : int, default 2
796
+ Number of minutes between retries.
614
797
  """
615
798
  ...
616
799
 
617
800
  @typing.overload
618
- def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
801
+ def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
619
802
  ...
620
803
 
621
804
  @typing.overload
622
- def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
623
- ...
624
-
625
- 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):
626
- """
627
- Specifies that the step will success under all circumstances.
628
-
629
- The decorator will create an optional artifact, specified by `var`, which
630
- contains the exception raised. You can use it to detect the presence
631
- of errors, indicating that all happy-path artifacts produced by the step
632
- are missing.
633
-
634
-
635
- Parameters
636
- ----------
637
- var : str, optional, default None
638
- Name of the artifact in which to store the caught exception.
639
- If not specified, the exception is not stored.
640
- print_exception : bool, default True
641
- Determines whether or not the exception is printed to
642
- stdout when caught.
643
- """
805
+ def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
644
806
  ...
645
807
 
646
- @typing.overload
647
- 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]]]:
808
+ 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):
648
809
  """
649
- Specifies the Conda environment for the step.
650
-
651
- Information in this decorator will augment any
652
- attributes set in the `@conda_base` flow-level decorator. Hence,
653
- you can use `@conda_base` to set packages required by all
654
- steps and use `@conda` to specify step-specific overrides.
655
-
810
+ Specifies the number of times the task corresponding
811
+ to a step needs to be retried.
656
812
 
657
- Parameters
658
- ----------
659
- packages : Dict[str, str], default {}
660
- Packages to use for this step. The key is the name of the package
661
- and the value is the version to use.
662
- libraries : Dict[str, str], default {}
663
- Supported for backward compatibility. When used with packages, packages will take precedence.
664
- python : str, optional, default None
665
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
666
- that the version used will correspond to the version of the Python interpreter used to start the run.
667
- disabled : bool, default False
668
- If set to True, disables @conda.
669
- """
670
- ...
671
-
672
- @typing.overload
673
- def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
674
- ...
675
-
676
- @typing.overload
677
- def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
678
- ...
679
-
680
- 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):
681
- """
682
- Specifies the Conda environment for the step.
813
+ This decorator is useful for handling transient errors, such as networking issues.
814
+ If your task contains operations that can't be retried safely, e.g. database updates,
815
+ it is advisable to annotate it with `@retry(times=0)`.
683
816
 
684
- Information in this decorator will augment any
685
- attributes set in the `@conda_base` flow-level decorator. Hence,
686
- you can use `@conda_base` to set packages required by all
687
- steps and use `@conda` to specify step-specific overrides.
817
+ This can be used in conjunction with the `@catch` decorator. The `@catch`
818
+ decorator will execute a no-op task after all retries have been exhausted,
819
+ ensuring that the flow execution can continue.
688
820
 
689
821
 
690
822
  Parameters
691
823
  ----------
692
- packages : Dict[str, str], default {}
693
- Packages to use for this step. The key is the name of the package
694
- and the value is the version to use.
695
- libraries : Dict[str, str], default {}
696
- Supported for backward compatibility. When used with packages, packages will take precedence.
697
- python : str, optional, default None
698
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
699
- that the version used will correspond to the version of the Python interpreter used to start the run.
700
- disabled : bool, default False
701
- If set to True, disables @conda.
824
+ times : int, default 3
825
+ Number of times to retry this task.
826
+ minutes_between_retries : int, default 2
827
+ Number of minutes between retries.
702
828
  """
703
829
  ...
704
830
 
705
831
  @typing.overload
706
832
  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]]]:
707
- """
708
- Specifies environment variables to be set prior to the execution of a step.
709
-
710
-
711
- Parameters
712
- ----------
713
- vars : Dict[str, str], default {}
714
- Dictionary of environment variables to set.
715
- """
716
- ...
717
-
718
- @typing.overload
719
- def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
720
- ...
721
-
722
- @typing.overload
723
- def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
724
- ...
725
-
726
- def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
727
- """
728
- Specifies environment variables to be set prior to the execution of a step.
729
-
730
-
731
- Parameters
732
- ----------
733
- vars : Dict[str, str], default {}
734
- Dictionary of environment variables to set.
735
- """
736
- ...
737
-
738
- def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: typing.Optional[str] = None, image_pull_policy: str = 'KUBERNETES_IMAGE_PULL_POLICY', service_account: str = 'METAFLOW_KUBERNETES_SERVICE_ACCOUNT', secrets: typing.Optional[typing.List[str]] = None, node_selector: typing.Union[typing.Dict[str, str], str, None] = None, namespace: str = 'METAFLOW_KUBERNETES_NAMESPACE', gpu: typing.Optional[int] = None, gpu_vendor: str = 'KUBERNETES_GPU_VENDOR', tolerations: typing.List[str] = [], labels: typing.Dict[str, str] = 'METAFLOW_KUBERNETES_LABELS', annotations: typing.Dict[str, str] = 'METAFLOW_KUBERNETES_ANNOTATIONS', use_tmpfs: bool = False, tmpfs_tempdir: bool = True, tmpfs_size: typing.Optional[int] = None, tmpfs_path: typing.Optional[str] = '/metaflow_temp', persistent_volume_claims: typing.Optional[typing.Dict[str, str]] = None, shared_memory: typing.Optional[int] = None, port: typing.Optional[int] = None, compute_pool: typing.Optional[str] = None, hostname_resolution_timeout: int = 600, qos: str = 'Burstable') -> 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]]]:
739
- """
740
- Specifies that this step should execute on Kubernetes.
741
-
742
-
743
- Parameters
744
- ----------
745
- cpu : int, default 1
746
- Number of CPUs required for this step. If `@resources` is
747
- also present, the maximum value from all decorators is used.
748
- memory : int, default 4096
749
- Memory size (in MB) required for this step. If
750
- `@resources` is also present, the maximum value from all decorators is
751
- used.
752
- disk : int, default 10240
753
- Disk size (in MB) required for this step. If
754
- `@resources` is also present, the maximum value from all decorators is
755
- used.
756
- image : str, optional, default None
757
- Docker image to use when launching on Kubernetes. If not specified, and
758
- METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
759
- not, a default Docker image mapping to the current version of Python is used.
760
- image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
761
- If given, the imagePullPolicy to be applied to the Docker image of the step.
762
- service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
763
- Kubernetes service account to use when launching pod in Kubernetes.
764
- secrets : List[str], optional, default None
765
- Kubernetes secrets to use when launching pod in Kubernetes. These
766
- secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
767
- in Metaflow configuration.
768
- node_selector: Union[Dict[str,str], str], optional, default None
769
- Kubernetes node selector(s) to apply to the pod running the task.
770
- Can be passed in as a comma separated string of values e.g.
771
- 'kubernetes.io/os=linux,kubernetes.io/arch=amd64' or as a dictionary
772
- {'kubernetes.io/os': 'linux', 'kubernetes.io/arch': 'amd64'}
773
- namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
774
- Kubernetes namespace to use when launching pod in Kubernetes.
775
- gpu : int, optional, default None
776
- Number of GPUs required for this step. A value of zero implies that
777
- the scheduled node should not have GPUs.
778
- gpu_vendor : str, default KUBERNETES_GPU_VENDOR
779
- The vendor of the GPUs to be used for this step.
780
- tolerations : List[str], default []
781
- The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
782
- Kubernetes tolerations to use when launching pod in Kubernetes.
783
- labels: Dict[str, str], default: METAFLOW_KUBERNETES_LABELS
784
- Kubernetes labels to use when launching pod in Kubernetes.
785
- annotations: Dict[str, str], default: METAFLOW_KUBERNETES_ANNOTATIONS
786
- Kubernetes annotations to use when launching pod in Kubernetes.
787
- use_tmpfs : bool, default False
788
- This enables an explicit tmpfs mount for this step.
789
- tmpfs_tempdir : bool, default True
790
- sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
791
- tmpfs_size : int, optional, default: None
792
- The value for the size (in MiB) of the tmpfs mount for this step.
793
- This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
794
- memory allocated for this step.
795
- tmpfs_path : str, optional, default /metaflow_temp
796
- Path to tmpfs mount for this step.
797
- persistent_volume_claims : Dict[str, str], optional, default None
798
- A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
799
- volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
800
- shared_memory: int, optional
801
- Shared memory size (in MiB) required for this step
802
- port: int, optional
803
- Port number to specify in the Kubernetes job object
804
- compute_pool : str, optional, default None
805
- Compute pool to be used for for this step.
806
- If not specified, any accessible compute pool within the perimeter is used.
807
- hostname_resolution_timeout: int, default 10 * 60
808
- Timeout in seconds for the workers tasks in the gang scheduled cluster to resolve the hostname of control task.
809
- Only applicable when @parallel is used.
810
- qos: str, default: Burstable
811
- Quality of Service class to assign to the pod. Supported values are: Guaranteed, Burstable, BestEffort
812
- """
813
- ...
814
-
815
- @typing.overload
816
- 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]]]:
817
- """
818
- Creates a human-readable report, a Metaflow Card, after this step completes.
819
-
820
- Note that you may add multiple `@card` decorators in a step with different parameters.
833
+ """
834
+ Specifies environment variables to be set prior to the execution of a step.
821
835
 
822
836
 
823
837
  Parameters
824
838
  ----------
825
- type : str, default 'default'
826
- Card type.
827
- id : str, optional, default None
828
- If multiple cards are present, use this id to identify this card.
829
- options : Dict[str, Any], default {}
830
- Options passed to the card. The contents depend on the card type.
831
- timeout : int, default 45
832
- Interrupt reporting if it takes more than this many seconds.
839
+ vars : Dict[str, str], default {}
840
+ Dictionary of environment variables to set.
833
841
  """
834
842
  ...
835
843
 
836
844
  @typing.overload
837
- def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
845
+ def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
838
846
  ...
839
847
 
840
848
  @typing.overload
841
- def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
842
- ...
843
-
844
- 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):
845
- """
846
- Creates a human-readable report, a Metaflow Card, after this step completes.
847
-
848
- Note that you may add multiple `@card` decorators in a step with different parameters.
849
-
850
-
851
- Parameters
852
- ----------
853
- type : str, default 'default'
854
- Card type.
855
- id : str, optional, default None
856
- If multiple cards are present, use this id to identify this card.
857
- options : Dict[str, Any], default {}
858
- Options passed to the card. The contents depend on the card type.
859
- timeout : int, default 45
860
- Interrupt reporting if it takes more than this many seconds.
861
- """
849
+ def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
862
850
  ...
863
851
 
864
- 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]]:
852
+ def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
865
853
  """
866
- 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.
867
- 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.
854
+ Specifies environment variables to be set prior to the execution of a step.
868
855
 
869
856
 
870
857
  Parameters
871
858
  ----------
872
- timeout : int
873
- Time, in seconds before the task times out and fails. (Default: 3600)
874
- poke_interval : int
875
- Time in seconds that the job should wait in between each try. (Default: 60)
876
- mode : str
877
- How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
878
- exponential_backoff : bool
879
- allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
880
- pool : str
881
- the slot pool this task should run in,
882
- slot pools are a way to limit concurrency for certain tasks. (Default:None)
883
- soft_fail : bool
884
- Set to true to mark the task as SKIPPED on failure. (Default: False)
885
- name : str
886
- Name of the sensor on Airflow
887
- description : str
888
- Description of sensor in the Airflow UI
889
- external_dag_id : str
890
- The dag_id that contains the task you want to wait for.
891
- external_task_ids : List[str]
892
- The list of task_ids that you want to wait for.
893
- If None (default value) the sensor waits for the DAG. (Default: None)
894
- allowed_states : List[str]
895
- Iterable of allowed states, (Default: ['success'])
896
- failed_states : List[str]
897
- Iterable of failed or dis-allowed states. (Default: None)
898
- execution_delta : datetime.timedelta
899
- time difference with the previous execution to look at,
900
- the default is the same logical date as the current task or DAG. (Default: None)
901
- check_existence: bool
902
- Set to True to check if the external task exists or check if
903
- the DAG to wait for exists. (Default: True)
859
+ vars : Dict[str, str], default {}
860
+ Dictionary of environment variables to set.
904
861
  """
905
862
  ...
906
863
 
@@ -945,13 +902,10 @@ def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packag
945
902
  """
946
903
  ...
947
904
 
948
- 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]]:
905
+ 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]]:
949
906
  """
950
- 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)
951
- before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
952
- and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
953
- added as a flow decorators. Adding more than one decorator will ensure that `start` step
954
- starts only after all sensors finish.
907
+ 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.
908
+ 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.
955
909
 
956
910
 
957
911
  Parameters
@@ -973,155 +927,114 @@ def airflow_s3_key_sensor(*, timeout: int, poke_interval: int, mode: str, expone
973
927
  Name of the sensor on Airflow
974
928
  description : str
975
929
  Description of sensor in the Airflow UI
976
- bucket_key : Union[str, List[str]]
977
- The key(s) being waited on. Supports full s3:// style url or relative path from root level.
978
- When it's specified as a full s3:// url, please leave `bucket_name` as None
979
- bucket_name : str
980
- Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
981
- When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
982
- wildcard_match : bool
983
- whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
984
- aws_conn_id : str
985
- a reference to the s3 connection on Airflow. (Default: None)
986
- verify : bool
987
- Whether or not to verify SSL certificates for S3 connection. (Default: None)
988
- """
989
- ...
990
-
991
- @typing.overload
992
- 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]]:
993
- """
994
- Specifies the times when the flow should be run when running on a
995
- production scheduler.
996
-
997
-
998
- Parameters
999
- ----------
1000
- hourly : bool, default False
1001
- Run the workflow hourly.
1002
- daily : bool, default True
1003
- Run the workflow daily.
1004
- weekly : bool, default False
1005
- Run the workflow weekly.
1006
- cron : str, optional, default None
1007
- Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1008
- specified by this expression.
1009
- timezone : str, optional, default None
1010
- Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1011
- which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
930
+ external_dag_id : str
931
+ The dag_id that contains the task you want to wait for.
932
+ external_task_ids : List[str]
933
+ The list of task_ids that you want to wait for.
934
+ If None (default value) the sensor waits for the DAG. (Default: None)
935
+ allowed_states : List[str]
936
+ Iterable of allowed states, (Default: ['success'])
937
+ failed_states : List[str]
938
+ Iterable of failed or dis-allowed states. (Default: None)
939
+ execution_delta : datetime.timedelta
940
+ time difference with the previous execution to look at,
941
+ the default is the same logical date as the current task or DAG. (Default: None)
942
+ check_existence: bool
943
+ Set to True to check if the external task exists or check if
944
+ the DAG to wait for exists. (Default: True)
1012
945
  """
1013
946
  ...
1014
947
 
1015
948
  @typing.overload
1016
- def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1017
- ...
1018
-
1019
- 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):
949
+ def trigger(*, event: typing.Union[str, typing.Dict[str, typing.Any], None] = None, events: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = [], options: typing.Dict[str, typing.Any] = {}) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1020
950
  """
1021
- Specifies the times when the flow should be run when running on a
1022
- production scheduler.
951
+ Specifies the event(s) that this flow depends on.
1023
952
 
953
+ ```
954
+ @trigger(event='foo')
955
+ ```
956
+ or
957
+ ```
958
+ @trigger(events=['foo', 'bar'])
959
+ ```
1024
960
 
1025
- Parameters
1026
- ----------
1027
- hourly : bool, default False
1028
- Run the workflow hourly.
1029
- daily : bool, default True
1030
- Run the workflow daily.
1031
- weekly : bool, default False
1032
- Run the workflow weekly.
1033
- cron : str, optional, default None
1034
- Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1035
- specified by this expression.
1036
- timezone : str, optional, default None
1037
- Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1038
- which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1039
- """
1040
- ...
1041
-
1042
- @typing.overload
1043
- 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]]:
1044
- """
1045
- Specifies the Conda environment for all steps of the flow.
961
+ Additionally, you can specify the parameter mappings
962
+ to map event payload to Metaflow parameters for the flow.
963
+ ```
964
+ @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
965
+ ```
966
+ or
967
+ ```
968
+ @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
969
+ {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
970
+ ```
1046
971
 
1047
- Use `@conda_base` to set common libraries required by all
1048
- steps and use `@conda` to specify step-specific additions.
972
+ 'parameters' can also be a list of strings and tuples like so:
973
+ ```
974
+ @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
975
+ ```
976
+ This is equivalent to:
977
+ ```
978
+ @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
979
+ ```
1049
980
 
1050
981
 
1051
982
  Parameters
1052
983
  ----------
1053
- packages : Dict[str, str], default {}
1054
- Packages to use for this flow. The key is the name of the package
1055
- and the value is the version to use.
1056
- libraries : Dict[str, str], default {}
1057
- Supported for backward compatibility. When used with packages, packages will take precedence.
1058
- python : str, optional, default None
1059
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1060
- that the version used will correspond to the version of the Python interpreter used to start the run.
1061
- disabled : bool, default False
1062
- If set to True, disables Conda.
984
+ event : Union[str, Dict[str, Any]], optional, default None
985
+ Event dependency for this flow.
986
+ events : List[Union[str, Dict[str, Any]]], default []
987
+ Events dependency for this flow.
988
+ options : Dict[str, Any], default {}
989
+ Backend-specific configuration for tuning eventing behavior.
1063
990
  """
1064
991
  ...
1065
992
 
1066
993
  @typing.overload
1067
- def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
994
+ def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1068
995
  ...
1069
996
 
1070
- def conda_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False):
997
+ def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, event: typing.Union[str, typing.Dict[str, typing.Any], None] = None, events: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = [], options: typing.Dict[str, typing.Any] = {}):
1071
998
  """
1072
- Specifies the Conda environment for all steps of the flow.
1073
-
1074
- Use `@conda_base` to set common libraries required by all
1075
- steps and use `@conda` to specify step-specific additions.
999
+ Specifies the event(s) that this flow depends on.
1076
1000
 
1001
+ ```
1002
+ @trigger(event='foo')
1003
+ ```
1004
+ or
1005
+ ```
1006
+ @trigger(events=['foo', 'bar'])
1007
+ ```
1077
1008
 
1078
- Parameters
1079
- ----------
1080
- packages : Dict[str, str], default {}
1081
- Packages to use for this flow. The key is the name of the package
1082
- and the value is the version to use.
1083
- libraries : Dict[str, str], default {}
1084
- Supported for backward compatibility. When used with packages, packages will take precedence.
1085
- python : str, optional, default None
1086
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1087
- that the version used will correspond to the version of the Python interpreter used to start the run.
1088
- disabled : bool, default False
1089
- If set to True, disables Conda.
1090
- """
1091
- ...
1092
-
1093
- def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1094
- """
1095
- Specifies what flows belong to the same project.
1009
+ Additionally, you can specify the parameter mappings
1010
+ to map event payload to Metaflow parameters for the flow.
1011
+ ```
1012
+ @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1013
+ ```
1014
+ or
1015
+ ```
1016
+ @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1017
+ {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1018
+ ```
1096
1019
 
1097
- A project-specific namespace is created for all flows that
1098
- use the same `@project(name)`.
1020
+ 'parameters' can also be a list of strings and tuples like so:
1021
+ ```
1022
+ @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1023
+ ```
1024
+ This is equivalent to:
1025
+ ```
1026
+ @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1027
+ ```
1099
1028
 
1100
1029
 
1101
1030
  Parameters
1102
1031
  ----------
1103
- name : str
1104
- Project name. Make sure that the name is unique amongst all
1105
- projects that use the same production scheduler. The name may
1106
- contain only lowercase alphanumeric characters and underscores.
1107
-
1108
- branch : Optional[str], default None
1109
- The branch to use. If not specified, the branch is set to
1110
- `user.<username>` unless `production` is set to `True`. This can
1111
- also be set on the command line using `--branch` as a top-level option.
1112
- It is an error to specify `branch` in the decorator and on the command line.
1113
-
1114
- production : bool, default False
1115
- Whether or not the branch is the production branch. This can also be set on the
1116
- command line using `--production` as a top-level option. It is an error to specify
1117
- `production` in the decorator and on the command line.
1118
- The project branch name will be:
1119
- - if `branch` is specified:
1120
- - if `production` is True: `prod.<branch>`
1121
- - if `production` is False: `test.<branch>`
1122
- - if `branch` is not specified:
1123
- - if `production` is True: `prod`
1124
- - if `production` is False: `user.<username>`
1032
+ event : Union[str, Dict[str, Any]], optional, default None
1033
+ Event dependency for this flow.
1034
+ events : List[Union[str, Dict[str, Any]]], default []
1035
+ Events dependency for this flow.
1036
+ options : Dict[str, Any], default {}
1037
+ Backend-specific configuration for tuning eventing behavior.
1125
1038
  """
1126
1039
  ...
1127
1040
 
@@ -1226,96 +1139,183 @@ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *
1226
1139
  """
1227
1140
  ...
1228
1141
 
1229
- @typing.overload
1230
- def trigger(*, event: typing.Union[str, typing.Dict[str, typing.Any], None] = None, events: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = [], options: typing.Dict[str, typing.Any] = {}) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1142
+ def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1231
1143
  """
1232
- Specifies the event(s) that this flow depends on.
1144
+ Specifies what flows belong to the same project.
1233
1145
 
1234
- ```
1235
- @trigger(event='foo')
1236
- ```
1237
- or
1238
- ```
1239
- @trigger(events=['foo', 'bar'])
1240
- ```
1146
+ A project-specific namespace is created for all flows that
1147
+ use the same `@project(name)`.
1241
1148
 
1242
- Additionally, you can specify the parameter mappings
1243
- to map event payload to Metaflow parameters for the flow.
1244
- ```
1245
- @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1246
- ```
1247
- or
1248
- ```
1249
- @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1250
- {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1251
- ```
1252
1149
 
1253
- 'parameters' can also be a list of strings and tuples like so:
1254
- ```
1255
- @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1256
- ```
1257
- This is equivalent to:
1258
- ```
1259
- @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1260
- ```
1150
+ Parameters
1151
+ ----------
1152
+ name : str
1153
+ Project name. Make sure that the name is unique amongst all
1154
+ projects that use the same production scheduler. The name may
1155
+ contain only lowercase alphanumeric characters and underscores.
1156
+
1157
+ branch : Optional[str], default None
1158
+ The branch to use. If not specified, the branch is set to
1159
+ `user.<username>` unless `production` is set to `True`. This can
1160
+ also be set on the command line using `--branch` as a top-level option.
1161
+ It is an error to specify `branch` in the decorator and on the command line.
1162
+
1163
+ production : bool, default False
1164
+ Whether or not the branch is the production branch. This can also be set on the
1165
+ command line using `--production` as a top-level option. It is an error to specify
1166
+ `production` in the decorator and on the command line.
1167
+ The project branch name will be:
1168
+ - if `branch` is specified:
1169
+ - if `production` is True: `prod.<branch>`
1170
+ - if `production` is False: `test.<branch>`
1171
+ - if `branch` is not specified:
1172
+ - if `production` is True: `prod`
1173
+ - if `production` is False: `user.<username>`
1174
+ """
1175
+ ...
1176
+
1177
+ @typing.overload
1178
+ 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]]:
1179
+ """
1180
+ Specifies the Conda environment for all steps of the flow.
1181
+
1182
+ Use `@conda_base` to set common libraries required by all
1183
+ steps and use `@conda` to specify step-specific additions.
1261
1184
 
1262
1185
 
1263
1186
  Parameters
1264
1187
  ----------
1265
- event : Union[str, Dict[str, Any]], optional, default None
1266
- Event dependency for this flow.
1267
- events : List[Union[str, Dict[str, Any]]], default []
1268
- Events dependency for this flow.
1269
- options : Dict[str, Any], default {}
1270
- Backend-specific configuration for tuning eventing behavior.
1188
+ packages : Dict[str, str], default {}
1189
+ Packages to use for this flow. The key is the name of the package
1190
+ and the value is the version to use.
1191
+ libraries : Dict[str, str], default {}
1192
+ Supported for backward compatibility. When used with packages, packages will take precedence.
1193
+ python : str, optional, default None
1194
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1195
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1196
+ disabled : bool, default False
1197
+ If set to True, disables Conda.
1271
1198
  """
1272
1199
  ...
1273
1200
 
1274
1201
  @typing.overload
1275
- def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1202
+ def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1276
1203
  ...
1277
1204
 
1278
- def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, event: typing.Union[str, typing.Dict[str, typing.Any], None] = None, events: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = [], options: typing.Dict[str, typing.Any] = {}):
1205
+ def conda_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False):
1279
1206
  """
1280
- Specifies the event(s) that this flow depends on.
1207
+ Specifies the Conda environment for all steps of the flow.
1281
1208
 
1282
- ```
1283
- @trigger(event='foo')
1284
- ```
1285
- or
1286
- ```
1287
- @trigger(events=['foo', 'bar'])
1288
- ```
1209
+ Use `@conda_base` to set common libraries required by all
1210
+ steps and use `@conda` to specify step-specific additions.
1289
1211
 
1290
- Additionally, you can specify the parameter mappings
1291
- to map event payload to Metaflow parameters for the flow.
1292
- ```
1293
- @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1294
- ```
1295
- or
1296
- ```
1297
- @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1298
- {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1299
- ```
1300
1212
 
1301
- 'parameters' can also be a list of strings and tuples like so:
1302
- ```
1303
- @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1304
- ```
1305
- This is equivalent to:
1306
- ```
1307
- @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1308
- ```
1213
+ Parameters
1214
+ ----------
1215
+ packages : Dict[str, str], default {}
1216
+ Packages to use for this flow. The key is the name of the package
1217
+ and the value is the version to use.
1218
+ libraries : Dict[str, str], default {}
1219
+ Supported for backward compatibility. When used with packages, packages will take precedence.
1220
+ python : str, optional, default None
1221
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1222
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1223
+ disabled : bool, default False
1224
+ If set to True, disables Conda.
1225
+ """
1226
+ ...
1227
+
1228
+ 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]]:
1229
+ """
1230
+ 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)
1231
+ before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
1232
+ and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
1233
+ added as a flow decorators. Adding more than one decorator will ensure that `start` step
1234
+ starts only after all sensors finish.
1309
1235
 
1310
1236
 
1311
1237
  Parameters
1312
1238
  ----------
1313
- event : Union[str, Dict[str, Any]], optional, default None
1314
- Event dependency for this flow.
1315
- events : List[Union[str, Dict[str, Any]]], default []
1316
- Events dependency for this flow.
1317
- options : Dict[str, Any], default {}
1318
- Backend-specific configuration for tuning eventing behavior.
1239
+ timeout : int
1240
+ Time, in seconds before the task times out and fails. (Default: 3600)
1241
+ poke_interval : int
1242
+ Time in seconds that the job should wait in between each try. (Default: 60)
1243
+ mode : str
1244
+ How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1245
+ exponential_backoff : bool
1246
+ allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1247
+ pool : str
1248
+ the slot pool this task should run in,
1249
+ slot pools are a way to limit concurrency for certain tasks. (Default:None)
1250
+ soft_fail : bool
1251
+ Set to true to mark the task as SKIPPED on failure. (Default: False)
1252
+ name : str
1253
+ Name of the sensor on Airflow
1254
+ description : str
1255
+ Description of sensor in the Airflow UI
1256
+ bucket_key : Union[str, List[str]]
1257
+ The key(s) being waited on. Supports full s3:// style url or relative path from root level.
1258
+ When it's specified as a full s3:// url, please leave `bucket_name` as None
1259
+ bucket_name : str
1260
+ Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
1261
+ When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
1262
+ wildcard_match : bool
1263
+ whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
1264
+ aws_conn_id : str
1265
+ a reference to the s3 connection on Airflow. (Default: None)
1266
+ verify : bool
1267
+ Whether or not to verify SSL certificates for S3 connection. (Default: None)
1268
+ """
1269
+ ...
1270
+
1271
+ @typing.overload
1272
+ 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]]:
1273
+ """
1274
+ Specifies the times when the flow should be run when running on a
1275
+ production scheduler.
1276
+
1277
+
1278
+ Parameters
1279
+ ----------
1280
+ hourly : bool, default False
1281
+ Run the workflow hourly.
1282
+ daily : bool, default True
1283
+ Run the workflow daily.
1284
+ weekly : bool, default False
1285
+ Run the workflow weekly.
1286
+ cron : str, optional, default None
1287
+ Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1288
+ specified by this expression.
1289
+ timezone : str, optional, default None
1290
+ Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1291
+ which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1292
+ """
1293
+ ...
1294
+
1295
+ @typing.overload
1296
+ def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1297
+ ...
1298
+
1299
+ 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):
1300
+ """
1301
+ Specifies the times when the flow should be run when running on a
1302
+ production scheduler.
1303
+
1304
+
1305
+ Parameters
1306
+ ----------
1307
+ hourly : bool, default False
1308
+ Run the workflow hourly.
1309
+ daily : bool, default True
1310
+ Run the workflow daily.
1311
+ weekly : bool, default False
1312
+ Run the workflow weekly.
1313
+ cron : str, optional, default None
1314
+ Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1315
+ specified by this expression.
1316
+ timezone : str, optional, default None
1317
+ Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1318
+ which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1319
1319
  """
1320
1320
  ...
1321
1321