metaflow-stubs 2.15.0__py2.py3-none-any.whl → 2.15.1__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 +542 -539
  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 +4 -4
  8. metaflow-stubs/client/filecache.pyi +3 -3
  9. metaflow-stubs/events.pyi +2 -2
  10. metaflow-stubs/exception.pyi +2 -2
  11. metaflow-stubs/flowspec.pyi +4 -4
  12. metaflow-stubs/generated_for.txt +1 -1
  13. metaflow-stubs/includefile.pyi +3 -3
  14. metaflow-stubs/info_file.pyi +2 -2
  15. metaflow-stubs/metadata_provider/__init__.pyi +2 -2
  16. metaflow-stubs/metadata_provider/heartbeat.pyi +2 -2
  17. metaflow-stubs/metadata_provider/metadata.pyi +2 -2
  18. metaflow-stubs/metadata_provider/util.pyi +2 -2
  19. metaflow-stubs/metaflow_config.pyi +4 -2
  20. metaflow-stubs/metaflow_current.pyi +18 -18
  21. metaflow-stubs/multicore_utils.pyi +2 -2
  22. metaflow-stubs/parameters.pyi +3 -3
  23. metaflow-stubs/plugins/__init__.pyi +13 -13
  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 +3 -3
  36. metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +2 -2
  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 +2 -2
  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 +2 -2
  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 +2 -2
  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 +6 -6
  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 +3 -3
  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 +2 -2
  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 +6 -6
  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.1.dist-info}/METADATA +2 -2
  143. metaflow_stubs-2.15.1.dist-info/RECORD +146 -0
  144. {metaflow_stubs-2.15.0.dist-info → metaflow_stubs-2.15.1.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.1.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.1 #
4
+ # Generated on 2025-02-28T22:52:51.105998 #
5
5
  ######################################################################################################
6
6
 
7
7
  from __future__ import annotations
@@ -35,13 +35,16 @@ from .user_configs.config_parameters import ConfigValue as ConfigValue
35
35
  from .user_configs.config_parameters import config_expr as config_expr
36
36
  from .user_configs.config_decorators import CustomFlowDecorator as CustomFlowDecorator
37
37
  from .user_configs.config_decorators import CustomStepDecorator as CustomStepDecorator
38
- from . import events as events
39
38
  from . import tuple_util as tuple_util
39
+ from . import events as events
40
40
  from . import runner as runner
41
41
  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
@@ -142,163 +145,6 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
142
145
  """
143
146
  ...
144
147
 
145
- @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]]]:
147
- """
148
- Specifies the Conda environment for the step.
149
-
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
-
155
-
156
- Parameters
157
- ----------
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.
168
- """
169
- ...
170
-
171
- @typing.overload
172
- def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
173
- ...
174
-
175
- @typing.overload
176
- def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
177
- ...
178
-
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
- """
181
- Specifies the Conda environment for the step.
182
-
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.
187
-
188
-
189
- Parameters
190
- ----------
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.
201
- """
202
- ...
203
-
204
- @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]]]:
206
- """
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`).
211
-
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`.
222
-
223
-
224
- Parameters
225
- ----------
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.
237
- """
238
- ...
239
-
240
- @typing.overload
241
- def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
242
- ...
243
-
244
- @typing.overload
245
- def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
246
- ...
247
-
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):
249
- """
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`).
254
-
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`.
265
-
266
-
267
- Parameters
268
- ----------
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.
280
- """
281
- ...
282
-
283
- @typing.overload
284
- def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
285
- """
286
- Parameters
287
- ----------
288
- """
289
- ...
290
-
291
- @typing.overload
292
- def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
293
- ...
294
-
295
- def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
296
- """
297
- Parameters
298
- ----------
299
- """
300
- ...
301
-
302
148
  @typing.overload
303
149
  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
150
  """
@@ -335,51 +181,57 @@ def secrets(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None],
335
181
  ...
336
182
 
337
183
  @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]]]:
