metaflow-stubs 2.15.7__py2.py3-none-any.whl → 2.15.9__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (149) hide show
  1. metaflow-stubs/__init__.pyi +513 -504
  2. metaflow-stubs/cards.pyi +2 -2
  3. metaflow-stubs/cli.pyi +4 -2
  4. metaflow-stubs/cli_components/__init__.pyi +2 -2
  5. metaflow-stubs/cli_components/utils.pyi +2 -2
  6. metaflow-stubs/client/__init__.pyi +2 -2
  7. metaflow-stubs/client/core.pyi +5 -5
  8. metaflow-stubs/client/filecache.pyi +3 -3
  9. metaflow-stubs/events.pyi +2 -2
  10. metaflow-stubs/exception.pyi +2 -2
  11. metaflow-stubs/flowspec.pyi +4 -4
  12. metaflow-stubs/generated_for.txt +1 -1
  13. metaflow-stubs/includefile.pyi +3 -3
  14. metaflow-stubs/info_file.pyi +2 -2
  15. metaflow-stubs/metadata_provider/__init__.pyi +2 -2
  16. metaflow-stubs/metadata_provider/heartbeat.pyi +2 -2
  17. metaflow-stubs/metadata_provider/metadata.pyi +2 -2
  18. metaflow-stubs/metadata_provider/util.pyi +2 -2
  19. metaflow-stubs/metaflow_config.pyi +4 -2
  20. metaflow-stubs/metaflow_current.pyi +36 -36
  21. metaflow-stubs/metaflow_git.pyi +26 -0
  22. metaflow-stubs/multicore_utils.pyi +2 -2
  23. metaflow-stubs/parameters.pyi +3 -3
  24. metaflow-stubs/plugins/__init__.pyi +12 -11
  25. metaflow-stubs/plugins/airflow/__init__.pyi +2 -2
  26. metaflow-stubs/plugins/airflow/airflow_decorator.pyi +2 -2
  27. metaflow-stubs/plugins/airflow/airflow_utils.pyi +2 -2
  28. metaflow-stubs/plugins/airflow/exception.pyi +2 -2
  29. metaflow-stubs/plugins/airflow/sensors/__init__.pyi +2 -2
  30. metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +2 -2
  31. metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +2 -2
  32. metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +2 -2
  33. metaflow-stubs/plugins/argo/__init__.pyi +2 -2
  34. metaflow-stubs/plugins/argo/argo_client.pyi +2 -2
  35. metaflow-stubs/plugins/argo/argo_events.pyi +2 -2
  36. metaflow-stubs/plugins/argo/argo_workflows.pyi +9 -3
  37. metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +3 -3
  38. metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +3 -3
  39. metaflow-stubs/plugins/argo/argo_workflows_deployer_objects.pyi +2 -2
  40. metaflow-stubs/plugins/aws/__init__.pyi +3 -3
  41. metaflow-stubs/plugins/aws/aws_client.pyi +2 -2
  42. metaflow-stubs/plugins/aws/aws_utils.pyi +2 -2
  43. metaflow-stubs/plugins/aws/batch/__init__.pyi +2 -2
  44. metaflow-stubs/plugins/aws/batch/batch.pyi +2 -2
  45. metaflow-stubs/plugins/aws/batch/batch_client.pyi +2 -2
  46. metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +2 -2
  47. metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +2 -2
  48. metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +3 -3
  49. metaflow-stubs/plugins/aws/step_functions/__init__.pyi +2 -2
  50. metaflow-stubs/plugins/aws/step_functions/dynamo_db_client.pyi +2 -2
  51. metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +2 -2
  52. metaflow-stubs/plugins/aws/step_functions/schedule_decorator.pyi +2 -2
  53. metaflow-stubs/plugins/aws/step_functions/step_functions.pyi +2 -2
  54. metaflow-stubs/plugins/aws/step_functions/step_functions_client.pyi +2 -2
  55. metaflow-stubs/plugins/aws/step_functions/step_functions_decorator.pyi +2 -2
  56. metaflow-stubs/plugins/aws/step_functions/step_functions_deployer.pyi +3 -3
  57. metaflow-stubs/plugins/aws/step_functions/step_functions_deployer_objects.pyi +2 -2
  58. metaflow-stubs/plugins/azure/__init__.pyi +2 -2
  59. metaflow-stubs/plugins/azure/azure_credential.pyi +2 -2
  60. metaflow-stubs/plugins/azure/azure_exceptions.pyi +2 -2
  61. metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +3 -3
  62. metaflow-stubs/plugins/azure/azure_utils.pyi +2 -2
  63. metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +2 -2
  64. metaflow-stubs/plugins/azure/includefile_support.pyi +2 -2
  65. metaflow-stubs/plugins/cards/__init__.pyi +2 -2
  66. metaflow-stubs/plugins/cards/card_client.pyi +2 -2
  67. metaflow-stubs/plugins/cards/card_creator.pyi +2 -2
  68. metaflow-stubs/plugins/cards/card_datastore.pyi +2 -2
  69. metaflow-stubs/plugins/cards/card_decorator.pyi +2 -2
  70. metaflow-stubs/plugins/cards/card_modules/__init__.pyi +2 -2
  71. metaflow-stubs/plugins/cards/card_modules/basic.pyi +3 -3
  72. metaflow-stubs/plugins/cards/card_modules/card.pyi +2 -2
  73. metaflow-stubs/plugins/cards/card_modules/components.pyi +3 -3
  74. metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +2 -2
  75. metaflow-stubs/plugins/cards/card_modules/renderer_tools.pyi +2 -2
  76. metaflow-stubs/plugins/cards/card_modules/test_cards.pyi +2 -2
  77. metaflow-stubs/plugins/cards/card_resolver.pyi +2 -2
  78. metaflow-stubs/plugins/cards/component_serializer.pyi +2 -2
  79. metaflow-stubs/plugins/cards/exception.pyi +2 -2
  80. metaflow-stubs/plugins/catch_decorator.pyi +3 -3
  81. metaflow-stubs/plugins/datatools/__init__.pyi +2 -2
  82. metaflow-stubs/plugins/datatools/local.pyi +2 -2
  83. metaflow-stubs/plugins/datatools/s3/__init__.pyi +2 -2
  84. metaflow-stubs/plugins/datatools/s3/s3.pyi +6 -4
  85. metaflow-stubs/plugins/datatools/s3/s3tail.pyi +2 -2
  86. metaflow-stubs/plugins/datatools/s3/s3util.pyi +2 -2
  87. metaflow-stubs/plugins/debug_logger.pyi +2 -2
  88. metaflow-stubs/plugins/debug_monitor.pyi +2 -2
  89. metaflow-stubs/plugins/environment_decorator.pyi +2 -2
  90. metaflow-stubs/plugins/events_decorator.pyi +2 -2
  91. metaflow-stubs/plugins/frameworks/__init__.pyi +2 -2
  92. metaflow-stubs/plugins/frameworks/pytorch.pyi +2 -2
  93. metaflow-stubs/plugins/gcp/__init__.pyi +2 -2
  94. metaflow-stubs/plugins/gcp/gcp_secret_manager_secrets_provider.pyi +3 -3
  95. metaflow-stubs/plugins/gcp/gs_exceptions.pyi +2 -2
  96. metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +2 -2
  97. metaflow-stubs/plugins/gcp/gs_utils.pyi +2 -2
  98. metaflow-stubs/plugins/gcp/includefile_support.pyi +2 -2
  99. metaflow-stubs/plugins/kubernetes/__init__.pyi +2 -2
  100. metaflow-stubs/plugins/kubernetes/kube_utils.pyi +2 -2
  101. metaflow-stubs/plugins/kubernetes/kubernetes.pyi +4 -4
  102. metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +2 -2
  103. metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +10 -2
  104. metaflow-stubs/plugins/kubernetes/kubernetes_job.pyi +2 -2
  105. metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +2 -2
  106. metaflow-stubs/plugins/kubernetes/spot_monitor_sidecar.pyi +2 -2
  107. metaflow-stubs/plugins/parallel_decorator.pyi +2 -2
  108. metaflow-stubs/plugins/project_decorator.pyi +2 -2
  109. metaflow-stubs/plugins/pypi/__init__.pyi +3 -3
  110. metaflow-stubs/plugins/pypi/conda_decorator.pyi +2 -2
  111. metaflow-stubs/plugins/pypi/conda_environment.pyi +5 -5
  112. metaflow-stubs/plugins/pypi/parsers.pyi +2 -2
  113. metaflow-stubs/plugins/pypi/pypi_decorator.pyi +2 -2
  114. metaflow-stubs/plugins/pypi/pypi_environment.pyi +2 -2
  115. metaflow-stubs/plugins/pypi/utils.pyi +2 -2
  116. metaflow-stubs/plugins/resources_decorator.pyi +2 -2
  117. metaflow-stubs/plugins/retry_decorator.pyi +2 -2
  118. metaflow-stubs/plugins/secrets/__init__.pyi +2 -2
  119. metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +2 -2
  120. metaflow-stubs/plugins/secrets/secrets_decorator.pyi +2 -2
  121. metaflow-stubs/plugins/storage_executor.pyi +2 -2
  122. metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +3 -3
  123. metaflow-stubs/plugins/timeout_decorator.pyi +3 -3
  124. metaflow-stubs/plugins/uv/__init__.pyi +11 -0
  125. metaflow-stubs/plugins/uv/uv_environment.pyi +36 -0
  126. metaflow-stubs/pylint_wrapper.pyi +2 -2
  127. metaflow-stubs/runner/__init__.pyi +2 -2
  128. metaflow-stubs/runner/deployer.pyi +7 -7
  129. metaflow-stubs/runner/deployer_impl.pyi +4 -4
  130. metaflow-stubs/runner/metaflow_runner.pyi +3 -3
  131. metaflow-stubs/runner/nbdeploy.pyi +2 -2
  132. metaflow-stubs/runner/nbrun.pyi +2 -2
  133. metaflow-stubs/runner/subprocess_manager.pyi +2 -2
  134. metaflow-stubs/runner/utils.pyi +3 -3
  135. metaflow-stubs/system/__init__.pyi +2 -2
  136. metaflow-stubs/system/system_logger.pyi +3 -3
  137. metaflow-stubs/system/system_monitor.pyi +2 -2
  138. metaflow-stubs/tagging_util.pyi +2 -2
  139. metaflow-stubs/tuple_util.pyi +2 -2
  140. metaflow-stubs/user_configs/__init__.pyi +2 -2
  141. metaflow-stubs/user_configs/config_decorators.pyi +6 -6
  142. metaflow-stubs/user_configs/config_options.pyi +2 -2
  143. metaflow-stubs/user_configs/config_parameters.pyi +5 -5
  144. metaflow-stubs/version.pyi +2 -2
  145. {metaflow_stubs-2.15.7.dist-info → metaflow_stubs-2.15.9.dist-info}/METADATA +2 -2
  146. metaflow_stubs-2.15.9.dist-info/RECORD +149 -0
  147. {metaflow_stubs-2.15.7.dist-info → metaflow_stubs-2.15.9.dist-info}/WHEEL +1 -1
  148. metaflow_stubs-2.15.7.dist-info/RECORD +0 -146
  149. {metaflow_stubs-2.15.7.dist-info → metaflow_stubs-2.15.9.dist-info}/top_level.txt +0 -0
