metaflow-stubs 2.16.3__py2.py3-none-any.whl → 2.16.5__py2.py3-none-any.whl

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

Potentially problematic release.


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

Files changed (166) hide show
  1. metaflow-stubs/__init__.pyi +405 -405
  2. metaflow-stubs/cards.pyi +2 -2
  3. metaflow-stubs/cli.pyi +2 -2
  4. metaflow-stubs/cli_components/__init__.pyi +2 -2
  5. metaflow-stubs/cli_components/utils.pyi +2 -2
  6. metaflow-stubs/client/__init__.pyi +2 -2
  7. metaflow-stubs/client/core.pyi +5 -5
  8. metaflow-stubs/client/filecache.pyi +2 -2
  9. metaflow-stubs/events.pyi +2 -2
  10. metaflow-stubs/exception.pyi +2 -2
  11. metaflow-stubs/flowspec.pyi +6 -6
  12. metaflow-stubs/generated_for.txt +1 -1
  13. metaflow-stubs/includefile.pyi +5 -5
  14. metaflow-stubs/meta_files.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 +3 -3
  18. metaflow-stubs/metadata_provider/util.pyi +2 -2
  19. metaflow-stubs/metaflow_config.pyi +2 -2
  20. metaflow-stubs/metaflow_current.pyi +34 -34
  21. metaflow-stubs/metaflow_git.pyi +2 -2
  22. metaflow-stubs/multicore_utils.pyi +2 -2
  23. metaflow-stubs/packaging_sys/__init__.pyi +6 -6
  24. metaflow-stubs/packaging_sys/backend.pyi +5 -5
  25. metaflow-stubs/packaging_sys/distribution_support.pyi +3 -3
  26. metaflow-stubs/packaging_sys/tar_backend.pyi +5 -5
  27. metaflow-stubs/packaging_sys/utils.pyi +2 -2
  28. metaflow-stubs/packaging_sys/v1.pyi +3 -3
  29. metaflow-stubs/parameters.pyi +5 -5
  30. metaflow-stubs/plugins/__init__.pyi +12 -12
  31. metaflow-stubs/plugins/airflow/__init__.pyi +2 -2
  32. metaflow-stubs/plugins/airflow/airflow_decorator.pyi +2 -2
  33. metaflow-stubs/plugins/airflow/airflow_utils.pyi +2 -2
  34. metaflow-stubs/plugins/airflow/exception.pyi +2 -2
  35. metaflow-stubs/plugins/airflow/sensors/__init__.pyi +2 -2
  36. metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +2 -2
  37. metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +2 -2
  38. metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +2 -2
  39. metaflow-stubs/plugins/argo/__init__.pyi +2 -2
  40. metaflow-stubs/plugins/argo/argo_client.pyi +3 -3
  41. metaflow-stubs/plugins/argo/argo_events.pyi +2 -2
  42. metaflow-stubs/plugins/argo/argo_workflows.pyi +4 -4
  43. metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +3 -3
  44. metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +4 -4
  45. metaflow-stubs/plugins/argo/argo_workflows_deployer_objects.pyi +22 -4
  46. metaflow-stubs/plugins/argo/exit_hooks.pyi +3 -3
  47. metaflow-stubs/plugins/aws/__init__.pyi +2 -2
  48. metaflow-stubs/plugins/aws/aws_client.pyi +2 -2
  49. metaflow-stubs/plugins/aws/aws_utils.pyi +2 -2
  50. metaflow-stubs/plugins/aws/batch/__init__.pyi +2 -2
  51. metaflow-stubs/plugins/aws/batch/batch.pyi +2 -2
  52. metaflow-stubs/plugins/aws/batch/batch_client.pyi +2 -2
  53. metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +2 -2
  54. metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +2 -2
  55. metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +2 -2
  56. metaflow-stubs/plugins/aws/step_functions/__init__.pyi +2 -2
  57. metaflow-stubs/plugins/aws/step_functions/dynamo_db_client.pyi +2 -2
  58. metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +2 -2
  59. metaflow-stubs/plugins/aws/step_functions/schedule_decorator.pyi +2 -2
  60. metaflow-stubs/plugins/aws/step_functions/step_functions.pyi +2 -2
  61. metaflow-stubs/plugins/aws/step_functions/step_functions_client.pyi +2 -2
  62. metaflow-stubs/plugins/aws/step_functions/step_functions_decorator.pyi +2 -2
  63. metaflow-stubs/plugins/aws/step_functions/step_functions_deployer.pyi +4 -4
  64. metaflow-stubs/plugins/aws/step_functions/step_functions_deployer_objects.pyi +15 -4
  65. metaflow-stubs/plugins/azure/__init__.pyi +2 -2
  66. metaflow-stubs/plugins/azure/azure_credential.pyi +2 -2
  67. metaflow-stubs/plugins/azure/azure_exceptions.pyi +2 -2
  68. metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +2 -2
  69. metaflow-stubs/plugins/azure/azure_utils.pyi +2 -2
  70. metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +2 -2
  71. metaflow-stubs/plugins/azure/includefile_support.pyi +2 -2
  72. metaflow-stubs/plugins/cards/__init__.pyi +2 -2
  73. metaflow-stubs/plugins/cards/card_client.pyi +2 -2
  74. metaflow-stubs/plugins/cards/card_creator.pyi +2 -2
  75. metaflow-stubs/plugins/cards/card_datastore.pyi +2 -2
  76. metaflow-stubs/plugins/cards/card_decorator.pyi +3 -3
  77. metaflow-stubs/plugins/cards/card_modules/__init__.pyi +2 -2
  78. metaflow-stubs/plugins/cards/card_modules/basic.pyi +3 -3
  79. metaflow-stubs/plugins/cards/card_modules/card.pyi +2 -2
  80. metaflow-stubs/plugins/cards/card_modules/components.pyi +3 -3
  81. metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +2 -2
  82. metaflow-stubs/plugins/cards/card_modules/renderer_tools.pyi +2 -2
  83. metaflow-stubs/plugins/cards/card_modules/test_cards.pyi +2 -2
  84. metaflow-stubs/plugins/cards/card_resolver.pyi +2 -2
  85. metaflow-stubs/plugins/cards/component_serializer.pyi +2 -2
  86. metaflow-stubs/plugins/cards/exception.pyi +2 -2
  87. metaflow-stubs/plugins/catch_decorator.pyi +2 -2
  88. metaflow-stubs/plugins/datatools/__init__.pyi +2 -2
  89. metaflow-stubs/plugins/datatools/local.pyi +2 -2
  90. metaflow-stubs/plugins/datatools/s3/__init__.pyi +2 -2
  91. metaflow-stubs/plugins/datatools/s3/s3.pyi +4 -4
  92. metaflow-stubs/plugins/datatools/s3/s3tail.pyi +2 -2
  93. metaflow-stubs/plugins/datatools/s3/s3util.pyi +2 -2
  94. metaflow-stubs/plugins/debug_logger.pyi +2 -2
  95. metaflow-stubs/plugins/debug_monitor.pyi +2 -2
  96. metaflow-stubs/plugins/environment_decorator.pyi +2 -2
  97. metaflow-stubs/plugins/events_decorator.pyi +2 -2
  98. metaflow-stubs/plugins/exit_hook/__init__.pyi +2 -2
  99. metaflow-stubs/plugins/exit_hook/exit_hook_decorator.pyi +2 -2
  100. metaflow-stubs/plugins/frameworks/__init__.pyi +2 -2
  101. metaflow-stubs/plugins/frameworks/pytorch.pyi +2 -2
  102. metaflow-stubs/plugins/gcp/__init__.pyi +2 -2
  103. metaflow-stubs/plugins/gcp/gcp_secret_manager_secrets_provider.pyi +2 -2
  104. metaflow-stubs/plugins/gcp/gs_exceptions.pyi +2 -2
  105. metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +2 -2
  106. metaflow-stubs/plugins/gcp/gs_utils.pyi +2 -2
  107. metaflow-stubs/plugins/gcp/includefile_support.pyi +2 -2
  108. metaflow-stubs/plugins/kubernetes/__init__.pyi +2 -2
  109. metaflow-stubs/plugins/kubernetes/kube_utils.pyi +3 -3
  110. metaflow-stubs/plugins/kubernetes/kubernetes.pyi +2 -2
  111. metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +2 -2
  112. metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +3 -3
  113. metaflow-stubs/plugins/kubernetes/kubernetes_job.pyi +2 -2
  114. metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +2 -2
  115. metaflow-stubs/plugins/kubernetes/spot_monitor_sidecar.pyi +2 -2
  116. metaflow-stubs/plugins/parallel_decorator.pyi +2 -2
  117. metaflow-stubs/plugins/project_decorator.pyi +2 -2
  118. metaflow-stubs/plugins/pypi/__init__.pyi +3 -3
  119. metaflow-stubs/plugins/pypi/conda_decorator.pyi +2 -2
  120. metaflow-stubs/plugins/pypi/conda_environment.pyi +3 -3
  121. metaflow-stubs/plugins/pypi/parsers.pyi +2 -2
  122. metaflow-stubs/plugins/pypi/pypi_decorator.pyi +2 -2
  123. metaflow-stubs/plugins/pypi/pypi_environment.pyi +2 -2
  124. metaflow-stubs/plugins/pypi/utils.pyi +2 -2
  125. metaflow-stubs/plugins/resources_decorator.pyi +2 -2
  126. metaflow-stubs/plugins/retry_decorator.pyi +2 -2
  127. metaflow-stubs/plugins/secrets/__init__.pyi +3 -3
  128. metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +2 -2
  129. metaflow-stubs/plugins/secrets/secrets_decorator.pyi +2 -2
  130. metaflow-stubs/plugins/secrets/secrets_func.pyi +2 -2
  131. metaflow-stubs/plugins/secrets/secrets_spec.pyi +2 -2
  132. metaflow-stubs/plugins/secrets/utils.pyi +2 -2
  133. metaflow-stubs/plugins/storage_executor.pyi +2 -2
  134. metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +2 -2
  135. metaflow-stubs/plugins/timeout_decorator.pyi +2 -2
  136. metaflow-stubs/plugins/uv/__init__.pyi +2 -2
  137. metaflow-stubs/plugins/uv/uv_environment.pyi +2 -2
  138. metaflow-stubs/pylint_wrapper.pyi +2 -2
  139. metaflow-stubs/runner/__init__.pyi +2 -2
  140. metaflow-stubs/runner/deployer.pyi +31 -6
  141. metaflow-stubs/runner/deployer_impl.pyi +2 -2
  142. metaflow-stubs/runner/metaflow_runner.pyi +4 -4
  143. metaflow-stubs/runner/nbdeploy.pyi +2 -2
  144. metaflow-stubs/runner/nbrun.pyi +2 -2
  145. metaflow-stubs/runner/subprocess_manager.pyi +2 -2
  146. metaflow-stubs/runner/utils.pyi +4 -4
  147. metaflow-stubs/system/__init__.pyi +2 -2
  148. metaflow-stubs/system/system_logger.pyi +2 -2
  149. metaflow-stubs/system/system_monitor.pyi +2 -2
  150. metaflow-stubs/tagging_util.pyi +2 -2
  151. metaflow-stubs/tuple_util.pyi +2 -2
  152. metaflow-stubs/user_configs/__init__.pyi +2 -2
  153. metaflow-stubs/user_configs/config_options.pyi +4 -4
  154. metaflow-stubs/user_configs/config_parameters.pyi +5 -5
  155. metaflow-stubs/user_decorators/__init__.pyi +2 -2
  156. metaflow-stubs/user_decorators/common.pyi +2 -2
  157. metaflow-stubs/user_decorators/mutable_flow.pyi +6 -6
  158. metaflow-stubs/user_decorators/mutable_step.pyi +4 -4
  159. metaflow-stubs/user_decorators/user_flow_decorator.pyi +5 -5
  160. metaflow-stubs/user_decorators/user_step_decorator.pyi +7 -7
  161. metaflow-stubs/version.pyi +2 -2
  162. {metaflow_stubs-2.16.3.dist-info → metaflow_stubs-2.16.5.dist-info}/METADATA +2 -2
  163. metaflow_stubs-2.16.5.dist-info/RECORD +166 -0
  164. metaflow_stubs-2.16.3.dist-info/RECORD +0 -166
  165. {metaflow_stubs-2.16.3.dist-info → metaflow_stubs-2.16.5.dist-info}/WHEEL +0 -0
  166. {metaflow_stubs-2.16.3.dist-info → metaflow_stubs-2.16.5.dist-info}/top_level.txt +0 -0