184
+ 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]]]:
339
185
  """
340
- Creates a human-readable report, a Metaflow Card, after this step completes.
186
+ Specifies the number of times the task corresponding
187
+ to a step needs to be retried.
341
188
 
342
- Note that you may add multiple `@card` decorators in a step with different parameters.
189
+ This decorator is useful for handling transient errors, such as networking issues.
190
+ If your task contains operations that can't be retried safely, e.g. database updates,
191
+ it is advisable to annotate it with `@retry(times=0)`.
192
+
193
+ This can be used in conjunction with the `@catch` decorator. The `@catch`
194
+ decorator will execute a no-op task after all retries have been exhausted,
195
+ ensuring that the flow execution can continue.
343
196
 
344
197
 
345
198
  Parameters
346
199
  ----------
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.
200
+ times : int, default 3
201
+ Number of times to retry this task.
202
+ minutes_between_retries : int, default 2
203
+ Number of minutes between retries.
355
204
  """
356
205
  ...
357
206
 
358
207
  @typing.overload
359
- def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
208
+ def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
360
209
  ...
361
210
 
362
211
  @typing.overload
363
- def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
212
+ def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
364
213
  ...
365
214
 
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):
215
+ 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):
367
216
  """
368
- Creates a human-readable report, a Metaflow Card, after this step completes.
217
+ Specifies the number of times the task corresponding
218
+ to a step needs to be retried.
369
219
 
370
- Note that you may add multiple `@card` decorators in a step with different parameters.
220
+ This decorator is useful for handling transient errors, such as networking issues.
221
+ If your task contains operations that can't be retried safely, e.g. database updates,
222
+ it is advisable to annotate it with `@retry(times=0)`.
223
+
224
+ This can be used in conjunction with the `@catch` decorator. The `@catch`
225
+ decorator will execute a no-op task after all retries have been exhausted,
226
+ ensuring that the flow execution can continue.
371
227
 
372
228
 
373
229
  Parameters
374
230
  ----------
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.
231
+ times : int, default 3
232
+ Number of times to retry this task.
233
+ minutes_between_retries : int, default 2
234
+ Number of minutes between retries.
383
235
  """
384
236
  ...
385
237
 
@@ -533,46 +385,203 @@ def batch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
533
385
  ...
534
386
 
535
387
  @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]]]:
388
+ 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
389
  """
538
- Specifies the PyPI packages for the step.
390
+ Specifies a timeout for your step.
539
391
 
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.
392
+ This decorator is useful if this step may hang indefinitely.
393
+
394
+ This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
395
+ A timeout is considered to be an exception thrown by the step. It will cause the step to be
396
+ retried if needed and the exception will be caught by the `@catch` decorator, if present.
397
+
398
+ Note that all the values specified in parameters are added together so if you specify
399
+ 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
544
400
 
545
401
 
546
402
  Parameters
547
403
  ----------
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.
404
+ seconds : int, default 0
405
+ Number of seconds to wait prior to timing out.
406
+ minutes : int, default 0
407
+ Number of minutes to wait prior to timing out.
408
+ hours : int, default 0
409
+ Number of hours to wait prior to timing out.
554
410
  """
555
411
  ...
556
412
 
557
413
  @typing.overload
558
- def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
414
+ def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
559
415
  ...
560
416
 
561
417
  @typing.overload
562
- def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
418
+ def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
563
419
  ...