@@ -1,15 +1,15 @@
1
1
  ######################################################################################################
2
2
  # Auto-generated Metaflow stub file #
3
- # MF version: 2.15.7 #
4
- # Generated on 2025-03-29T00:30:30.645150 #
3
+ # MF version: 2.15.9 #
4
+ # Generated on 2025-04-22T01:36:50.325150 #
5
5
  ######################################################################################################
6
6
 
7
7
  from __future__ import annotations
8
8
 
9
9
  import typing
10
10
  if typing.TYPE_CHECKING:
11
- import typing
12
11
  import datetime
12
+ import typing
13
13
  FlowSpecDerived = typing.TypeVar("FlowSpecDerived", bound="FlowSpec", contravariant=False, covariant=False)
14
14
  StepFlag = typing.NewType("StepFlag", bool)
15
15
 
@@ -36,14 +36,15 @@ from .user_configs.config_parameters import config_expr as config_expr
36
36
  from .user_configs.config_decorators import CustomFlowDecorator as CustomFlowDecorator
37
37
  from .user_configs.config_decorators import CustomStepDecorator as CustomStepDecorator
38
38
  from . import tuple_util as tuple_util
39
+ from . import metaflow_git as metaflow_git
39
40
  from . import events as events
40
41
  from . import runner as runner
41
42
  from . import plugins as plugins
42
43
  from .plugins.datatools.s3.s3 import S3 as S3
43
44
  from . import includefile as includefile
44
45
  from .includefile import IncludeFile as IncludeFile
45
- from .plugins.pypi.parsers import pyproject_toml_parser as pyproject_toml_parser
46
46
  from .plugins.pypi.parsers import requirements_txt_parser as requirements_txt_parser
47
+ from .plugins.pypi.parsers import pyproject_toml_parser as pyproject_toml_parser
47
48
  from .plugins.pypi.parsers import conda_environment_yml_parser as conda_environment_yml_parser
48
49
  from . import cards as cards
49
50
  from . import client as client
@@ -145,136 +146,156 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
145
146
  """
146
147
  ...
147
148
 
148
- @typing.overload
149
- def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
150
- """
151
- Decorator prototype for all step decorators. This function gets specialized
152
- and imported for all decorators types by _import_plugin_decorators().
153
- """
154
- ...
155
-
156
- @typing.overload
157
- def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
158
- ...
159
-
160
- def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
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', 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]]]:
161
150
  """
