metaflow-stubs 2.15.0__py2.py3-none-any.whl → 2.15.2__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (146) hide show
  1. metaflow-stubs/__init__.pyi +443 -440
  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 +3 -3
  8. metaflow-stubs/client/filecache.pyi +3 -3
  9. metaflow-stubs/events.pyi +3 -3
  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 +2 -2
  14. metaflow-stubs/info_file.pyi +2 -2
  15. metaflow-stubs/metadata_provider/__init__.pyi +2 -2
  16. metaflow-stubs/metadata_provider/heartbeat.pyi +2 -2
  17. metaflow-stubs/metadata_provider/metadata.pyi +2 -2
  18. metaflow-stubs/metadata_provider/util.pyi +2 -2
  19. metaflow-stubs/metaflow_config.pyi +4 -2
  20. metaflow-stubs/metaflow_current.pyi +4 -4
  21. metaflow-stubs/multicore_utils.pyi +2 -2
  22. metaflow-stubs/parameters.pyi +2 -2
  23. metaflow-stubs/plugins/__init__.pyi +10 -10
  24. metaflow-stubs/plugins/airflow/__init__.pyi +2 -2
  25. metaflow-stubs/plugins/airflow/airflow_decorator.pyi +2 -2
  26. metaflow-stubs/plugins/airflow/airflow_utils.pyi +2 -2
  27. metaflow-stubs/plugins/airflow/exception.pyi +2 -2
  28. metaflow-stubs/plugins/airflow/sensors/__init__.pyi +2 -2
  29. metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +2 -2
  30. metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +2 -2
  31. metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +2 -2
  32. metaflow-stubs/plugins/argo/__init__.pyi +2 -2
  33. metaflow-stubs/plugins/argo/argo_client.pyi +2 -2
  34. metaflow-stubs/plugins/argo/argo_events.pyi +2 -2
  35. metaflow-stubs/plugins/argo/argo_workflows.pyi +2 -2
  36. metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +3 -3
  37. metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +2 -2
  38. metaflow-stubs/plugins/argo/argo_workflows_deployer_objects.pyi +3 -3
  39. metaflow-stubs/plugins/aws/__init__.pyi +3 -3
  40. metaflow-stubs/plugins/aws/aws_client.pyi +2 -2
  41. metaflow-stubs/plugins/aws/aws_utils.pyi +2 -2
  42. metaflow-stubs/plugins/aws/batch/__init__.pyi +2 -2
  43. metaflow-stubs/plugins/aws/batch/batch.pyi +2 -2
  44. metaflow-stubs/plugins/aws/batch/batch_client.pyi +2 -2
  45. metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +2 -2
  46. metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +2 -2
  47. metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +3 -3
  48. metaflow-stubs/plugins/aws/step_functions/__init__.pyi +2 -2
  49. metaflow-stubs/plugins/aws/step_functions/dynamo_db_client.pyi +2 -2
  50. metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +2 -2
  51. metaflow-stubs/plugins/aws/step_functions/schedule_decorator.pyi +2 -2
  52. metaflow-stubs/plugins/aws/step_functions/step_functions.pyi +2 -2
  53. metaflow-stubs/plugins/aws/step_functions/step_functions_client.pyi +2 -2
  54. metaflow-stubs/plugins/aws/step_functions/step_functions_decorator.pyi +2 -2
  55. metaflow-stubs/plugins/aws/step_functions/step_functions_deployer.pyi +3 -3
  56. metaflow-stubs/plugins/aws/step_functions/step_functions_deployer_objects.pyi +3 -3
  57. metaflow-stubs/plugins/azure/__init__.pyi +2 -2
  58. metaflow-stubs/plugins/azure/azure_credential.pyi +2 -2
  59. metaflow-stubs/plugins/azure/azure_exceptions.pyi +2 -2
  60. metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +3 -3
  61. metaflow-stubs/plugins/azure/azure_utils.pyi +2 -2
  62. metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +2 -2
  63. metaflow-stubs/plugins/azure/includefile_support.pyi +2 -2
  64. metaflow-stubs/plugins/cards/__init__.pyi +2 -2
  65. metaflow-stubs/plugins/cards/card_client.pyi +2 -2
  66. metaflow-stubs/plugins/cards/card_creator.pyi +2 -2
  67. metaflow-stubs/plugins/cards/card_datastore.pyi +2 -2
  68. metaflow-stubs/plugins/cards/card_decorator.pyi +2 -2
  69. metaflow-stubs/plugins/cards/card_modules/__init__.pyi +2 -2
  70. metaflow-stubs/plugins/cards/card_modules/basic.pyi +2 -2
  71. metaflow-stubs/plugins/cards/card_modules/card.pyi +2 -2
  72. metaflow-stubs/plugins/cards/card_modules/components.pyi +4 -4
  73. metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +2 -2
  74. metaflow-stubs/plugins/cards/card_modules/renderer_tools.pyi +2 -2
  75. metaflow-stubs/plugins/cards/card_modules/test_cards.pyi +2 -2
  76. metaflow-stubs/plugins/cards/card_resolver.pyi +2 -2
  77. metaflow-stubs/plugins/cards/component_serializer.pyi +2 -2
  78. metaflow-stubs/plugins/cards/exception.pyi +2 -2
  79. metaflow-stubs/plugins/catch_decorator.pyi +2 -2
  80. metaflow-stubs/plugins/datatools/__init__.pyi +2 -2
  81. metaflow-stubs/plugins/datatools/local.pyi +2 -2
  82. metaflow-stubs/plugins/datatools/s3/__init__.pyi +2 -2
  83. metaflow-stubs/plugins/datatools/s3/s3.pyi +3 -3
  84. metaflow-stubs/plugins/datatools/s3/s3tail.pyi +2 -2
  85. metaflow-stubs/plugins/datatools/s3/s3util.pyi +2 -2
  86. metaflow-stubs/plugins/debug_logger.pyi +2 -2
  87. metaflow-stubs/plugins/debug_monitor.pyi +2 -2
  88. metaflow-stubs/plugins/environment_decorator.pyi +2 -2
  89. metaflow-stubs/plugins/events_decorator.pyi +2 -2
  90. metaflow-stubs/plugins/frameworks/__init__.pyi +2 -2
  91. metaflow-stubs/plugins/frameworks/pytorch.pyi +2 -2
  92. metaflow-stubs/plugins/gcp/__init__.pyi +2 -2
  93. metaflow-stubs/plugins/gcp/gcp_secret_manager_secrets_provider.pyi +3 -3
  94. metaflow-stubs/plugins/gcp/gs_exceptions.pyi +2 -2
  95. metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +2 -2
  96. metaflow-stubs/plugins/gcp/gs_utils.pyi +2 -2
  97. metaflow-stubs/plugins/gcp/includefile_support.pyi +2 -2
  98. metaflow-stubs/plugins/kubernetes/__init__.pyi +2 -2
  99. metaflow-stubs/plugins/kubernetes/kube_utils.pyi +2 -2
  100. metaflow-stubs/plugins/kubernetes/kubernetes.pyi +2 -2
  101. metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +2 -2
  102. metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +4 -2
  103. metaflow-stubs/plugins/kubernetes/kubernetes_job.pyi +2 -2
  104. metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +2 -2
  105. metaflow-stubs/plugins/kubernetes/spot_monitor_sidecar.pyi +2 -2
  106. metaflow-stubs/plugins/parallel_decorator.pyi +2 -2
  107. metaflow-stubs/plugins/project_decorator.pyi +2 -2
  108. metaflow-stubs/plugins/pypi/__init__.pyi +4 -3
  109. metaflow-stubs/plugins/pypi/conda_decorator.pyi +2 -2
  110. metaflow-stubs/plugins/pypi/conda_environment.pyi +5 -5
  111. metaflow-stubs/plugins/pypi/parsers.pyi +113 -0
  112. metaflow-stubs/plugins/pypi/pypi_decorator.pyi +2 -2
  113. metaflow-stubs/plugins/pypi/pypi_environment.pyi +2 -2
  114. metaflow-stubs/plugins/pypi/utils.pyi +2 -2
  115. metaflow-stubs/plugins/resources_decorator.pyi +2 -2
  116. metaflow-stubs/plugins/retry_decorator.pyi +2 -2
  117. metaflow-stubs/plugins/secrets/__init__.pyi +2 -2
  118. metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +2 -2
  119. metaflow-stubs/plugins/secrets/secrets_decorator.pyi +2 -2
  120. metaflow-stubs/plugins/storage_executor.pyi +2 -2
  121. metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +3 -3
  122. metaflow-stubs/plugins/timeout_decorator.pyi +2 -2
  123. metaflow-stubs/pylint_wrapper.pyi +2 -2
  124. metaflow-stubs/runner/__init__.pyi +2 -2
  125. metaflow-stubs/runner/deployer.pyi +29 -29
  126. metaflow-stubs/runner/deployer_impl.pyi +2 -2
  127. metaflow-stubs/runner/metaflow_runner.pyi +3 -3
  128. metaflow-stubs/runner/nbdeploy.pyi +2 -2
  129. metaflow-stubs/runner/nbrun.pyi +2 -2
  130. metaflow-stubs/runner/subprocess_manager.pyi +2 -2
  131. metaflow-stubs/runner/utils.pyi +3 -3
  132. metaflow-stubs/system/__init__.pyi +2 -2
  133. metaflow-stubs/system/system_logger.pyi +2 -2
  134. metaflow-stubs/system/system_monitor.pyi +2 -2
  135. metaflow-stubs/tagging_util.pyi +2 -2
  136. metaflow-stubs/tuple_util.pyi +2 -2
  137. metaflow-stubs/user_configs/__init__.pyi +2 -2
  138. metaflow-stubs/user_configs/config_decorators.pyi +5 -5
  139. metaflow-stubs/user_configs/config_options.pyi +2 -2
  140. metaflow-stubs/user_configs/config_parameters.pyi +6 -6
  141. metaflow-stubs/version.pyi +2 -2
  142. {metaflow_stubs-2.15.0.dist-info → metaflow_stubs-2.15.2.dist-info}/METADATA +2 -2
  143. metaflow_stubs-2.15.2.dist-info/RECORD +146 -0
  144. {metaflow_stubs-2.15.0.dist-info → metaflow_stubs-2.15.2.dist-info}/WHEEL +1 -1
  145. metaflow_stubs-2.15.0.dist-info/RECORD +0 -145
  146. {metaflow_stubs-2.15.0.dist-info → metaflow_stubs-2.15.2.dist-info}/top_level.txt +0 -0