564
420
 
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):
421
+ 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
422
  """
567
- Specifies the PyPI packages for the step.
568
-
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.
423
+ Specifies a timeout for your step.
573
424
 
425
+ This decorator is useful if this step may hang indefinitely.
574
426
 
575
- Parameters
427
+ This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
428
+ A timeout is considered to be an exception thrown by the step. It will cause the step to be
429
+ retried if needed and the exception will be caught by the `@catch` decorator, if present.
430
+
431
+ Note that all the values specified in parameters are added together so if you specify
432
+ 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
433
+
434
+
435
+ Parameters
436
+ ----------
437
+ seconds : int, default 0
438
+ Number of seconds to wait prior to timing out.
439
+ minutes : int, default 0
440
+ Number of minutes to wait prior to timing out.
441
+ hours : int, default 0
442
+ Number of hours to wait prior to timing out.
443
+ """
444
+ ...
445
+
446
+ @typing.overload
447
+ def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
448
+ """
449
+ Decorator prototype for all step decorators. This function gets specialized
450
+ and imported for all decorators types by _import_plugin_decorators().
451
+ """
452
+ ...
453
+
454
+ @typing.overload
455
+ def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
456
+ ...
457
+
458
+ def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
459
+ """
460
+ Decorator prototype for all step decorators. This function gets specialized
461
+ and imported for all decorators types by _import_plugin_decorators().
462
+ """
463
+ ...
464
+
465
+ @typing.overload
466
+ 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]]]:
467
+ """
468
+ Specifies the resources needed when executing this step.
469
+
470
+ Use `@resources` to specify the resource requirements
471
+ independently of the specific compute layer (`@batch`, `@kubernetes`).
472
+
473
+ You can choose the compute layer on the command line by executing e.g.
474
+ ```
475
+ python myflow.py run --with batch
476
+ ```
477
+ or
478
+ ```
479
+ python myflow.py run --with kubernetes
480
+ ```
481
+ which executes the flow on the desired system using the
482
+ requirements specified in `@resources`.
483
+
484
+
485
+ Parameters
486
+ ----------
487
+ cpu : int, default 1
488
+ Number of CPUs required for this step.
489
+ gpu : int, optional, default None
490
+ Number of GPUs required for this step.
491
+ disk : int, optional, default None
492
+ Disk size (in MB) required for this step. Only applies on Kubernetes.
493
+ memory : int, default 4096
494
+ Memory size (in MB) required for this step.
495
+ shared_memory : int, optional, default None
496
+ The value for the size (in MiB) of the /dev/shm volume for this step.
497
+ This parameter maps to the `--shm-size` option in Docker.
498
+ """
499
+ ...
500
+
501
+ @typing.overload
502
+ def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
503
+ ...
504
+
505
+ @typing.overload
506
+ def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
507
+ ...
508
+
509
+ 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):
510
+ """
511
+ Specifies the resources needed when executing this step.
512
+
513
+ Use `@resources` to specify the resource requirements
514
+ independently of the specific compute layer (`@batch`, `@kubernetes`).
515
+
516
+ You can choose the compute layer on the command line by executing e.g.
517
+ ```
518
+ python myflow.py run --with batch
519
+ ```
520
+ or
521
+ ```
522
+ python myflow.py run --with kubernetes
523
+ ```
524
+ which executes the flow on the desired system using the
525
+ requirements specified in `@resources`.
526
+
527
+
528
+ Parameters
529
+ ----------
530
+ cpu : int, default 1
531
+ Number of CPUs required for this step.
532
+ gpu : int, optional, default None
533
+ Number of GPUs required for this step.
534
+ disk : int, optional, default None
535
+ Disk size (in MB) required for this step. Only applies on Kubernetes.
536
+ memory : int, default 4096
537
+ Memory size (in MB) required for this step.
538
+ shared_memory : int, optional, default None
539
+ The value for the size (in MiB) of the /dev/shm volume for this step.
540
+ This parameter maps to the `--shm-size` option in Docker.
541
+ """
542
+ ...
543
+
544
+ @typing.overload
545
+ 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]]]:
546
+ """
547
+ Specifies the PyPI packages for the step.
548
+
549
+ Information in this decorator will augment any
550
+ attributes set in the `@pyi_base` flow-level decorator. Hence,
551
+ you can use `@pypi_base` to set packages required by all
552
+ steps and use `@pypi` to specify step-specific overrides.
553
+
554
+
555
+ Parameters
556
+ ----------
557
+ packages : Dict[str, str], default: {}
558
+ Packages to use for this step. The key is the name of the package
559
+ and the value is the version to use.
560
+ python : str, optional, default: None
561
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
562
+ that the version used will correspond to the version of the Python interpreter used to start the run.
563
+ """
564
+ ...
565
+
566
+ @typing.overload
567
+ def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
568
+ ...
569
+
570
+ @typing.overload
571
+ def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
572
+ ...
573
+
574
+ 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):
575
+ """
576
+ Specifies the PyPI packages for the step.
577
+
578
+ Information in this decorator will augment any
579
+ attributes set in the `@pyi_base` flow-level decorator. Hence,
580
+ you can use `@pypi_base` to set packages required by all
581
+ steps and use `@pypi` to specify step-specific overrides.
582
+
583
+
584
+ Parameters
576
585
  ----------
577
586
  packages : Dict[str, str], default: {}
578
587
  Packages to use for this step. The key is the name of the package
@@ -635,57 +644,94 @@ def catch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
635
644
  ...
636
645
 
637
646
  @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]]]:
647
+ 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]]]:
639
648
  """
