metaflow-stubs 2.15.12__py2.py3-none-any.whl → 2.15.13__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 (149) hide show
  1. metaflow-stubs/__init__.pyi +499 -499
  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 +2 -2
  14. metaflow-stubs/info_file.pyi +2 -2
  15. metaflow-stubs/metadata_provider/__init__.pyi +2 -2
  16. metaflow-stubs/metadata_provider/heartbeat.pyi +2 -2
  17. metaflow-stubs/metadata_provider/metadata.pyi +2 -2
  18. metaflow-stubs/metadata_provider/util.pyi +2 -2
  19. metaflow-stubs/metaflow_config.pyi +2 -4
  20. metaflow-stubs/metaflow_current.pyi +23 -23
  21. metaflow-stubs/metaflow_git.pyi +2 -2
  22. metaflow-stubs/multicore_utils.pyi +2 -2
  23. metaflow-stubs/parameters.pyi +2 -2
  24. metaflow-stubs/plugins/__init__.pyi +12 -12
  25. metaflow-stubs/plugins/airflow/__init__.pyi +2 -2
  26. metaflow-stubs/plugins/airflow/airflow_decorator.pyi +2 -2
  27. metaflow-stubs/plugins/airflow/airflow_utils.pyi +2 -2
  28. metaflow-stubs/plugins/airflow/exception.pyi +2 -2
  29. metaflow-stubs/plugins/airflow/sensors/__init__.pyi +2 -2
  30. metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +2 -2
  31. metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +2 -2
  32. metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +2 -2
  33. metaflow-stubs/plugins/argo/__init__.pyi +2 -2
  34. metaflow-stubs/plugins/argo/argo_client.pyi +2 -2
  35. metaflow-stubs/plugins/argo/argo_events.pyi +2 -2
  36. metaflow-stubs/plugins/argo/argo_workflows.pyi +2 -2
  37. metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +3 -3
  38. metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +2 -2
  39. metaflow-stubs/plugins/argo/argo_workflows_deployer_objects.pyi +3 -3
  40. metaflow-stubs/plugins/aws/__init__.pyi +3 -3
  41. metaflow-stubs/plugins/aws/aws_client.pyi +2 -2
  42. metaflow-stubs/plugins/aws/aws_utils.pyi +2 -2
  43. metaflow-stubs/plugins/aws/batch/__init__.pyi +2 -2
  44. metaflow-stubs/plugins/aws/batch/batch.pyi +2 -2
  45. metaflow-stubs/plugins/aws/batch/batch_client.pyi +2 -2
  46. metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +2 -2
  47. metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +2 -2
  48. metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +3 -3
  49. metaflow-stubs/plugins/aws/step_functions/__init__.pyi +2 -2
  50. metaflow-stubs/plugins/aws/step_functions/dynamo_db_client.pyi +2 -2
  51. metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +2 -2
  52. metaflow-stubs/plugins/aws/step_functions/schedule_decorator.pyi +2 -2
  53. metaflow-stubs/plugins/aws/step_functions/step_functions.pyi +2 -2
  54. metaflow-stubs/plugins/aws/step_functions/step_functions_client.pyi +2 -2
  55. metaflow-stubs/plugins/aws/step_functions/step_functions_decorator.pyi +2 -2
  56. metaflow-stubs/plugins/aws/step_functions/step_functions_deployer.pyi +2 -2
  57. metaflow-stubs/plugins/aws/step_functions/step_functions_deployer_objects.pyi +2 -2
  58. metaflow-stubs/plugins/azure/__init__.pyi +2 -2
  59. metaflow-stubs/plugins/azure/azure_credential.pyi +2 -2
  60. metaflow-stubs/plugins/azure/azure_exceptions.pyi +2 -2
  61. metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +3 -3
  62. metaflow-stubs/plugins/azure/azure_utils.pyi +2 -2
  63. metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +2 -2
  64. metaflow-stubs/plugins/azure/includefile_support.pyi +2 -2
  65. metaflow-stubs/plugins/cards/__init__.pyi +2 -2
  66. metaflow-stubs/plugins/cards/card_client.pyi +3 -3
  67. metaflow-stubs/plugins/cards/card_creator.pyi +2 -2
  68. metaflow-stubs/plugins/cards/card_datastore.pyi +2 -2
  69. metaflow-stubs/plugins/cards/card_decorator.pyi +2 -2
  70. metaflow-stubs/plugins/cards/card_modules/__init__.pyi +2 -2
  71. metaflow-stubs/plugins/cards/card_modules/basic.pyi +3 -3
  72. metaflow-stubs/plugins/cards/card_modules/card.pyi +2 -2
  73. metaflow-stubs/plugins/cards/card_modules/components.pyi +3 -3
  74. metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +2 -2
  75. metaflow-stubs/plugins/cards/card_modules/renderer_tools.pyi +2 -2
  76. metaflow-stubs/plugins/cards/card_modules/test_cards.pyi +2 -2
  77. metaflow-stubs/plugins/cards/card_resolver.pyi +2 -2
  78. metaflow-stubs/plugins/cards/component_serializer.pyi +2 -2
  79. metaflow-stubs/plugins/cards/exception.pyi +2 -2
  80. metaflow-stubs/plugins/catch_decorator.pyi +2 -2
  81. metaflow-stubs/plugins/datatools/__init__.pyi +2 -2
  82. metaflow-stubs/plugins/datatools/local.pyi +2 -2
  83. metaflow-stubs/plugins/datatools/s3/__init__.pyi +2 -2
  84. metaflow-stubs/plugins/datatools/s3/s3.pyi +3 -3
  85. metaflow-stubs/plugins/datatools/s3/s3tail.pyi +2 -2
  86. metaflow-stubs/plugins/datatools/s3/s3util.pyi +2 -2
  87. metaflow-stubs/plugins/debug_logger.pyi +2 -2
  88. metaflow-stubs/plugins/debug_monitor.pyi +2 -2
  89. metaflow-stubs/plugins/environment_decorator.pyi +2 -2
  90. metaflow-stubs/plugins/events_decorator.pyi +2 -2
  91. metaflow-stubs/plugins/frameworks/__init__.pyi +2 -2
  92. metaflow-stubs/plugins/frameworks/pytorch.pyi +2 -2
  93. metaflow-stubs/plugins/gcp/__init__.pyi +2 -2
  94. metaflow-stubs/plugins/gcp/gcp_secret_manager_secrets_provider.pyi +3 -3
  95. metaflow-stubs/plugins/gcp/gs_exceptions.pyi +2 -2
  96. metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +2 -2
  97. metaflow-stubs/plugins/gcp/gs_utils.pyi +2 -2
  98. metaflow-stubs/plugins/gcp/includefile_support.pyi +2 -2
  99. metaflow-stubs/plugins/kubernetes/__init__.pyi +2 -2
  100. metaflow-stubs/plugins/kubernetes/kube_utils.pyi +2 -2
  101. metaflow-stubs/plugins/kubernetes/kubernetes.pyi +2 -2
  102. metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +2 -2
  103. metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +2 -2
  104. metaflow-stubs/plugins/kubernetes/kubernetes_job.pyi +2 -2
  105. metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +2 -2
  106. metaflow-stubs/plugins/kubernetes/spot_monitor_sidecar.pyi +2 -2
  107. metaflow-stubs/plugins/parallel_decorator.pyi +2 -2
  108. metaflow-stubs/plugins/project_decorator.pyi +2 -2
  109. metaflow-stubs/plugins/pypi/__init__.pyi +2 -2
  110. metaflow-stubs/plugins/pypi/conda_decorator.pyi +2 -2
  111. metaflow-stubs/plugins/pypi/conda_environment.pyi +4 -4
  112. metaflow-stubs/plugins/pypi/parsers.pyi +2 -2
  113. metaflow-stubs/plugins/pypi/pypi_decorator.pyi +2 -2
  114. metaflow-stubs/plugins/pypi/pypi_environment.pyi +2 -2
  115. metaflow-stubs/plugins/pypi/utils.pyi +2 -2
  116. metaflow-stubs/plugins/resources_decorator.pyi +2 -2
  117. metaflow-stubs/plugins/retry_decorator.pyi +2 -2
  118. metaflow-stubs/plugins/secrets/__init__.pyi +2 -2
  119. metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +3 -3
  120. metaflow-stubs/plugins/secrets/secrets_decorator.pyi +2 -2
  121. metaflow-stubs/plugins/storage_executor.pyi +2 -2
  122. metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +2 -2
  123. metaflow-stubs/plugins/timeout_decorator.pyi +2 -2
  124. metaflow-stubs/plugins/uv/__init__.pyi +2 -2
  125. metaflow-stubs/plugins/uv/uv_environment.pyi +2 -2
  126. metaflow-stubs/pylint_wrapper.pyi +2 -2
  127. metaflow-stubs/runner/__init__.pyi +2 -2
  128. metaflow-stubs/runner/deployer.pyi +30 -30
  129. metaflow-stubs/runner/deployer_impl.pyi +2 -2
  130. metaflow-stubs/runner/metaflow_runner.pyi +3 -3
  131. metaflow-stubs/runner/nbdeploy.pyi +2 -2
  132. metaflow-stubs/runner/nbrun.pyi +2 -2
  133. metaflow-stubs/runner/subprocess_manager.pyi +2 -2
  134. metaflow-stubs/runner/utils.pyi +2 -2
  135. metaflow-stubs/system/__init__.pyi +2 -2
  136. metaflow-stubs/system/system_logger.pyi +2 -2
  137. metaflow-stubs/system/system_monitor.pyi +2 -2
  138. metaflow-stubs/tagging_util.pyi +2 -2
  139. metaflow-stubs/tuple_util.pyi +2 -2
  140. metaflow-stubs/user_configs/__init__.pyi +2 -2
  141. metaflow-stubs/user_configs/config_decorators.pyi +6 -6
  142. metaflow-stubs/user_configs/config_options.pyi +2 -2
  143. metaflow-stubs/user_configs/config_parameters.pyi +4 -4
  144. metaflow-stubs/version.pyi +2 -2
  145. {metaflow_stubs-2.15.12.dist-info → metaflow_stubs-2.15.13.dist-info}/METADATA +2 -2
  146. metaflow_stubs-2.15.13.dist-info/RECORD +149 -0
  147. {metaflow_stubs-2.15.12.dist-info → metaflow_stubs-2.15.13.dist-info}/WHEEL +1 -1
  148. metaflow_stubs-2.15.12.dist-info/RECORD +0 -149
  149. {metaflow_stubs-2.15.12.dist-info → metaflow_stubs-2.15.13.dist-info}/top_level.txt +0 -0