@@ -1,7 +1,7 @@
1
1
  ######################################################################################################
2
2
  # Auto-generated Metaflow stub file #
3
- # MF version: 2.15.0 #
4
- # Generated on 2025-02-25T21:21:51.409752 #
3
+ # MF version: 2.15.2 #
4
+ # Generated on 2025-03-01T03:37:26.010128 #
5
5
  ######################################################################################################
6
6
 
7
7
  from __future__ import annotations
@@ -42,6 +42,9 @@ from . import plugins as plugins
42
42
  from .plugins.datatools.s3.s3 import S3 as S3
43
43
  from . import includefile as includefile
44
44
  from .includefile import IncludeFile as IncludeFile
45
+ from .plugins.pypi.parsers import requirements_txt_parser as requirements_txt_parser
46
+ from .plugins.pypi.parsers import pyproject_toml_parser as pyproject_toml_parser
47
+ from .plugins.pypi.parsers import conda_environment_yml_parser as conda_environment_yml_parser
45
48
  from . import cards as cards
46
49
  from . import client as client
47
50
  from .client.core import namespace as namespace
@@ -143,148 +146,116 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
143
146
  ...
144
147
 
145
148
  @typing.overload
146
- 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]]]:
149
+ def retry(*, times: int = 3, minutes_between_retries: int = 2) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
147
150
  """
148
- Specifies the Conda environment for the step.
151
+ Specifies the number of times the task corresponding
152
+ to a step needs to be retried.
149
153
 
150
- Information in this decorator will augment any
151
- attributes set in the `@conda_base` flow-level decorator. Hence,
152
- you can use `@conda_base` to set packages required by all
153
- steps and use `@conda` to specify step-specific overrides.
154
+ This decorator is useful for handling transient errors, such as networking issues.
155
+ If your task contains operations that can't be retried safely, e.g. database updates,
156
+ it is advisable to annotate it with `@retry(times=0)`.
157
+
158
+ This can be used in conjunction with the `@catch` decorator. The `@catch`
159
+ decorator will execute a no-op task after all retries have been exhausted,
160
+ ensuring that the flow execution can continue.
154
161
 
155
162
 
156
163
  Parameters
157
164
  ----------
158
- packages : Dict[str, str], default {}
159
- Packages to use for this step. The key is the name of the package
160
- and the value is the version to use.
161
- libraries : Dict[str, str], default {}
162
- Supported for backward compatibility. When used with packages, packages will take precedence.
163
- python : str, optional, default None
164
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
165
- that the version used will correspond to the version of the Python interpreter used to start the run.
166
- disabled : bool, default False
167
- If set to True, disables @conda.
165
+ times : int, default 3
166
+ Number of times to retry this task.
167
+ minutes_between_retries : int, default 2
168
+ Number of minutes between retries.
168
169
  """
