metaflow-stubs 2.15.14__py2.py3-none-any.whl → 2.15.16__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 +517 -517
  2. metaflow-stubs/cards.pyi +2 -2
  3. metaflow-stubs/cli.pyi +2 -2
  4. metaflow-stubs/cli_components/__init__.pyi +2 -2
  5. metaflow-stubs/cli_components/utils.pyi +2 -2
  6. metaflow-stubs/client/__init__.pyi +2 -2
  7. metaflow-stubs/client/core.pyi +26 -26
  8. metaflow-stubs/client/filecache.pyi +3 -3
  9. metaflow-stubs/events.pyi +5 -5
  10. metaflow-stubs/exception.pyi +2 -2
  11. metaflow-stubs/flowspec.pyi +3 -3
  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 +2 -2
  20. metaflow-stubs/metaflow_current.pyi +36 -36
  21. metaflow-stubs/metaflow_git.pyi +2 -2
  22. metaflow-stubs/multicore_utils.pyi +2 -2
  23. metaflow-stubs/parameters.pyi +4 -4
  24. metaflow-stubs/plugins/__init__.pyi +10 -10
  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 +3 -3
  37. metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +2 -2
  38. metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +2 -2
  39. metaflow-stubs/plugins/argo/argo_workflows_deployer_objects.pyi +4 -6
  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 +4 -4
  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 +4 -4
  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 +4 -4
  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 +2 -2
  74. metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +2 -2
  75. metaflow-stubs/plugins/cards/card_modules/renderer_tools.pyi +2 -2
  76. metaflow-stubs/plugins/cards/card_modules/test_cards.pyi +2 -2
  77. metaflow-stubs/plugins/cards/card_resolver.pyi +2 -2
  78. metaflow-stubs/plugins/cards/component_serializer.pyi +2 -2
  79. metaflow-stubs/plugins/cards/exception.pyi +2 -2
  80. metaflow-stubs/plugins/catch_decorator.pyi +2 -2
  81. metaflow-stubs/plugins/datatools/__init__.pyi +2 -2
  82. metaflow-stubs/plugins/datatools/local.pyi +2 -2
  83. metaflow-stubs/plugins/datatools/s3/__init__.pyi +2 -2
  84. metaflow-stubs/plugins/datatools/s3/s3.pyi +15 -15
  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 +4 -4
  95. metaflow-stubs/plugins/gcp/gs_exceptions.pyi +2 -2
  96. metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +2 -2
  97. metaflow-stubs/plugins/gcp/gs_utils.pyi +2 -2
  98. metaflow-stubs/plugins/gcp/includefile_support.pyi +2 -2
  99. metaflow-stubs/plugins/kubernetes/__init__.pyi +2 -2
  100. metaflow-stubs/plugins/kubernetes/kube_utils.pyi +2 -2
  101. metaflow-stubs/plugins/kubernetes/kubernetes.pyi +2 -2
  102. metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +2 -2
  103. metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +2 -2
  104. metaflow-stubs/plugins/kubernetes/kubernetes_job.pyi +2 -2
  105. metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +2 -2
  106. metaflow-stubs/plugins/kubernetes/spot_monitor_sidecar.pyi +2 -2
  107. metaflow-stubs/plugins/parallel_decorator.pyi +2 -2
  108. metaflow-stubs/plugins/project_decorator.pyi +2 -2
  109. metaflow-stubs/plugins/pypi/__init__.pyi +2 -2
  110. metaflow-stubs/plugins/pypi/conda_decorator.pyi +2 -2
  111. metaflow-stubs/plugins/pypi/conda_environment.pyi +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 +3 -3
  119. metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +3 -3
  120. metaflow-stubs/plugins/secrets/secrets_decorator.pyi +2 -2
  121. metaflow-stubs/plugins/storage_executor.pyi +2 -2
  122. metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +2 -2
  123. metaflow-stubs/plugins/timeout_decorator.pyi +2 -2
  124. metaflow-stubs/plugins/uv/__init__.pyi +2 -2
  125. metaflow-stubs/plugins/uv/uv_environment.pyi +2 -2
  126. metaflow-stubs/pylint_wrapper.pyi +2 -2
  127. metaflow-stubs/runner/__init__.pyi +2 -2
  128. metaflow-stubs/runner/deployer.pyi +7 -4
  129. metaflow-stubs/runner/deployer_impl.pyi +5 -2
  130. metaflow-stubs/runner/metaflow_runner.pyi +6 -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 +6 -3
  135. metaflow-stubs/system/__init__.pyi +2 -2
  136. metaflow-stubs/system/system_logger.pyi +2 -2
  137. metaflow-stubs/system/system_monitor.pyi +2 -2
  138. metaflow-stubs/tagging_util.pyi +2 -2
  139. metaflow-stubs/tuple_util.pyi +2 -2
  140. metaflow-stubs/user_configs/__init__.pyi +2 -2
  141. metaflow-stubs/user_configs/config_decorators.pyi +5 -5
  142. metaflow-stubs/user_configs/config_options.pyi +3 -3
  143. metaflow-stubs/user_configs/config_parameters.pyi +77 -17
  144. metaflow-stubs/version.pyi +2 -2
  145. {metaflow_stubs-2.15.14.dist-info → metaflow_stubs-2.15.16.dist-info}/METADATA +2 -2
  146. metaflow_stubs-2.15.16.dist-info/RECORD +149 -0
  147. {metaflow_stubs-2.15.14.dist-info → metaflow_stubs-2.15.16.dist-info}/WHEEL +1 -1
  148. metaflow_stubs-2.15.14.dist-info/RECORD +0 -149
  149. {metaflow_stubs-2.15.14.dist-info → metaflow_stubs-2.15.16.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.14 #
4
- # Generated on 2025-05-21T14:01:03.779738 #
3
+ # MF version: 2.15.16 #
4
+ # Generated on 2025-06-10T23:43:51.639260 #
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
 
@@ -35,17 +35,17 @@ from .user_configs.config_parameters import ConfigValue as ConfigValue
35
35
  from .user_configs.config_parameters import config_expr as config_expr
36
36
  from .user_configs.config_decorators import CustomFlowDecorator as CustomFlowDecorator
37
37
  from .user_configs.config_decorators import CustomStepDecorator as CustomStepDecorator
38
+ from . import metaflow_git as metaflow_git
38
39
  from . import tuple_util as tuple_util
39
40
  from . import events as events
40
- from . import metaflow_git as metaflow_git
41
41
  from . import runner as runner
42
42
  from . import plugins as plugins
43
43
  from .plugins.datatools.s3.s3 import S3 as S3
44
44
  from . import includefile as includefile
45
45
  from .includefile import IncludeFile as IncludeFile
46
+ from .plugins.pypi.parsers import conda_environment_yml_parser as conda_environment_yml_parser
46
47
  from .plugins.pypi.parsers import requirements_txt_parser as requirements_txt_parser
47
48
  from .plugins.pypi.parsers import pyproject_toml_parser as pyproject_toml_parser
48
- from .plugins.pypi.parsers import conda_environment_yml_parser as conda_environment_yml_parser
49
49
  from . import cards as cards
50
50
  from . import client as client
51
51
  from .client.core import namespace as namespace
@@ -147,142 +147,145 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
147
147
  ...
148
148
 
149
149
  @typing.overload
150
- def retry(*, times: int = 3, minutes_between_retries: int = 2) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
150
+ def secrets(*, sources: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = []) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
151
151
  """
152
- Specifies the number of times the task corresponding
153
- to a step needs to be retried.
152
+ Specifies secrets to be retrieved and injected as environment variables prior to
153
+ the execution of a step.
154
154
 
155
- This decorator is useful for handling transient errors, such as networking issues.
156
- If your task contains operations that can't be retried safely, e.g. database updates,
157
- it is advisable to annotate it with `@retry(times=0)`.
158
155
 
159
- This can be used in conjunction with the `@catch` decorator. The `@catch`
160
- decorator will execute a no-op task after all retries have been exhausted,
161
- ensuring that the flow execution can continue.
156
+ Parameters
157
+ ----------
158
+ sources : List[Union[str, Dict[str, Any]]], default: []
159
+ List of secret specs, defining how the secrets are to be retrieved
160
+ """
161
+ ...
162
+
163
+ @typing.overload
164
+ def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
165
+ ...
166
+
167
+ @typing.overload
168
+ def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
169
+ ...
170
+
171
+ def secrets(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, sources: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = []):
172
+ """
173
+ Specifies secrets to be retrieved and injected as environment variables prior to
174
+ the execution of a step.
162
175
 
163
176
 
164
177
  Parameters
165
178
  ----------
166
- times : int, default 3
167
- Number of times to retry this task.
168
- minutes_between_retries : int, default 2
169
- Number of minutes between retries.
179
+ sources : List[Union[str, Dict[str, Any]]], default: []
180
+ List of secret specs, defining how the secrets are to be retrieved
170
181
  """
171
182
  ...
172
183
 
173
184
  @typing.overload
174
- def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
185
+ 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]]]:
186
+ """
187
+ Specifies the Conda environment for the step.
188
+
189
+ Information in this decorator will augment any
190
+ attributes set in the `@conda_base` flow-level decorator. Hence,
191
+ you can use `@conda_base` to set packages required by all
192
+ steps and use `@conda` to specify step-specific overrides.
193
+
194
+
195
+ Parameters
196
+ ----------
197
+ packages : Dict[str, str], default {}
198
+ Packages to use for this step. The key is the name of the package
199
+ and the value is the version to use.
200
+ libraries : Dict[str, str], default {}
201
+ Supported for backward compatibility. When used with packages, packages will take precedence.
202
+ python : str, optional, default None
203
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
204
+ that the version used will correspond to the version of the Python interpreter used to start the run.
205
+ disabled : bool, default False
206
+ If set to True, disables @conda.
207
+ """
175
208
  ...