@@ -1,7 +1,7 @@
1
1
  ######################################################################################################
2
2
  # Auto-generated Metaflow stub file #
3
- # MF version: 2.15.12 #
4
- # Generated on 2025-05-15T19:09:53.993231 #
3
+ # MF version: 2.15.13 #
4
+ # Generated on 2025-05-20T18:34:43.119385 #
5
5
  ######################################################################################################
6
6
 
7
7
  from __future__ import annotations
@@ -35,9 +35,9 @@ from .user_configs.config_parameters import ConfigValue as ConfigValue
35
35
  from .user_configs.config_parameters import config_expr as config_expr
36
36
  from .user_configs.config_decorators import CustomFlowDecorator as CustomFlowDecorator
37
37
  from .user_configs.config_decorators import CustomStepDecorator as CustomStepDecorator
38
- from . import events as events
39
38
  from . import tuple_util as tuple_util
40
39
  from . import metaflow_git as metaflow_git
40
+ from . import events as events
41
41
  from . import runner as runner
42
42
  from . import plugins as plugins
43
43
  from .plugins.datatools.s3.s3 import S3 as S3
@@ -146,55 +146,6 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
146
146
  """
147
147
  ...
148
148
 
149
- @typing.overload
150
- 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]]]:
151
- """
152
- Creates a human-readable report, a Metaflow Card, after this step completes.
153
-
154
- Note that you may add multiple `@card` decorators in a step with different parameters.
155
-
156
-
157
- Parameters
158
- ----------
159
- type : str, default 'default'
160
- Card type.
161
- id : str, optional, default None
162
- If multiple cards are present, use this id to identify this card.
163
- options : Dict[str, Any], default {}
164
- Options passed to the card. The contents depend on the card type.
165
- timeout : int, default 45
166
- Interrupt reporting if it takes more than this many seconds.
167
- """
168
- ...
169
-
170
- @typing.overload
171
- def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
172
- ...
173
-
174
- @typing.overload
175
- def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
176
- ...
177
-
178
- 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):
179
- """
180
- Creates a human-readable report, a Metaflow Card, after this step completes.
181
-
182
- Note that you may add multiple `@card` decorators in a step with different parameters.
183
-
184
-
185
- Parameters
186
- ----------
187
- type : str, default 'default'
188
- Card type.
189
- id : str, optional, default None
190
- If multiple cards are present, use this id to identify this card.
191
- options : Dict[str, Any], default {}
192
- Options passed to the card. The contents depend on the card type.
193
- timeout : int, default 45
194
- Interrupt reporting if it takes more than this many seconds.
195
- """
196
- ...
197
-
198
149
  @typing.overload
199
150
  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]]]:
200
151
  """