162
- Decorator prototype for all step decorators. This function gets specialized
163
- and imported for all decorators types by _import_plugin_decorators().
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
+ service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
174
+ Kubernetes service account to use when launching pod in Kubernetes.
175
+ secrets : List[str], optional, default None
176
+ Kubernetes secrets to use when launching pod in Kubernetes. These
177
+ secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
178
+ in Metaflow configuration.
179
+ node_selector: Union[Dict[str,str], str], optional, default None
180
+ Kubernetes node selector(s) to apply to the pod running the task.
181
+ Can be passed in as a comma separated string of values e.g.
182
+ 'kubernetes.io/os=linux,kubernetes.io/arch=amd64' or as a dictionary
183
+ {'kubernetes.io/os': 'linux', 'kubernetes.io/arch': 'amd64'}
184
+ namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
185
+ Kubernetes namespace to use when launching pod in Kubernetes.
186
+ gpu : int, optional, default None
187
+ Number of GPUs required for this step. A value of zero implies that
188
+ the scheduled node should not have GPUs.
189
+ gpu_vendor : str, default KUBERNETES_GPU_VENDOR
190
+ The vendor of the GPUs to be used for this step.
191
+ tolerations : List[str], default []
192
+ The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
193
+ Kubernetes tolerations to use when launching pod in Kubernetes.
194
+ labels: Dict[str, str], default: METAFLOW_KUBERNETES_LABELS
195
+ Kubernetes labels to use when launching pod in Kubernetes.
196
+ annotations: Dict[str, str], default: METAFLOW_KUBERNETES_ANNOTATIONS
197
+ Kubernetes annotations to use when launching pod in Kubernetes.
198
+ use_tmpfs : bool, default False
199
+ This enables an explicit tmpfs mount for this step.
200
+ tmpfs_tempdir : bool, default True
201
+ sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
202
+ tmpfs_size : int, optional, default: None
203
+ The value for the size (in MiB) of the tmpfs mount for this step.
204
+ This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
205
+ memory allocated for this step.
206
+ tmpfs_path : str, optional, default /metaflow_temp
207
+ Path to tmpfs mount for this step.
208
+ persistent_volume_claims : Dict[str, str], optional, default None
209
+ A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
210
+ volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
211
+ shared_memory: int, optional
212
+ Shared memory size (in MiB) required for this step
213
+ port: int, optional
214
+ Port number to specify in the Kubernetes job object
215
+ compute_pool : str, optional, default None
216
+ Compute pool to be used for for this step.
217
+ If not specified, any accessible compute pool within the perimeter is used.
218
+ hostname_resolution_timeout: int, default 10 * 60
219
+ Timeout in seconds for the workers tasks in the gang scheduled cluster to resolve the hostname of control task.
220
+ Only applicable when @parallel is used.
221
+ qos: str, default: Burstable
222
+ Quality of Service class to assign to the pod. Supported values are: Guaranteed, Burstable, BestEffort
223
+
224
+ security_context: Dict[str, Any], optional, default None
225
+ Container security context. Applies to the task container. Allows the following keys:
226
+ - privileged: bool, optional, default None
227
+ - allow_privilege_escalation: bool, optional, default None
228
+ - run_as_user: int, optional, default None
229
+ - run_as_group: int, optional, default None
230
+ - run_as_non_root: bool, optional, default None
164
231
  """
165
232
  ...
166
233
 
167
234
  @typing.overload
168
- 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]]]:
235
+ 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]]]:
169
236
  """
170
- Specifies a timeout for your step.
171
-
172
- This decorator is useful if this step may hang indefinitely.
173
-
174
- This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
175
- A timeout is considered to be an exception thrown by the step. It will cause the step to be
176
- retried if needed and the exception will be caught by the `@catch` decorator, if present.
237
+ Creates a human-readable report, a Metaflow Card, after this step completes.
177
238
 
178
- Note that all the values specified in parameters are added together so if you specify
179
- 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
239
+ Note that you may add multiple `@card` decorators in a step with different parameters.
180
240
 
181
241
 
182
242
  Parameters
183
243
  ----------
184
- seconds : int, default 0
185
- Number of seconds to wait prior to timing out.
186
- minutes : int, default 0
187
- Number of minutes to wait prior to timing out.
188
- hours : int, default 0
189
- Number of hours to wait prior to timing out.
244
+ type : str, default 'default'
245
+ Card type.
246
+ id : str, optional, default None
247
+ If multiple cards are present, use this id to identify this card.
248
+ options : Dict[str, Any], default {}
249
+ Options passed to the card. The contents depend on the card type.
250
+ timeout : int, default 45
251
+ Interrupt reporting if it takes more than this many seconds.
190
252
  """
191
253
  ...
192
254
 
193
255
  @typing.overload
194
- def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
256
+ def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
195
257
  ...
196
258
 
197
259
  @typing.overload
198
- def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
260
+ def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
199
261
  ...
200
262
 
201
- 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):
263
+ 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):
202
264
  """
203
- Specifies a timeout for your step.
204
-
205
- This decorator is useful if this step may hang indefinitely.
206
-
207
- This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
208
- A timeout is considered to be an exception thrown by the step. It will cause the step to be
209
- retried if needed and the exception will be caught by the `@catch` decorator, if present.
265
+ Creates a human-readable report, a Metaflow Card, after this step completes.
210
266
 
211
- Note that all the values specified in parameters are added together so if you specify
212
- 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
267
+ Note that you may add multiple `@card` decorators in a step with different parameters.
213
268
 
214
269
 
215
270
  Parameters
216
271
  ----------
217
- seconds : int, default 0
218
- Number of seconds to wait prior to timing out.
219
- minutes : int, default 0
220
- Number of minutes to wait prior to timing out.
221
- hours : int, default 0
222
- Number of hours to wait prior to timing out.
272
+ type : str, default 'default'
273
+ Card type.
274
+ id : str, optional, default None
275
+ If multiple cards are present, use this id to identify this card.
276
+ options : Dict[str, Any], default {}
277
+ Options passed to the card. The contents depend on the card type.
278
+ timeout : int, default 45
279
+ Interrupt reporting if it takes more than this many seconds.
223
280
  """
224
281
  ...
225
282
 
226
283
  @typing.overload
227
- def retry(*, times: int = 3, minutes_between_retries: int = 2) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
284
+ def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
228
285
  """
229
- Specifies the number of times the task corresponding
230
- to a step needs to be retried.
231
-
232
- This decorator is useful for handling transient errors, such as networking issues.
233
- If your task contains operations that can't be retried safely, e.g. database updates,
234
- it is advisable to annotate it with `@retry(times=0)`.
235
-
236
- This can be used in conjunction with the `@catch` decorator. The `@catch`
237
- decorator will execute a no-op task after all retries have been exhausted,
238
- ensuring that the flow execution can continue.
239
-
240
-
241
- Parameters
242
- ----------
243
- times : int, default 3
244
- Number of times to retry this task.
245
- minutes_between_retries : int, default 2
246
- Number of minutes between retries.
286
+ Decorator prototype for all step decorators. This function gets specialized
287
+ and imported for all decorators types by _import_plugin_decorators().
247
288
  """
248
289
  ...
249
290
 
250
291
  @typing.overload
251
- def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
252
- ...
253
-
254
- @typing.overload
255
- def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
292
+ def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
256
293
  ...
257
294
 
258
- def retry(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, times: int = 3, minutes_between_retries: int = 2):
295
+ def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
259
296
  """
260
- Specifies the number of times the task corresponding
261
- to a step needs to be retried.
262
-
263
- This decorator is useful for handling transient errors, such as networking issues.
264
- If your task contains operations that can't be retried safely, e.g. database updates,
265
- it is advisable to annotate it with `@retry(times=0)`.
266
-
267
- This can be used in conjunction with the `@catch` decorator. The `@catch`
268
- decorator will execute a no-op task after all retries have been exhausted,
269
- ensuring that the flow execution can continue.
270
-
271
-
272
- Parameters
273
- ----------
274
- times : int, default 3
275
- Number of times to retry this task.
276
- minutes_between_retries : int, default 2
277
- Number of minutes between retries.
297
+ Decorator prototype for all step decorators. This function gets specialized
298
+ and imported for all decorators types by _import_plugin_decorators().
278
299
  """
279
300
  ...
280
301
 
@@ -428,112 +449,116 @@ def batch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
428
449
  ...
429
450
 
430
451
  @typing.overload
431
- 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]]]:
452
+ 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]]]:
432
453
  """