169
170
  ...
170
171
 
171
172
  @typing.overload
172
- def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
173
+ def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
173
174
  ...
174
175
 
175
176
  @typing.overload
176
- def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
177
+ def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
177
178
  ...
178
179
 
179
- 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):
180
+ def retry(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, times: int = 3, minutes_between_retries: int = 2):
180
181
  """
181
- Specifies the Conda environment for the step.
182
+ Specifies the number of times the task corresponding
183
+ to a step needs to be retried.
182
184
 
183
- Information in this decorator will augment any
184
- attributes set in the `@conda_base` flow-level decorator. Hence,
185
- you can use `@conda_base` to set packages required by all
186
- steps and use `@conda` to specify step-specific overrides.
185
+ This decorator is useful for handling transient errors, such as networking issues.
186
+ If your task contains operations that can't be retried safely, e.g. database updates,
187
+ it is advisable to annotate it with `@retry(times=0)`.
188
+
189
+ This can be used in conjunction with the `@catch` decorator. The `@catch`
190
+ decorator will execute a no-op task after all retries have been exhausted,
191
+ ensuring that the flow execution can continue.
187
192
 
188
193
 
189
194
  Parameters
190
195
  ----------
191
- packages : Dict[str, str], default {}
192
- Packages to use for this step. The key is the name of the package
193
- and the value is the version to use.
194
- libraries : Dict[str, str], default {}
195
- Supported for backward compatibility. When used with packages, packages will take precedence.
196
- python : str, optional, default None
197
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
198
- that the version used will correspond to the version of the Python interpreter used to start the run.
199
- disabled : bool, default False
200
- If set to True, disables @conda.
196
+ times : int, default 3
197
+ Number of times to retry this task.
198
+ minutes_between_retries : int, default 2
199
+ Number of minutes between retries.
201
200
  """
202
201
  ...
203
202
 
204
203
  @typing.overload
205
- 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]]]:
204
+ 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]]]:
206
205
  """
207
- Specifies the resources needed when executing this step.
208
-
209
- Use `@resources` to specify the resource requirements
210
- independently of the specific compute layer (`@batch`, `@kubernetes`).
206
+ Specifies that the step will success under all circumstances.
211
207
 
212
- You can choose the compute layer on the command line by executing e.g.
213
- ```
214
- python myflow.py run --with batch
215
- ```
216
- or
217
- ```
218
- python myflow.py run --with kubernetes
219
- ```
220
- which executes the flow on the desired system using the
221
- requirements specified in `@resources`.
208
+ The decorator will create an optional artifact, specified by `var`, which
209
+ contains the exception raised. You can use it to detect the presence
210
+ of errors, indicating that all happy-path artifacts produced by the step
211
+ are missing.
222
212
 
223
213
 
224
214
  Parameters
225
215
  ----------
226
- cpu : int, default 1
227
- Number of CPUs required for this step.
228
- gpu : int, optional, default None
229
- Number of GPUs required for this step.
230
- disk : int, optional, default None
231
- Disk size (in MB) required for this step. Only applies on Kubernetes.
232
- memory : int, default 4096
233
- Memory size (in MB) required for this step.
234
- shared_memory : int, optional, default None
235
- The value for the size (in MiB) of the /dev/shm volume for this step.
236
- This parameter maps to the `--shm-size` option in Docker.
216
+ var : str, optional, default None
217
+ Name of the artifact in which to store the caught exception.
218
+ If not specified, the exception is not stored.
219
+ print_exception : bool, default True
220
+ Determines whether or not the exception is printed to
221
+ stdout when caught.
237
222
  """
238
223
  ...
239
224
 
240
225
  @typing.overload
241
- def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
226
+ def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
242
227
  ...
243
228
 
244
229
  @typing.overload
245
- def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
230
+ def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
246
231
  ...
247
232
 