176
209
 
177
210
  @typing.overload
178
- def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
211
+ def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
179
212
  ...
180
213
 
181
- 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):
214
+ @typing.overload
215
+ def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
216
+ ...
217
+
218
+ 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):
182
219
  """
183
- Specifies the number of times the task corresponding
184
- to a step needs to be retried.
185
-
186
- This decorator is useful for handling transient errors, such as networking issues.
187
- If your task contains operations that can't be retried safely, e.g. database updates,
188
- it is advisable to annotate it with `@retry(times=0)`.
220
+ Specifies the Conda environment for the step.
189
221
 
190
- This can be used in conjunction with the `@catch` decorator. The `@catch`
191
- decorator will execute a no-op task after all retries have been exhausted,
192
- ensuring that the flow execution can continue.
222
+ Information in this decorator will augment any
223
+ attributes set in the `@conda_base` flow-level decorator. Hence,
224
+ you can use `@conda_base` to set packages required by all
225
+ steps and use `@conda` to specify step-specific overrides.
193
226
 
194
227
 
195
228
  Parameters
196
229
  ----------
197
- times : int, default 3
198
- Number of times to retry this task.
199
- minutes_between_retries : int, default 2
200
- Number of minutes between retries.
230
+ packages : Dict[str, str], default {}
231
+ Packages to use for this step. The key is the name of the package
232
+ and the value is the version to use.
233
+ libraries : Dict[str, str], default {}
234
+ Supported for backward compatibility. When used with packages, packages will take precedence.
235
+ python : str, optional, default None
236
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
237
+ that the version used will correspond to the version of the Python interpreter used to start the run.
238
+ disabled : bool, default False
239
+ If set to True, disables @conda.
201
240
  """
202
241
  ...
203
242
 
