metaflow-stubs 2.15.19__py2.py3-none-any.whl → 2.15.20__py2.py3-none-any.whl

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

Potentially problematic release.


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

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