248
- 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):
233
+ 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):
249
234
  """
250
- Specifies the resources needed when executing this step.
251
-
252
- Use `@resources` to specify the resource requirements
253
- independently of the specific compute layer (`@batch`, `@kubernetes`).
235
+ Specifies that the step will success under all circumstances.
254
236
 
255
- You can choose the compute layer on the command line by executing e.g.
256
- ```
257
- python myflow.py run --with batch
258
- ```
259
- or
260
- ```
261
- python myflow.py run --with kubernetes
262
- ```
263
- which executes the flow on the desired system using the
264
- requirements specified in `@resources`.
237
+ The decorator will create an optional artifact, specified by `var`, which
238
+ contains the exception raised. You can use it to detect the presence
239
+ of errors, indicating that all happy-path artifacts produced by the step
240
+ are missing.
265
241
 
266
242
 
267
243
  Parameters
268
244
  ----------
269
- cpu : int, default 1
270
- Number of CPUs required for this step.
271
- gpu : int, optional, default None
272
- Number of GPUs required for this step.
273
- disk : int, optional, default None
274
- Disk size (in MB) required for this step. Only applies on Kubernetes.
275
- memory : int, default 4096
276
- Memory size (in MB) required for this step.
277
- shared_memory : int, optional, default None
278
- The value for the size (in MiB) of the /dev/shm volume for this step.
279
- This parameter maps to the `--shm-size` option in Docker.
245
+ var : str, optional, default None
246
+ Name of the artifact in which to store the caught exception.
247
+ If not specified, the exception is not stored.
248
+ print_exception : bool, default True
249
+ Determines whether or not the exception is printed to
250
+ stdout when caught.
280
251
  """
281
252
  ...
282
253
 
283
254
  @typing.overload
284
255
  def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
285
256
  """
286
- Parameters
287
- ----------
257
+ Decorator prototype for all step decorators. This function gets specialized
258
+ and imported for all decorators types by _import_plugin_decorators().
288
259
  """
289
260
  ...
290
261
 
@@ -294,92 +265,59 @@ def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None])
294
265
 
295
266
  def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
296
267
  """
297
- Parameters
298
- ----------
299
- """
300
- ...
301
-
302
- @typing.overload
303
- 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]]]:
304
- """
305
- Specifies secrets to be retrieved and injected as environment variables prior to
306
- the execution of a step.
307
-
308
-
309
- Parameters
310
- ----------
311
- sources : List[Union[str, Dict[str, Any]]], default: []
312
- List of secret specs, defining how the secrets are to be retrieved
313
- """
314
- ...
315
-
316
- @typing.overload
317
- def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
318
- ...
319
-
320
- @typing.overload
321
- def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
322
- ...
323
-
324
- 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]]] = []):
325
- """
326
- Specifies secrets to be retrieved and injected as environment variables prior to
327
- the execution of a step.
328
-
329
-
330
- Parameters
331
- ----------
332
- sources : List[Union[str, Dict[str, Any]]], default: []
333
- List of secret specs, defining how the secrets are to be retrieved
268
+ Decorator prototype for all step decorators. This function gets specialized
269
+ and imported for all decorators types by _import_plugin_decorators().
334
270
  """
335
271
  ...
336
272
 
337
273
  @typing.overload
338
- 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]]]:
274
+ def pypi(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
339
275
  """
340
- Creates a human-readable report, a Metaflow Card, after this step completes.
276
+ Specifies the PyPI packages for the step.
341
277
 
342
- Note that you may add multiple `@card` decorators in a step with different parameters.
278
+ Information in this decorator will augment any
279
+ attributes set in the `@pyi_base` flow-level decorator. Hence,
280
+ you can use `@pypi_base` to set packages required by all
281
+ steps and use `@pypi` to specify step-specific overrides.
343
282
 
344
283
 
345
284
  Parameters
346
285
  ----------
347
- type : str, default 'default'
348
- Card type.
349
- id : str, optional, default None
350
- If multiple cards are present, use this id to identify this card.
351
- options : Dict[str, Any], default {}
352
- Options passed to the card. The contents depend on the card type.
353
- timeout : int, default 45
354
- Interrupt reporting if it takes more than this many seconds.
286
+ packages : Dict[str, str], default: {}
287
+ Packages to use for this step. The key is the name of the package
288
+ and the value is the version to use.
289
+ python : str, optional, default: None
290
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
291
+ that the version used will correspond to the version of the Python interpreter used to start the run.
355
292
  """
356
293
  ...
357
294
 
358
295
  @typing.overload
359
- def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
296
+ def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
360
297
  ...
361
298
 
362
299
  @typing.overload
363
- def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
300
+ def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
364
301
  ...
365
302
 
366
- 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):
303
+ def pypi(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
367
304
  """
368
- Creates a human-readable report, a Metaflow Card, after this step completes.
305
+ Specifies the PyPI packages for the step.
369
306
 
370
- Note that you may add multiple `@card` decorators in a step with different parameters.
307
+ Information in this decorator will augment any
308
+ attributes set in the `@pyi_base` flow-level decorator. Hence,
309
+ you can use `@pypi_base` to set packages required by all
310
+ steps and use `@pypi` to specify step-specific overrides.
371
311
 
372
312
 
373
313
  Parameters
374
314
  ----------
375
- type : str, default 'default'
376
- Card type.
377
- id : str, optional, default None
378
- If multiple cards are present, use this id to identify this card.
379
- options : Dict[str, Any], default {}
380
- Options passed to the card. The contents depend on the card type.
381
- timeout : int, default 45
382
- Interrupt reporting if it takes more than this many seconds.
315
+ packages : Dict[str, str], default: {}
316
+ Packages to use for this step. The key is the name of the package
317
+ and the value is the version to use.
318
+ python : str, optional, default: None
319
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
320
+ that the version used will correspond to the version of the Python interpreter used to start the run.
383
321
  """
384
322
  ...
385
323
 
@@ -533,159 +471,234 @@ def batch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
533
471
  ...
534
472
 
535
473
  @typing.overload
536
- def pypi(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
474
+ 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]]]:
537
475
  """
538
- Specifies the PyPI packages for the step.
476
+ Specifies a timeout for your step.
539
477
 
540
- Information in this decorator will augment any
541
- attributes set in the `@pyi_base` flow-level decorator. Hence,
542
- you can use `@pypi_base` to set packages required by all
543
- steps and use `@pypi` to specify step-specific overrides.
478
+ This decorator is useful if this step may hang indefinitely.
479
+
480
+ This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
481
+ A timeout is considered to be an exception thrown by the step. It will cause the step to be
482
+ retried if needed and the exception will be caught by the `@catch` decorator, if present.
483
+
484
+ Note that all the values specified in parameters are added together so if you specify
485
+ 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
544
486
 
545
487
 
546
488
  Parameters
547
489
  ----------
548
- packages : Dict[str, str], default: {}
549
- Packages to use for this step. The key is the name of the package
550
- and the value is the version to use.
551
- python : str, optional, default: None
552
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
553
- that the version used will correspond to the version of the Python interpreter used to start the run.
554
- """
490
+ seconds : int, default 0
491
+ Number of seconds to wait prior to timing out.
492
+ minutes : int, default 0
493
+ Number of minutes to wait prior to timing out.
494
+ hours : int, default 0
495
+ Number of hours to wait prior to timing out.
496
+ """
555
497
  ...
556
498
 
557
499
  @typing.overload
558
- def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
500
+ def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
559
501
  ...
560
502
 
561
503
  @typing.overload
562
- def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
504
+ def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
563
505
  ...
564
506
 
565
- def pypi(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
507
+ 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):
566
508
  """