433
- Specifies the Conda environment for the step.
454
+ Specifies a timeout for your step.
434
455
 
435
- Information in this decorator will augment any
436
- attributes set in the `@conda_base` flow-level decorator. Hence,
437
- you can use `@conda_base` to set packages required by all
438
- steps and use `@conda` to specify step-specific overrides.
456
+ This decorator is useful if this step may hang indefinitely.
457
+
458
+ This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
459
+ A timeout is considered to be an exception thrown by the step. It will cause the step to be
460
+ retried if needed and the exception will be caught by the `@catch` decorator, if present.
461
+
462
+ Note that all the values specified in parameters are added together so if you specify
463
+ 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
439
464
 
440
465
 
441
466
  Parameters
442
467
  ----------
443
- packages : Dict[str, str], default {}
444
- Packages to use for this step. The key is the name of the package
445
- and the value is the version to use.
446
- libraries : Dict[str, str], default {}
447
- Supported for backward compatibility. When used with packages, packages will take precedence.
448
- python : str, optional, default None
449
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
450
- that the version used will correspond to the version of the Python interpreter used to start the run.
451
- disabled : bool, default False
452
- If set to True, disables @conda.
468
+ seconds : int, default 0
469
+ Number of seconds to wait prior to timing out.
470
+ minutes : int, default 0
471
+ Number of minutes to wait prior to timing out.
472
+ hours : int, default 0
473
+ Number of hours to wait prior to timing out.
453
474
  """
454
475
  ...
455
476
 
456
477
  @typing.overload
457
- def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
478
+ def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
458
479
  ...
459
480
 
460
481
  @typing.overload
461
- def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
482
+ def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
462
483
  ...
463
484
 
464
- def conda(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False):
485
+ 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):
465
486
  """
466
- Specifies the Conda environment for the step.
487
+ Specifies a timeout for your step.
467
488
 
468
- Information in this decorator will augment any
469
- attributes set in the `@conda_base` flow-level decorator. Hence,
470
- you can use `@conda_base` to set packages required by all
471
- steps and use `@conda` to specify step-specific overrides.
489
+ This decorator is useful if this step may hang indefinitely.
490
+
491
+ This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
492
+ A timeout is considered to be an exception thrown by the step. It will cause the step to be
493
+ retried if needed and the exception will be caught by the `@catch` decorator, if present.
494
+
495
+ Note that all the values specified in parameters are added together so if you specify
496
+ 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
472
497
 
473
498
 
474
499
  Parameters
475
500
  ----------
476
- packages : Dict[str, str], default {}
477
- Packages to use for this step. The key is the name of the package
478
- and the value is the version to use.
479
- libraries : Dict[str, str], default {}
480
- Supported for backward compatibility. When used with packages, packages will take precedence.
481
- python : str, optional, default None
482
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
483
- that the version used will correspond to the version of the Python interpreter used to start the run.
484
- disabled : bool, default False
485
- If set to True, disables @conda.
501
+ seconds : int, default 0
502
+ Number of seconds to wait prior to timing out.
503
+ minutes : int, default 0
504
+ Number of minutes to wait prior to timing out.
505
+ hours : int, default 0
506
+ Number of hours to wait prior to timing out.
486
507
  """
487
508
  ...
488
509
 
489
510
  @typing.overload
490
- 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]]]:
511
+ def retry(*, times: int = 3, minutes_between_retries: int = 2) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
491
512
  """
492
- Specifies that the step will success under all circumstances.
513
+ Specifies the number of times the task corresponding
514
+ to a step needs to be retried.
493
515
 
494
- The decorator will create an optional artifact, specified by `var`, which
495
- contains the exception raised. You can use it to detect the presence
496
- of errors, indicating that all happy-path artifacts produced by the step
497
- are missing.
516
+ This decorator is useful for handling transient errors, such as networking issues.
517
+ If your task contains operations that can't be retried safely, e.g. database updates,
518
+ it is advisable to annotate it with `@retry(times=0)`.
519
+
520
+ This can be used in conjunction with the `@catch` decorator. The `@catch`
521
+ decorator will execute a no-op task after all retries have been exhausted,
522
+ ensuring that the flow execution can continue.
498
523
 
499
524
 
500
525
  Parameters
501
526
  ----------
502
- var : str, optional, default None
503
- Name of the artifact in which to store the caught exception.
504
- If not specified, the exception is not stored.
505
- print_exception : bool, default True
506
- Determines whether or not the exception is printed to
507
- stdout when caught.
527
+ times : int, default 3
528
+ Number of times to retry this task.
529
+ minutes_between_retries : int, default 2
530
+ Number of minutes between retries.
508
531
  """
509
532
  ...
510
533
 
511
534
  @typing.overload
512
- def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
535
+ def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
513
536
  ...
514
537
 
515
538
  @typing.overload
516
- def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
539
+ def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
517
540
  ...
518
541
 
519
- 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):
542
+ def retry(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, times: int = 3, minutes_between_retries: int = 2):
520
543
  """
521
- Specifies that the step will success under all circumstances.
544
+ Specifies the number of times the task corresponding
545
+ to a step needs to be retried.
522
546
 
523
- The decorator will create an optional artifact, specified by `var`, which
524
- contains the exception raised. You can use it to detect the presence
525
- of errors, indicating that all happy-path artifacts produced by the step
526
- are missing.
547
+ This decorator is useful for handling transient errors, such as networking issues.
548
+ If your task contains operations that can't be retried safely, e.g. database updates,
549
+ it is advisable to annotate it with `@retry(times=0)`.
550
+
551
+ This can be used in conjunction with the `@catch` decorator. The `@catch`
552
+ decorator will execute a no-op task after all retries have been exhausted,
553
+ ensuring that the flow execution can continue.
527
554
 
528
555
 
529
556
  Parameters
530
557
  ----------
531
- var : str, optional, default None
532
- Name of the artifact in which to store the caught exception.
533
- If not specified, the exception is not stored.
534
- print_exception : bool, default True
535
- Determines whether or not the exception is printed to
536
- stdout when caught.
558
+ times : int, default 3
559
+ Number of times to retry this task.
560
+ minutes_between_retries : int, default 2
561
+ Number of minutes between retries.
537
562
  """
538
563
  ...
539
564
 
@@ -571,51 +596,81 @@ def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], Non
571
596
  ...
572
597
 
573
598
  @typing.overload
574
- 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]]]:
599
+ 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]]]:
575
600
  """
576
- Creates a human-readable report, a Metaflow Card, after this step completes.
601
+ Specifies the resources needed when executing this step.
577
602
 
578
- Note that you may add multiple `@card` decorators in a step with different parameters.
603
+ Use `@resources` to specify the resource requirements
604
+ independently of the specific compute layer (`@batch`, `@kubernetes`).
605
+
606
+ You can choose the compute layer on the command line by executing e.g.
607
+ ```
608
+ python myflow.py run --with batch
609
+ ```
610
+ or
611
+ ```
612
+ python myflow.py run --with kubernetes
613
+ ```
614
+ which executes the flow on the desired system using the
615
+ requirements specified in `@resources`.
579
616
 