@@ -1,15 +1,15 @@
1
1
  ######################################################################################################
2
2
  # Auto-generated Metaflow stub file #
3
- # MF version: 2.16.3 #
4
- # Generated on 2025-07-16T15:23:11.248549 #
3
+ # MF version: 2.16.5 #
4
+ # Generated on 2025-07-21T20:37:22.333694 #
5
5
  ######################################################################################################
6
6
 
7
7
  from __future__ import annotations
8
8
 
9
9
  import typing
10
10
  if typing.TYPE_CHECKING:
11
- import datetime
12
11
  import typing
12
+ import datetime
13
13
  FlowSpecDerived = typing.TypeVar("FlowSpecDerived", bound="FlowSpec", contravariant=False, covariant=False)
14
14
  StepFlag = typing.NewType("StepFlag", bool)
15
15
 
@@ -39,17 +39,17 @@ from .user_decorators.user_step_decorator import UserStepDecorator as UserStepDe
39
39
  from .user_decorators.user_step_decorator import StepMutator as StepMutator
40
40
  from .user_decorators.user_step_decorator import user_step_decorator as user_step_decorator
41
41
  from .user_decorators.user_flow_decorator import FlowMutator as FlowMutator
42
- from . import tuple_util as tuple_util
43
- from . import metaflow_git as metaflow_git
44
42
  from . import events as events