567
- Specifies the PyPI packages for the step.
509
+ Specifies a timeout for your step.
568
510
 
569
- Information in this decorator will augment any
570
- attributes set in the `@pyi_base` flow-level decorator. Hence,
571
- you can use `@pypi_base` to set packages required by all
572
- steps and use `@pypi` to specify step-specific overrides.
511
+ This decorator is useful if this step may hang indefinitely.
512
+
513
+ This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
514
+ A timeout is considered to be an exception thrown by the step. It will cause the step to be
515
+ retried if needed and the exception will be caught by the `@catch` decorator, if present.
516
+
517
+ Note that all the values specified in parameters are added together so if you specify
518
+ 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
573
519
 
574
520
 
575
521
  Parameters
576
522
  ----------
577
- packages : Dict[str, str], default: {}
578
- Packages to use for this step. The key is the name of the package
579
- and the value is the version to use.
580
- python : str, optional, default: None
581
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
582
- that the version used will correspond to the version of the Python interpreter used to start the run.
523
+ seconds : int, default 0
524
+ Number of seconds to wait prior to timing out.
525
+ minutes : int, default 0
526
+ Number of minutes to wait prior to timing out.
527
+ hours : int, default 0
528
+ Number of hours to wait prior to timing out.
583
529
  """
584
530
  ...
585
531
 
586
532
  @typing.overload
587
- 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]]]:
533
+ def secrets(*, sources: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = []) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
588
534
  """
589
- Specifies that the step will success under all circumstances.
535
+ Specifies secrets to be retrieved and injected as environment variables prior to
536
+ the execution of a step.
590
537
 
591
- The decorator will create an optional artifact, specified by `var`, which
592
- contains the exception raised. You can use it to detect the presence
593
- of errors, indicating that all happy-path artifacts produced by the step
594
- are missing.
538
+
539
+ Parameters
540
+ ----------
541
+ sources : List[Union[str, Dict[str, Any]]], default: []
542
+ List of secret specs, defining how the secrets are to be retrieved
543
+ """
544
+ ...
545
+
546
+ @typing.overload
547
+ def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
548
+ ...
549
+
550
+ @typing.overload
551
+ def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
552
+ ...
553
+
554
+ 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]]] = []):
555
+ """
556
+ Specifies secrets to be retrieved and injected as environment variables prior to
557
+ the execution of a step.
595
558
 
596
559
 
597
560
  Parameters
598
561
  ----------
599
- var : str, optional, default None
600
- Name of the artifact in which to store the caught exception.
601
- If not specified, the exception is not stored.
602
- print_exception : bool, default True
603
- Determines whether or not the exception is printed to
604
- stdout when caught.
562
+ sources : List[Union[str, Dict[str, Any]]], default: []
563
+ List of secret specs, defining how the secrets are to be retrieved
605
564
  """
606
565
  ...
607
566
 
608
567
  @typing.overload
609
- def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
568
+ 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]]]:
569
+ """
570
+ Specifies the Conda environment for the step.
571
+
572
+ Information in this decorator will augment any
573
+ attributes set in the `@conda_base` flow-level decorator. Hence,
574
+ you can use `@conda_base` to set packages required by all
575
+ steps and use `@conda` to specify step-specific overrides.
576
+
577
+
578
+ Parameters
579
+ ----------
580
+ packages : Dict[str, str], default {}
581
+ Packages to use for this step. The key is the name of the package
582
+ and the value is the version to use.
583
+ libraries : Dict[str, str], default {}
584
+ Supported for backward compatibility. When used with packages, packages will take precedence.
585
+ python : str, optional, default None
586
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
587
+ that the version used will correspond to the version of the Python interpreter used to start the run.
588
+ disabled : bool, default False
589
+ If set to True, disables @conda.
590
+ """
610
591
  ...
611
592
 
612
593
  @typing.overload
613
- def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
594
+ def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
614
595
  ...
615
596
 
616
- 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):
597
+ @typing.overload
598
+ def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
599
+ ...
600
+
601
+ 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):
617
602
  """
618
- Specifies that the step will success under all circumstances.
603
+ Specifies the Conda environment for the step.
619
604
 
620
- The decorator will create an optional artifact, specified by `var`, which
621
- contains the exception raised. You can use it to detect the presence
622
- of errors, indicating that all happy-path artifacts produced by the step
623
- are missing.
605
+ Information in this decorator will augment any
606
+ attributes set in the `@conda_base` flow-level decorator. Hence,
607
+ you can use `@conda_base` to set packages required by all
608
+ steps and use `@conda` to specify step-specific overrides.
624
609
 
625
610
 
626
611
  Parameters
627
612
  ----------
628
- var : str, optional, default None
629
- Name of the artifact in which to store the caught exception.
630
- If not specified, the exception is not stored.
631
- print_exception : bool, default True
632
- Determines whether or not the exception is printed to
633
- stdout when caught.
613
+ packages : Dict[str, str], default {}
614
+ Packages to use for this step. The key is the name of the package
615
+ and the value is the version to use.
616
+ libraries : Dict[str, str], default {}
617
+ Supported for backward compatibility. When used with packages, packages will take precedence.
618
+ python : str, optional, default None
619
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
620
+ that the version used will correspond to the version of the Python interpreter used to start the run.
621
+ disabled : bool, default False
622
+ If set to True, disables @conda.
634
623
  """
635
624
  ...
636
625
 
637
626
  @typing.overload
638
- 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]]]:
627
+ 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]]]:
639
628
  """