@@ -230,91 +181,6 @@ def secrets(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None],
230
181
  """
231
182
  ...
232
183
 
233
- 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', 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]]]:
234
- """
235
- Specifies that this step should execute on Kubernetes.
236
-
237
-
238
- Parameters
239
- ----------
240
- cpu : int, default 1
241
- Number of CPUs required for this step. If `@resources` is
242
- also present, the maximum value from all decorators is used.
243
- memory : int, default 4096
244
- Memory size (in MB) required for this step. If
245
- `@resources` is also present, the maximum value from all decorators is
246
- used.
247
- disk : int, default 10240
248
- Disk size (in MB) required for this step. If
249
- `@resources` is also present, the maximum value from all decorators is
250
- used.
251
- image : str, optional, default None
252
- Docker image to use when launching on Kubernetes. If not specified, and
253
- METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
254
- not, a default Docker image mapping to the current version of Python is used.
255
- image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
256
- If given, the imagePullPolicy to be applied to the Docker image of the step.
257
- service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
258
- Kubernetes service account to use when launching pod in Kubernetes.
259
- secrets : List[str], optional, default None
260
- Kubernetes secrets to use when launching pod in Kubernetes. These
261
- secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
262
- in Metaflow configuration.
263
- node_selector: Union[Dict[str,str], str], optional, default None
264
- Kubernetes node selector(s) to apply to the pod running the task.
265
- Can be passed in as a comma separated string of values e.g.
266
- 'kubernetes.io/os=linux,kubernetes.io/arch=amd64' or as a dictionary
267
- {'kubernetes.io/os': 'linux', 'kubernetes.io/arch': 'amd64'}
268
- namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
269
- Kubernetes namespace to use when launching pod in Kubernetes.
270
- gpu : int, optional, default None
271
- Number of GPUs required for this step. A value of zero implies that
272
- the scheduled node should not have GPUs.
273
- gpu_vendor : str, default KUBERNETES_GPU_VENDOR
274
- The vendor of the GPUs to be used for this step.
275
- tolerations : List[str], default []
276
- The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
277
- Kubernetes tolerations to use when launching pod in Kubernetes.
278
- labels: Dict[str, str], default: METAFLOW_KUBERNETES_LABELS
279
- Kubernetes labels to use when launching pod in Kubernetes.
280
- annotations: Dict[str, str], default: METAFLOW_KUBERNETES_ANNOTATIONS
281
- Kubernetes annotations to use when launching pod in Kubernetes.
282
- use_tmpfs : bool, default False
283
- This enables an explicit tmpfs mount for this step.
284
- tmpfs_tempdir : bool, default True
285
- sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
286
- tmpfs_size : int, optional, default: None
287
- The value for the size (in MiB) of the tmpfs mount for this step.
288
- This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
289
- memory allocated for this step.
290
- tmpfs_path : str, optional, default /metaflow_temp
291
- Path to tmpfs mount for this step.
292
- persistent_volume_claims : Dict[str, str], optional, default None
293
- A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
294
- volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
295
- shared_memory: int, optional
296
- Shared memory size (in MiB) required for this step
297
- port: int, optional
298
- Port number to specify in the Kubernetes job object
299
- compute_pool : str, optional, default None
300
- Compute pool to be used for for this step.
301
- If not specified, any accessible compute pool within the perimeter is used.
302
- hostname_resolution_timeout: int, default 10 * 60
303
- Timeout in seconds for the workers tasks in the gang scheduled cluster to resolve the hostname of control task.
304
- Only applicable when @parallel is used.
305
- qos: str, default: Burstable
306
- Quality of Service class to assign to the pod. Supported values are: Guaranteed, Burstable, BestEffort
307
-
308
- security_context: Dict[str, Any], optional, default None
309
- Container security context. Applies to the task container. Allows the following keys:
310
- - privileged: bool, optional, default None
311
- - allow_privilege_escalation: bool, optional, default None
312
- - run_as_user: int, optional, default None
313
- - run_as_group: int, optional, default None
314
- - run_as_non_root: bool, optional, default None
315
- """
316
- ...
317
-
318
184
  @typing.overload
319
185
  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]]]:
320
186
  """
@@ -524,114 +390,141 @@ def conda(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
524
390
  ...
525
391
 
526
392
  @typing.overload
527
- 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]]]:
393
+ 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]]]:
528
394
  """
529
- Specifies the PyPI packages for the step.
395
+ Specifies that the step will success under all circumstances.
530
396
 
531
- Information in this decorator will augment any
532
- attributes set in the `@pyi_base` flow-level decorator. Hence,
533
- you can use `@pypi_base` to set packages required by all
534
- steps and use `@pypi` to specify step-specific overrides.
397
+ The decorator will create an optional artifact, specified by `var`, which
398
+ contains the exception raised. You can use it to detect the presence
399
+ of errors, indicating that all happy-path artifacts produced by the step
400
+ are missing.
535
401
 
536
402
 
537
403
  Parameters
538
404
  ----------
539
- packages : Dict[str, str], default: {}
540
- Packages to use for this step. The key is the name of the package
541
- and the value is the version to use.
542
- python : str, optional, default: None
543
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
544
- that the version used will correspond to the version of the Python interpreter used to start the run.
405
+ var : str, optional, default None
406
+ Name of the artifact in which to store the caught exception.
407
+ If not specified, the exception is not stored.
408
+ print_exception : bool, default True
409
+ Determines whether or not the exception is printed to
410
+ stdout when caught.
545
411
  """
546
412
  ...
547
413
 
548
414
  @typing.overload
549
- def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
415
+ def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
550
416
  ...
551
417
 
552
418
  @typing.overload
553
- def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
419
+ def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
554
420
  ...
555
421
 
