metaflow-stubs 2.16.4__py2.py3-none-any.whl → 2.16.6__py2.py3-none-any.whl

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

Potentially problematic release.


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

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