640
- Specifies the number of times the task corresponding
641
- to a step needs to be retried.
629
+ Specifies the resources needed when executing this step.
642
630
 
643
- This decorator is useful for handling transient errors, such as networking issues.
644
- If your task contains operations that can't be retried safely, e.g. database updates,
645
- it is advisable to annotate it with `@retry(times=0)`.
631
+ Use `@resources` to specify the resource requirements
632
+ independently of the specific compute layer (`@batch`, `@kubernetes`).
646
633
 
647
- This can be used in conjunction with the `@catch` decorator. The `@catch`
648
- decorator will execute a no-op task after all retries have been exhausted,
649
- ensuring that the flow execution can continue.
634
+ You can choose the compute layer on the command line by executing e.g.
635
+ ```
636
+ python myflow.py run --with batch
637
+ ```
638
+ or
639
+ ```
640
+ python myflow.py run --with kubernetes
641
+ ```
642
+ which executes the flow on the desired system using the
643
+ requirements specified in `@resources`.
650
644
 
651
645
 
652
646
  Parameters
653
647
  ----------
654
- times : int, default 3
655
- Number of times to retry this task.
656
- minutes_between_retries : int, default 2
657
- Number of minutes between retries.
648
+ cpu : int, default 1
649
+ Number of CPUs required for this step.
650
+ gpu : int, optional, default None
651
+ Number of GPUs required for this step.
652
+ disk : int, optional, default None
653
+ Disk size (in MB) required for this step. Only applies on Kubernetes.
654
+ memory : int, default 4096
655
+ Memory size (in MB) required for this step.
656
+ shared_memory : int, optional, default None
657
+ The value for the size (in MiB) of the /dev/shm volume for this step.
658
+ This parameter maps to the `--shm-size` option in Docker.
658
659
  """
659
660
  ...
660
661
 
661
662
  @typing.overload
662
- def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
663
+ def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
663
664
  ...
664
665
 
665
666
  @typing.overload
666
- def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
667
+ def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
667
668
  ...
668
669
 
669
- 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):
670
+ 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):
670
671
  """
671
- Specifies the number of times the task corresponding
672
- to a step needs to be retried.
672
+ Specifies the resources needed when executing this step.
673
673
 
674
- This decorator is useful for handling transient errors, such as networking issues.
675
- If your task contains operations that can't be retried safely, e.g. database updates,
676
- it is advisable to annotate it with `@retry(times=0)`.
674
+ Use `@resources` to specify the resource requirements
675
+ independently of the specific compute layer (`@batch`, `@kubernetes`).
677
676
 
678
- This can be used in conjunction with the `@catch` decorator. The `@catch`
679
- decorator will execute a no-op task after all retries have been exhausted,
680
- ensuring that the flow execution can continue.
677
+ You can choose the compute layer on the command line by executing e.g.
678
+ ```
679
+ python myflow.py run --with batch
680
+ ```
681
+ or
682
+ ```
683
+ python myflow.py run --with kubernetes
684
+ ```
685
+ which executes the flow on the desired system using the
686
+ requirements specified in `@resources`.
681
687
 
682
688
 
683
689
  Parameters
684
690
  ----------
685
- times : int, default 3
686
- Number of times to retry this task.
687
- minutes_between_retries : int, default 2
688
- Number of minutes between retries.
691
+ cpu : int, default 1
692
+ Number of CPUs required for this step.
693
+ gpu : int, optional, default None
694
+ Number of GPUs required for this step.
695
+ disk : int, optional, default None
696
+ Disk size (in MB) required for this step. Only applies on Kubernetes.
697
+ memory : int, default 4096
698
+ Memory size (in MB) required for this step.
699
+ shared_memory : int, optional, default None
700
+ The value for the size (in MiB) of the /dev/shm volume for this step.
701
+ This parameter maps to the `--shm-size` option in Docker.
689
702
  """
690
703
  ...
691
704
 
@@ -767,61 +780,51 @@ def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: ty
767
780
  ...
768
781
 
769
782
  @typing.overload
770
- 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]]]:
783
+ 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]]]:
771
784
  """
772
- Specifies a timeout for your step.
773
-
774
- This decorator is useful if this step may hang indefinitely.
775
-
776
- This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
777
- A timeout is considered to be an exception thrown by the step. It will cause the step to be
778
- retried if needed and the exception will be caught by the `@catch` decorator, if present.
785
+ Creates a human-readable report, a Metaflow Card, after this step completes.
779
786
 
780
- Note that all the values specified in parameters are added together so if you specify
781
- 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
787
+ Note that you may add multiple `@card` decorators in a step with different parameters.
782
788
 
783
789
 
784
790
  Parameters
785
791
  ----------
786
- seconds : int, default 0
787
- Number of seconds to wait prior to timing out.
788
- minutes : int, default 0
789
- Number of minutes to wait prior to timing out.
790
- hours : int, default 0
791
- Number of hours to wait prior to timing out.
792
+ type : str, default 'default'
793
+ Card type.
794
+ id : str, optional, default None
795
+ If multiple cards are present, use this id to identify this card.
796
+ options : Dict[str, Any], default {}
797
+ Options passed to the card. The contents depend on the card type.
798
+ timeout : int, default 45
799
+ Interrupt reporting if it takes more than this many seconds.
792
800
  """
793
801
  ...
794
802
 
795
803
  @typing.overload
796
- def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
804
+ def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
797
805
  ...
798
806
 
799
807
  @typing.overload
800
- def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
808
+ def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
801
809
  ...
802
810
 
803
- 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):
811
+ 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):
804
812
  """
805
- Specifies a timeout for your step.
813
+ Creates a human-readable report, a Metaflow Card, after this step completes.
806
814
 