204
- 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]]]:
243
+ @typing.overload
244
+ 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]]]:
205
245
  """
206
- Specifies that this step should execute on Kubernetes.
246
+ Creates a human-readable report, a Metaflow Card, after this step completes.
247
+
248
+ Note that you may add multiple `@card` decorators in a step with different parameters.
207
249
 
208
250
 
209
251
  Parameters
210
252
  ----------
211
- cpu : int, default 1
212
- Number of CPUs required for this step. If `@resources` is
213
- also present, the maximum value from all decorators is used.
214
- memory : int, default 4096
215
- Memory size (in MB) required for this step. If
216
- `@resources` is also present, the maximum value from all decorators is
217
- used.
218
- disk : int, default 10240
219
- Disk size (in MB) required for this step. If
220
- `@resources` is also present, the maximum value from all decorators is
221
- used.
222
- image : str, optional, default None
223
- Docker image to use when launching on Kubernetes. If not specified, and
224
- METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
225
- not, a default Docker image mapping to the current version of Python is used.
226
- image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
227
- If given, the imagePullPolicy to be applied to the Docker image of the step.
228
- service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
229
- Kubernetes service account to use when launching pod in Kubernetes.
230
- secrets : List[str], optional, default None
231
- Kubernetes secrets to use when launching pod in Kubernetes. These
232
- secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
233
- in Metaflow configuration.
234
- node_selector: Union[Dict[str,str], str], optional, default None
235
- Kubernetes node selector(s) to apply to the pod running the task.
236
- Can be passed in as a comma separated string of values e.g.
237
- 'kubernetes.io/os=linux,kubernetes.io/arch=amd64' or as a dictionary
238
- {'kubernetes.io/os': 'linux', 'kubernetes.io/arch': 'amd64'}
239
- namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
240
- Kubernetes namespace to use when launching pod in Kubernetes.
241
- gpu : int, optional, default None
242
- Number of GPUs required for this step. A value of zero implies that
243
- the scheduled node should not have GPUs.
244
- gpu_vendor : str, default KUBERNETES_GPU_VENDOR
245
- The vendor of the GPUs to be used for this step.
246
- tolerations : List[str], default []
247
- The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
248
- Kubernetes tolerations to use when launching pod in Kubernetes.
249
- labels: Dict[str, str], default: METAFLOW_KUBERNETES_LABELS
250
- Kubernetes labels to use when launching pod in Kubernetes.
251
- annotations: Dict[str, str], default: METAFLOW_KUBERNETES_ANNOTATIONS
252
- Kubernetes annotations to use when launching pod in Kubernetes.
253
- use_tmpfs : bool, default False
254
- This enables an explicit tmpfs mount for this step.
255
- tmpfs_tempdir : bool, default True
256
- sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
257
- tmpfs_size : int, optional, default: None
258
- The value for the size (in MiB) of the tmpfs mount for this step.
259
- This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
260
- memory allocated for this step.
261
- tmpfs_path : str, optional, default /metaflow_temp
262
- Path to tmpfs mount for this step.
263
- persistent_volume_claims : Dict[str, str], optional, default None
264
- A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
265
- volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
266
- shared_memory: int, optional
267
- Shared memory size (in MiB) required for this step
268
- port: int, optional
269
- Port number to specify in the Kubernetes job object
270
- compute_pool : str, optional, default None
271
- Compute pool to be used for for this step.
272
- If not specified, any accessible compute pool within the perimeter is used.
273
- hostname_resolution_timeout: int, default 10 * 60
274
- Timeout in seconds for the workers tasks in the gang scheduled cluster to resolve the hostname of control task.
275
- Only applicable when @parallel is used.
276
- qos: str, default: Burstable
277
- Quality of Service class to assign to the pod. Supported values are: Guaranteed, Burstable, BestEffort
253
+ type : str, default 'default'
254
+ Card type.
255
+ id : str, optional, default None
256
+ If multiple cards are present, use this id to identify this card.
257
+ options : Dict[str, Any], default {}
258
+ Options passed to the card. The contents depend on the card type.
259
+ timeout : int, default 45
260
+ Interrupt reporting if it takes more than this many seconds.
261
+ """
262
+ ...
263
+
264
+ @typing.overload
265
+ def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
266
+ ...
267
+
268
+ @typing.overload
269
+ def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
270
+ ...
271
+
272
+ 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):
273
+ """
274
+ Creates a human-readable report, a Metaflow Card, after this step completes.
278
275
 
279
- security_context: Dict[str, Any], optional, default None
280
- Container security context. Applies to the task container. Allows the following keys:
281
- - privileged: bool, optional, default None
282
- - allow_privilege_escalation: bool, optional, default None
283
- - run_as_user: int, optional, default None
284
- - run_as_group: int, optional, default None
285
- - run_as_non_root: bool, optional, default None
276
+ Note that you may add multiple `@card` decorators in a step with different parameters.
277
+
278
+
279
+ Parameters
280
+ ----------
281
+ type : str, default 'default'
282
+ Card type.
283
+ id : str, optional, default None
284
+ If multiple cards are present, use this id to identify this card.
285
+ options : Dict[str, Any], default {}
286
+ Options passed to the card. The contents depend on the card type.
287
+ timeout : int, default 45
288
+ Interrupt reporting if it takes more than this many seconds.
286
289
  """
287
290
  ...
288
291
 
@@ -436,192 +439,201 @@ def batch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
436
439
  ...
437
440
 
438
441
  @typing.overload
439
- 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]]]:
442
+ 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]]]:
440
443
  """
441
- Specifies the Conda environment for the step.
444
+ Specifies a timeout for your step.
442
445
 
443
- Information in this decorator will augment any
444
- attributes set in the `@conda_base` flow-level decorator. Hence,
445
- you can use `@conda_base` to set packages required by all
446
- steps and use `@conda` to specify step-specific overrides.
446
+ This decorator is useful if this step may hang indefinitely.
447
+
448
+ This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
449
+ A timeout is considered to be an exception thrown by the step. It will cause the step to be
450
+ retried if needed and the exception will be caught by the `@catch` decorator, if present.
451
+
452
+ Note that all the values specified in parameters are added together so if you specify
453
+ 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
447
454
 
448
455
 
449
456
  Parameters
450
457
  ----------
451
- packages : Dict[str, str], default {}
452
- Packages to use for this step. The key is the name of the package
453
- and the value is the version to use.
454
- libraries : Dict[str, str], default {}
455
- Supported for backward compatibility. When used with packages, packages will take precedence.
456
- python : str, optional, default None
457
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
458
- that the version used will correspond to the version of the Python interpreter used to start the run.
459
- disabled : bool, default False
460
- If set to True, disables @conda.
458
+ seconds : int, default 0
459
+ Number of seconds to wait prior to timing out.
460
+ minutes : int, default 0
461
+ Number of minutes to wait prior to timing out.
462
+ hours : int, default 0
463
+ Number of hours to wait prior to timing out.
461
464
  """
462
465
  ...
463
466
 
464
467
  @typing.overload
465
- def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
468
+ def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
466
469
  ...
467
470
 
468
471
  @typing.overload
469
- def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
472
+ def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
470
473
  ...
471
474
 