640
- Specifies the number of times the task corresponding
641
- to a step needs to be retried.
642
-
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)`.
649
+ Specifies the Conda environment for the step.
646
650
 
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.
651
+ Information in this decorator will augment any
652
+ attributes set in the `@conda_base` flow-level decorator. Hence,
653
+ you can use `@conda_base` to set packages required by all
654
+ steps and use `@conda` to specify step-specific overrides.
650
655
 
651
656
 
652
657
  Parameters
653
658
  ----------
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.
659
+ packages : Dict[str, str], default {}
660
+ Packages to use for this step. The key is the name of the package
661
+ and the value is the version to use.
662
+ libraries : Dict[str, str], default {}
663
+ Supported for backward compatibility. When used with packages, packages will take precedence.
664
+ python : str, optional, default None
665
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
666
+ that the version used will correspond to the version of the Python interpreter used to start the run.
667
+ disabled : bool, default False
668
+ If set to True, disables @conda.
658
669
  """
659
670
  ...
660
671
 
661
672
  @typing.overload
662
- def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
673
+ def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
663
674
  ...
664
675
 
665
676
  @typing.overload
666
- def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
677
+ def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
667
678
  ...
668
679
 
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):
680
+ 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):
670
681
  """
671
- Specifies the number of times the task corresponding
672
- to a step needs to be retried.
682
+ Specifies the Conda environment for the step.
673
683
 
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)`.
684
+ Information in this decorator will augment any
685
+ attributes set in the `@conda_base` flow-level decorator. Hence,
686
+ you can use `@conda_base` to set packages required by all
687
+ steps and use `@conda` to specify step-specific overrides.
677
688
 
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.
689
+
690
+ Parameters
691
+ ----------
692
+ packages : Dict[str, str], default {}
693
+ Packages to use for this step. The key is the name of the package
694
+ and the value is the version to use.
695
+ libraries : Dict[str, str], default {}
696
+ Supported for backward compatibility. When used with packages, packages will take precedence.
697
+ python : str, optional, default None
698
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
699
+ that the version used will correspond to the version of the Python interpreter used to start the run.
700
+ disabled : bool, default False
701
+ If set to True, disables @conda.
702
+ """
703
+ ...
704
+
705
+ @typing.overload
706
+ 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]]]:
707
+ """
708
+ Specifies environment variables to be set prior to the execution of a step.
681
709
 
682
710
 
683
711
  Parameters
684
712
  ----------
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.
713
+ vars : Dict[str, str], default {}
714
+ Dictionary of environment variables to set.
715
+ """
716
+ ...
717
+
718
+ @typing.overload
719
+ def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
720
+ ...
721
+
722
+ @typing.overload
723
+ def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
724
+ ...
725
+
726
+ def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
727
+ """
728
+ Specifies environment variables to be set prior to the execution of a step.
729
+
730
+
731
+ Parameters
732
+ ----------
733
+ vars : Dict[str, str], default {}
734
+ Dictionary of environment variables to set.
689
735
  """
690
736
  ...
691
737
 
@@ -767,187 +813,229 @@ def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: ty
767
813
  ...
768
814
 
769
815
  @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]]]:
816
+ 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
817
  """