807
- This decorator is useful if this step may hang indefinitely.
808
-
809
- This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
810
- A timeout is considered to be an exception thrown by the step. It will cause the step to be
811
- retried if needed and the exception will be caught by the `@catch` decorator, if present.
812
-
813
- Note that all the values specified in parameters are added together so if you specify
814
- 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
815
+ Note that you may add multiple `@card` decorators in a step with different parameters.
815
816
 
816
817
 
817
818
  Parameters
818
819
  ----------
819
- seconds : int, default 0
820
- Number of seconds to wait prior to timing out.
821
- minutes : int, default 0
822
- Number of minutes to wait prior to timing out.
823
- hours : int, default 0
824
- Number of hours to wait prior to timing out.
820
+ type : str, default 'default'
821
+ Card type.
822
+ id : str, optional, default None
823
+ If multiple cards are present, use this id to identify this card.
824
+ options : Dict[str, Any], default {}
825
+ Options passed to the card. The contents depend on the card type.
826
+ timeout : int, default 45
827
+ Interrupt reporting if it takes more than this many seconds.
825
828
  """
826
829
  ...
827
830
 
@@ -858,6 +861,57 @@ def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], Non
858
861
  """
859
862
  ...
860
863
 
864
+ @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]]:
866
+ """
867
+ Specifies the times when the flow should be run when running on a
868
+ production scheduler.
869
+
870
+
871
+ Parameters
872
+ ----------
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).
885
+ """
886
+ ...
887
+
888
+ @typing.overload
889
+ def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
890
+ ...
891
+
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):
893
+ """
894
+ Specifies the times when the flow should be run when running on a
895
+ production scheduler.
896
+
897
+
898
+ Parameters
899
+ ----------
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).
912
+ """
913
+ ...
914
+
861
915
  @typing.overload
862
916
  def trigger(*, event: typing.Union[str, typing.Dict[str, typing.Any], None] = None, events: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = [], options: typing.Dict[str, typing.Any] = {}) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
863
917
  """
@@ -951,6 +1005,127 @@ def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, event: t
951
1005
  """
952
1006
  ...
953
1007
 
1008
+ def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1009
+ """
1010
+ Specifies what flows belong to the same project.
1011
+
1012
+ A project-specific namespace is created for all flows that
1013
+ use the same `@project(name)`.
1014
+
1015
+
1016
+ Parameters
1017
+ ----------
1018
+ name : str
1019
+ Project name. Make sure that the name is unique amongst all
1020
+ projects that use the same production scheduler. The name may
1021
+ contain only lowercase alphanumeric characters and underscores.
1022
+
1023
+ branch : Optional[str], default None
1024
+ The branch to use. If not specified, the branch is set to
1025
+ `user.<username>` unless `production` is set to `True`. This can
1026
+ also be set on the command line using `--branch` as a top-level option.
1027
+ It is an error to specify `branch` in the decorator and on the command line.
1028
+
1029
+ production : bool, default False
1030
+ Whether or not the branch is the production branch. This can also be set on the
1031
+ command line using `--production` as a top-level option. It is an error to specify
1032
+ `production` in the decorator and on the command line.
1033
+ The project branch name will be:
1034
+ - if `branch` is specified:
1035
+ - if `production` is True: `prod.<branch>`
1036
+ - if `production` is False: `test.<branch>`
1037
+ - if `branch` is not specified:
1038
+ - if `production` is True: `prod`
1039
+ - if `production` is False: `user.<username>`
1040
+ """
1041
+ ...
1042
+
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]]:
1044
+ """
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.
1050
+
1051
+
1052
+ Parameters
1053
+ ----------
1054
+ timeout : int
1055
+ Time, in seconds before the task times out and fails. (Default: 3600)
1056
+ poke_interval : int
1057
+ Time in seconds that the job should wait in between each try. (Default: 60)
1058
+ mode : str
1059
+ How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1060
+ exponential_backoff : bool
1061
+ allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1062
+ pool : str
1063
+ the slot pool this task should run in,
1064
+ slot pools are a way to limit concurrency for certain tasks. (Default:None)
1065
+ soft_fail : bool
1066
+ Set to true to mark the task as SKIPPED on failure. (Default: False)
1067
+ name : str
1068
+ Name of the sensor on Airflow
1069
+ description : str
1070
+ Description of sensor in the Airflow UI
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)
1083
+ """
1084
+ ...
1085
+
1086
+ 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]]:
1087
+ """
1088
+ 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.
1089
+ 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.
1090
+
1091
+
1092
+ Parameters
1093
+ ----------
1094
+ timeout : int
1095
+ Time, in seconds before the task times out and fails. (Default: 3600)
1096
+ poke_interval : int
1097
+ Time in seconds that the job should wait in between each try. (Default: 60)
1098
+ mode : str
1099
+ How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1100
+ exponential_backoff : bool
1101
+ allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1102
+ pool : str
1103
+ the slot pool this task should run in,
1104
+ slot pools are a way to limit concurrency for certain tasks. (Default:None)
1105
+ soft_fail : bool
1106
+ Set to true to mark the task as SKIPPED on failure. (Default: False)
1107
+ name : str
1108
+ Name of the sensor on Airflow
1109
+ description : str
1110
+ Description of sensor in the Airflow UI
1111
+ external_dag_id : str
1112
+ The dag_id that contains the task you want to wait for.
1113
+ external_task_ids : List[str]
1114
+ The list of task_ids that you want to wait for.
1115
+ If None (default value) the sensor waits for the DAG. (Default: None)
1116
+ allowed_states : List[str]
1117
+ Iterable of allowed states, (Default: ['success'])
1118
+ failed_states : List[str]
1119
+ Iterable of failed or dis-allowed states. (Default: None)
1120
+ execution_delta : datetime.timedelta
1121
+ time difference with the previous execution to look at,
1122
+ the default is the same logical date as the current task or DAG. (Default: None)
1123
+ check_existence: bool
1124
+ Set to True to check if the external task exists or check if
1125
+ the DAG to wait for exists. (Default: True)
1126
+ """
1127
+ ...
1128
+
954
1129
  @typing.overload