43
+ from . import metaflow_git as metaflow_git
44
+ from . import tuple_util as tuple_util
45
45
  from . import runner as runner
46
46
  from . import plugins as plugins
47
47
  from .plugins.datatools.s3.s3 import S3 as S3
48
48
  from . import includefile as includefile
49
49
  from .includefile import IncludeFile as IncludeFile
50
+ from .plugins.pypi.parsers import pyproject_toml_parser as pyproject_toml_parser
50
51
  from .plugins.pypi.parsers import requirements_txt_parser as requirements_txt_parser
51
52
  from .plugins.pypi.parsers import conda_environment_yml_parser as conda_environment_yml_parser
52
- from .plugins.pypi.parsers import pyproject_toml_parser as pyproject_toml_parser
53
53
  from . import cards as cards
54
54
  from . import client as client
55
55
  from .client.core import namespace as namespace
@@ -153,84 +153,241 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
153
153
  ...
154
154
 
155
155
  @typing.overload
156
- 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]]]:
156
+ 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]]]:
157
157
  """
158
- Specifies environment variables to be set prior to the execution of a step.
158
+ Specifies that the step will success under all circumstances.
159
+
160
+ The decorator will create an optional artifact, specified by `var`, which
161
+ contains the exception raised. You can use it to detect the presence
162
+ of errors, indicating that all happy-path artifacts produced by the step
163
+ are missing.
159
164
 
160
165
 
161
166
  Parameters
162
167
  ----------
163
- vars : Dict[str, str], default {}
164
- Dictionary of environment variables to set.
168
+ var : str, optional, default None
169
+ Name of the artifact in which to store the caught exception.
170
+ If not specified, the exception is not stored.
171
+ print_exception : bool, default True
172
+ Determines whether or not the exception is printed to
173
+ stdout when caught.
165
174
  """
166
175
  ...
167
176
 
168
177
  @typing.overload
169
- def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
178
+ def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
170
179
  ...
171
180
 
172
181
  @typing.overload
173
- def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
182
+ def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
174
183
  ...
175
184
 
176
- def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
185
+ 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):
177
186
  """
178
- Specifies environment variables to be set prior to the execution of a step.
187
+ Specifies that the step will success under all circumstances.
188
+
189
+ The decorator will create an optional artifact, specified by `var`, which
190
+ contains the exception raised. You can use it to detect the presence
191
+ of errors, indicating that all happy-path artifacts produced by the step
192
+ are missing.
179
193
 
180
194
 
181
195
  Parameters
182
196
  ----------
183
- vars : Dict[str, str], default {}
184
- Dictionary of environment variables to set.
197
+ var : str, optional, default None
198
+ Name of the artifact in which to store the caught exception.
199
+ If not specified, the exception is not stored.
200
+ print_exception : bool, default True
201
+ Determines whether or not the exception is printed to
202
+ stdout when caught.
185
203
  """
186
204
  ...
187
205
 
188
206
  @typing.overload
189
- 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]]]:
207
+ 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]]]:
190
208
  """
191
- Creates a human-readable report, a Metaflow Card, after this step completes.
209
+ Specifies the resources needed when executing this step.
192
210
 
193
- Note that you may add multiple `@card` decorators in a step with different parameters.
211
+ Use `@resources` to specify the resource requirements
212
+ independently of the specific compute layer (`@batch`, `@kubernetes`).
213
+
214
+ You can choose the compute layer on the command line by executing e.g.
215
+ ```
216
+ python myflow.py run --with batch
217
+ ```
218
+ or
219
+ ```
220
+ python myflow.py run --with kubernetes
221
+ ```
222
+ which executes the flow on the desired system using the
223
+ requirements specified in `@resources`.
194
224
 
195
225
 
196
226
  Parameters
197
227
  ----------
198
- type : str, default 'default'
199
- Card type.
200
- id : str, optional, default None
201
- If multiple cards are present, use this id to identify this card.
202
- options : Dict[str, Any], default {}
203
- Options passed to the card. The contents depend on the card type.
204
- timeout : int, default 45
205
- Interrupt reporting if it takes more than this many seconds.
228
+ cpu : int, default 1
229
+ Number of CPUs required for this step.
230
+ gpu : int, optional, default None
231
+ Number of GPUs required for this step.
232
+ disk : int, optional, default None
233
+ Disk size (in MB) required for this step. Only applies on Kubernetes.
234
+ memory : int, default 4096
235
+ Memory size (in MB) required for this step.
236
+ shared_memory : int, optional, default None
237
+ The value for the size (in MiB) of the /dev/shm volume for this step.
238
+ This parameter maps to the `--shm-size` option in Docker.
206
239
  """
207
240
  ...
208
241
 
209
242
  @typing.overload
210
- def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
243
+ def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
211
244
  ...
212
245
 
213
246
  @typing.overload
214
- def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
247
+ def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
215
248
  ...
216
249
 