580
617
 
581
618
  Parameters
582
619
  ----------
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.
620
+ cpu : int, default 1
621
+ Number of CPUs required for this step.
622
+ gpu : int, optional, default None
623
+ Number of GPUs required for this step.
624
+ disk : int, optional, default None
625
+ Disk size (in MB) required for this step. Only applies on Kubernetes.
626
+ memory : int, default 4096
627
+ Memory size (in MB) required for this step.
628
+ shared_memory : int, optional, default None
629
+ The value for the size (in MiB) of the /dev/shm volume for this step.
630
+ This parameter maps to the `--shm-size` option in Docker.
591
631
  """
592
632
  ...
593
633
 
594
634
  @typing.overload
595
- def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
635
+ def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
596
636
  ...
597
637
 
598
638
  @typing.overload
599
- def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
639
+ def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
600
640
  ...
601
641
 
602
- 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):
642
+ 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):
603
643
  """
604
- Creates a human-readable report, a Metaflow Card, after this step completes.
644
+ Specifies the resources needed when executing this step.
605
645
 
606
- Note that you may add multiple `@card` decorators in a step with different parameters.
646
+ Use `@resources` to specify the resource requirements
647
+ independently of the specific compute layer (`@batch`, `@kubernetes`).
648
+
649
+ You can choose the compute layer on the command line by executing e.g.
650
+ ```
651
+ python myflow.py run --with batch
652
+ ```
653
+ or
654
+ ```
655
+ python myflow.py run --with kubernetes
656
+ ```
657
+ which executes the flow on the desired system using the
658
+ requirements specified in `@resources`.
607
659
 
608
660
 
609
661
  Parameters
610
662
  ----------
611
- type : str, default 'default'
612
- Card type.
613
- id : str, optional, default None
614
- If multiple cards are present, use this id to identify this card.
615
- options : Dict[str, Any], default {}
616
- Options passed to the card. The contents depend on the card type.
617
- timeout : int, default 45
618
- Interrupt reporting if it takes more than this many seconds.
663
+ cpu : int, default 1
664
+ Number of CPUs required for this step.
665
+ gpu : int, optional, default None
666
+ Number of GPUs required for this step.
667
+ disk : int, optional, default None
668
+ Disk size (in MB) required for this step. Only applies on Kubernetes.
669
+ memory : int, default 4096
670
+ Memory size (in MB) required for this step.
671
+ shared_memory : int, optional, default None
672
+ The value for the size (in MiB) of the /dev/shm volume for this step.
673
+ This parameter maps to the `--shm-size` option in Docker.
619
674
  """
620
675
  ...
621
676
 
@@ -705,217 +760,293 @@ def secrets(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None],
705
760
  """
706
761
  ...
707
762
 
708
- def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: typing.Optional[str] = None, image_pull_policy: str = 'KUBERNETES_IMAGE_PULL_POLICY', service_account: str = 'METAFLOW_KUBERNETES_SERVICE_ACCOUNT', secrets: typing.Optional[typing.List[str]] = None, node_selector: typing.Union[typing.Dict[str, str], str, None] = None, namespace: str = 'METAFLOW_KUBERNETES_NAMESPACE', gpu: typing.Optional[int] = None, gpu_vendor: str = 'KUBERNETES_GPU_VENDOR', tolerations: typing.List[str] = [], labels: typing.Dict[str, str] = 'METAFLOW_KUBERNETES_LABELS', annotations: typing.Dict[str, str] = 'METAFLOW_KUBERNETES_ANNOTATIONS', use_tmpfs: bool = False, tmpfs_tempdir: bool = True, tmpfs_size: typing.Optional[int] = None, tmpfs_path: typing.Optional[str] = '/metaflow_temp', persistent_volume_claims: typing.Optional[typing.Dict[str, str]] = None, shared_memory: typing.Optional[int] = None, port: typing.Optional[int] = None, compute_pool: typing.Optional[str] = None, hostname_resolution_timeout: int = 600, qos: str = 'Burstable') -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
763
+ @typing.overload
764
+ 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]]]:
709
765
  """
710
- Specifies that this step should execute on Kubernetes.
766
+ Specifies the Conda environment for the step.
767
+
768
+ Information in this decorator will augment any
769
+ attributes set in the `@conda_base` flow-level decorator. Hence,
770
+ you can use `@conda_base` to set packages required by all
771
+ steps and use `@conda` to specify step-specific overrides.
711
772
 
712
773
 
713
774
  Parameters
714
775
  ----------
715
- cpu : int, default 1
716
- Number of CPUs required for this step. If `@resources` is
717
- also present, the maximum value from all decorators is used.
718
- memory : int, default 4096
719
- Memory size (in MB) required for this step. If
720
- `@resources` is also present, the maximum value from all decorators is
721
- used.
722
- disk : int, default 10240
723
- Disk size (in MB) required for this step. If
724
- `@resources` is also present, the maximum value from all decorators is
725
- used.
726
- image : str, optional, default None
727
- Docker image to use when launching on Kubernetes. If not specified, and
728
- METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
729
- not, a default Docker image mapping to the current version of Python is used.
730
- image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
731
- If given, the imagePullPolicy to be applied to the Docker image of the step.
732
- service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
733
- Kubernetes service account to use when launching pod in Kubernetes.
734
- secrets : List[str], optional, default None
735
- Kubernetes secrets to use when launching pod in Kubernetes. These
736
- secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
737
- in Metaflow configuration.
738
- node_selector: Union[Dict[str,str], str], optional, default None
739
- Kubernetes node selector(s) to apply to the pod running the task.
740
- Can be passed in as a comma separated string of values e.g.
741
- 'kubernetes.io/os=linux,kubernetes.io/arch=amd64' or as a dictionary
742
- {'kubernetes.io/os': 'linux', 'kubernetes.io/arch': 'amd64'}
743
- namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
744
- Kubernetes namespace to use when launching pod in Kubernetes.
745
- gpu : int, optional, default None
746
- Number of GPUs required for this step. A value of zero implies that
747
- the scheduled node should not have GPUs.
748
- gpu_vendor : str, default KUBERNETES_GPU_VENDOR
749
- The vendor of the GPUs to be used for this step.
750
- tolerations : List[str], default []
751
- The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
752
- Kubernetes tolerations to use when launching pod in Kubernetes.
753
- labels: Dict[str, str], default: METAFLOW_KUBERNETES_LABELS
754
- Kubernetes labels to use when launching pod in Kubernetes.
755
- annotations: Dict[str, str], default: METAFLOW_KUBERNETES_ANNOTATIONS
756
- Kubernetes annotations to use when launching pod in Kubernetes.
757
- use_tmpfs : bool, default False
758
- This enables an explicit tmpfs mount for this step.
759
- tmpfs_tempdir : bool, default True
760
- sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
761
- tmpfs_size : int, optional, default: None
762
- The value for the size (in MiB) of the tmpfs mount for this step.
763
- This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
764
- memory allocated for this step.
765
- tmpfs_path : str, optional, default /metaflow_temp
766
- Path to tmpfs mount for this step.
767
- persistent_volume_claims : Dict[str, str], optional, default None
768
- A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
769
- volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
770
- shared_memory: int, optional
771
- Shared memory size (in MiB) required for this step
772
- port: int, optional
773
- Port number to specify in the Kubernetes job object
774
- compute_pool : str, optional, default None
775
- Compute pool to be used for for this step.
776
- If not specified, any accessible compute pool within the perimeter is used.
777
- hostname_resolution_timeout: int, default 10 * 60
778
- Timeout in seconds for the workers tasks in the gang scheduled cluster to resolve the hostname of control task.
779
- Only applicable when @parallel is used.
780
- qos: str, default: Burstable
781
- Quality of Service class to assign to the pod. Supported values are: Guaranteed, Burstable, BestEffort
776
+ packages : Dict[str, str], default {}
777
+ Packages to use for this step. The key is the name of the package
778
+ and the value is the version to use.
779
+ libraries : Dict[str, str], default {}
780
+ Supported for backward compatibility. When used with packages, packages will take precedence.
781
+ python : str, optional, default None
782
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
783
+ that the version used will correspond to the version of the Python interpreter used to start the run.
784
+ disabled : bool, default False
785
+ If set to True, disables @conda.
782
786
  """