772
- Specifies a timeout for your step.
818
+ Creates a human-readable report, a Metaflow Card, after this step completes.
773
819
 
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.
779
-
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.
820
+ Note that you may add multiple `@card` decorators in a step with different parameters.
782
821
 
783
822
 
784
823
  Parameters
785
824
  ----------
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.
825
+ type : str, default 'default'
826
+ Card type.
827
+ id : str, optional, default None
828
+ If multiple cards are present, use this id to identify this card.
829
+ options : Dict[str, Any], default {}
830
+ Options passed to the card. The contents depend on the card type.
831
+ timeout : int, default 45
832
+ Interrupt reporting if it takes more than this many seconds.
792
833
  """
793
834
  ...
794
835
 
795
836
  @typing.overload
796
- def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
837
+ def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
797
838
  ...
798
839
 
799
840
  @typing.overload
800
- def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
841
+ def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
801
842
  ...
802
843
 
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):
844
+ 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
845
  """
805
- Specifies a timeout for your step.
846
+ Creates a human-readable report, a Metaflow Card, after this step completes.
806
847
 
807
- This decorator is useful if this step may hang indefinitely.
848
+ Note that you may add multiple `@card` decorators in a step with different parameters.
808
849
 
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
850
 
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.
851
+ Parameters
852
+ ----------
853
+ type : str, default 'default'
854
+ Card type.
855
+ id : str, optional, default None
856
+ If multiple cards are present, use this id to identify this card.
857
+ options : Dict[str, Any], default {}
858
+ Options passed to the card. The contents depend on the card type.
859
+ timeout : int, default 45
860
+ Interrupt reporting if it takes more than this many seconds.
861
+ """
862
+ ...
863
+
864
+ 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]]:
865
+ """
866
+ 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.
867
+ 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.
815
868
 
816
869
 
817
870
  Parameters
818
871
  ----------
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.
872
+ timeout : int
873
+ Time, in seconds before the task times out and fails. (Default: 3600)
874
+ poke_interval : int
875
+ Time in seconds that the job should wait in between each try. (Default: 60)
876
+ mode : str
877
+ How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
878
+ exponential_backoff : bool
879
+ allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
880
+ pool : str
881
+ the slot pool this task should run in,
882
+ slot pools are a way to limit concurrency for certain tasks. (Default:None)
883
+ soft_fail : bool
884
+ Set to true to mark the task as SKIPPED on failure. (Default: False)
885
+ name : str
886
+ Name of the sensor on Airflow
887
+ description : str
888
+ Description of sensor in the Airflow UI
889
+ external_dag_id : str
890
+ The dag_id that contains the task you want to wait for.
891
+ external_task_ids : List[str]
892
+ The list of task_ids that you want to wait for.
893
+ If None (default value) the sensor waits for the DAG. (Default: None)
894
+ allowed_states : List[str]
895
+ Iterable of allowed states, (Default: ['success'])
896
+ failed_states : List[str]
897
+ Iterable of failed or dis-allowed states. (Default: None)
898
+ execution_delta : datetime.timedelta
899
+ time difference with the previous execution to look at,
900
+ the default is the same logical date as the current task or DAG. (Default: None)
901
+ check_existence: bool
902
+ Set to True to check if the external task exists or check if
903
+ the DAG to wait for exists. (Default: True)
825
904
  """
826
905
  ...
827
906
 
828
907
  @typing.overload
829
- 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]]]:
908
+ def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
830
909
  """
831
- Specifies environment variables to be set prior to the execution of a step.
910
+ Specifies the PyPI packages for all steps of the flow.
832
911
 
912
+ Use `@pypi_base` to set common packages required by all
913
+ steps and use `@pypi` to specify step-specific overrides.
833
914
 
834
915
  Parameters
835
916
  ----------