556
- 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):
422
+ 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):
557
423
  """
558
- Specifies the PyPI packages for the step.
424
+ Specifies that the step will success under all circumstances.
559
425
 
560
- Information in this decorator will augment any
561
- attributes set in the `@pyi_base` flow-level decorator. Hence,
562
- you can use `@pypi_base` to set packages required by all
563
- steps and use `@pypi` to specify step-specific overrides.
426
+ The decorator will create an optional artifact, specified by `var`, which
427
+ contains the exception raised. You can use it to detect the presence
428
+ of errors, indicating that all happy-path artifacts produced by the step
429
+ are missing.
564
430
 
565
431
 
566
432
  Parameters
567
433
  ----------
568
- packages : Dict[str, str], default: {}
569
- Packages to use for this step. The key is the name of the package
570
- and the value is the version to use.
571
- python : str, optional, default: None
572
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
573
- that the version used will correspond to the version of the Python interpreter used to start the run.
574
- """
575
- ...
576
-
577
- @typing.overload
578
- def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
579
- """
580
- Decorator prototype for all step decorators. This function gets specialized
581
- and imported for all decorators types by _import_plugin_decorators().
582
- """
583
- ...
584
-
585
- @typing.overload
586
- def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
587
- ...
588
-
589
- def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
590
- """
591
- Decorator prototype for all step decorators. This function gets specialized
592
- and imported for all decorators types by _import_plugin_decorators().
434
+ var : str, optional, default None
435
+ Name of the artifact in which to store the caught exception.
436
+ If not specified, the exception is not stored.
437
+ print_exception : bool, default True
438
+ Determines whether or not the exception is printed to
439
+ stdout when caught.
593
440
  """
594
441
  ...
595
442
 
596
443
  @typing.overload
597
- 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]]]:
444
+ 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]]]:
598
445
  """
599
- Specifies a timeout for your step.
600
-
601
- This decorator is useful if this step may hang indefinitely.
446
+ Specifies the resources needed when executing this step.
602
447
 
603
- This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
604
- A timeout is considered to be an exception thrown by the step. It will cause the step to be
605
- retried if needed and the exception will be caught by the `@catch` decorator, if present.
448
+ Use `@resources` to specify the resource requirements
449
+ independently of the specific compute layer (`@batch`, `@kubernetes`).
606
450
 
607
- Note that all the values specified in parameters are added together so if you specify
608
- 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
451
+ You can choose the compute layer on the command line by executing e.g.
452
+ ```
453
+ python myflow.py run --with batch
454
+ ```
455
+ or
456
+ ```
457
+ python myflow.py run --with kubernetes
458
+ ```
459
+ which executes the flow on the desired system using the
460
+ requirements specified in `@resources`.
609
461
 
610
462
 
611
463
  Parameters
612
464
  ----------
613
- seconds : int, default 0
614
- Number of seconds to wait prior to timing out.
615
- minutes : int, default 0
616
- Number of minutes to wait prior to timing out.
617
- hours : int, default 0
618
- Number of hours to wait prior to timing out.
465
+ cpu : int, default 1
466
+ Number of CPUs required for this step.
467
+ gpu : int, optional, default None
468
+ Number of GPUs required for this step.
469
+ disk : int, optional, default None
470
+ Disk size (in MB) required for this step. Only applies on Kubernetes.
471
+ memory : int, default 4096
472
+ Memory size (in MB) required for this step.
473
+ shared_memory : int, optional, default None
474
+ The value for the size (in MiB) of the /dev/shm volume for this step.
475
+ This parameter maps to the `--shm-size` option in Docker.
619
476
  """
620
477
  ...
621
478
 
622
479
  @typing.overload
623
- def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
480
+ def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
624
481
  ...
625
482
 
626
483
  @typing.overload
627
- def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
484
+ def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
628
485
  ...
629
486
 
630
- 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):
487
+ 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):
631
488
  """
632
- Specifies a timeout for your step.
489
+ Specifies the resources needed when executing this step.
490
+
491
+ Use `@resources` to specify the resource requirements
492
+ independently of the specific compute layer (`@batch`, `@kubernetes`).
493
+
494
+ You can choose the compute layer on the command line by executing e.g.
495
+ ```
496
+ python myflow.py run --with batch
497
+ ```
498
+ or
499
+ ```
500
+ python myflow.py run --with kubernetes
501
+ ```
502
+ which executes the flow on the desired system using the
503
+ requirements specified in `@resources`.
633
504
 
634
- This decorator is useful if this step may hang indefinitely.
505
+
506
+ Parameters
507
+ ----------
508
+ cpu : int, default 1
509
+ Number of CPUs required for this step.
510
+ gpu : int, optional, default None
511
+ Number of GPUs required for this step.
512
+ disk : int, optional, default None
513
+ Disk size (in MB) required for this step. Only applies on Kubernetes.
514
+ memory : int, default 4096
515
+ Memory size (in MB) required for this step.
516
+ shared_memory : int, optional, default None
517
+ The value for the size (in MiB) of the /dev/shm volume for this step.
518
+ This parameter maps to the `--shm-size` option in Docker.
519
+ """
520
+ ...
521
+
522
+ @typing.overload
523
+ 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]]]:
524
+ """
525
+ Specifies a timeout for your step.
526
+
527
+ This decorator is useful if this step may hang indefinitely.
635
528
 
636
529
  This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
637
530
  A timeout is considered to be an exception thrown by the step. It will cause the step to be
@@ -652,6 +545,176 @@ def timeout(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None],
652
545
  """
653
546
  ...
654
547
 
