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