836
- vars : Dict[str, str], default {}
837
- Dictionary of environment variables to set.
917
+ packages : Dict[str, str], default: {}
918
+ Packages to use for this flow. The key is the name of the package
919
+ and the value is the version to use.
920
+ python : str, optional, default: None
921
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
922
+ that the version used will correspond to the version of the Python interpreter used to start the run.
838
923
  """
839
924
  ...
840
925
 
841
926
  @typing.overload
842
- def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
927
+ def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
843
928
  ...
844
929
 
845
- @typing.overload
846
- def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
930
+ def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
931
+ """
932
+ Specifies the PyPI packages for all steps of the flow.
933
+
934
+ Use `@pypi_base` to set common packages required by all
935
+ steps and use `@pypi` to specify step-specific overrides.
936
+
937
+ Parameters
938
+ ----------
939
+ packages : Dict[str, str], default: {}
940
+ Packages to use for this flow. The key is the name of the package
941
+ and the value is the version to use.
942
+ python : str, optional, default: None
943
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
944
+ that the version used will correspond to the version of the Python interpreter used to start the run.
945
+ """
847
946
  ...
848
947
 
849
- def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
948
+ 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]]:
850
949
  """
851
- Specifies environment variables to be set prior to the execution of a step.
950
+ 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)
951
+ before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
952
+ and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
953
+ added as a flow decorators. Adding more than one decorator will ensure that `start` step
954
+ starts only after all sensors finish.
852
955
 
853
956
 
854
957
  Parameters
855
958
  ----------
856
- vars : Dict[str, str], default {}
857
- Dictionary of environment variables to set.
959
+ timeout : int
960
+ Time, in seconds before the task times out and fails. (Default: 3600)
961
+ poke_interval : int
962
+ Time in seconds that the job should wait in between each try. (Default: 60)
963
+ mode : str
964
+ How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
965
+ exponential_backoff : bool
966
+ allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
967
+ pool : str
968
+ the slot pool this task should run in,
969
+ slot pools are a way to limit concurrency for certain tasks. (Default:None)
970
+ soft_fail : bool
971
+ Set to true to mark the task as SKIPPED on failure. (Default: False)
972
+ name : str
973
+ Name of the sensor on Airflow
974
+ description : str
975
+ Description of sensor in the Airflow UI
976
+ bucket_key : Union[str, List[str]]
977
+ The key(s) being waited on. Supports full s3:// style url or relative path from root level.
978
+ When it's specified as a full s3:// url, please leave `bucket_name` as None
979
+ bucket_name : str
980
+ Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
981
+ When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
982
+ wildcard_match : bool
983
+ whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
984
+ aws_conn_id : str
985
+ a reference to the s3 connection on Airflow. (Default: None)
986
+ verify : bool
987
+ Whether or not to verify SSL certificates for S3 connection. (Default: None)
858
988
  """
859
989
  ...
860
990
 
861
991
  @typing.overload
862
- 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]]:
992
+ 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]]:
863
993
  """
864
- Specifies the event(s) that this flow depends on.
865
-
866
- ```
867
- @trigger(event='foo')
868
- ```
869
- or
870
- ```
871
- @trigger(events=['foo', 'bar'])
872
- ```
873
-
874
- Additionally, you can specify the parameter mappings
875
- to map event payload to Metaflow parameters for the flow.
876
- ```
877
- @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
878
- ```
879
- or
880
- ```
881
- @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
882
- {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
883
- ```
884
-
885
- 'parameters' can also be a list of strings and tuples like so:
886
- ```
887
- @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
888
- ```
889
- This is equivalent to:
890
- ```
891
- @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
892
- ```
994
+ Specifies the times when the flow should be run when running on a
995
+ production scheduler.
893
996
 
894
997
 
895
998
  Parameters
896
999
  ----------
897
- event : Union[str, Dict[str, Any]], optional, default None
898
- Event dependency for this flow.
899
- events : List[Union[str, Dict[str, Any]]], default []
900
- Events dependency for this flow.
901
- options : Dict[str, Any], default {}
902
- Backend-specific configuration for tuning eventing behavior.
1000
+ hourly : bool, default False
1001
+ Run the workflow hourly.
1002
+ daily : bool, default True
1003
+ Run the workflow daily.
1004
+ weekly : bool, default False
1005
+ Run the workflow weekly.
1006
+ cron : str, optional, default None
1007
+ Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1008
+ specified by this expression.
1009
+ timezone : str, optional, default None
1010
+ Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1011
+ which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
903
1012
  """
904
1013
  ...
905
1014
 
906
1015
  @typing.overload
907
- def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1016
+ def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
908
1017
  ...
909
1018
 
910
- def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, 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] = {}):
1019
+ 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):
911
1020
  """