548
+ @typing.overload
549
+ def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
550
+ ...
551
+
552
+ @typing.overload
553
+ def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
554
+ ...
555
+
556
+ 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):
557
+ """
558
+ Specifies a timeout for your step.
559
+
560
+ This decorator is useful if this step may hang indefinitely.
561
+
562
+ This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
563
+ A timeout is considered to be an exception thrown by the step. It will cause the step to be
564
+ retried if needed and the exception will be caught by the `@catch` decorator, if present.
565
+
566
+ Note that all the values specified in parameters are added together so if you specify
567
+ 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
568
+
569
+
570
+ Parameters
571
+ ----------
572
+ seconds : int, default 0
573
+ Number of seconds to wait prior to timing out.
574
+ minutes : int, default 0
575
+ Number of minutes to wait prior to timing out.
576
+ hours : int, default 0
577
+ Number of hours to wait prior to timing out.
578
+ """
579
+ ...
580
+
581
+ @typing.overload
582
+ def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
583
+ """
584
+ Decorator prototype for all step decorators. This function gets specialized
585
+ and imported for all decorators types by _import_plugin_decorators().
586
+ """
587
+ ...
588
+
589
+ @typing.overload
590
+ def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
591
+ ...
592
+
593
+ def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
594
+ """
595
+ Decorator prototype for all step decorators. This function gets specialized
596
+ and imported for all decorators types by _import_plugin_decorators().
597
+ """
598
+ ...
599
+
600
+ 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', 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]]]:
601
+ """
602
+ Specifies that this step should execute on Kubernetes.
603
+
604
+
605
+ Parameters
606
+ ----------
607
+ cpu : int, default 1
608
+ Number of CPUs required for this step. If `@resources` is
609
+ also present, the maximum value from all decorators is used.
610
+ memory : int, default 4096
611
+ Memory size (in MB) required for this step. If
612
+ `@resources` is also present, the maximum value from all decorators is
613
+ used.
614
+ disk : int, default 10240
615
+ Disk size (in MB) required for this step. If
616
+ `@resources` is also present, the maximum value from all decorators is
617
+ used.
618
+ image : str, optional, default None
619
+ Docker image to use when launching on Kubernetes. If not specified, and
620
+ METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
621
+ not, a default Docker image mapping to the current version of Python is used.
622
+ image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
623
+ If given, the imagePullPolicy to be applied to the Docker image of the step.
624
+ service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
625
+ Kubernetes service account to use when launching pod in Kubernetes.
626
+ secrets : List[str], optional, default None
627
+ Kubernetes secrets to use when launching pod in Kubernetes. These
628
+ secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
629
+ in Metaflow configuration.
630
+ node_selector: Union[Dict[str,str], str], optional, default None
631
+ Kubernetes node selector(s) to apply to the pod running the task.
632
+ Can be passed in as a comma separated string of values e.g.
633
+ 'kubernetes.io/os=linux,kubernetes.io/arch=amd64' or as a dictionary
634
+ {'kubernetes.io/os': 'linux', 'kubernetes.io/arch': 'amd64'}
635
+ namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
636
+ Kubernetes namespace to use when launching pod in Kubernetes.
637
+ gpu : int, optional, default None
638
+ Number of GPUs required for this step. A value of zero implies that
639
+ the scheduled node should not have GPUs.
640
+ gpu_vendor : str, default KUBERNETES_GPU_VENDOR
641
+ The vendor of the GPUs to be used for this step.
642
+ tolerations : List[str], default []
643
+ The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
644
+ Kubernetes tolerations to use when launching pod in Kubernetes.
645
+ labels: Dict[str, str], default: METAFLOW_KUBERNETES_LABELS
646
+ Kubernetes labels to use when launching pod in Kubernetes.
647
+ annotations: Dict[str, str], default: METAFLOW_KUBERNETES_ANNOTATIONS
648
+ Kubernetes annotations to use when launching pod in Kubernetes.
649
+ use_tmpfs : bool, default False
650
+ This enables an explicit tmpfs mount for this step.
651
+ tmpfs_tempdir : bool, default True
652
+ sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
653
+ tmpfs_size : int, optional, default: None
654
+ The value for the size (in MiB) of the tmpfs mount for this step.
655
+ This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
656
+ memory allocated for this step.
657
+ tmpfs_path : str, optional, default /metaflow_temp
658
+ Path to tmpfs mount for this step.
659
+ persistent_volume_claims : Dict[str, str], optional, default None
660
+ A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
661
+ volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
662
+ shared_memory: int, optional
663
+ Shared memory size (in MiB) required for this step
664
+ port: int, optional
665
+ Port number to specify in the Kubernetes job object
666
+ compute_pool : str, optional, default None
667
+ Compute pool to be used for for this step.
668
+ If not specified, any accessible compute pool within the perimeter is used.
669
+ hostname_resolution_timeout: int, default 10 * 60
670
+ Timeout in seconds for the workers tasks in the gang scheduled cluster to resolve the hostname of control task.
671
+ Only applicable when @parallel is used.
672
+ qos: str, default: Burstable
673
+ Quality of Service class to assign to the pod. Supported values are: Guaranteed, Burstable, BestEffort
674
+
675
+ security_context: Dict[str, Any], optional, default None
676
+ Container security context. Applies to the task container. Allows the following keys:
677
+ - privileged: bool, optional, default None
678
+ - allow_privilege_escalation: bool, optional, default None
679
+ - run_as_user: int, optional, default None
680
+ - run_as_group: int, optional, default None
681
+ - run_as_non_root: bool, optional, default None
682
+ """
683
+ ...
684
+
685
+ @typing.overload
686
+ 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]]]:
687
+ """
688
+ Specifies environment variables to be set prior to the execution of a step.
689
+
690
+
691
+ Parameters
692
+ ----------
693
+ vars : Dict[str, str], default {}
694
+ Dictionary of environment variables to set.
695
+ """
696
+ ...
697
+
698
+ @typing.overload
699
+ def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
700
+ ...
701
+
702
+ @typing.overload
703
+ def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
704
+ ...
705
+
706
+ def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
707
+ """
708
+ Specifies environment variables to be set prior to the execution of a step.
709
+
710
+
711
+ Parameters
712
+ ----------
713
+ vars : Dict[str, str], default {}
714
+ Dictionary of environment variables to set.
715
+ """
716
+ ...
717
+
655
718
  @typing.overload
656
719
  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]]]:
657
720
  """
@@ -708,208 +771,236 @@ def retry(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
708
771
  ...
709
772
 
710
773
  @typing.overload
711
- 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]]]:
774
+ 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]]]:
712
775
  """
713
- Specifies environment variables to be set prior to the execution of a step.
776
+ Creates a human-readable report, a Metaflow Card, after this step completes.
777
+
778
+ Note that you may add multiple `@card` decorators in a step with different parameters.
714
779
 
715
780
 
716
781
  Parameters
717
782
  ----------
718
- vars : Dict[str, str], default {}
719
- Dictionary of environment variables to set.
783
+ type : str, default 'default'
784
+ Card type.
785
+ id : str, optional, default None
786
+ If multiple cards are present, use this id to identify this card.
787
+ options : Dict[str, Any], default {}
788
+ Options passed to the card. The contents depend on the card type.
789
+ timeout : int, default 45
790
+ Interrupt reporting if it takes more than this many seconds.
720
791
  """
721
792
  ...
722
793
 
723
794
  @typing.overload
724
- def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
795
+ def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
725
796
  ...
726
797
 
727
798
  @typing.overload
728
- def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
799
+ def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
729
800
  ...
730
801
 
731
- def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
802
+ 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):
732
803
  """
