metaflow-stubs 2.15.4__py2.py3-none-any.whl → 2.15.5__py2.py3-none-any.whl

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