912
- Specifies the event(s) that this flow depends on.
913
-
914
- ```
915
- @trigger(event='foo')
916
- ```
917
- or
918
- ```
919
- @trigger(events=['foo', 'bar'])
920
- ```
921
-
922
- Additionally, you can specify the parameter mappings
923
- to map event payload to Metaflow parameters for the flow.
924
- ```
925
- @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
926
- ```
927
- or
928
- ```
929
- @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
930
- {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
931
- ```
932
-
933
- 'parameters' can also be a list of strings and tuples like so:
934
- ```
935
- @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
936
- ```
937
- This is equivalent to:
938
- ```
939
- @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
940
- ```
1021
+ Specifies the times when the flow should be run when running on a
1022
+ production scheduler.
941
1023
 
942
1024
 
943
1025
  Parameters
944
1026
  ----------
945
- event : Union[str, Dict[str, Any]], optional, default None
946
- Event dependency for this flow.
947
- events : List[Union[str, Dict[str, Any]]], default []
948
- Events dependency for this flow.
949
- options : Dict[str, Any], default {}
950
- Backend-specific configuration for tuning eventing behavior.
1027
+ hourly : bool, default False
1028
+ Run the workflow hourly.
1029
+ daily : bool, default True
1030
+ Run the workflow daily.
1031
+ weekly : bool, default False
1032
+ Run the workflow weekly.
1033
+ cron : str, optional, default None
1034
+ Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1035
+ specified by this expression.
1036
+ timezone : str, optional, default None
1037
+ Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1038
+ which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
951
1039
  """
952
1040
  ...
953
1041
 
@@ -1002,6 +1090,41 @@ def conda_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packa
1002
1090
  """
1003
1091
  ...
1004
1092
 
1093
+ def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1094
+ """
1095
+ Specifies what flows belong to the same project.
1096
+
1097
+ A project-specific namespace is created for all flows that
1098
+ use the same `@project(name)`.
1099
+
1100
+
1101
+ Parameters
1102
+ ----------
1103
+ name : str
1104
+ Project name. Make sure that the name is unique amongst all
1105
+ projects that use the same production scheduler. The name may
1106
+ contain only lowercase alphanumeric characters and underscores.
1107
+
1108
+ branch : Optional[str], default None
1109
+ The branch to use. If not specified, the branch is set to
1110
+ `user.<username>` unless `production` is set to `True`. This can
1111
+ also be set on the command line using `--branch` as a top-level option.
1112
+ It is an error to specify `branch` in the decorator and on the command line.
1113
+
1114
+ production : bool, default False
1115
+ Whether or not the branch is the production branch. This can also be set on the
1116
+ command line using `--production` as a top-level option. It is an error to specify
1117
+ `production` in the decorator and on the command line.
1118
+ The project branch name will be:
1119
+ - if `branch` is specified:
1120
+ - if `production` is True: `prod.<branch>`
1121
+ - if `production` is False: `test.<branch>`
1122
+ - if `branch` is not specified:
1123
+ - if `production` is True: `prod`
1124
+ - if `production` is False: `user.<username>`
1125
+ """
1126
+ ...
1127
+
1005
1128
  @typing.overload
1006
1129
  def trigger_on_finish(*, flow: typing.Union[typing.Dict[str, str], str, None] = None, flows: typing.List[typing.Union[str, typing.Dict[str, str]]] = [], options: typing.Dict[str, typing.Any] = {}) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1007
1130
  """
@@ -1104,215 +1227,95 @@ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *
1104
1227
  ...
1105
1228
 
1106
1229
  @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]]:
1230
+ 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]]:
1108
1231
  """
