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