472
- 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):
475
+ 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):
473
476
  """
474
- Specifies the Conda environment for the step.
477
+ Specifies a timeout for your step.
475
478
 
476
- Information in this decorator will augment any
477
- attributes set in the `@conda_base` flow-level decorator. Hence,
478
- you can use `@conda_base` to set packages required by all
479
- steps and use `@conda` to specify step-specific overrides.
479
+ This decorator is useful if this step may hang indefinitely.
480
+
481
+ This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
482
+ A timeout is considered to be an exception thrown by the step. It will cause the step to be
483
+ retried if needed and the exception will be caught by the `@catch` decorator, if present.
484
+
485
+ Note that all the values specified in parameters are added together so if you specify
486
+ 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
480
487
 
481
488
 
482
489
  Parameters
483
490
  ----------
484
- packages : Dict[str, str], default {}
485
- Packages to use for this step. The key is the name of the package
486
- and the value is the version to use.
487
- libraries : Dict[str, str], default {}
488
- Supported for backward compatibility. When used with packages, packages will take precedence.
489
- python : str, optional, default None
490
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
491
- that the version used will correspond to the version of the Python interpreter used to start the run.
492
- disabled : bool, default False
493
- If set to True, disables @conda.
491
+ seconds : int, default 0
492
+ Number of seconds to wait prior to timing out.
493
+ minutes : int, default 0
494
+ Number of minutes to wait prior to timing out.
495
+ hours : int, default 0
496
+ Number of hours to wait prior to timing out.
494
497
  """
495
498
  ...
496
499
 
497
- @typing.overload
498
- 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]]]:
500
+ 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]]]:
499
501
  """
500
- Specifies the resources needed when executing this step.
501
-
502
- Use `@resources` to specify the resource requirements
503
- independently of the specific compute layer (`@batch`, `@kubernetes`).
504
-
505
- You can choose the compute layer on the command line by executing e.g.
506
- ```
507
- python myflow.py run --with batch
508
- ```
509
- or
510
- ```
511
- python myflow.py run --with kubernetes
512
- ```
513
- which executes the flow on the desired system using the
514
- requirements specified in `@resources`.
502
+ Specifies that this step should execute on Kubernetes.
515
503
 
516
504
 
517
505
  Parameters
518
506
  ----------
519
507
  cpu : int, default 1
520
- Number of CPUs required for this step.
521
- gpu : int, optional, default None
522
- Number of GPUs required for this step.
523
- disk : int, optional, default None
524
- Disk size (in MB) required for this step. Only applies on Kubernetes.
508
+ Number of CPUs required for this step. If `@resources` is
509
+ also present, the maximum value from all decorators is used.
525
510
  memory : int, default 4096
526
- Memory size (in MB) required for this step.
527
- shared_memory : int, optional, default None
528
- The value for the size (in MiB) of the /dev/shm volume for this step.
529
- This parameter maps to the `--shm-size` option in Docker.
511
+ Memory size (in MB) required for this step. If
512
+ `@resources` is also present, the maximum value from all decorators is
513
+ used.
514
+ disk : int, default 10240
515
+ Disk size (in MB) required for this step. If
516
+ `@resources` is also present, the maximum value from all decorators is
517
+ used.
518
+ image : str, optional, default None
519
+ Docker image to use when launching on Kubernetes. If not specified, and
520
+ METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
521
+ not, a default Docker image mapping to the current version of Python is used.
522
+ image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
523
+ If given, the imagePullPolicy to be applied to the Docker image of the step.
524
+ service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
525
+ Kubernetes service account to use when launching pod in Kubernetes.
526
+ secrets : List[str], optional, default None
527
+ Kubernetes secrets to use when launching pod in Kubernetes. These
528
+ secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
529
+ in Metaflow configuration.
530
+ node_selector: Union[Dict[str,str], str], optional, default None
531
+ Kubernetes node selector(s) to apply to the pod running the task.
532
+ Can be passed in as a comma separated string of values e.g.
533
+ 'kubernetes.io/os=linux,kubernetes.io/arch=amd64' or as a dictionary
534
+ {'kubernetes.io/os': 'linux', 'kubernetes.io/arch': 'amd64'}
535
+ namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
536
+ Kubernetes namespace to use when launching pod in Kubernetes.
537
+ gpu : int, optional, default None
538
+ Number of GPUs required for this step. A value of zero implies that
539
+ the scheduled node should not have GPUs.
540
+ gpu_vendor : str, default KUBERNETES_GPU_VENDOR
541
+ The vendor of the GPUs to be used for this step.
542
+ tolerations : List[str], default []
543
+ The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
544
+ Kubernetes tolerations to use when launching pod in Kubernetes.
545
+ labels: Dict[str, str], default: METAFLOW_KUBERNETES_LABELS
546
+ Kubernetes labels to use when launching pod in Kubernetes.
547
+ annotations: Dict[str, str], default: METAFLOW_KUBERNETES_ANNOTATIONS
548
+ Kubernetes annotations to use when launching pod in Kubernetes.
549
+ use_tmpfs : bool, default False
550
+ This enables an explicit tmpfs mount for this step.
551
+ tmpfs_tempdir : bool, default True
552
+ sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
553
+ tmpfs_size : int, optional, default: None
554
+ The value for the size (in MiB) of the tmpfs mount for this step.
555
+ This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
556
+ memory allocated for this step.
557
+ tmpfs_path : str, optional, default /metaflow_temp
558
+ Path to tmpfs mount for this step.
559
+ persistent_volume_claims : Dict[str, str], optional, default None
560
+ A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
561
+ volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
562
+ shared_memory: int, optional
563
+ Shared memory size (in MiB) required for this step
564
+ port: int, optional
565
+ Port number to specify in the Kubernetes job object
566
+ compute_pool : str, optional, default None
567
+ Compute pool to be used for for this step.
568
+ If not specified, any accessible compute pool within the perimeter is used.
569
+ hostname_resolution_timeout: int, default 10 * 60
570
+ Timeout in seconds for the workers tasks in the gang scheduled cluster to resolve the hostname of control task.
571
+ Only applicable when @parallel is used.
572
+ qos: str, default: Burstable
573
+ Quality of Service class to assign to the pod. Supported values are: Guaranteed, Burstable, BestEffort
574
+
575
+ security_context: Dict[str, Any], optional, default None
576
+ Container security context. Applies to the task container. Allows the following keys:
577
+ - privileged: bool, optional, default None
578
+ - allow_privilege_escalation: bool, optional, default None
579
+ - run_as_user: int, optional, default None
580
+ - run_as_group: int, optional, default None
581
+ - run_as_non_root: bool, optional, default None
530
582
  """
531
583
  ...
532
584
 