783
787
  ...
784
788
 
785
789
  @typing.overload
786
- 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]]]:
790
+ def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
791
+ ...
792
+
793
+ @typing.overload
794
+ def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
795
+ ...
796
+
797
+ def conda(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False):
787
798
  """
788
- Specifies the resources needed when executing this step.
799
+ Specifies the Conda environment for the step.
789
800
 
790
- Use `@resources` to specify the resource requirements
791
- independently of the specific compute layer (`@batch`, `@kubernetes`).
801
+ Information in this decorator will augment any
802
+ attributes set in the `@conda_base` flow-level decorator. Hence,
803
+ you can use `@conda_base` to set packages required by all
804
+ steps and use `@conda` to specify step-specific overrides.
792
805
 
793
- You can choose the compute layer on the command line by executing e.g.
794
- ```
795
- python myflow.py run --with batch
796
- ```
797
- or
798
- ```
799
- python myflow.py run --with kubernetes
800
- ```
801
- which executes the flow on the desired system using the
802
- requirements specified in `@resources`.
806
+
807
+ Parameters
808
+ ----------
809
+ packages : Dict[str, str], default {}
810
+ Packages to use for this step. The key is the name of the package
811
+ and the value is the version to use.
812
+ libraries : Dict[str, str], default {}
813
+ Supported for backward compatibility. When used with packages, packages will take precedence.
814
+ python : str, optional, default None
815
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
816
+ that the version used will correspond to the version of the Python interpreter used to start the run.
817
+ disabled : bool, default False
818
+ If set to True, disables @conda.
819
+ """
820
+ ...
821
+
822
+ @typing.overload
823
+ def catch(*, var: typing.Optional[str] = None, print_exception: bool = True) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
824
+ """
825
+ Specifies that the step will success under all circumstances.
826
+
827
+ The decorator will create an optional artifact, specified by `var`, which
828
+ contains the exception raised. You can use it to detect the presence
829
+ of errors, indicating that all happy-path artifacts produced by the step
830
+ are missing.
803
831
 
804
832
 
805
833
  Parameters
806
834
  ----------
807
- cpu : int, default 1
808
- Number of CPUs required for this step.
809
- gpu : int, optional, default None
810
- Number of GPUs required for this step.
811
- disk : int, optional, default None
812
- Disk size (in MB) required for this step. Only applies on Kubernetes.
813
- memory : int, default 4096
814
- Memory size (in MB) required for this step.
815
- shared_memory : int, optional, default None
816
- The value for the size (in MiB) of the /dev/shm volume for this step.
817
- This parameter maps to the `--shm-size` option in Docker.
835
+ var : str, optional, default None
836
+ Name of the artifact in which to store the caught exception.
837
+ If not specified, the exception is not stored.
838
+ print_exception : bool, default True
839
+ Determines whether or not the exception is printed to
840
+ stdout when caught.
818
841
  """
819
842
  ...
820
843
 
821
844
  @typing.overload
822
- def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
845
+ def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
823
846
  ...
824
847
 
825
848
  @typing.overload
826
- def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
849
+ def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
827
850
  ...
828
851
 
829
- def resources(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, cpu: int = 1, gpu: typing.Optional[int] = None, disk: typing.Optional[int] = None, memory: int = 4096, shared_memory: typing.Optional[int] = None):
852
+ def 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):
830
853
  """
831
- Specifies the resources needed when executing this step.
854
+ Specifies that the step will success under all circumstances.
832
855
 
833
- Use `@resources` to specify the resource requirements
834
- independently of the specific compute layer (`@batch`, `@kubernetes`).
856
+ The decorator will create an optional artifact, specified by `var`, which
857
+ contains the exception raised. You can use it to detect the presence
858
+ of errors, indicating that all happy-path artifacts produced by the step
859
+ are missing.
835
860
 
836
- You can choose the compute layer on the command line by executing e.g.
837
- ```
838
- python myflow.py run --with batch
839
- ```
840
- or
841
- ```
842
- python myflow.py run --with kubernetes
843
- ```
844
- which executes the flow on the desired system using the
845
- requirements specified in `@resources`.
861
+
862
+ Parameters
863
+ ----------
864
+ var : str, optional, default None
865
+ Name of the artifact in which to store the caught exception.
866
+ If not specified, the exception is not stored.
867
+ print_exception : bool, default True
868
+ Determines whether or not the exception is printed to
869
+ stdout when caught.
870
+ """
871
+ ...
872
+
873
+ def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
874
+ """
875
+ Specifies what flows belong to the same project.
876
+
877
+ A project-specific namespace is created for all flows that
878
+ use the same `@project(name)`.
846
879
 
847
880
 
848
881
  Parameters
849
882
  ----------
850
- cpu : int, default 1
851
- Number of CPUs required for this step.
852
- gpu : int, optional, default None
853
- Number of GPUs required for this step.
854
- disk : int, optional, default None
855
- Disk size (in MB) required for this step. Only applies on Kubernetes.
856
- memory : int, default 4096
857
- Memory size (in MB) required for this step.
858
- shared_memory : int, optional, default None
859
- The value for the size (in MiB) of the /dev/shm volume for this step.
860
- This parameter maps to the `--shm-size` option in Docker.
883
+ name : str
884
+ Project name. Make sure that the name is unique amongst all
885
+ projects that use the same production scheduler. The name may
886
+ contain only lowercase alphanumeric characters and underscores.
887
+
888
+ branch : Optional[str], default None
889
+ The branch to use. If not specified, the branch is set to
890
+ `user.<username>` unless `production` is set to `True`. This can
891
+ also be set on the command line using `--branch` as a top-level option.
892
+ It is an error to specify `branch` in the decorator and on the command line.
893
+
894
+ production : bool, default False
895
+ Whether or not the branch is the production branch. This can also be set on the
896
+ command line using `--production` as a top-level option. It is an error to specify
897
+ `production` in the decorator and on the command line.
898
+ The project branch name will be:
899
+ - if `branch` is specified:
900
+ - if `production` is True: `prod.<branch>`
901
+ - if `production` is False: `test.<branch>`
902
+ - if `branch` is not specified:
903
+ - if `production` is True: `prod`
904
+ - if `production` is False: `user.<username>`
905
+ """
906
+ ...
907
+
908
+ 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]]:
909
+ """
910
+ 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.
911
+ 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.
912
+
913
+
914
+ Parameters
915
+ ----------
916
+ timeout : int
917
+ Time, in seconds before the task times out and fails. (Default: 3600)
918
+ poke_interval : int
919
+ Time in seconds that the job should wait in between each try. (Default: 60)
920
+ mode : str
921
+ How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
922
+ exponential_backoff : bool
923
+ allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
924
+ pool : str
925
+ the slot pool this task should run in,
926
+ slot pools are a way to limit concurrency for certain tasks. (Default:None)
927
+ soft_fail : bool
928
+ Set to true to mark the task as SKIPPED on failure. (Default: False)
929
+ name : str
930
+ Name of the sensor on Airflow
931
+ description : str
932
+ Description of sensor in the Airflow UI
933
+ external_dag_id : str
934
+ The dag_id that contains the task you want to wait for.
935
+ external_task_ids : List[str]
936
+ The list of task_ids that you want to wait for.
937
+ If None (default value) the sensor waits for the DAG. (Default: None)
938
+ allowed_states : List[str]
939
+ Iterable of allowed states, (Default: ['success'])
940
+ failed_states : List[str]
941
+ Iterable of failed or dis-allowed states. (Default: None)
942
+ execution_delta : datetime.timedelta
943
+ time difference with the previous execution to look at,
944
+ the default is the same logical date as the current task or DAG. (Default: None)
945
+ check_existence: bool
946
+ Set to True to check if the external task exists or check if
947
+ the DAG to wait for exists. (Default: True)
861
948
  """