733
- Specifies environment variables to be set prior to the execution of a step.
804
+ Creates a human-readable report, a Metaflow Card, after this step completes.
805
+
806
+ Note that you may add multiple `@card` decorators in a step with different parameters.
734
807
 
735
808
 
736
809
  Parameters
737
810
  ----------
738
- vars : Dict[str, str], default {}
739
- Dictionary of environment variables to set.
811
+ type : str, default 'default'
812
+ Card type.
813
+ id : str, optional, default None
814
+ If multiple cards are present, use this id to identify this card.
815
+ options : Dict[str, Any], default {}
816
+ Options passed to the card. The contents depend on the card type.
817
+ timeout : int, default 45
818
+ Interrupt reporting if it takes more than this many seconds.
740
819
  """
741
820
  ...
742
821
 
743
822
  @typing.overload
744
- 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]]]:
823
+ 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]]]:
745
824
  """
746
- Specifies the resources needed when executing this step.
747
-
748
- Use `@resources` to specify the resource requirements
749
- independently of the specific compute layer (`@batch`, `@kubernetes`).
825
+ Specifies the PyPI packages for the step.
750
826
 
751
- You can choose the compute layer on the command line by executing e.g.
752
- ```
753
- python myflow.py run --with batch
754
- ```
755
- or
756
- ```
757
- python myflow.py run --with kubernetes
758
- ```
759
- which executes the flow on the desired system using the
760
- requirements specified in `@resources`.
827
+ Information in this decorator will augment any
828
+ attributes set in the `@pyi_base` flow-level decorator. Hence,
829
+ you can use `@pypi_base` to set packages required by all
830
+ steps and use `@pypi` to specify step-specific overrides.
761
831
 
762
832
 
763
833
  Parameters
764
834
  ----------
765
- cpu : int, default 1
766
- Number of CPUs required for this step.
767
- gpu : int, optional, default None
768
- Number of GPUs required for this step.
769
- disk : int, optional, default None
770
- Disk size (in MB) required for this step. Only applies on Kubernetes.
771
- memory : int, default 4096
772
- Memory size (in MB) required for this step.
773
- shared_memory : int, optional, default None
774
- The value for the size (in MiB) of the /dev/shm volume for this step.
775
- This parameter maps to the `--shm-size` option in Docker.
835
+ packages : Dict[str, str], default: {}
836
+ Packages to use for this step. The key is the name of the package
837
+ and the value is the version to use.
838
+ python : str, optional, default: None
839
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
840
+ that the version used will correspond to the version of the Python interpreter used to start the run.
776
841
  """
777
842
  ...
778
843
 
779
844
  @typing.overload
780
- def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
845
+ def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
781
846
  ...
782
847
 
783
848
  @typing.overload
784
- def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
849
+ def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
785
850
  ...
786
851
 
787
- 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):
852
+ 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):
788
853
  """
789
- Specifies the resources needed when executing this step.
790
-
791
- Use `@resources` to specify the resource requirements
792
- independently of the specific compute layer (`@batch`, `@kubernetes`).
854
+ Specifies the PyPI packages for the step.
793
855
 
794
- You can choose the compute layer on the command line by executing e.g.
795
- ```
796
- python myflow.py run --with batch
797
- ```
798
- or
799
- ```
800
- python myflow.py run --with kubernetes
801
- ```
802
- which executes the flow on the desired system using the
803
- requirements specified in `@resources`.
856
+ Information in this decorator will augment any
857
+ attributes set in the `@pyi_base` flow-level decorator. Hence,
858
+ you can use `@pypi_base` to set packages required by all
859
+ steps and use `@pypi` to specify step-specific overrides.
804
860
 
805
861
 
806
862
  Parameters
807
863
  ----------
808
- cpu : int, default 1
809
- Number of CPUs required for this step.
810
- gpu : int, optional, default None
811
- Number of GPUs required for this step.
812
- disk : int, optional, default None
813
- Disk size (in MB) required for this step. Only applies on Kubernetes.
814
- memory : int, default 4096
815
- Memory size (in MB) required for this step.
816
- shared_memory : int, optional, default None
817
- The value for the size (in MiB) of the /dev/shm volume for this step.
818
- This parameter maps to the `--shm-size` option in Docker.
864
+ packages : Dict[str, str], default: {}
865
+ Packages to use for this step. The key is the name of the package
866
+ and the value is the version to use.
867
+ python : str, optional, default: None
868
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
869
+ that the version used will correspond to the version of the Python interpreter used to start the run.
819
870
  """
820
871
  ...
821
872
 
822
873
  @typing.overload
823
- 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]]]:
874
+ 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]]:
824
875
  """
825
- Specifies that the step will success under all circumstances.
876
+ Specifies the event(s) that this flow depends on.
826
877
 
827
- The decorator will create an optional artifact, specified by `var`, which
828
- contains the exception raised. You can use it to detect the presence
829
- of errors, indicating that all happy-path artifacts produced by the step
830
- are missing.
878
+ ```
879
+ @trigger(event='foo')
880
+ ```
881
+ or
882
+ ```
883
+ @trigger(events=['foo', 'bar'])
884
+ ```
885
+
886
+ Additionally, you can specify the parameter mappings
887
+ to map event payload to Metaflow parameters for the flow.
888
+ ```
889
+ @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
890
+ ```
891
+ or
892
+ ```
893
+ @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
894
+ {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
895
+ ```
896
+
897
+ 'parameters' can also be a list of strings and tuples like so:
898
+ ```
899
+ @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
900
+ ```
901
+ This is equivalent to:
902
+ ```
903
+ @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
904
+ ```
831
905
 
832
906
 
833
907
  Parameters
834
908
  ----------
835
- var : str, optional, default None
836
- Name of the artifact in which to store the caught exception.
837
- If not specified, the exception is not stored.
838
- print_exception : bool, default True
839
- Determines whether or not the exception is printed to
840
- stdout when caught.
909
+ event : Union[str, Dict[str, Any]], optional, default None
910
+ Event dependency for this flow.
911
+ events : List[Union[str, Dict[str, Any]]], default []
912
+ Events dependency for this flow.
913
+ options : Dict[str, Any], default {}
914
+ Backend-specific configuration for tuning eventing behavior.
841
915
  """
842
916
  ...
843
917
 
844
918
  @typing.overload
845
- def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
846
- ...
847
-
848
- @typing.overload
849
- def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
919
+ def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
850
920
  ...
851
921
 
852
- 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):
922
+ 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] = {}):
853
923
  """