533
585
  @typing.overload
534
- def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
535
- ...
536
-
537
- @typing.overload
538
- def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
539
- ...
540
-
541
- 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):
586
+ 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]]]:
542
587
  """
543
- Specifies the resources needed when executing this step.
588
+ Specifies the number of times the task corresponding
589
+ to a step needs to be retried.
544
590
 
545
- Use `@resources` to specify the resource requirements
546
- independently of the specific compute layer (`@batch`, `@kubernetes`).
591
+ This decorator is useful for handling transient errors, such as networking issues.
592
+ If your task contains operations that can't be retried safely, e.g. database updates,
593
+ it is advisable to annotate it with `@retry(times=0)`.
547
594
 
548
- You can choose the compute layer on the command line by executing e.g.
549
- ```
550
- python myflow.py run --with batch
551
- ```
552
- or
553
- ```
554
- python myflow.py run --with kubernetes
555
- ```
556
- which executes the flow on the desired system using the
557
- requirements specified in `@resources`.
595
+ This can be used in conjunction with the `@catch` decorator. The `@catch`
596
+ decorator will execute a no-op task after all retries have been exhausted,
597
+ ensuring that the flow execution can continue.
558
598
 
559
599
 
560
600
  Parameters
561
601
  ----------
562
- cpu : int, default 1
563
- Number of CPUs required for this step.
564
- gpu : int, optional, default None
565
- Number of GPUs required for this step.
566
- disk : int, optional, default None
567
- Disk size (in MB) required for this step. Only applies on Kubernetes.
568
- memory : int, default 4096
569
- Memory size (in MB) required for this step.
570
- shared_memory : int, optional, default None
571
- The value for the size (in MiB) of the /dev/shm volume for this step.
572
- This parameter maps to the `--shm-size` option in Docker.
602
+ times : int, default 3
603
+ Number of times to retry this task.
604
+ minutes_between_retries : int, default 2
605
+ Number of minutes between retries.
573
606
  """
574
607
  ...
575
608
 
576
609
  @typing.overload
577
- def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
578
- """
579
- Decorator prototype for all step decorators. This function gets specialized
580
- and imported for all decorators types by _import_plugin_decorators().
581
- """
610
+ def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
582
611
  ...
583
612
 
584
613
  @typing.overload
585
- def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
586
- ...
587
-
588
- def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
589
- """
590
- Decorator prototype for all step decorators. This function gets specialized
591
- and imported for all decorators types by _import_plugin_decorators().
592
- """
614
+ def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
593
615
  ...
594
616
 
595
- @typing.overload
596
- 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]]]:
617
+ 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):
597
618
  """
598
- Specifies environment variables to be set prior to the execution of a step.
619
+ Specifies the number of times the task corresponding
620
+ to a step needs to be retried.
599
621
 
622
+ This decorator is useful for handling transient errors, such as networking issues.
623
+ If your task contains operations that can't be retried safely, e.g. database updates,
624
+ it is advisable to annotate it with `@retry(times=0)`.
600
625
 
601
- Parameters
602
- ----------
603
- vars : Dict[str, str], default {}
604
- Dictionary of environment variables to set.
605
- """
606
- ...
607
-
608
- @typing.overload
609
- def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
610
- ...
611
-
612
- @typing.overload
613
- def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
614
- ...
615
-
616
- def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
617
- """
618
- Specifies environment variables to be set prior to the execution of a step.
626
+ This can be used in conjunction with the `@catch` decorator. The `@catch`
627
+ decorator will execute a no-op task after all retries have been exhausted,
628
+ ensuring that the flow execution can continue.
619
629
 
620
630
 
621
631
  Parameters
622
632
  ----------
623
- vars : Dict[str, str], default {}
624
- Dictionary of environment variables to set.
633
+ times : int, default 3
634
+ Number of times to retry this task.
635
+ minutes_between_retries : int, default 2
636
+ Number of minutes between retries.
625
637
  """
626
638
  ...
627
639
 
@@ -677,196 +689,313 @@ def pypi(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typ
677
689
  ...
678
690
 
679
691
  @typing.overload
680
- def secrets(*, sources: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = []) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
692
+ 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]]]:
681
693
  """
682
- Specifies secrets to be retrieved and injected as environment variables prior to
683
- the execution of a step.
694
+ Specifies environment variables to be set prior to the execution of a step.
684
695
 
685
696
 
686
697
  Parameters
687
698
  ----------
688
- sources : List[Union[str, Dict[str, Any]]], default: []
689
- List of secret specs, defining how the secrets are to be retrieved
699
+ vars : Dict[str, str], default {}
700
+ Dictionary of environment variables to set.
690
701
  """
691
702
  ...
692
703
 
693
704
  @typing.overload
694
- def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
705
+ def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
695
706
  ...
696
707
 
697
708
  @typing.overload
698
- def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
709
+ def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
699
710
  ...
700
711
 
701
- def secrets(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, sources: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = []):
712
+ def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
702
713
  """
703
- Specifies secrets to be retrieved and injected as environment variables prior to
704
- the execution of a step.
714
+ Specifies environment variables to be set prior to the execution of a step.
705
715
 
706
716
 
707
717
  Parameters
708
718
  ----------
709
- sources : List[Union[str, Dict[str, Any]]], default: []
710
- List of secret specs, defining how the secrets are to be retrieved
719
+ vars : Dict[str, str], default {}
720
+ Dictionary of environment variables to set.
711
721
  """
712
722
  ...
713
723
 
714
724
  @typing.overload
715
- 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]]]:
725
+ 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]]]:
716
726
  """
717
- Specifies a timeout for your step.
718
-
719
- This decorator is useful if this step may hang indefinitely.
727
+ Specifies that the step will success under all circumstances.
720
728
 
721
- This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
722
- A timeout is considered to be an exception thrown by the step. It will cause the step to be
723
- retried if needed and the exception will be caught by the `@catch` decorator, if present.
724
-
725
- Note that all the values specified in parameters are added together so if you specify
726
- 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
729
+ The decorator will create an optional artifact, specified by `var`, which
730
+ contains the exception raised. You can use it to detect the presence
731
+ of errors, indicating that all happy-path artifacts produced by the step
732
+ are missing.
727
733
 
728
734
 
729
735
  Parameters
730
736
  ----------
731
- seconds : int, default 0
732
- Number of seconds to wait prior to timing out.
733
- minutes : int, default 0
734
- Number of minutes to wait prior to timing out.
735
- hours : int, default 0
736
- Number of hours to wait prior to timing out.
737
+ var : str, optional, default None
738
+ Name of the artifact in which to store the caught exception.
739
+ If not specified, the exception is not stored.
740
+ print_exception : bool, default True
741
+ Determines whether or not the exception is printed to
742
+ stdout when caught.
737
743
  """