862
949
  ...
863
950
 
864
951
  @typing.overload
865
- 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]]:
952
+ def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
866
953
  """
867
- Specifies the times when the flow should be run when running on a
868
- production scheduler.
954
+ Specifies the PyPI packages for all steps of the flow.
869
955
 
956
+ Use `@pypi_base` to set common packages required by all
957
+ steps and use `@pypi` to specify step-specific overrides.
870
958
 
871
959
  Parameters
872
960
  ----------
873
- hourly : bool, default False
874
- Run the workflow hourly.
875
- daily : bool, default True
876
- Run the workflow daily.
877
- weekly : bool, default False
878
- Run the workflow weekly.
879
- cron : str, optional, default None
880
- Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
881
- specified by this expression.
882
- timezone : str, optional, default None
883
- Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
884
- which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
961
+ packages : Dict[str, str], default: {}
962
+ Packages to use for this flow. The key is the name of the package
963
+ and the value is the version to use.
964
+ python : str, optional, default: None
965
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
966
+ that the version used will correspond to the version of the Python interpreter used to start the run.
885
967
  """
886
968
  ...
887
969
 
888
970
  @typing.overload
889
- def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
971
+ def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
972
+ ...
973
+
974
+ def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
975
+ """
976
+ Specifies the PyPI packages for all steps of the flow.
977
+
978
+ Use `@pypi_base` to set common packages required by all
979
+ steps and use `@pypi` to specify step-specific overrides.
980
+
981
+ Parameters
982
+ ----------
983
+ packages : Dict[str, str], default: {}
984
+ Packages to use for this flow. The key is the name of the package
985
+ and the value is the version to use.
986
+ python : str, optional, default: None
987
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
988
+ that the version used will correspond to the version of the Python interpreter used to start the run.
989
+ """
990
+ ...
991
+
992
+ @typing.overload
993
+ 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]]:
994
+ """
995
+ Specifies the Conda environment for all steps of the flow.
996
+
997
+ Use `@conda_base` to set common libraries required by all
998
+ steps and use `@conda` to specify step-specific additions.
999
+
1000
+
1001
+ Parameters
1002
+ ----------
1003
+ packages : Dict[str, str], default {}
1004
+ Packages to use for this flow. The key is the name of the package
1005
+ and the value is the version to use.
1006
+ libraries : Dict[str, str], default {}
1007
+ Supported for backward compatibility. When used with packages, packages will take precedence.
1008
+ python : str, optional, default None
1009
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1010
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1011
+ disabled : bool, default False
1012
+ If set to True, disables Conda.
1013
+ """
1014
+ ...
1015
+
1016
+ @typing.overload
1017
+ def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
890
1018
  ...
891
1019
 
892
- 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):
1020
+ 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):
893
1021
  """
894
- Specifies the times when the flow should be run when running on a
895
- production scheduler.
1022
+ Specifies the Conda environment for all steps of the flow.
1023
+
1024
+ Use `@conda_base` to set common libraries required by all
1025
+ steps and use `@conda` to specify step-specific additions.
896
1026
 
897
1027
 
898
1028
  Parameters
899
1029
  ----------
900
- hourly : bool, default False
901
- Run the workflow hourly.
902
- daily : bool, default True
903
- Run the workflow daily.
904
- weekly : bool, default False
905
- Run the workflow weekly.
906
- cron : str, optional, default None
907
- Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
908
- specified by this expression.
909
- timezone : str, optional, default None
910
- Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
911
- which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1030
+ packages : Dict[str, str], default {}
1031
+ Packages to use for this flow. The key is the name of the package
1032
+ and the value is the version to use.
1033
+ libraries : Dict[str, str], default {}
1034
+ Supported for backward compatibility. When used with packages, packages will take precedence.
1035
+ python : str, optional, default None
1036
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1037
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1038
+ disabled : bool, default False
1039
+ If set to True, disables Conda.
912
1040
  """
913
1041
  ...
914
1042
 
915
- 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]]:
1043
+ 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]]:
916
1044
  """
917
- 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.
918
- 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.
1045
+ 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)
1046
+ before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
1047
+ and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
1048
+ added as a flow decorators. Adding more than one decorator will ensure that `start` step
1049
+ starts only after all sensors finish.
919
1050
 
920
1051
 
921
1052
  Parameters
@@ -937,21 +1068,18 @@ def airflow_external_task_sensor(*, timeout: int, poke_interval: int, mode: str,
937
1068
  Name of the sensor on Airflow
938
1069
  description : str
939
1070
  Description of sensor in the Airflow UI
940
- external_dag_id : str
941
- The dag_id that contains the task you want to wait for.
942
- external_task_ids : List[str]
943
- The list of task_ids that you want to wait for.
944
- If None (default value) the sensor waits for the DAG. (Default: None)
945
- allowed_states : List[str]
946
- Iterable of allowed states, (Default: ['success'])
947
- failed_states : List[str]
948
- Iterable of failed or dis-allowed states. (Default: None)
949
- execution_delta : datetime.timedelta
950
- time difference with the previous execution to look at,
951
- the default is the same logical date as the current task or DAG. (Default: None)
952
- check_existence: bool
953
- Set to True to check if the external task exists or check if
954
- the DAG to wait for exists. (Default: True)
1071
+ bucket_key : Union[str, List[str]]
1072
+ The key(s) being waited on. Supports full s3:// style url or relative path from root level.
1073
+ When it's specified as a full s3:// url, please leave `bucket_name` as None
1074
+ bucket_name : str
1075
+ Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
1076
+ When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
1077
+ wildcard_match : bool
1078
+ whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
1079
+ aws_conn_id : str
1080
+ a reference to the s3 connection on Airflow. (Default: None)
1081
+ verify : bool
1082
+ Whether or not to verify SSL certificates for S3 connection. (Default: None)
955
1083
  """
956
1084
  ...