854
- Specifies that the step will success under all circumstances.
924
+ Specifies the event(s) that this flow depends on.
855
925
 
856
- The decorator will create an optional artifact, specified by `var`, which
857
- contains the exception raised. You can use it to detect the presence
858
- of errors, indicating that all happy-path artifacts produced by the step
859
- are missing.
926
+ ```
927
+ @trigger(event='foo')
928
+ ```
929
+ or
930
+ ```
931
+ @trigger(events=['foo', 'bar'])
932
+ ```
933
+
934
+ Additionally, you can specify the parameter mappings
935
+ to map event payload to Metaflow parameters for the flow.
936
+ ```
937
+ @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
938
+ ```
939
+ or
940
+ ```
941
+ @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
942
+ {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
943
+ ```
944
+
945
+ 'parameters' can also be a list of strings and tuples like so:
946
+ ```
947
+ @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
948
+ ```
949
+ This is equivalent to:
950
+ ```
951
+ @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
952
+ ```
860
953
 
861
954
 
862
955
  Parameters
863
956
  ----------
864
- var : str, optional, default None
865
- Name of the artifact in which to store the caught exception.
866
- If not specified, the exception is not stored.
867
- print_exception : bool, default True
868
- Determines whether or not the exception is printed to
869
- stdout when caught.
957
+ event : Union[str, Dict[str, Any]], optional, default None
958
+ Event dependency for this flow.
959
+ events : List[Union[str, Dict[str, Any]]], default []
960
+ Events dependency for this flow.
961
+ options : Dict[str, Any], default {}
962
+ Backend-specific configuration for tuning eventing behavior.
870
963
  """
871
964
  ...
872
965
 
873
- 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]]:
966
+ @typing.overload
967
+ def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
874
968
  """
875
- 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)
876
- before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
877
- and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
878
- added as a flow decorators. Adding more than one decorator will ensure that `start` step
879
- starts only after all sensors finish.
969
+ Specifies the PyPI packages for all steps of the flow.
880
970
 
971
+ Use `@pypi_base` to set common packages required by all
972
+ steps and use `@pypi` to specify step-specific overrides.
881
973
 
882
974
  Parameters
883
975
  ----------
884
- timeout : int
885
- Time, in seconds before the task times out and fails. (Default: 3600)
886
- poke_interval : int
887
- Time in seconds that the job should wait in between each try. (Default: 60)
888
- mode : str
889
- How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
890
- exponential_backoff : bool
891
- allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
892
- pool : str
893
- the slot pool this task should run in,
894
- slot pools are a way to limit concurrency for certain tasks. (Default:None)
895
- soft_fail : bool
896
- Set to true to mark the task as SKIPPED on failure. (Default: False)
897
- name : str
898
- Name of the sensor on Airflow
899
- description : str
900
- Description of sensor in the Airflow UI
901
- bucket_key : Union[str, List[str]]
902
- The key(s) being waited on. Supports full s3:// style url or relative path from root level.
903
- When it's specified as a full s3:// url, please leave `bucket_name` as None
904
- bucket_name : str
905
- Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
906
- When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
907
- wildcard_match : bool
908
- whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
909
- aws_conn_id : str
910
- a reference to the s3 connection on Airflow. (Default: None)
911
- verify : bool
912
- Whether or not to verify SSL certificates for S3 connection. (Default: None)
976
+ packages : Dict[str, str], default: {}
977
+ Packages to use for this flow. The key is the name of the package
978
+ and the value is the version to use.
979
+ python : str, optional, default: None
980
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
981
+ that the version used will correspond to the version of the Python interpreter used to start the run.
982
+ """
983
+ ...
984
+
985
+ @typing.overload
986
+ def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
987
+ ...
988
+
989
+ def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
990
+ """
991
+ Specifies the PyPI packages for all steps of the flow.
992
+
993
+ Use `@pypi_base` to set common packages required by all
994
+ steps and use `@pypi` to specify step-specific overrides.
995
+
996
+ Parameters
997
+ ----------
998
+ packages : Dict[str, str], default: {}
999
+ Packages to use for this flow. The key is the name of the package
1000
+ and the value is the version to use.
1001
+ python : str, optional, default: None
1002
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1003
+ that the version used will correspond to the version of the Python interpreter used to start the run.
913
1004
  """
914
1005
  ...
915
1006
 
@@ -1057,6 +1148,41 @@ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *
1057
1148
  """
1058
1149
  ...
1059
1150
 
1151
+ def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1152
+ """
1153
+ Specifies what flows belong to the same project.
1154
+
1155
+ A project-specific namespace is created for all flows that
1156
+ use the same `@project(name)`.
1157
+
1158
+
1159
+ Parameters
1160
+ ----------
1161
+ name : str
1162
+ Project name. Make sure that the name is unique amongst all
1163
+ projects that use the same production scheduler. The name may
1164
+ contain only lowercase alphanumeric characters and underscores.
1165
+
1166
+ branch : Optional[str], default None
1167
+ The branch to use. If not specified, the branch is set to
1168
+ `user.<username>` unless `production` is set to `True`. This can
1169
+ also be set on the command line using `--branch` as a top-level option.
1170
+ It is an error to specify `branch` in the decorator and on the command line.
1171
+
1172
+ production : bool, default False
1173
+ Whether or not the branch is the production branch. This can also be set on the
1174
+ command line using `--production` as a top-level option. It is an error to specify
1175
+ `production` in the decorator and on the command line.
1176
+ The project branch name will be:
1177
+ - if `branch` is specified:
1178
+ - if `production` is True: `prod.<branch>`
1179
+ - if `production` is False: `test.<branch>`
1180
+ - if `branch` is not specified:
1181
+ - if `production` is True: `prod`
1182
+ - if `production` is False: `user.<username>`
1183
+ """
1184
+ ...
1185
+
1060
1186
  @typing.overload
1061
1187
  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]]:
1062
1188
  """
@@ -1108,175 +1234,6 @@ def conda_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packa
1108
1234
  """
1109
1235
  ...
1110
1236
 