738
744
  ...
739
745
 
740
746
  @typing.overload
741
- def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
747
+ def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
742
748
  ...
743
749
 
744
750
  @typing.overload
745
- def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
751
+ def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
746
752
  ...
747
753
 
748
- 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):
754
+ 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):
749
755
  """
750
- Specifies a timeout for your step.
751
-
752
- This decorator is useful if this step may hang indefinitely.
753
-
754
- This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
755
- A timeout is considered to be an exception thrown by the step. It will cause the step to be
756
- retried if needed and the exception will be caught by the `@catch` decorator, if present.
756
+ Specifies that the step will success under all circumstances.
757
757
 
758
- Note that all the values specified in parameters are added together so if you specify
759
- 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
758
+ The decorator will create an optional artifact, specified by `var`, which
759
+ contains the exception raised. You can use it to detect the presence
760
+ of errors, indicating that all happy-path artifacts produced by the step
761
+ are missing.
760
762
 
761
763
 
762
764
  Parameters
763
765
  ----------
764
- seconds : int, default 0
765
- Number of seconds to wait prior to timing out.
766
- minutes : int, default 0
767
- Number of minutes to wait prior to timing out.
768
- hours : int, default 0
769
- Number of hours to wait prior to timing out.
766
+ var : str, optional, default None
767
+ Name of the artifact in which to store the caught exception.
768
+ If not specified, the exception is not stored.
769
+ print_exception : bool, default True
770
+ Determines whether or not the exception is printed to
771
+ stdout when caught.
770
772
  """
771
773
  ...
772
774
 
773
775
  @typing.overload
774
- def card(*, type: str = 'default', id: typing.Optional[str] = None, options: typing.Dict[str, typing.Any] = {}, timeout: int = 45) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
776
+ 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]]]:
775
777
  """
776
- Creates a human-readable report, a Metaflow Card, after this step completes.
778
+ Specifies the resources needed when executing this step.
777
779
 
778
- Note that you may add multiple `@card` decorators in a step with different parameters.
780
+ Use `@resources` to specify the resource requirements
781
+ independently of the specific compute layer (`@batch`, `@kubernetes`).
782
+
783
+ You can choose the compute layer on the command line by executing e.g.
784
+ ```
785
+ python myflow.py run --with batch
786
+ ```
787
+ or
788
+ ```
789
+ python myflow.py run --with kubernetes
790
+ ```
791
+ which executes the flow on the desired system using the
792
+ requirements specified in `@resources`.
779
793
 
780
794
 
781
795
  Parameters
782
796
  ----------
783
- type : str, default 'default'
784
- Card type.
785
- id : str, optional, default None
786
- If multiple cards are present, use this id to identify this card.
787
- options : Dict[str, Any], default {}
788
- Options passed to the card. The contents depend on the card type.
789
- timeout : int, default 45
790
- Interrupt reporting if it takes more than this many seconds.
797
+ cpu : int, default 1
798
+ Number of CPUs required for this step.
799
+ gpu : int, optional, default None
800
+ Number of GPUs required for this step.
801
+ disk : int, optional, default None
802
+ Disk size (in MB) required for this step. Only applies on Kubernetes.
803
+ memory : int, default 4096
804
+ Memory size (in MB) required for this step.
805
+ shared_memory : int, optional, default None
806
+ The value for the size (in MiB) of the /dev/shm volume for this step.
807
+ This parameter maps to the `--shm-size` option in Docker.
791
808
  """
792
809
  ...
793
810
 
794
811
  @typing.overload
795
- def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
812
+ def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
796
813
  ...
797
814
 
798
815
  @typing.overload
799
- def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
816
+ def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
800
817
  ...
801
818
 
802
- def card(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, type: str = 'default', id: typing.Optional[str] = None, options: typing.Dict[str, typing.Any] = {}, timeout: int = 45):
819
+ 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):
803
820
  """
804
- Creates a human-readable report, a Metaflow Card, after this step completes.
821
+ Specifies the resources needed when executing this step.
805
822
 
806
- Note that you may add multiple `@card` decorators in a step with different parameters.
823
+ Use `@resources` to specify the resource requirements
824
+ independently of the specific compute layer (`@batch`, `@kubernetes`).
825
+
826
+ You can choose the compute layer on the command line by executing e.g.
827
+ ```
828
+ python myflow.py run --with batch
829
+ ```
830
+ or
831
+ ```
832
+ python myflow.py run --with kubernetes
833
+ ```
834
+ which executes the flow on the desired system using the
835
+ requirements specified in `@resources`.
807
836
 
808
837
 
809
838
  Parameters
810
839
  ----------
811
- type : str, default 'default'
812
- Card type.
813
- id : str, optional, default None
814
- If multiple cards are present, use this id to identify this card.
815
- options : Dict[str, Any], default {}
816
- Options passed to the card. The contents depend on the card type.
817
- timeout : int, default 45
818
- Interrupt reporting if it takes more than this many seconds.
840
+ cpu : int, default 1
841
+ Number of CPUs required for this step.
842
+ gpu : int, optional, default None
843
+ Number of GPUs required for this step.
844
+ disk : int, optional, default None
845
+ Disk size (in MB) required for this step. Only applies on Kubernetes.
846
+ memory : int, default 4096
847
+ Memory size (in MB) required for this step.
848
+ shared_memory : int, optional, default None
849
+ The value for the size (in MiB) of the /dev/shm volume for this step.
850
+ This parameter maps to the `--shm-size` option in Docker.
819
851
  """
820
852
  ...
821
853
 
822
854
  @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]]]:
855
+ def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
824
856
  """
825
- Specifies that the step will success under all circumstances.
857
+ Decorator prototype for all step decorators. This function gets specialized
858
+ and imported for all decorators types by _import_plugin_decorators().
859
+ """
860
+ ...
861
+
862
+ @typing.overload
863
+ def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
864
+ ...
865
+
866
+ def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
867
+ """
868
+ Decorator prototype for all step decorators. This function gets specialized
869
+ and imported for all decorators types by _import_plugin_decorators().
870
+ """
871
+ ...
872
+
873
+ @typing.overload
874
+ 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]]:
875
+ """
876
+ Specifies the Conda environment for all steps of the flow.
826
877
 
827
- The decorator will create an optional artifact, specified by `var`, which
828
- contains the exception raised. You can use it to detect the presence
829
- of errors, indicating that all happy-path artifacts produced by the step
830
- are missing.
878
+ Use `@conda_base` to set common libraries required by all
879
+ steps and use `@conda` to specify step-specific additions.
831
880
 
832
881
 
833
882
  Parameters
834
883
  ----------
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.
884
+ packages : Dict[str, str], default {}
885
+ Packages to use for this flow. The key is the name of the package
886
+ and the value is the version to use.
887
+ libraries : Dict[str, str], default {}
888
+ Supported for backward compatibility. When used with packages, packages will take precedence.
889
+ python : str, optional, default None
890
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
891
+ that the version used will correspond to the version of the Python interpreter used to start the run.
892
+ disabled : bool, default False
893
+ If set to True, disables Conda.
841
894
  """
842
895
  ...
843
896
 
844
897
  @typing.overload
845
- def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
898
+ def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
846
899
  ...
847
900
 
848
- @typing.overload
849
- def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
901
+ 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):
902
+ """
903
+ Specifies the Conda environment for all steps of the flow.
904
+
905
+ Use `@conda_base` to set common libraries required by all
906
+ steps and use `@conda` to specify step-specific additions.
907
+
908
+
909
+ Parameters
910
+ ----------
911
+ packages : Dict[str, str], default {}
912
+ Packages to use for this flow. The key is the name of the package
913
+ and the value is the version to use.
914
+ libraries : Dict[str, str], default {}
915
+ Supported for backward compatibility. When used with packages, packages will take precedence.
916
+ python : str, optional, default None
917
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
918
+ that the version used will correspond to the version of the Python interpreter used to start the run.
919
+ disabled : bool, default False
920
+ If set to True, disables Conda.
921
+ """
850
922
  ...
851
923
 
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):
924
+ 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]]:
853
925
  """
854
- Specifies that the step will success under all circumstances.
926
+ 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.
927
+ 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.
855
928
 
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.
860
929
 
930
+ Parameters
931
+ ----------
932
+ timeout : int
933
+ Time, in seconds before the task times out and fails. (Default: 3600)
934
+ poke_interval : int
935
+ Time in seconds that the job should wait in between each try. (Default: 60)
936
+ mode : str
937
+ How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
938
+ exponential_backoff : bool
939
+ allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
940
+ pool : str
941
+ the slot pool this task should run in,
942
+ slot pools are a way to limit concurrency for certain tasks. (Default:None)
943
+ soft_fail : bool
944
+ Set to true to mark the task as SKIPPED on failure. (Default: False)
945
+ name : str
946
+ Name of the sensor on Airflow
947
+ description : str
948
+ Description of sensor in the Airflow UI
949
+ external_dag_id : str
950
+ The dag_id that contains the task you want to wait for.
951
+ external_task_ids : List[str]
952
+ The list of task_ids that you want to wait for.
953
+ If None (default value) the sensor waits for the DAG. (Default: None)
954
+ allowed_states : List[str]
955
+ Iterable of allowed states, (Default: ['success'])
956
+ failed_states : List[str]
957
+ Iterable of failed or dis-allowed states. (Default: None)
958
+ execution_delta : datetime.timedelta
959
+ time difference with the previous execution to look at,
960
+ the default is the same logical date as the current task or DAG. (Default: None)
961
+ check_existence: bool
962
+ Set to True to check if the external task exists or check if
963
+ the DAG to wait for exists. (Default: True)
964
+ """
965
+ ...
966
+
967
+ def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
968
+ """
969
+ Specifies what flows belong to the same project.
970
+
971
+ A project-specific namespace is created for all flows that
972
+ use the same `@project(name)`.
973
+
974
+
975
+ Parameters
976
+ ----------
977
+ name : str
978
+ Project name. Make sure that the name is unique amongst all
979
+ projects that use the same production scheduler. The name may
980
+ contain only lowercase alphanumeric characters and underscores.
981
+
982
+ branch : Optional[str], default None
983
+ The branch to use. If not specified, the branch is set to
984
+ `user.<username>` unless `production` is set to `True`. This can
985
+ also be set on the command line using `--branch` as a top-level option.
986
+ It is an error to specify `branch` in the decorator and on the command line.
861
987
 
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.
988
+ production : bool, default False
989
+ Whether or not the branch is the production branch. This can also be set on the
990
+ command line using `--production` as a top-level option. It is an error to specify
991
+ `production` in the decorator and on the command line.
992
+ The project branch name will be:
993
+ - if `branch` is specified:
994
+ - if `production` is True: `prod.<branch>`
995
+ - if `production` is False: `test.<branch>`
996
+ - if `branch` is not specified:
997
+ - if `production` is True: `prod`
998
+ - if `production` is False: `user.<username>`
870
999
  """
871
1000
  ...
872
1001
 
@@ -971,49 +1100,6 @@ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *
971
1100
  """
972
1101
  ...
973
1102
 
974
- 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]]:
975
- """
976
- 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.
977
- 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.
978
-
979
-
980
- Parameters
981
- ----------
982
- timeout : int
983
- Time, in seconds before the task times out and fails. (Default: 3600)
984
- poke_interval : int
985
- Time in seconds that the job should wait in between each try. (Default: 60)
986
- mode : str
987
- How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
988
- exponential_backoff : bool
989
- allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
990
- pool : str
991
- the slot pool this task should run in,
992
- slot pools are a way to limit concurrency for certain tasks. (Default:None)
993
- soft_fail : bool
994
- Set to true to mark the task as SKIPPED on failure. (Default: False)
995
- name : str
996
- Name of the sensor on Airflow
997
- description : str
998
- Description of sensor in the Airflow UI
999
- external_dag_id : str
1000
- The dag_id that contains the task you want to wait for.
1001
- external_task_ids : List[str]
1002
- The list of task_ids that you want to wait for.
1003
- If None (default value) the sensor waits for the DAG. (Default: None)
1004
- allowed_states : List[str]
1005
- Iterable of allowed states, (Default: ['success'])
1006
- failed_states : List[str]
1007
- Iterable of failed or dis-allowed states. (Default: None)
1008
- execution_delta : datetime.timedelta
1009
- time difference with the previous execution to look at,
1010
- the default is the same logical date as the current task or DAG. (Default: None)
1011
- check_existence: bool
1012
- Set to True to check if the external task exists or check if
1013
- the DAG to wait for exists. (Default: True)
1014
- """
1015
- ...
1016
-
1017
1103
  @typing.overload
1018
1104
  def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1019
1105
  """