957
1085
 
@@ -1048,98 +1176,6 @@ def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, event: t
1048
1176
  """
1049
1177
  ...
1050
1178
 
1051
- @typing.overload
1052
- def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1053
- """
1054
- Specifies the PyPI packages for all steps of the flow.
1055
-
1056
- Use `@pypi_base` to set common packages required by all
1057
- steps and use `@pypi` to specify step-specific overrides.
1058
-
1059
- Parameters
1060
- ----------
1061
- packages : Dict[str, str], default: {}
1062
- Packages to use for this flow. The key is the name of the package
1063
- and the value is the version to use.
1064
- python : str, optional, default: None
1065
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1066
- that the version used will correspond to the version of the Python interpreter used to start the run.
1067
- """
1068
- ...
1069
-
1070
- @typing.overload
1071
- def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1072
- ...
1073
-
1074
- def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
1075
- """
1076
- Specifies the PyPI packages for all steps of the flow.
1077
-
1078
- Use `@pypi_base` to set common packages required by all
1079
- steps and use `@pypi` to specify step-specific overrides.
1080
-
1081
- Parameters
1082
- ----------
1083
- packages : Dict[str, str], default: {}
1084
- Packages to use for this flow. The key is the name of the package
1085
- and the value is the version to use.
1086
- python : str, optional, default: None
1087
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1088
- that the version used will correspond to the version of the Python interpreter used to start the run.
1089
- """
1090
- ...
1091
-
1092
- @typing.overload
1093
- 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]]:
1094
- """
1095
- Specifies the Conda environment for all steps of the flow.
1096
-
1097
- Use `@conda_base` to set common libraries required by all
1098
- steps and use `@conda` to specify step-specific additions.
1099
-
1100
-
1101
- Parameters
1102
- ----------
1103
- packages : Dict[str, str], default {}
1104
- Packages to use for this flow. The key is the name of the package
1105
- and the value is the version to use.
1106
- libraries : Dict[str, str], default {}
1107
- Supported for backward compatibility. When used with packages, packages will take precedence.
1108
- python : str, optional, default None
1109
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1110
- that the version used will correspond to the version of the Python interpreter used to start the run.
1111
- disabled : bool, default False
1112
- If set to True, disables Conda.
1113
- """
1114
- ...
1115
-
1116
- @typing.overload
1117
- def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1118
- ...
1119
-
1120
- 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):
1121
- """
1122
- Specifies the Conda environment for all steps of the flow.
1123
-
1124
- Use `@conda_base` to set common libraries required by all
1125
- steps and use `@conda` to specify step-specific additions.
1126
-
1127
-
1128
- Parameters
1129
- ----------
1130
- packages : Dict[str, str], default {}
1131
- Packages to use for this flow. The key is the name of the package
1132
- and the value is the version to use.
1133
- libraries : Dict[str, str], default {}
1134
- Supported for backward compatibility. When used with packages, packages will take precedence.
1135
- python : str, optional, default None
1136
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1137
- that the version used will correspond to the version of the Python interpreter used to start the run.
1138
- disabled : bool, default False
1139
- If set to True, disables Conda.
1140
- """
1141
- ...
1142
-
1143
1179
  @typing.overload
1144
1180
  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]]:
1145
1181
  """
@@ -1241,81 +1277,54 @@ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *
1241
1277
  """
1242
1278
  ...
1243
1279
 
1244
- def airflow_s3_key_sensor(*, timeout: int, poke_interval: int, mode: str, exponential_backoff: bool, pool: str, soft_fail: bool, name: str, description: str, bucket_key: typing.Union[str, typing.List[str]], bucket_name: str, wildcard_match: bool, aws_conn_id: str, verify: bool) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1280
+ @typing.overload
1281
+ def schedule(*, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: typing.Optional[str] = None, timezone: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1245
1282
  """
1246
- 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)
1247
- before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
1248
- and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
1249
- added as a flow decorators. Adding more than one decorator will ensure that `start` step
1250
- starts only after all sensors finish.
1283
+ Specifies the times when the flow should be run when running on a
1284
+ production scheduler.
1251
1285
 
1252
1286
 
1253
1287
  Parameters
1254
1288
  ----------
1255
- timeout : int
1256
- Time, in seconds before the task times out and fails. (Default: 3600)
1257
- poke_interval : int
1258
- Time in seconds that the job should wait in between each try. (Default: 60)
1259
- mode : str
1260
- How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1261
- exponential_backoff : bool
1262
- allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1263
- pool : str
1264
- the slot pool this task should run in,
1265
- slot pools are a way to limit concurrency for certain tasks. (Default:None)
1266
- soft_fail : bool
1267
- Set to true to mark the task as SKIPPED on failure. (Default: False)
1268
- name : str
1269
- Name of the sensor on Airflow
1270
- description : str
1271
- Description of sensor in the Airflow UI
1272
- bucket_key : Union[str, List[str]]
1273
- The key(s) being waited on. Supports full s3:// style url or relative path from root level.
1274
- When it's specified as a full s3:// url, please leave `bucket_name` as None
1275
- bucket_name : str
1276
- Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
1277
- When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
1278
- wildcard_match : bool
1279
- whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
1280
- aws_conn_id : str
1281
- a reference to the s3 connection on Airflow. (Default: None)
1282
- verify : bool
1283
- Whether or not to verify SSL certificates for S3 connection. (Default: None)
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).
1284
1301
  """
1285
1302
  ...
1286
1303
 
1287
- def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1304
+ @typing.overload
1305
+ def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1306
+ ...
1307
+
1308
+ 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):
1288
1309
  """
1289
- Specifies what flows belong to the same project.
1290
-
1291
- A project-specific namespace is created for all flows that
1292
- use the same `@project(name)`.
1310
+ Specifies the times when the flow should be run when running on a
1311
+ production scheduler.
1293
1312
 
1294
1313
 
1295
1314
  Parameters
1296
1315
  ----------
1297
- name : str
1298
- Project name. Make sure that the name is unique amongst all
1299
- projects that use the same production scheduler. The name may
1300
- contain only lowercase alphanumeric characters and underscores.
1301
-
1302
- branch : Optional[str], default None
1303
- The branch to use. If not specified, the branch is set to
1304
- `user.<username>` unless `production` is set to `True`. This can
1305
- also be set on the command line using `--branch` as a top-level option.
1306
- It is an error to specify `branch` in the decorator and on the command line.
1307
-
1308
- production : bool, default False
1309
- Whether or not the branch is the production branch. This can also be set on the
1310
- command line using `--production` as a top-level option. It is an error to specify
1311
- `production` in the decorator and on the command line.
1312
- The project branch name will be:
1313
- - if `branch` is specified:
1314
- - if `production` is True: `prod.<branch>`
1315
- - if `production` is False: `test.<branch>`
1316
- - if `branch` is not specified:
1317
- - if `production` is True: `prod`
1318
- - if `production` is False: `user.<username>`
1316
+ hourly : bool, default False
1317
+ Run the workflow hourly.
1318
+ daily : bool, default True
1319
+ Run the workflow daily.
1320
+ weekly : bool, default False
1321
+ Run the workflow weekly.
1322
+ cron : str, optional, default None
1323
+ Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1324
+ specified by this expression.
1325
+ timezone : str, optional, default None
1326
+ Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1327
+ which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1319
1328
  """
1320
1329
  ...
1321
1330