217
- 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):
250
+ 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):
218
251
  """
219
- Creates a human-readable report, a Metaflow Card, after this step completes.
252
+ Specifies the resources needed when executing this step.
220
253
 
221
- Note that you may add multiple `@card` decorators in a step with different parameters.
254
+ Use `@resources` to specify the resource requirements
255
+ independently of the specific compute layer (`@batch`, `@kubernetes`).
256
+
257
+ You can choose the compute layer on the command line by executing e.g.
258
+ ```
259
+ python myflow.py run --with batch
260
+ ```
261
+ or
262
+ ```
263
+ python myflow.py run --with kubernetes
264
+ ```
265
+ which executes the flow on the desired system using the
266
+ requirements specified in `@resources`.
222
267
 
223
268
 
224
269
  Parameters
225
270
  ----------
226
- type : str, default 'default'
227
- Card type.
228
- id : str, optional, default None
229
- If multiple cards are present, use this id to identify this card.
230
- options : Dict[str, Any], default {}
231
- Options passed to the card. The contents depend on the card type.
232
- timeout : int, default 45
233
- Interrupt reporting if it takes more than this many seconds.
271
+ cpu : int, default 1
272
+ Number of CPUs required for this step.
273
+ gpu : int, optional, default None
274
+ Number of GPUs required for this step.
275
+ disk : int, optional, default None
276
+ Disk size (in MB) required for this step. Only applies on Kubernetes.
277
+ memory : int, default 4096
278
+ Memory size (in MB) required for this step.
279
+ shared_memory : int, optional, default None
280
+ The value for the size (in MiB) of the /dev/shm volume for this step.
281
+ This parameter maps to the `--shm-size` option in Docker.
282
+ """
283
+ ...
284
+
285
+ @typing.overload
286
+ def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
287
+ """
288
+ Decorator prototype for all step decorators. This function gets specialized
289
+ and imported for all decorators types by _import_plugin_decorators().
290
+ """
291
+ ...
292
+
293
+ @typing.overload
294
+ def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
295
+ ...
296
+
297
+ def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
298
+ """
299
+ Decorator prototype for all step decorators. This function gets specialized
300
+ and imported for all decorators types by _import_plugin_decorators().
301
+ """
302
+ ...
303
+
304
+ @typing.overload
305
+ 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]]]:
306
+ """
307
+ Specifies the PyPI packages for the step.
308
+
309
+ Information in this decorator will augment any
310
+ attributes set in the `@pyi_base` flow-level decorator. Hence,
311
+ you can use `@pypi_base` to set packages required by all
312
+ steps and use `@pypi` to specify step-specific overrides.
313
+
314
+
315
+ Parameters
316
+ ----------
317
+ packages : Dict[str, str], default: {}
318
+ Packages to use for this step. The key is the name of the package
319
+ and the value is the version to use.
320
+ python : str, optional, default: None
321
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
322
+ that the version used will correspond to the version of the Python interpreter used to start the run.
323
+ """
324
+ ...
325
+
326
+ @typing.overload
327
+ def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
328
+ ...
329
+
330
+ @typing.overload
331
+ def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
332
+ ...
333
+
334
+ 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):
335
+ """
336
+ Specifies the PyPI packages for the step.
337
+
338
+ Information in this decorator will augment any
339
+ attributes set in the `@pyi_base` flow-level decorator. Hence,
340
+ you can use `@pypi_base` to set packages required by all
341
+ steps and use `@pypi` to specify step-specific overrides.
342
+
343
+
344
+ Parameters
345
+ ----------
346
+ packages : Dict[str, str], default: {}
347
+ Packages to use for this step. The key is the name of the package
348
+ and the value is the version to use.
349
+ python : str, optional, default: None
350
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
351
+ that the version used will correspond to the version of the Python interpreter used to start the run.
352
+ """
353
+ ...
354
+
355
+ @typing.overload
356
+ def secrets(*, sources: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = [], role: 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]]]:
357
+ """
358
+ Specifies secrets to be retrieved and injected as environment variables prior to
359
+ the execution of a step.
360
+
361
+
362
+ Parameters
363
+ ----------
364
+ sources : List[Union[str, Dict[str, Any]]], default: []
365
+ List of secret specs, defining how the secrets are to be retrieved
366
+ role : str, optional, default: None
367
+ Role to use for fetching secrets
368
+ """
369
+ ...
370
+
371
+ @typing.overload
372
+ def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
373
+ ...
374
+
375
+ @typing.overload
376
+ def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
377
+ ...
378
+
379
+ 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]]] = [], role: typing.Optional[str] = None):
380
+ """
381
+ Specifies secrets to be retrieved and injected as environment variables prior to
382
+ the execution of a step.
383
+
384
+
385
+ Parameters
386
+ ----------
387
+ sources : List[Union[str, Dict[str, Any]]], default: []
388
+ List of secret specs, defining how the secrets are to be retrieved
389
+ role : str, optional, default: None
390
+ Role to use for fetching secrets
234
391
  """
235
392
  ...
236
393
 
@@ -384,57 +541,51 @@ def batch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
384
541
  ...
385
542
 
386
543
  @typing.overload
387
- 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]]]:
544
+ 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]]]:
388
545
  """
389
- Specifies the number of times the task corresponding
390
- to a step needs to be retried.
391
-
392
- This decorator is useful for handling transient errors, such as networking issues.
393
- If your task contains operations that can't be retried safely, e.g. database updates,
394
- it is advisable to annotate it with `@retry(times=0)`.
546
+ Creates a human-readable report, a Metaflow Card, after this step completes.
395
547
 
396
- This can be used in conjunction with the `@catch` decorator. The `@catch`
397
- decorator will execute a no-op task after all retries have been exhausted,
398
- ensuring that the flow execution can continue.
548
+ Note that you may add multiple `@card` decorators in a step with different parameters.
399
549
 
400
550
 
401
551
  Parameters
402
552
  ----------
403
- times : int, default 3
404
- Number of times to retry this task.
405
- minutes_between_retries : int, default 2
406
- Number of minutes between retries.
407
- """
408
- ...
409
-
410
- @typing.overload
411
- def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
412
- ...
553
+ type : str, default 'default'
554
+ Card type.
555
+ id : str, optional, default None
556
+ If multiple cards are present, use this id to identify this card.
557
+ options : Dict[str, Any], default {}
558
+ Options passed to the card. The contents depend on the card type.
559
+ timeout : int, default 45
560
+ Interrupt reporting if it takes more than this many seconds.
561
+ """
562
+ ...
413
563
 
414
564
  @typing.overload
415
- def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
565
+ def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
416
566
  ...
417
567
 
418
- 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):
568
+ @typing.overload
569
+ def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
570
+ ...
571
+
572
+ 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):
419
573
  """
420
- Specifies the number of times the task corresponding
421
- to a step needs to be retried.
422
-
423
- This decorator is useful for handling transient errors, such as networking issues.
424
- If your task contains operations that can't be retried safely, e.g. database updates,
425
- it is advisable to annotate it with `@retry(times=0)`.
574
+ Creates a human-readable report, a Metaflow Card, after this step completes.
426
575
 