1109
- Specifies the times when the flow should be run when running on a
1110
- production scheduler.
1111
-
1232
+ Specifies the event(s) that this flow depends on.
1112
1233
 
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.
1234
+ ```
1235
+ @trigger(event='foo')
1236
+ ```
1237
+ or
1238
+ ```
1239
+ @trigger(events=['foo', 'bar'])
1240
+ ```
1138
1241
 
1242
+ Additionally, you can specify the parameter mappings
1243
+ to map event payload to Metaflow parameters for the flow.
1244
+ ```
1245
+ @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1246
+ ```
1247
+ or
1248
+ ```
1249
+ @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1250
+ {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1251
+ ```
1139
1252
 
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.
1253
+ 'parameters' can also be a list of strings and tuples like so:
1254
+ ```
1255
+ @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1256
+ ```
1257
+ This is equivalent to:
1258
+ ```
1259
+ @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1260
+ ```
1164
1261
 
1165
1262
 
1166
1263
  Parameters
1167
1264
  ----------
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)
1265
+ event : Union[str, Dict[str, Any]], optional, default None
1266
+ Event dependency for this flow.
1267
+ events : List[Union[str, Dict[str, Any]]], default []
1268
+ Events dependency for this flow.
1269
+ options : Dict[str, Any], default {}
1270
+ Backend-specific configuration for tuning eventing behavior.
1197
1271
  """
1198
1272
  ...
1199
1273
 
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
- """
1274
+ @typing.overload
1275
+ def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1233
1276
  ...
1234
1277
 
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]]:
1278
+ def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, 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] = {}):
1236
1279
  """
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
-
1280
+ Specifies the event(s) that this flow depends on.
1240
1281
 
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
- @typing.overload
1279
- def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1280
- """
1281
- Specifies the PyPI packages for all steps of the flow.
1282
+ ```
1283
+ @trigger(event='foo')
1284
+ ```
1285
+ or
1286
+ ```
1287
+ @trigger(events=['foo', 'bar'])
1288
+ ```
1282
1289
 
1283
- Use `@pypi_base` to set common packages required by all
1284
- steps and use `@pypi` to specify step-specific overrides.
1290
+ Additionally, you can specify the parameter mappings
1291
+ to map event payload to Metaflow parameters for the flow.
1292
+ ```
1293
+ @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1294
+ ```
1295
+ or
1296
+ ```
1297
+ @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1298
+ {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1299
+ ```
1285
1300
 
1286
- Parameters
1287
- ----------
1288
- packages : Dict[str, str], default: {}
1289
- Packages to use for this flow. The key is the name of the package
1290
- and the value is the version to use.
1291
- python : str, optional, default: None
1292
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1293
- that the version used will correspond to the version of the Python interpreter used to start the run.
1294
- """
1295
- ...
1296
-
1297
- @typing.overload
1298
- def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1299
- ...
1300
-
1301
- def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
1302
- """
1303
- Specifies the PyPI packages for all steps of the flow.
1301
+ 'parameters' can also be a list of strings and tuples like so:
1302
+ ```
1303
+ @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1304
+ ```
1305
+ This is equivalent to:
1306
+ ```
1307
+ @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1308
+ ```
1304
1309
 
1305
- Use `@pypi_base` to set common packages required by all
1306
- steps and use `@pypi` to specify step-specific overrides.
1307
1310
 
1308
1311
  Parameters
1309
1312
  ----------
1310
- packages : Dict[str, str], default: {}
1311
- Packages to use for this flow. The key is the name of the package
1312
- and the value is the version to use.
1313
- python : str, optional, default: None
1314
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1315
- that the version used will correspond to the version of the Python interpreter used to start the run.
1313
+ event : Union[str, Dict[str, Any]], optional, default None
1314
+ Event dependency for this flow.
1315
+ events : List[Union[str, Dict[str, Any]]], default []
1316
+ Events dependency for this flow.
1317
+ options : Dict[str, Any], default {}
1318
+ Backend-specific configuration for tuning eventing behavior.
1316
1319
  """
1317
1320
  ...
1318
1321