1111
- @typing.overload
1112
- def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1113
- """
1114
- Specifies the PyPI packages for all steps of the flow.
1115
-
1116
- Use `@pypi_base` to set common packages required by all
1117
- steps and use `@pypi` to specify step-specific overrides.
1118
-
1119
- Parameters
1120
- ----------
1121
- packages : Dict[str, str], default: {}
1122
- Packages to use for this flow. The key is the name of the package
1123
- and the value is the version to use.
1124
- python : str, optional, default: None
1125
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1126
- that the version used will correspond to the version of the Python interpreter used to start the run.
1127
- """
1128
- ...
1129
-
1130
- @typing.overload
1131
- def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1132
- ...
1133
-
1134
- def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
1135
- """
1136
- Specifies the PyPI packages for all steps of the flow.
1137
-
1138
- Use `@pypi_base` to set common packages required by all
1139
- steps and use `@pypi` to specify step-specific overrides.
1140
-
1141
- Parameters
1142
- ----------
1143
- packages : Dict[str, str], default: {}
1144
- Packages to use for this flow. The key is the name of the package
1145
- and the value is the version to use.
1146
- python : str, optional, default: None
1147
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1148
- that the version used will correspond to the version of the Python interpreter used to start the run.
1149
- """
1150
- ...
1151
-
1152
- @typing.overload
1153
- 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]]:
1154
- """
1155
- Specifies the event(s) that this flow depends on.
1156
-
1157
- ```
1158
- @trigger(event='foo')
1159
- ```
1160
- or
1161
- ```
1162
- @trigger(events=['foo', 'bar'])
1163
- ```
1164
-
1165
- Additionally, you can specify the parameter mappings
1166
- to map event payload to Metaflow parameters for the flow.
1167
- ```
1168
- @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1169
- ```
1170
- or
1171
- ```
1172
- @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1173
- {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1174
- ```
1175
-
1176
- 'parameters' can also be a list of strings and tuples like so:
1177
- ```
1178
- @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1179
- ```
1180
- This is equivalent to:
1181
- ```
1182
- @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1183
- ```
1184
-
1185
-
1186
- Parameters
1187
- ----------
1188
- event : Union[str, Dict[str, Any]], optional, default None
1189
- Event dependency for this flow.
1190
- events : List[Union[str, Dict[str, Any]]], default []
1191
- Events dependency for this flow.
1192
- options : Dict[str, Any], default {}
1193
- Backend-specific configuration for tuning eventing behavior.
1194
- """
1195
- ...
1196
-
1197
- @typing.overload
1198
- def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1199
- ...
1200
-
1201
- 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] = {}):
1202
- """
1203
- Specifies the event(s) that this flow depends on.
1204
-
1205
- ```
1206
- @trigger(event='foo')
1207
- ```
1208
- or
1209
- ```
1210
- @trigger(events=['foo', 'bar'])
1211
- ```
1212
-
1213
- Additionally, you can specify the parameter mappings
1214
- to map event payload to Metaflow parameters for the flow.
1215
- ```
1216
- @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1217
- ```
1218
- or
1219
- ```
1220
- @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1221
- {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1222
- ```
1223
-
1224
- 'parameters' can also be a list of strings and tuples like so:
1225
- ```
1226
- @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1227
- ```
1228
- This is equivalent to:
1229
- ```
1230
- @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1231
- ```
1232
-
1233
-
1234
- Parameters
1235
- ----------
1236
- event : Union[str, Dict[str, Any]], optional, default None
1237
- Event dependency for this flow.
1238
- events : List[Union[str, Dict[str, Any]]], default []
1239
- Events dependency for this flow.
1240
- options : Dict[str, Any], default {}
1241
- Backend-specific configuration for tuning eventing behavior.
1242
- """
1243
- ...
1244
-
1245
- def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1246
- """
1247
- Specifies what flows belong to the same project.
1248
-
1249
- A project-specific namespace is created for all flows that
1250
- use the same `@project(name)`.
1251
-
1252
-
1253
- Parameters
1254
- ----------
1255
- name : str
1256
- Project name. Make sure that the name is unique amongst all
1257
- projects that use the same production scheduler. The name may
1258
- contain only lowercase alphanumeric characters and underscores.
1259
-
1260
- branch : Optional[str], default None
1261
- The branch to use. If not specified, the branch is set to
1262
- `user.<username>` unless `production` is set to `True`. This can
1263
- also be set on the command line using `--branch` as a top-level option.
1264
- It is an error to specify `branch` in the decorator and on the command line.
1265
-
1266
- production : bool, default False
1267
- Whether or not the branch is the production branch. This can also be set on the
1268
- command line using `--production` as a top-level option. It is an error to specify
1269
- `production` in the decorator and on the command line.
1270
- The project branch name will be:
1271
- - if `branch` is specified:
1272
- - if `production` is True: `prod.<branch>`
1273
- - if `production` is False: `test.<branch>`
1274
- - if `branch` is not specified:
1275
- - if `production` is True: `prod`
1276
- - if `production` is False: `user.<username>`
1277
- """
1278
- ...
1279
-
1280
1237
  @typing.overload
1281
1238
  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]]:
1282
1239
  """
@@ -1328,3 +1285,46 @@ def schedule(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, hourly:
1328
1285
  """
1329
1286
  ...
1330
1287
 
1288
+ 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]]:
1289
+ """
1290
+ 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)
1291
+ before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
1292
+ and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
1293
+ added as a flow decorators. Adding more than one decorator will ensure that `start` step
1294
+ starts only after all sensors finish.
1295
+
1296
+
1297
+ Parameters
1298
+ ----------
1299
+ timeout : int
1300
+ Time, in seconds before the task times out and fails. (Default: 3600)
1301
+ poke_interval : int
1302
+ Time in seconds that the job should wait in between each try. (Default: 60)
1303
+ mode : str
1304
+ How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1305
+ exponential_backoff : bool
1306
+ allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1307
+ pool : str
1308
+ the slot pool this task should run in,
1309
+ slot pools are a way to limit concurrency for certain tasks. (Default:None)
1310
+ soft_fail : bool
1311
+ Set to true to mark the task as SKIPPED on failure. (Default: False)
1312
+ name : str
1313
+ Name of the sensor on Airflow
1314
+ description : str
1315
+ Description of sensor in the Airflow UI
1316
+ bucket_key : Union[str, List[str]]
1317
+ The key(s) being waited on. Supports full s3:// style url or relative path from root level.
1318
+ When it's specified as a full s3:// url, please leave `bucket_name` as None
1319
+ bucket_name : str
1320
+ Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
1321
+ When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
1322
+ wildcard_match : bool
1323
+ whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
1324
+ aws_conn_id : str
1325
+ a reference to the s3 connection on Airflow. (Default: None)
1326
+ verify : bool
1327
+ Whether or not to verify SSL certificates for S3 connection. (Default: None)
1328
+ """
1329
+ ...
1330
+