427
- This can be used in conjunction with the `@catch` decorator. The `@catch`
428
- decorator will execute a no-op task after all retries have been exhausted,
429
- ensuring that the flow execution can continue.
576
+ Note that you may add multiple `@card` decorators in a step with different parameters.
430
577
 
431
578
 
432
579
  Parameters
433
580
  ----------
434
- times : int, default 3
435
- Number of times to retry this task.
436
- minutes_between_retries : int, default 2
437
- Number of minutes between retries.
581
+ type : str, default 'default'
582
+ Card type.
583
+ id : str, optional, default None
584
+ If multiple cards are present, use this id to identify this card.
585
+ options : Dict[str, Any], default {}
586
+ Options passed to the card. The contents depend on the card type.
587
+ timeout : int, default 45
588
+ Interrupt reporting if it takes more than this many seconds.
438
589
  """
439
590
  ...
440
591
 
@@ -498,136 +649,65 @@ def conda(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
498
649
  ...
499
650
 
500
651
  @typing.overload
501
- 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]]]:
652
+ 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]]]:
502
653
  """
503
- Specifies the resources needed when executing this step.
654
+ Specifies a timeout for your step.
504
655
 
505
- Use `@resources` to specify the resource requirements
506
- independently of the specific compute layer (`@batch`, `@kubernetes`).
656
+ This decorator is useful if this step may hang indefinitely.
507
657
 
508
- You can choose the compute layer on the command line by executing e.g.
509
- ```
510
- python myflow.py run --with batch
511
- ```
512
- or
513
- ```
514
- python myflow.py run --with kubernetes
515
- ```
516
- which executes the flow on the desired system using the
517
- requirements specified in `@resources`.
658
+ This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
659
+ A timeout is considered to be an exception thrown by the step. It will cause the step to be
660
+ retried if needed and the exception will be caught by the `@catch` decorator, if present.
661
+
662
+ Note that all the values specified in parameters are added together so if you specify
663
+ 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
518
664
 
519
665
 
520
666
  Parameters
521
667
  ----------
522
- cpu : int, default 1
523
- Number of CPUs required for this step.
524
- gpu : int, optional, default None
525
- Number of GPUs required for this step.
526
- disk : int, optional, default None
527
- Disk size (in MB) required for this step. Only applies on Kubernetes.
528
- memory : int, default 4096
529
- Memory size (in MB) required for this step.
530
- shared_memory : int, optional, default None
531
- The value for the size (in MiB) of the /dev/shm volume for this step.
532
- This parameter maps to the `--shm-size` option in Docker.
668
+ seconds : int, default 0
669
+ Number of seconds to wait prior to timing out.
670
+ minutes : int, default 0
671
+ Number of minutes to wait prior to timing out.
672
+ hours : int, default 0
673
+ Number of hours to wait prior to timing out.
533
674
  """
534
675
  ...
535
676
 
536
677
  @typing.overload
537
- def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
678
+ def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
538
679
  ...
539
680
 
540
681
  @typing.overload
541
- def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
542
- ...
543
-
544
- 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):
545
- """
546
- Specifies the resources needed when executing this step.
547
-
548
- Use `@resources` to specify the resource requirements
549
- independently of the specific compute layer (`@batch`, `@kubernetes`).
550
-
551
- You can choose the compute layer on the command line by executing e.g.
552
- ```
553
- python myflow.py run --with batch
554
- ```
555
- or
556
- ```
557
- python myflow.py run --with kubernetes
558
- ```
559
- which executes the flow on the desired system using the
560
- requirements specified in `@resources`.
561
-
562
-
563
- Parameters
564
- ----------
565
- cpu : int, default 1
566
- Number of CPUs required for this step.
567
- gpu : int, optional, default None
568
- Number of GPUs required for this step.
569
- disk : int, optional, default None
570
- Disk size (in MB) required for this step. Only applies on Kubernetes.
571
- memory : int, default 4096
572
- Memory size (in MB) required for this step.
573
- shared_memory : int, optional, default None
574
- The value for the size (in MiB) of the /dev/shm volume for this step.
575
- This parameter maps to the `--shm-size` option in Docker.
576
- """
682
+ def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
577
683
  ...
578
684
 
579
- @typing.overload
580
- 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]]]:
685
+ 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):
581
686
  """
582
- Specifies that the step will success under all circumstances.
583
-
584
- The decorator will create an optional artifact, specified by `var`, which
585
- contains the exception raised. You can use it to detect the presence
586
- of errors, indicating that all happy-path artifacts produced by the step
587
- are missing.
687
+ Specifies a timeout for your step.
588
688
 
689
+ This decorator is useful if this step may hang indefinitely.
589
690
 
590
- Parameters
591
- ----------
592
- var : str, optional, default None
593
- Name of the artifact in which to store the caught exception.
594
- If not specified, the exception is not stored.
595
- print_exception : bool, default True
596
- Determines whether or not the exception is printed to
597
- stdout when caught.
598
- """
599
- ...
600
-
601
- @typing.overload
602
- def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
603
- ...
604
-
605
- @typing.overload
606
- def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
607
- ...
608
-
609
- 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):
610
- """
611
- Specifies that the step will success under all circumstances.
691
+ This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
692
+ A timeout is considered to be an exception thrown by the step. It will cause the step to be
693
+ retried if needed and the exception will be caught by the `@catch` decorator, if present.
612
694
 
613
- The decorator will create an optional artifact, specified by `var`, which
614
- contains the exception raised. You can use it to detect the presence
615
- of errors, indicating that all happy-path artifacts produced by the step
616
- are missing.
695
+ Note that all the values specified in parameters are added together so if you specify
696
+ 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
617
697
 
618
698
 
619
699
  Parameters
620
700
  ----------