955
1130
  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]]:
956
1131
  """
@@ -1103,178 +1278,6 @@ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *
1103
1278
  """
1104
1279
  ...
1105
1280
 
1106
- @typing.overload
1107
- 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]]:
1108
- """
1109
- Specifies the times when the flow should be run when running on a
1110
- production scheduler.
1111
-
1112
-
1113
- Parameters
1114
- ----------
1115
- hourly : bool, default False
1116
- Run the workflow hourly.
1117
- daily : bool, default True
1118
- Run the workflow daily.
1119
- weekly : bool, default False
1120
- Run the workflow weekly.
1121
- cron : str, optional, default None
1122
- Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1123
- specified by this expression.
1124
- timezone : str, optional, default None
1125
- Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1126
- which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1127
- """
1128
- ...
1129
-
1130
- @typing.overload
1131
- def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1132
- ...
1133
-
1134
- 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):
1135
- """
1136
- Specifies the times when the flow should be run when running on a
1137
- production scheduler.
1138
-
1139
-
1140
- Parameters
1141
- ----------
1142
- hourly : bool, default False
1143
- Run the workflow hourly.
1144
- daily : bool, default True
1145
- Run the workflow daily.
1146
- weekly : bool, default False
1147
- Run the workflow weekly.
1148
- cron : str, optional, default None
1149
- Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1150
- specified by this expression.
1151
- timezone : str, optional, default None
1152
- Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1153
- which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1154
- """
1155
- ...
1156
-
1157
- 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]]:
1158
- """
1159
- 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)
1160
- before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
1161
- and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
1162
- added as a flow decorators. Adding more than one decorator will ensure that `start` step
1163
- starts only after all sensors finish.
1164
-
1165
-
1166
- Parameters
1167
- ----------
1168
- timeout : int
1169
- Time, in seconds before the task times out and fails. (Default: 3600)
1170
- poke_interval : int
1171
- Time in seconds that the job should wait in between each try. (Default: 60)
1172
- mode : str
1173
- How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1174
- exponential_backoff : bool
1175
- allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1176
- pool : str
1177
- the slot pool this task should run in,
1178
- slot pools are a way to limit concurrency for certain tasks. (Default:None)
1179
- soft_fail : bool
1180
- Set to true to mark the task as SKIPPED on failure. (Default: False)
1181
- name : str
1182
- Name of the sensor on Airflow
1183
- description : str
1184
- Description of sensor in the Airflow UI
1185
- bucket_key : Union[str, List[str]]
1186
- The key(s) being waited on. Supports full s3:// style url or relative path from root level.
1187
- When it's specified as a full s3:// url, please leave `bucket_name` as None
1188
- bucket_name : str
1189
- Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
1190
- When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
1191
- wildcard_match : bool
1192
- whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
1193
- aws_conn_id : str
1194
- a reference to the s3 connection on Airflow. (Default: None)
1195
- verify : bool
1196
- Whether or not to verify SSL certificates for S3 connection. (Default: None)
1197
- """
1198
- ...
1199
-
1200
- def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1201
- """
1202
- Specifies what flows belong to the same project.
1203
-
1204
- A project-specific namespace is created for all flows that
1205
- use the same `@project(name)`.
1206
-
1207
-
1208
- Parameters
1209
- ----------
1210
- name : str
1211
- Project name. Make sure that the name is unique amongst all
1212
- projects that use the same production scheduler. The name may
1213
- contain only lowercase alphanumeric characters and underscores.
1214
-
1215
- branch : Optional[str], default None
1216
- The branch to use. If not specified, the branch is set to
1217
- `user.<username>` unless `production` is set to `True`. This can
1218
- also be set on the command line using `--branch` as a top-level option.
1219
- It is an error to specify `branch` in the decorator and on the command line.
1220
-
1221
- production : bool, default False
1222
- Whether or not the branch is the production branch. This can also be set on the
1223
- command line using `--production` as a top-level option. It is an error to specify
1224
- `production` in the decorator and on the command line.
1225
- The project branch name will be:
1226
- - if `branch` is specified:
1227
- - if `production` is True: `prod.<branch>`
1228
- - if `production` is False: `test.<branch>`
1229
- - if `branch` is not specified:
1230
- - if `production` is True: `prod`
1231
- - if `production` is False: `user.<username>`
1232
- """
1233
- ...
1234
-
1235
- 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]]:
1236
- """
1237
- 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.
1238
- 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.
1239
-
1240
-
1241
- Parameters
1242
- ----------
1243
- timeout : int
1244
- Time, in seconds before the task times out and fails. (Default: 3600)
1245
- poke_interval : int
1246
- Time in seconds that the job should wait in between each try. (Default: 60)
1247
- mode : str
1248
- How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1249
- exponential_backoff : bool
1250
- allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1251
- pool : str
1252
- the slot pool this task should run in,
1253
- slot pools are a way to limit concurrency for certain tasks. (Default:None)
1254
- soft_fail : bool
1255
- Set to true to mark the task as SKIPPED on failure. (Default: False)
1256
- name : str
1257
- Name of the sensor on Airflow
1258
- description : str
1259
- Description of sensor in the Airflow UI
1260
- external_dag_id : str
1261
- The dag_id that contains the task you want to wait for.
1262
- external_task_ids : List[str]
1263
- The list of task_ids that you want to wait for.
1264
- If None (default value) the sensor waits for the DAG. (Default: None)
1265
- allowed_states : List[str]
1266
- Iterable of allowed states, (Default: ['success'])
1267
- failed_states : List[str]
1268
- Iterable of failed or dis-allowed states. (Default: None)
1269
- execution_delta : datetime.timedelta
1270
- time difference with the previous execution to look at,
1271
- the default is the same logical date as the current task or DAG. (Default: None)
1272
- check_existence: bool
1273
- Set to True to check if the external task exists or check if
1274
- the DAG to wait for exists. (Default: True)
1275
- """
1276
- ...
1277
-
1278
1281
  @typing.overload
1279
1282
  def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1280
1283
  """