@@ -1055,6 +1141,57 @@ def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packag
1055
1141
  """
1056
1142
  ...
1057
1143
 
1144
+ @typing.overload
1145
+ 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]]:
1146
+ """
1147
+ Specifies the times when the flow should be run when running on a
1148
+ production scheduler.
1149
+
1150
+
1151
+ Parameters
1152
+ ----------
1153
+ hourly : bool, default False
1154
+ Run the workflow hourly.
1155
+ daily : bool, default True
1156
+ Run the workflow daily.
1157
+ weekly : bool, default False
1158
+ Run the workflow weekly.
1159
+ cron : str, optional, default None
1160
+ Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1161
+ specified by this expression.
1162
+ timezone : str, optional, default None
1163
+ Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1164
+ which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1165
+ """
1166
+ ...
1167
+
1168
+ @typing.overload
1169
+ def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1170
+ ...
1171
+
1172
+ 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):
1173
+ """
1174
+ Specifies the times when the flow should be run when running on a
1175
+ production scheduler.
1176
+
1177
+
1178
+ Parameters
1179
+ ----------
1180
+ hourly : bool, default False
1181
+ Run the workflow hourly.
1182
+ daily : bool, default True
1183
+ Run the workflow daily.
1184
+ weekly : bool, default False
1185
+ Run the workflow weekly.
1186
+ cron : str, optional, default None
1187
+ Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1188
+ specified by this expression.
1189
+ timezone : str, optional, default None
1190
+ Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1191
+ which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1192
+ """
1193
+ ...
1194
+
1058
1195
  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]]:
1059
1196
  """
1060
1197
  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)
@@ -1191,140 +1328,3 @@ def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, event: t
1191
1328
  """
1192
1329
  ...
1193
1330
 
1194
- @typing.overload
1195
- 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]]:
1196
- """
1197
- Specifies the times when the flow should be run when running on a
1198
- production scheduler.
1199
-
1200
-
1201
- Parameters
1202
- ----------
1203
- hourly : bool, default False
1204
- Run the workflow hourly.
1205
- daily : bool, default True
1206
- Run the workflow daily.
1207
- weekly : bool, default False
1208
- Run the workflow weekly.
1209
- cron : str, optional, default None
1210
- Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1211
- specified by this expression.
1212
- timezone : str, optional, default None
1213
- Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1214
- which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1215
- """
1216
- ...
1217
-
1218
- @typing.overload
1219
- def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1220
- ...
1221
-
1222
- 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):
1223
- """
1224
- Specifies the times when the flow should be run when running on a
1225
- production scheduler.
1226
-
1227
-
1228
- Parameters
1229
- ----------
1230
- hourly : bool, default False
1231
- Run the workflow hourly.
1232
- daily : bool, default True
1233
- Run the workflow daily.
1234
- weekly : bool, default False
1235
- Run the workflow weekly.
1236
- cron : str, optional, default None
1237
- Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1238
- specified by this expression.
1239
- timezone : str, optional, default None
1240
- Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1241
- which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1242
- """
1243
- ...
1244
-
1245
- def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1246
- """
1247
- Specifies what flows belong to the same project.
1248
-
1249
- A project-specific namespace is created for all flows that
1250
- use the same `@project(name)`.
1251
-
1252
-
1253
- Parameters
1254
- ----------
1255
- name : str
1256
- Project name. Make sure that the name is unique amongst all
1257
- projects that use the same production scheduler. The name may
1258
- contain only lowercase alphanumeric characters and underscores.
1259
-
1260
- branch : Optional[str], default None
1261
- The branch to use. If not specified, the branch is set to
1262
- `user.<username>` unless `production` is set to `True`. This can
1263
- also be set on the command line using `--branch` as a top-level option.
1264
- It is an error to specify `branch` in the decorator and on the command line.
1265
-
1266
- production : bool, default False
1267
- Whether or not the branch is the production branch. This can also be set on the
1268
- command line using `--production` as a top-level option. It is an error to specify
1269
- `production` in the decorator and on the command line.
1270
- The project branch name will be:
1271
- - if `branch` is specified:
1272
- - if `production` is True: `prod.<branch>`
1273
- - if `production` is False: `test.<branch>`
1274
- - if `branch` is not specified:
1275
- - if `production` is True: `prod`
1276
- - if `production` is False: `user.<username>`
1277
- """
1278
- ...
1279
-
1280
- @typing.overload
1281
- 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]]:
1282
- """
1283
- Specifies the Conda environment for all steps of the flow.
1284
-
1285
- Use `@conda_base` to set common libraries required by all
1286
- steps and use `@conda` to specify step-specific additions.
1287
-
1288
-
1289
- Parameters
1290
- ----------
1291
- packages : Dict[str, str], default {}
1292
- Packages to use for this flow. The key is the name of the package
1293
- and the value is the version to use.
1294
- libraries : Dict[str, str], default {}
1295
- Supported for backward compatibility. When used with packages, packages will take precedence.
1296
- python : str, optional, default None
1297
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1298
- that the version used will correspond to the version of the Python interpreter used to start the run.
1299
- disabled : bool, default False
1300
- If set to True, disables Conda.
1301
- """
1302
- ...
1303
-
1304
- @typing.overload
1305
- def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1306
- ...
1307
-
1308
- 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):
1309
- """
1310
- Specifies the Conda environment for all steps of the flow.
1311
-
1312
- Use `@conda_base` to set common libraries required by all
1313
- steps and use `@conda` to specify step-specific additions.
1314
-
1315
-
1316
- Parameters
1317
- ----------
1318
- packages : Dict[str, str], default {}
1319
- Packages to use for this flow. The key is the name of the package
1320
- and the value is the version to use.
1321
- libraries : Dict[str, str], default {}
1322
- Supported for backward compatibility. When used with packages, packages will take precedence.
1323
- python : str, optional, default None
1324
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1325
- that the version used will correspond to the version of the Python interpreter used to start the run.
1326
- disabled : bool, default False
1327
- If set to True, disables Conda.
1328
- """
1329
- ...
1330
-