621
- var : str, optional, default None
622
- Name of the artifact in which to store the caught exception.
623
- If not specified, the exception is not stored.
624
- print_exception : bool, default True
625
- Determines whether or not the exception is printed to
626
- stdout when caught.
701
+ seconds : int, default 0
702
+ Number of seconds to wait prior to timing out.
703
+ minutes : int, default 0
704
+ Number of minutes to wait prior to timing out.
705
+ hours : int, default 0
706
+ Number of hours to wait prior to timing out.
627
707
  """
628
708
  ...
629
709
 
630
- def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: typing.Optional[str] = None, image_pull_policy: str = 'KUBERNETES_IMAGE_PULL_POLICY', image_pull_secrets: typing.List[str] = [], service_account: str = 'METAFLOW_KUBERNETES_SERVICE_ACCOUNT', secrets: typing.Optional[typing.List[str]] = None, node_selector: typing.Union[typing.Dict[str, str], str, None] = None, namespace: str = 'METAFLOW_KUBERNETES_NAMESPACE', gpu: typing.Optional[int] = None, gpu_vendor: str = 'KUBERNETES_GPU_VENDOR', tolerations: typing.List[str] = [], labels: typing.Dict[str, str] = 'METAFLOW_KUBERNETES_LABELS', annotations: typing.Dict[str, str] = 'METAFLOW_KUBERNETES_ANNOTATIONS', use_tmpfs: bool = False, tmpfs_tempdir: bool = True, tmpfs_size: typing.Optional[int] = None, tmpfs_path: typing.Optional[str] = '/metaflow_temp', persistent_volume_claims: typing.Optional[typing.Dict[str, str]] = None, shared_memory: typing.Optional[int] = None, port: typing.Optional[int] = None, compute_pool: typing.Optional[str] = None, hostname_resolution_timeout: int = 600, qos: str = 'Burstable', security_context: typing.Optional[typing.Dict[str, typing.Any]] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
710
+ def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: typing.Optional[str] = None, image_pull_policy: str = 'KUBERNETES_IMAGE_PULL_POLICY', image_pull_secrets: typing.List[str] = [], service_account: str = 'METAFLOW_KUBERNETES_SERVICE_ACCOUNT', secrets: typing.Optional[typing.List[str]] = None, node_selector: typing.Union[typing.Dict[str, str], str, None] = None, namespace: str = 'METAFLOW_KUBERNETES_NAMESPACE', gpu: typing.Optional[int] = None, gpu_vendor: str = 'KUBERNETES_GPU_VENDOR', tolerations: typing.List[typing.Dict[str, 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]]]:
631
711
  """
632
712
  Specifies that this step should execute on Kubernetes.
633
713
 
@@ -673,7 +753,7 @@ def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: ty
673
753
  the scheduled node should not have GPUs.
674
754
  gpu_vendor : str, default KUBERNETES_GPU_VENDOR
675
755
  The vendor of the GPUs to be used for this step.
676
- tolerations : List[str], default []
756
+ tolerations : List[Dict[str,str]], default []
677
757
  The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
678
758
  Kubernetes tolerations to use when launching pod in Kubernetes.
679
759
  labels: Dict[str, str], default: METAFLOW_KUBERNETES_LABELS
@@ -717,137 +797,105 @@ def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: ty
717
797
  ...
718
798
 
719
799
  @typing.overload
720
- def secrets(*, sources: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = [], role: 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]]]:
800
+ 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]]]:
721
801
  """
722
- Specifies secrets to be retrieved and injected as environment variables prior to
723
- the execution of a step.
802
+ Specifies environment variables to be set prior to the execution of a step.
724
803
 
725
804
 
726
805
  Parameters
727
806
  ----------
728
- sources : List[Union[str, Dict[str, Any]]], default: []
729
- List of secret specs, defining how the secrets are to be retrieved
730
- role : str, optional, default: None
731
- Role to use for fetching secrets
807
+ vars : Dict[str, str], default {}
808
+ Dictionary of environment variables to set.
732
809
  """
733
810
  ...
734
811
 
735
812
  @typing.overload
736
- def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
813
+ def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
737
814
  ...
738
815
 
739
816
  @typing.overload
740
- def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
817
+ def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
741
818
  ...
742
819
 
743
- 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]]] = [], role: typing.Optional[str] = None):
820
+ def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
744
821
  """
745
- Specifies secrets to be retrieved and injected as environment variables prior to
746
- the execution of a step.
822
+ Specifies environment variables to be set prior to the execution of a step.
747
823
 
748
824
 
749
825
  Parameters
750
826
  ----------
751
- sources : List[Union[str, Dict[str, Any]]], default: []
752
- List of secret specs, defining how the secrets are to be retrieved
753
- role : str, optional, default: None
754
- Role to use for fetching secrets
755
- """
756
- ...
757
-
758
- @typing.overload
759
- def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
760
- """
761
- Decorator prototype for all step decorators. This function gets specialized
762
- and imported for all decorators types by _import_plugin_decorators().
763
- """
764
- ...
765
-
766
- @typing.overload
767
- def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
768
- ...
769
-
770
- def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
771
- """
772
- Decorator prototype for all step decorators. This function gets specialized
773
- and imported for all decorators types by _import_plugin_decorators().
827
+ vars : Dict[str, str], default {}
828
+ Dictionary of environment variables to set.
774
829
  """
775
830
  ...
776
831
 
777
832
  @typing.overload
778
- 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]]]:
833
+ 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]]]:
779
834
  """
780
- Specifies a timeout for your step.
781
-
782
- This decorator is useful if this step may hang indefinitely.
835
+ Specifies the number of times the task corresponding
836
+ to a step needs to be retried.
783
837
 
784
- This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
785
- A timeout is considered to be an exception thrown by the step. It will cause the step to be
786
- retried if needed and the exception will be caught by the `@catch` decorator, if present.
838
+ This decorator is useful for handling transient errors, such as networking issues.
839
+ If your task contains operations that can't be retried safely, e.g. database updates,
840
+ it is advisable to annotate it with `@retry(times=0)`.
787
841
 
788
- Note that all the values specified in parameters are added together so if you specify
789
- 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
842
+ This can be used in conjunction with the `@catch` decorator. The `@catch`
843
+ decorator will execute a no-op task after all retries have been exhausted,
844
+ ensuring that the flow execution can continue.
790
845
 
791
846
 
792
847
  Parameters
793
848
  ----------
794
- seconds : int, default 0
795
- Number of seconds to wait prior to timing out.
796
- minutes : int, default 0
797
- Number of minutes to wait prior to timing out.
798
- hours : int, default 0
799
- Number of hours to wait prior to timing out.
849
+ times : int, default 3
850
+ Number of times to retry this task.
851
+ minutes_between_retries : int, default 2
852
+ Number of minutes between retries.
800
853
  """
801
854
  ...
802
855
 
803
856
  @typing.overload
804
- def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
857
+ def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
805
858
  ...
806
859
 
807
860
  @typing.overload
808
- def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
861
+ def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
809
862
  ...
810
863
 
