metaflow-stubs 2.15.21__py2.py3-none-any.whl → 2.16.0__py2.py3-none-any.whl

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

Potentially problematic release.


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

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