811
- 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):
864
+ 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):
812
865
  """
813
- Specifies a timeout for your step.
866
+ Specifies the number of times the task corresponding
867
+ to a step needs to be retried.
814
868
 
815
- This decorator is useful if this step may hang indefinitely.
816
-
817
- This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
818
- A timeout is considered to be an exception thrown by the step. It will cause the step to be
819
- retried if needed and the exception will be caught by the `@catch` decorator, if present.
869
+ This decorator is useful for handling transient errors, such as networking issues.
870
+ If your task contains operations that can't be retried safely, e.g. database updates,
871
+ it is advisable to annotate it with `@retry(times=0)`.
820
872
 
821
- Note that all the values specified in parameters are added together so if you specify
822
- 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
873
+ This can be used in conjunction with the `@catch` decorator. The `@catch`
874
+ decorator will execute a no-op task after all retries have been exhausted,
875
+ ensuring that the flow execution can continue.
823
876
 
824
877
 
825
878
  Parameters
826
879
  ----------
827
- seconds : int, default 0
828
- Number of seconds to wait prior to timing out.
829
- minutes : int, default 0
830
- Number of minutes to wait prior to timing out.
831
- hours : int, default 0
832
- Number of hours to wait prior to timing out.
880
+ times : int, default 3
881
+ Number of times to retry this task.
882
+ minutes_between_retries : int, default 2
883
+ Number of minutes between retries.
833
884
  """
834
885
  ...
835
886
 
836
887
  @typing.overload
837
- 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]]]:
888
+ def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
838
889
  """
839
- Specifies the PyPI packages for the step.
890
+ Specifies the PyPI packages for all steps of the flow.
840
891
 
841
- Information in this decorator will augment any
842
- attributes set in the `@pyi_base` flow-level decorator. Hence,
843
- you can use `@pypi_base` to set packages required by all
892
+ Use `@pypi_base` to set common packages required by all
844
893
  steps and use `@pypi` to specify step-specific overrides.
845
894
 
846
-
847
895
  Parameters
848
896
  ----------
849
897
  packages : Dict[str, str], default: {}
850
- Packages to use for this step. The key is the name of the package
898
+ Packages to use for this flow. The key is the name of the package
851
899
  and the value is the version to use.
852
900
  python : str, optional, default: None
853
901
  Version of Python to use, e.g. '3.7.4'. A default value of None implies
@@ -856,71 +904,10 @@ def pypi(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] =
856
904
  ...
857
905
 
858
906
  @typing.overload
859
- def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
860
- ...
861
-
862
- @typing.overload
863
- def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
864
- ...
865
-
866
- 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):
867
- """
868
- Specifies the PyPI packages for the step.
869
-
870
- Information in this decorator will augment any
871
- attributes set in the `@pyi_base` flow-level decorator. Hence,
872
- you can use `@pypi_base` to set packages required by all
873
- steps and use `@pypi` to specify step-specific overrides.
874
-
875
-
876
- Parameters
877
- ----------
878
- packages : Dict[str, str], default: {}
879
- Packages to use for this step. The key is the name of the package
880
- and the value is the version to use.
881
- python : str, optional, default: None
882
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
883
- that the version used will correspond to the version of the Python interpreter used to start the run.
884
- """
885
- ...
886
-
887
- def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
888
- """
889
- Specifies what flows belong to the same project.
890
-
891
- A project-specific namespace is created for all flows that
892
- use the same `@project(name)`.
893
-
894
-
895
- Parameters
896
- ----------
897
- name : str
898
- Project name. Make sure that the name is unique amongst all
899
- projects that use the same production scheduler. The name may
900
- contain only lowercase alphanumeric characters and underscores.
901
-
902
- branch : Optional[str], default None
903
- The branch to use. If not specified, the branch is set to
904
- `user.<username>` unless `production` is set to `True`. This can
905
- also be set on the command line using `--branch` as a top-level option.
906
- It is an error to specify `branch` in the decorator and on the command line.
907
-
908
- production : bool, default False
909
- Whether or not the branch is the production branch. This can also be set on the
910
- command line using `--production` as a top-level option. It is an error to specify
911
- `production` in the decorator and on the command line.
912
- The project branch name will be:
913
- - if `branch` is specified:
914
- - if `production` is True: `prod.<branch>`
915
- - if `production` is False: `test.<branch>`
916
- - if `branch` is not specified:
917
- - if `production` is True: `prod`
918
- - if `production` is False: `user.<username>`
919
- """
907
+ def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
920
908
  ...
921
909
 
922
- @typing.overload
923
- def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
910
+ def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
924
911
  """
925
912
  Specifies the PyPI packages for all steps of the flow.
926
913
 
@@ -938,25 +925,46 @@ def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[s
938
925
  """
939
926
  ...
940
927
 
941
- @typing.overload
942
- def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
943
- ...
944
-
945
- def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
928
+ 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]]:
946
929
  """
947
- Specifies the PyPI packages for all steps of the flow.
930
+ 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)
931
+ before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
932
+ and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
933
+ added as a flow decorators. Adding more than one decorator will ensure that `start` step
934
+ starts only after all sensors finish.
948
935
 
949
- Use `@pypi_base` to set common packages required by all
950
- steps and use `@pypi` to specify step-specific overrides.
951
936
 
952
937
  Parameters
953
938
  ----------
954
- packages : Dict[str, str], default: {}
955
- Packages to use for this flow. The key is the name of the package
956
- and the value is the version to use.
957
- python : str, optional, default: None
958
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
959
- that the version used will correspond to the version of the Python interpreter used to start the run.
939
+ timeout : int
940
+ Time, in seconds before the task times out and fails. (Default: 3600)
941
+ poke_interval : int
942
+ Time in seconds that the job should wait in between each try. (Default: 60)
943
+ mode : str
944
+ How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
945
+ exponential_backoff : bool
946
+ allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
947
+ pool : str
948
+ the slot pool this task should run in,
949
+ slot pools are a way to limit concurrency for certain tasks. (Default:None)
950
+ soft_fail : bool
951
+ Set to true to mark the task as SKIPPED on failure. (Default: False)
952
+ name : str
953
+ Name of the sensor on Airflow
954
+ description : str
955
+ Description of sensor in the Airflow UI
956
+ bucket_key : Union[str, List[str]]
957
+ The key(s) being waited on. Supports full s3:// style url or relative path from root level.
958
+ When it's specified as a full s3:// url, please leave `bucket_name` as None
959
+ bucket_name : str
960
+ Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
961
+ When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
962
+ wildcard_match : bool
963
+ whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
964
+ aws_conn_id : str
965
+ a reference to the s3 connection on Airflow. (Default: None)
966
+ verify : bool
967
+ Whether or not to verify SSL certificates for S3 connection. (Default: None)
960
968
  """
961
969
  ...
962
970
 
@@ -1011,6 +1019,49 @@ def conda_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packa
1011
1019
  """
1012
1020
  ...
1013
1021
 
1022
+ 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]]:
1023
+ """
1024
+ 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.
1025
+ 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.
1026
+
1027
+
1028
+ Parameters
1029
+ ----------
1030
+ timeout : int
1031
+ Time, in seconds before the task times out and fails. (Default: 3600)
1032
+ poke_interval : int
1033
+ Time in seconds that the job should wait in between each try. (Default: 60)
1034
+ mode : str
1035
+ How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1036
+ exponential_backoff : bool
1037
+ allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1038
+ pool : str
1039
+ the slot pool this task should run in,
1040
+ slot pools are a way to limit concurrency for certain tasks. (Default:None)
1041
+ soft_fail : bool
1042
+ Set to true to mark the task as SKIPPED on failure. (Default: False)
1043
+ name : str
1044
+ Name of the sensor on Airflow
1045
+ description : str
1046
+ Description of sensor in the Airflow UI
1047
+ external_dag_id : str
1048
+ The dag_id that contains the task you want to wait for.
1049
+ external_task_ids : List[str]
1050
+ The list of task_ids that you want to wait for.
1051
+ If None (default value) the sensor waits for the DAG. (Default: None)
1052
+ allowed_states : List[str]
1053
+ Iterable of allowed states, (Default: ['success'])
1054
+ failed_states : List[str]
1055
+ Iterable of failed or dis-allowed states. (Default: None)
1056
+ execution_delta : datetime.timedelta
1057
+ time difference with the previous execution to look at,
1058
+ the default is the same logical date as the current task or DAG. (Default: None)
1059
+ check_existence: bool
1060
+ Set to True to check if the external task exists or check if
1061
+ the DAG to wait for exists. (Default: True)
1062
+ """
1063
+ ...
1064
+
1014
1065
  @typing.overload
1015
1066
  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]]:
1016
1067
  """
@@ -1104,89 +1155,38 @@ def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, event: t
1104
1155
  """
1105
1156
  ...
1106
1157
 
1107
- 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]]:
1158
+ def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1108
1159
  """
1109
- 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.
1110
- 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.
1160
+ Specifies what flows belong to the same project.
1161
+
1162
+ A project-specific namespace is created for all flows that
1163
+ use the same `@project(name)`.
1111
1164
 
1112
1165
 
1113
1166
  Parameters
1114
1167
  ----------
1115
- timeout : int
1116
- Time, in seconds before the task times out and fails. (Default: 3600)
1117
- poke_interval : int
1118
- Time in seconds that the job should wait in between each try. (Default: 60)
1119
- mode : str
1120
- How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1121
- exponential_backoff : bool
1122
- allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1123
- pool : str
1124
- the slot pool this task should run in,
1125
- slot pools are a way to limit concurrency for certain tasks. (Default:None)
1126
- soft_fail : bool
1127
- Set to true to mark the task as SKIPPED on failure. (Default: False)
1128
1168
  name : str
1129
- Name of the sensor on Airflow
1130
- description : str
1131
- Description of sensor in the Airflow UI
1132
- external_dag_id : str
1133
- The dag_id that contains the task you want to wait for.
1134
- external_task_ids : List[str]
1135
- The list of task_ids that you want to wait for.
1136
- If None (default value) the sensor waits for the DAG. (Default: None)
1137
- allowed_states : List[str]
1138
- Iterable of allowed states, (Default: ['success'])
1139
- failed_states : List[str]
1140
- Iterable of failed or dis-allowed states. (Default: None)
1141
- execution_delta : datetime.timedelta
1142
- time difference with the previous execution to look at,
1143
- the default is the same logical date as the current task or DAG. (Default: None)
1144
- check_existence: bool
1145
- Set to True to check if the external task exists or check if
1146
- the DAG to wait for exists. (Default: True)
1147
- """
1148
- ...
1149
-
1150
- 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]]:
1151
- """
1152
- 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)
1153
- before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
1154
- and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
1155
- added as a flow decorators. Adding more than one decorator will ensure that `start` step
1156
- starts only after all sensors finish.
1169
+ Project name. Make sure that the name is unique amongst all
1170
+ projects that use the same production scheduler. The name may
1171
+ contain only lowercase alphanumeric characters and underscores.
1157
1172
 
1173
+ branch : Optional[str], default None
1174
+ The branch to use. If not specified, the branch is set to
1175
+ `user.<username>` unless `production` is set to `True`. This can
1176
+ also be set on the command line using `--branch` as a top-level option.
1177
+ It is an error to specify `branch` in the decorator and on the command line.
1158
1178
 
1159
- Parameters
1160
- ----------
1161
- timeout : int
1162
- Time, in seconds before the task times out and fails. (Default: 3600)
1163
- poke_interval : int
1164
- Time in seconds that the job should wait in between each try. (Default: 60)
1165
- mode : str
1166
- How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1167
- exponential_backoff : bool
1168
- allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1169
- pool : str
1170
- the slot pool this task should run in,
1171
- slot pools are a way to limit concurrency for certain tasks. (Default:None)
1172
- soft_fail : bool
1173
- Set to true to mark the task as SKIPPED on failure. (Default: False)
1174
- name : str
1175
- Name of the sensor on Airflow
1176
- description : str
1177
- Description of sensor in the Airflow UI
1178
- bucket_key : Union[str, List[str]]
1179
- The key(s) being waited on. Supports full s3:// style url or relative path from root level.
1180
- When it's specified as a full s3:// url, please leave `bucket_name` as None
1181
- bucket_name : str
1182
- Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
1183
- When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
1184
- wildcard_match : bool
1185
- whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
1186
- aws_conn_id : str
1187
- a reference to the s3 connection on Airflow. (Default: None)
1188
- verify : bool
1189
- Whether or not to verify SSL certificates for S3 connection. (Default: None)
1179
+ production : bool, default False
1180
+ Whether or not the branch is the production branch. This can also be set on the
1181
+ command line using `--production` as a top-level option. It is an error to specify
1182
+ `production` in the decorator and on the command line.
1183
+ The project branch name will be:
1184
+ - if `branch` is specified:
1185
+ - if `production` is True: `prod.<branch>`
1186
+ - if `production` is False: `test.<branch>`
1187
+ - if `branch` is not specified:
1188
+ - if `production` is True: `prod`
1189
+ - if `production` is False: `user.<username>`
1190
1190
  """
1191
1191
  ...
1192
1192