metaflow-stubs 2.13.10__py2.py3-none-any.whl → 2.14.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 (145) hide show
  1. metaflow-stubs/__init__.pyi +525 -525
  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 +93 -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 +3 -3
  12. metaflow-stubs/generated_for.txt +1 -1
  13. metaflow-stubs/includefile.pyi +3 -3
  14. metaflow-stubs/info_file.pyi +2 -2
  15. metaflow-stubs/metadata_provider/__init__.pyi +2 -2
  16. metaflow-stubs/metadata_provider/heartbeat.pyi +2 -2
  17. metaflow-stubs/metadata_provider/metadata.pyi +26 -2
  18. metaflow-stubs/metadata_provider/util.pyi +2 -2
  19. metaflow-stubs/metaflow_config.pyi +2 -4
  20. metaflow-stubs/metaflow_current.pyi +27 -27
  21. metaflow-stubs/multicore_utils.pyi +2 -2
  22. metaflow-stubs/parameters.pyi +3 -3
  23. metaflow-stubs/plugins/__init__.pyi +15 -15
  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 +3 -3
  38. metaflow-stubs/plugins/argo/argo_workflows_deployer_objects.pyi +2 -2
  39. metaflow-stubs/plugins/aws/__init__.pyi +4 -4
  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 +4 -4
  48. metaflow-stubs/plugins/aws/step_functions/__init__.pyi +2 -2
  49. metaflow-stubs/plugins/aws/step_functions/dynamo_db_client.pyi +2 -2
  50. metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +2 -2
  51. metaflow-stubs/plugins/aws/step_functions/schedule_decorator.pyi +2 -2
  52. metaflow-stubs/plugins/aws/step_functions/step_functions.pyi +2 -2
  53. metaflow-stubs/plugins/aws/step_functions/step_functions_client.pyi +2 -2
  54. metaflow-stubs/plugins/aws/step_functions/step_functions_decorator.pyi +2 -2
  55. metaflow-stubs/plugins/aws/step_functions/step_functions_deployer.pyi +3 -3
  56. metaflow-stubs/plugins/aws/step_functions/step_functions_deployer_objects.pyi +3 -3
  57. metaflow-stubs/plugins/azure/__init__.pyi +2 -2
  58. metaflow-stubs/plugins/azure/azure_credential.pyi +2 -2
  59. metaflow-stubs/plugins/azure/azure_exceptions.pyi +2 -2
  60. metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +4 -4
  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 +3 -3
  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 +3 -3
  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 +4 -4
  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 +2 -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 +2 -2
  109. metaflow-stubs/plugins/pypi/conda_decorator.pyi +2 -2
  110. metaflow-stubs/plugins/pypi/conda_environment.pyi +5 -5
  111. metaflow-stubs/plugins/pypi/pypi_decorator.pyi +2 -2
  112. metaflow-stubs/plugins/pypi/pypi_environment.pyi +2 -2
  113. metaflow-stubs/plugins/pypi/utils.pyi +2 -2
  114. metaflow-stubs/plugins/resources_decorator.pyi +2 -2
  115. metaflow-stubs/plugins/retry_decorator.pyi +2 -2
  116. metaflow-stubs/plugins/secrets/__init__.pyi +2 -2
  117. metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +4 -4
  118. metaflow-stubs/plugins/secrets/secrets_decorator.pyi +2 -2
  119. metaflow-stubs/plugins/storage_executor.pyi +2 -2
  120. metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +2 -2
  121. metaflow-stubs/plugins/timeout_decorator.pyi +2 -2
  122. metaflow-stubs/pylint_wrapper.pyi +2 -2
  123. metaflow-stubs/runner/__init__.pyi +2 -2
  124. metaflow-stubs/runner/deployer.pyi +30 -30
  125. metaflow-stubs/runner/deployer_impl.pyi +2 -2
  126. metaflow-stubs/runner/metaflow_runner.pyi +3 -3
  127. metaflow-stubs/runner/nbdeploy.pyi +2 -2
  128. metaflow-stubs/runner/nbrun.pyi +2 -2
  129. metaflow-stubs/runner/subprocess_manager.pyi +2 -2
  130. metaflow-stubs/runner/utils.pyi +4 -4
  131. metaflow-stubs/system/__init__.pyi +2 -2
  132. metaflow-stubs/system/system_logger.pyi +2 -2
  133. metaflow-stubs/system/system_monitor.pyi +2 -2
  134. metaflow-stubs/tagging_util.pyi +2 -2
  135. metaflow-stubs/tuple_util.pyi +2 -2
  136. metaflow-stubs/user_configs/__init__.pyi +2 -2
  137. metaflow-stubs/user_configs/config_decorators.pyi +5 -5
  138. metaflow-stubs/user_configs/config_options.pyi +2 -2
  139. metaflow-stubs/user_configs/config_parameters.pyi +6 -6
  140. metaflow-stubs/version.pyi +2 -2
  141. {metaflow_stubs-2.13.10.dist-info → metaflow_stubs-2.14.1.dist-info}/METADATA +2 -2
  142. metaflow_stubs-2.14.1.dist-info/RECORD +145 -0
  143. metaflow_stubs-2.13.10.dist-info/RECORD +0 -145
  144. {metaflow_stubs-2.13.10.dist-info → metaflow_stubs-2.14.1.dist-info}/WHEEL +0 -0
  145. {metaflow_stubs-2.13.10.dist-info → metaflow_stubs-2.14.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.13.10 #
4
- # Generated on 2025-02-11T14:38:33.693974 #
3
+ # MF version: 2.14.1 #
4
+ # Generated on 2025-02-21T00:53:08.401724 #
5
5
  ######################################################################################################
6
6
 
7
7
  from __future__ import annotations
@@ -143,135 +143,102 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
143
143
  ...
144
144
 
145
145
  @typing.overload
146
- 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]]]:
146
+ 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]]]:
147
147
  """
148
- Specifies the resources needed when executing this step.
149
-
150
- Use `@resources` to specify the resource requirements
151
- independently of the specific compute layer (`@batch`, `@kubernetes`).
148
+ Specifies the PyPI packages for the step.
152
149
 
153
- You can choose the compute layer on the command line by executing e.g.
154
- ```
155
- python myflow.py run --with batch
156
- ```
157
- or
158
- ```
159
- python myflow.py run --with kubernetes
160
- ```
161
- which executes the flow on the desired system using the
162
- requirements specified in `@resources`.
150
+ Information in this decorator will augment any
151
+ attributes set in the `@pyi_base` flow-level decorator. Hence,
152
+ you can use `@pypi_base` to set packages required by all
153
+ steps and use `@pypi` to specify step-specific overrides.
163
154
 
164
155
 
165
156
  Parameters
166
157
  ----------
167
- cpu : int, default 1
168
- Number of CPUs required for this step.
169
- gpu : int, optional, default None
170
- Number of GPUs required for this step.
171
- disk : int, optional, default None
172
- Disk size (in MB) required for this step. Only applies on Kubernetes.
173
- memory : int, default 4096
174
- Memory size (in MB) required for this step.
175
- shared_memory : int, optional, default None
176
- The value for the size (in MiB) of the /dev/shm volume for this step.
177
- This parameter maps to the `--shm-size` option in Docker.
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
+ python : str, optional, default: None
162
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
163
+ that the version used will correspond to the version of the Python interpreter used to start the run.
178
164
  """
179
165
  ...
180
166
 
181
167
  @typing.overload
182
- def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
168
+ def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
183
169
  ...
184
170
 
185
171
  @typing.overload
186
- def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
172
+ def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
187
173
  ...
188
174
 
189
- 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):
175
+ 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):
190
176
  """
191
- Specifies the resources needed when executing this step.
192
-
193
- Use `@resources` to specify the resource requirements
194
- independently of the specific compute layer (`@batch`, `@kubernetes`).
177
+ Specifies the PyPI packages for the step.
195
178
 
196
- You can choose the compute layer on the command line by executing e.g.
197
- ```
198
- python myflow.py run --with batch
199
- ```
200
- or
201
- ```
202
- python myflow.py run --with kubernetes
203
- ```
204
- which executes the flow on the desired system using the
205
- requirements specified in `@resources`.
179
+ Information in this decorator will augment any
180
+ attributes set in the `@pyi_base` flow-level decorator. Hence,
181
+ you can use `@pypi_base` to set packages required by all
182
+ steps and use `@pypi` to specify step-specific overrides.
206
183
 
207
184
 
208
185
  Parameters
209
186
  ----------
210
- cpu : int, default 1
211
- Number of CPUs required for this step.
212
- gpu : int, optional, default None
213
- Number of GPUs required for this step.
214
- disk : int, optional, default None
215
- Disk size (in MB) required for this step. Only applies on Kubernetes.
216
- memory : int, default 4096
217
- Memory size (in MB) required for this step.
218
- shared_memory : int, optional, default None
219
- The value for the size (in MiB) of the /dev/shm volume for this step.
220
- This parameter maps to the `--shm-size` option in Docker.
221
- """
222
- ...
223
-
224
- @typing.overload
225
- def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
226
- """
227
- Parameters
228
- ----------
229
- """
230
- ...
231
-
232
- @typing.overload
233
- def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
234
- ...
235
-
236
- def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
237
- """
238
- Parameters
239
- ----------
187
+ packages : Dict[str, str], default: {}
188
+ Packages to use for this step. The key is the name of the package
189
+ and the value is the version to use.
190
+ python : str, optional, default: None
191
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
192
+ that the version used will correspond to the version of the Python interpreter used to start the run.
240
193
  """
241
194
  ...
242
195
 
243
196
  @typing.overload
244
- 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]]]:
197
+ 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]]]:
245
198
  """
246
- Specifies secrets to be retrieved and injected as environment variables prior to
247
- the execution of a step.
199
+ Creates a human-readable report, a Metaflow Card, after this step completes.
200
+
201
+ Note that you may add multiple `@card` decorators in a step with different parameters.
248
202
 
249
203
 
250
204
  Parameters
251
205
  ----------
252
- sources : List[Union[str, Dict[str, Any]]], default: []
253
- List of secret specs, defining how the secrets are to be retrieved
206
+ type : str, default 'default'
207
+ Card type.
208
+ id : str, optional, default None
209
+ If multiple cards are present, use this id to identify this card.
210
+ options : Dict[str, Any], default {}
211
+ Options passed to the card. The contents depend on the card type.
212
+ timeout : int, default 45
213
+ Interrupt reporting if it takes more than this many seconds.
254
214
  """
255
215
  ...
256
216
 
257
217
  @typing.overload
258
- def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
218
+ def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
259
219
  ...
260
220
 
261
221
  @typing.overload
262
- def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
222
+ def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
263
223
  ...
264
224
 
265
- 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]]] = []):
225
+ 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):
266
226
  """
267
- Specifies secrets to be retrieved and injected as environment variables prior to
268
- the execution of a step.
227
+ Creates a human-readable report, a Metaflow Card, after this step completes.
228
+
229
+ Note that you may add multiple `@card` decorators in a step with different parameters.
269
230
 
270
231
 
271
232
  Parameters
272
233
  ----------
273
- sources : List[Union[str, Dict[str, Any]]], default: []
274
- List of secret specs, defining how the secrets are to be retrieved
234
+ type : str, default 'default'
235
+ Card type.
236
+ id : str, optional, default None
237
+ If multiple cards are present, use this id to identify this card.
238
+ options : Dict[str, Any], default {}
239
+ Options passed to the card. The contents depend on the card type.
240
+ timeout : int, default 45
241
+ Interrupt reporting if it takes more than this many seconds.
275
242
  """
276
243
  ...
277
244
 
@@ -335,186 +302,244 @@ def timeout(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None],
335
302
  ...
336
303
 
337
304
  @typing.overload
338
- def pypi(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
339
- """
340
- Specifies the PyPI packages for the step.
341
-
342
- Information in this decorator will augment any
343
- attributes set in the `@pyi_base` flow-level decorator. Hence,
344
- you can use `@pypi_base` to set packages required by all
345
- steps and use `@pypi` to specify step-specific overrides.
346
-
347
-
348
- Parameters
349
- ----------
350
- packages : Dict[str, str], default: {}
351
- Packages to use for this step. The key is the name of the package
352
- and the value is the version to use.
353
- python : str, optional, default: None
354
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
355
- that the version used will correspond to the version of the Python interpreter used to start the run.
356
- """
357
- ...
358
-
359
- @typing.overload
360
- def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
361
- ...
362
-
363
- @typing.overload
364
- def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
365
- ...
366
-
367
- 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):
368
- """
369
- Specifies the PyPI packages for the step.
370
-
371
- Information in this decorator will augment any
372
- attributes set in the `@pyi_base` flow-level decorator. Hence,
373
- you can use `@pypi_base` to set packages required by all
374
- steps and use `@pypi` to specify step-specific overrides.
375
-
376
-
377
- Parameters
378
- ----------
379
- packages : Dict[str, str], default: {}
380
- Packages to use for this step. The key is the name of the package
381
- and the value is the version to use.
382
- python : str, optional, default: None
383
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
384
- that the version used will correspond to the version of the Python interpreter used to start the run.
385
- """
386
- ...
387
-
388
- @typing.overload
389
- 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]]]:
305
+ 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]]]:
390
306
  """
391
- Specifies that the step will success under all circumstances.
392
-
393
- The decorator will create an optional artifact, specified by `var`, which
394
- contains the exception raised. You can use it to detect the presence
395
- of errors, indicating that all happy-path artifacts produced by the step
396
- are missing.
307
+ Specifies secrets to be retrieved and injected as environment variables prior to
308
+ the execution of a step.
397
309
 
398
310
 
399
311
  Parameters
400
312
  ----------
401
- var : str, optional, default None
402
- Name of the artifact in which to store the caught exception.
403
- If not specified, the exception is not stored.
404
- print_exception : bool, default True
405
- Determines whether or not the exception is printed to
406
- stdout when caught.
313
+ sources : List[Union[str, Dict[str, Any]]], default: []
314
+ List of secret specs, defining how the secrets are to be retrieved
407
315
  """
408
316
  ...
409
317
 
410
318
  @typing.overload
411
- def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
319
+ def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
412
320
  ...
413
321
 
414
322
  @typing.overload
415
- def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
323
+ def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
416
324
  ...
417
325
 
418
- 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):
326
+ 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]]] = []):
419
327
  """
420
- Specifies that the step will success under all circumstances.
421
-
422
- The decorator will create an optional artifact, specified by `var`, which
423
- contains the exception raised. You can use it to detect the presence
424
- of errors, indicating that all happy-path artifacts produced by the step
425
- are missing.
328
+ Specifies secrets to be retrieved and injected as environment variables prior to
329
+ the execution of a step.
426
330
 
427
331
 
428
332
  Parameters
429
333
  ----------
430
- var : str, optional, default None
431
- Name of the artifact in which to store the caught exception.
432
- If not specified, the exception is not stored.
433
- print_exception : bool, default True
434
- Determines whether or not the exception is printed to
435
- stdout when caught.
334
+ sources : List[Union[str, Dict[str, Any]]], default: []
335
+ List of secret specs, defining how the secrets are to be retrieved
436
336
  """
437
337
  ...
438
338
 
439
- @typing.overload
440
- 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]]]:
339
+ def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: typing.Optional[str] = None, image_pull_policy: str = 'KUBERNETES_IMAGE_PULL_POLICY', service_account: str = 'METAFLOW_KUBERNETES_SERVICE_ACCOUNT', secrets: typing.Optional[typing.List[str]] = None, node_selector: typing.Union[typing.Dict[str, str], str, None] = None, namespace: str = 'METAFLOW_KUBERNETES_NAMESPACE', gpu: typing.Optional[int] = None, gpu_vendor: str = 'KUBERNETES_GPU_VENDOR', tolerations: typing.List[str] = [], labels: typing.Dict[str, str] = 'METAFLOW_KUBERNETES_LABELS', annotations: typing.Dict[str, str] = 'METAFLOW_KUBERNETES_ANNOTATIONS', use_tmpfs: bool = False, tmpfs_tempdir: bool = True, tmpfs_size: typing.Optional[int] = None, tmpfs_path: typing.Optional[str] = '/metaflow_temp', persistent_volume_claims: typing.Optional[typing.Dict[str, str]] = None, shared_memory: typing.Optional[int] = None, port: typing.Optional[int] = None, compute_pool: typing.Optional[str] = None, hostname_resolution_timeout: int = 600, qos: str = 'Burstable') -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
441
340
  """
442
- Creates a human-readable report, a Metaflow Card, after this step completes.
443
-
444
- Note that you may add multiple `@card` decorators in a step with different parameters.
341
+ Specifies that this step should execute on Kubernetes.
445
342
 
446
343
 
447
344
  Parameters
448
345
  ----------
449
- type : str, default 'default'
450
- Card type.
451
- id : str, optional, default None
452
- If multiple cards are present, use this id to identify this card.
453
- options : Dict[str, Any], default {}
454
- Options passed to the card. The contents depend on the card type.
455
- timeout : int, default 45
456
- Interrupt reporting if it takes more than this many seconds.
457
- """
458
- ...
459
-
460
- @typing.overload
461
- def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
462
- ...
463
-
464
- @typing.overload
465
- def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
466
- ...
467
-
468
- 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):
469
- """
470
- Creates a human-readable report, a Metaflow Card, after this step completes.
346
+ cpu : int, default 1
347
+ Number of CPUs required for this step. If `@resources` is
348
+ also present, the maximum value from all decorators is used.
349
+ memory : int, default 4096
350
+ Memory size (in MB) required for this step. If
351
+ `@resources` is also present, the maximum value from all decorators is
352
+ used.
353
+ disk : int, default 10240
354
+ Disk size (in MB) required for this step. If
355
+ `@resources` is also present, the maximum value from all decorators is
356
+ used.
357
+ image : str, optional, default None
358
+ Docker image to use when launching on Kubernetes. If not specified, and
359
+ METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
360
+ not, a default Docker image mapping to the current version of Python is used.
361
+ image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
362
+ If given, the imagePullPolicy to be applied to the Docker image of the step.
363
+ service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
364
+ Kubernetes service account to use when launching pod in Kubernetes.
365
+ secrets : List[str], optional, default None
366
+ Kubernetes secrets to use when launching pod in Kubernetes. These
367
+ secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
368
+ in Metaflow configuration.
369
+ node_selector: Union[Dict[str,str], str], optional, default None
370
+ Kubernetes node selector(s) to apply to the pod running the task.
371
+ Can be passed in as a comma separated string of values e.g.
372
+ 'kubernetes.io/os=linux,kubernetes.io/arch=amd64' or as a dictionary
373
+ {'kubernetes.io/os': 'linux', 'kubernetes.io/arch': 'amd64'}
374
+ namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
375
+ Kubernetes namespace to use when launching pod in Kubernetes.
376
+ gpu : int, optional, default None
377
+ Number of GPUs required for this step. A value of zero implies that
378
+ the scheduled node should not have GPUs.
379
+ gpu_vendor : str, default KUBERNETES_GPU_VENDOR
380
+ The vendor of the GPUs to be used for this step.
381
+ tolerations : List[str], default []
382
+ The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
383
+ Kubernetes tolerations to use when launching pod in Kubernetes.
384
+ labels: Dict[str, str], default: METAFLOW_KUBERNETES_LABELS
385
+ Kubernetes labels to use when launching pod in Kubernetes.
386
+ annotations: Dict[str, str], default: METAFLOW_KUBERNETES_ANNOTATIONS
387
+ Kubernetes annotations to use when launching pod in Kubernetes.
388
+ use_tmpfs : bool, default False
389
+ This enables an explicit tmpfs mount for this step.
390
+ tmpfs_tempdir : bool, default True
391
+ sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
392
+ tmpfs_size : int, optional, default: None
393
+ The value for the size (in MiB) of the tmpfs mount for this step.
394
+ This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
395
+ memory allocated for this step.
396
+ tmpfs_path : str, optional, default /metaflow_temp
397
+ Path to tmpfs mount for this step.
398
+ persistent_volume_claims : Dict[str, str], optional, default None
399
+ A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
400
+ volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
401
+ shared_memory: int, optional
402
+ Shared memory size (in MiB) required for this step
403
+ port: int, optional
404
+ Port number to specify in the Kubernetes job object
405
+ compute_pool : str, optional, default None
406
+ Compute pool to be used for for this step.
407
+ If not specified, any accessible compute pool within the perimeter is used.
408
+ hostname_resolution_timeout: int, default 10 * 60
409
+ Timeout in seconds for the workers tasks in the gang scheduled cluster to resolve the hostname of control task.
410
+ Only applicable when @parallel is used.
411
+ qos: str, default: Burstable
412
+ Quality of Service class to assign to the pod. Supported values are: Guaranteed, Burstable, BestEffort
413
+ """
414
+ ...
415
+
416
+ @typing.overload
417
+ 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]]]:
418
+ """
419
+ Specifies the resources needed when executing this step.
471
420
 
472
- Note that you may add multiple `@card` decorators in a step with different parameters.
421
+ Use `@resources` to specify the resource requirements
422
+ independently of the specific compute layer (`@batch`, `@kubernetes`).
423
+
424
+ You can choose the compute layer on the command line by executing e.g.
425
+ ```
426
+ python myflow.py run --with batch
427
+ ```
428
+ or
429
+ ```
430
+ python myflow.py run --with kubernetes
431
+ ```
432
+ which executes the flow on the desired system using the
433
+ requirements specified in `@resources`.
473
434
 
474
435
 
475
436
  Parameters
476
437
  ----------
477
- type : str, default 'default'
478
- Card type.
479
- id : str, optional, default None
480
- If multiple cards are present, use this id to identify this card.
481
- options : Dict[str, Any], default {}
482
- Options passed to the card. The contents depend on the card type.
483
- timeout : int, default 45
484
- Interrupt reporting if it takes more than this many seconds.
438
+ cpu : int, default 1
439
+ Number of CPUs required for this step.
440
+ gpu : int, optional, default None
441
+ Number of GPUs required for this step.
442
+ disk : int, optional, default None
443
+ Disk size (in MB) required for this step. Only applies on Kubernetes.
444
+ memory : int, default 4096
445
+ Memory size (in MB) required for this step.
446
+ shared_memory : int, optional, default None
447
+ The value for the size (in MiB) of the /dev/shm volume for this step.
448
+ This parameter maps to the `--shm-size` option in Docker.
485
449
  """
486
450
  ...
487
451
 
488
452
  @typing.overload
489
- 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]]]:
453
+ def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
454
+ ...
455
+
456
+ @typing.overload
457
+ def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
458
+ ...
459
+
460
+ 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):
490
461
  """
491
- Specifies environment variables to be set prior to the execution of a step.
462
+ Specifies the resources needed when executing this step.
463
+
464
+ Use `@resources` to specify the resource requirements
465
+ independently of the specific compute layer (`@batch`, `@kubernetes`).
466
+
467
+ You can choose the compute layer on the command line by executing e.g.
468
+ ```
469
+ python myflow.py run --with batch
470
+ ```
471
+ or
472
+ ```
473
+ python myflow.py run --with kubernetes
474
+ ```
475
+ which executes the flow on the desired system using the
476
+ requirements specified in `@resources`.
492
477
 
493
478
 
494
479
  Parameters
495
480
  ----------
496
- vars : Dict[str, str], default {}
497
- Dictionary of environment variables to set.
481
+ cpu : int, default 1
482
+ Number of CPUs required for this step.
483
+ gpu : int, optional, default None
484
+ Number of GPUs required for this step.
485
+ disk : int, optional, default None
486
+ Disk size (in MB) required for this step. Only applies on Kubernetes.
487
+ memory : int, default 4096
488
+ Memory size (in MB) required for this step.
489
+ shared_memory : int, optional, default None
490
+ The value for the size (in MiB) of the /dev/shm volume for this step.
491
+ This parameter maps to the `--shm-size` option in Docker.
498
492
  """
499
493
  ...
500
494
 
501
495
  @typing.overload
502
- def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
496
+ 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]]]:
497
+ """
498
+ Specifies that the step will success under all circumstances.
499
+
500
+ The decorator will create an optional artifact, specified by `var`, which
501
+ contains the exception raised. You can use it to detect the presence
502
+ of errors, indicating that all happy-path artifacts produced by the step
503
+ are missing.
504
+
505
+
506
+ Parameters
507
+ ----------
508
+ var : str, optional, default None
509
+ Name of the artifact in which to store the caught exception.
510
+ If not specified, the exception is not stored.
511
+ print_exception : bool, default True
512
+ Determines whether or not the exception is printed to
513
+ stdout when caught.
514
+ """
503
515
  ...
504
516
 
505
517
  @typing.overload
506
- def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
518
+ def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
507
519
  ...
508
520
 
509
- def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
521
+ @typing.overload
522
+ def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
523
+ ...
524
+
525
+ 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):
510
526
  """
511
- Specifies environment variables to be set prior to the execution of a step.
527
+ Specifies that the step will success under all circumstances.
528
+
529
+ The decorator will create an optional artifact, specified by `var`, which
530
+ contains the exception raised. You can use it to detect the presence
531
+ of errors, indicating that all happy-path artifacts produced by the step
532
+ are missing.
512
533
 
513
534
 
514
535
  Parameters
515
536
  ----------
516
- vars : Dict[str, str], default {}
517
- Dictionary of environment variables to set.
537
+ var : str, optional, default None
538
+ Name of the artifact in which to store the caught exception.
539
+ If not specified, the exception is not stored.
540
+ print_exception : bool, default True
541
+ Determines whether or not the exception is printed to
542
+ stdout when caught.
518
543
  """
519
544
  ...
520
545
 
@@ -668,57 +693,54 @@ def batch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
668
693
  ...
669
694
 
670
695
  @typing.overload
671
- 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]]]:
696
+ def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
672
697
  """
673
- Specifies the number of times the task corresponding
674
- to a step needs to be retried.
675
-
676
- This decorator is useful for handling transient errors, such as networking issues.
677
- If your task contains operations that can't be retried safely, e.g. database updates,
678
- it is advisable to annotate it with `@retry(times=0)`.
679
-
680
- This can be used in conjunction with the `@catch` decorator. The `@catch`
681
- decorator will execute a no-op task after all retries have been exhausted,
682
- ensuring that the flow execution can continue.
698
+ Parameters
699
+ ----------
700
+ """
701
+ ...
702
+
703
+ @typing.overload
704
+ def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
705
+ ...
706
+
707
+ def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
708
+ """
709
+ Parameters
710
+ ----------
711
+ """
712
+ ...
713
+
714
+ @typing.overload
715
+ 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]]]:
716
+ """
717
+ Specifies environment variables to be set prior to the execution of a step.
683
718
 
684
719
 
685
720
  Parameters
686
721
  ----------
687
- times : int, default 3
688
- Number of times to retry this task.
689
- minutes_between_retries : int, default 2
690
- Number of minutes between retries.
722
+ vars : Dict[str, str], default {}
723
+ Dictionary of environment variables to set.
691
724
  """
692
725
  ...
693
726
 
694
727
  @typing.overload
695
- def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
728
+ def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
696
729
  ...
697
730
 
698
731
  @typing.overload
699
- def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
732
+ def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
700
733
  ...
701
734
 
702
- 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):
735
+ def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
703
736
  """
704
- Specifies the number of times the task corresponding
705
- to a step needs to be retried.
706
-
707
- This decorator is useful for handling transient errors, such as networking issues.
708
- If your task contains operations that can't be retried safely, e.g. database updates,
709
- it is advisable to annotate it with `@retry(times=0)`.
710
-
711
- This can be used in conjunction with the `@catch` decorator. The `@catch`
712
- decorator will execute a no-op task after all retries have been exhausted,
713
- ensuring that the flow execution can continue.
737
+ Specifies environment variables to be set prior to the execution of a step.
714
738
 
715
739
 
716
740
  Parameters
717
741
  ----------
718
- times : int, default 3
719
- Number of times to retry this task.
720
- minutes_between_retries : int, default 2
721
- Number of minutes between retries.
742
+ vars : Dict[str, str], default {}
743
+ Dictionary of environment variables to set.
722
744
  """
723
745
  ...
724
746
 
@@ -781,310 +803,58 @@ def conda(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
781
803
  """
782
804
  ...
783
805
 
784
- def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: typing.Optional[str] = None, image_pull_policy: str = 'KUBERNETES_IMAGE_PULL_POLICY', service_account: str = 'METAFLOW_KUBERNETES_SERVICE_ACCOUNT', secrets: typing.Optional[typing.List[str]] = None, node_selector: typing.Union[typing.Dict[str, str], str, None] = None, namespace: str = 'METAFLOW_KUBERNETES_NAMESPACE', gpu: typing.Optional[int] = None, gpu_vendor: str = 'KUBERNETES_GPU_VENDOR', tolerations: typing.List[str] = [], labels: typing.Dict[str, str] = 'METAFLOW_KUBERNETES_LABELS', annotations: typing.Dict[str, str] = 'METAFLOW_KUBERNETES_ANNOTATIONS', use_tmpfs: bool = False, tmpfs_tempdir: bool = True, tmpfs_size: typing.Optional[int] = None, tmpfs_path: typing.Optional[str] = '/metaflow_temp', persistent_volume_claims: typing.Optional[typing.Dict[str, str]] = None, shared_memory: typing.Optional[int] = None, port: typing.Optional[int] = None, compute_pool: typing.Optional[str] = None, hostname_resolution_timeout: int = 600, qos: str = 'Burstable') -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
806
+ @typing.overload
807
+ 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]]]:
785
808
  """
786
- Specifies that this step should execute on Kubernetes.
809
+ Specifies the number of times the task corresponding
810
+ to a step needs to be retried.
787
811
 
812
+ This decorator is useful for handling transient errors, such as networking issues.
813
+ If your task contains operations that can't be retried safely, e.g. database updates,
814
+ it is advisable to annotate it with `@retry(times=0)`.
788
815
 
789
- Parameters
790
- ----------
791
- cpu : int, default 1
792
- Number of CPUs required for this step. If `@resources` is
793
- also present, the maximum value from all decorators is used.
794
- memory : int, default 4096
795
- Memory size (in MB) required for this step. If
796
- `@resources` is also present, the maximum value from all decorators is
797
- used.
798
- disk : int, default 10240
799
- Disk size (in MB) required for this step. If
800
- `@resources` is also present, the maximum value from all decorators is
801
- used.
802
- image : str, optional, default None
803
- Docker image to use when launching on Kubernetes. If not specified, and
804
- METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
805
- not, a default Docker image mapping to the current version of Python is used.
806
- image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
807
- If given, the imagePullPolicy to be applied to the Docker image of the step.
808
- service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
809
- Kubernetes service account to use when launching pod in Kubernetes.
810
- secrets : List[str], optional, default None
811
- Kubernetes secrets to use when launching pod in Kubernetes. These
812
- secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
813
- in Metaflow configuration.
814
- node_selector: Union[Dict[str,str], str], optional, default None
815
- Kubernetes node selector(s) to apply to the pod running the task.
816
- Can be passed in as a comma separated string of values e.g.
817
- 'kubernetes.io/os=linux,kubernetes.io/arch=amd64' or as a dictionary
818
- {'kubernetes.io/os': 'linux', 'kubernetes.io/arch': 'amd64'}
819
- namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
820
- Kubernetes namespace to use when launching pod in Kubernetes.
821
- gpu : int, optional, default None
822
- Number of GPUs required for this step. A value of zero implies that
823
- the scheduled node should not have GPUs.
824
- gpu_vendor : str, default KUBERNETES_GPU_VENDOR
825
- The vendor of the GPUs to be used for this step.
826
- tolerations : List[str], default []
827
- The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
828
- Kubernetes tolerations to use when launching pod in Kubernetes.
829
- labels: Dict[str, str], default: METAFLOW_KUBERNETES_LABELS
830
- Kubernetes labels to use when launching pod in Kubernetes.
831
- annotations: Dict[str, str], default: METAFLOW_KUBERNETES_ANNOTATIONS
832
- Kubernetes annotations to use when launching pod in Kubernetes.
833
- use_tmpfs : bool, default False
834
- This enables an explicit tmpfs mount for this step.
835
- tmpfs_tempdir : bool, default True
836
- sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
837
- tmpfs_size : int, optional, default: None
838
- The value for the size (in MiB) of the tmpfs mount for this step.
839
- This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
840
- memory allocated for this step.
841
- tmpfs_path : str, optional, default /metaflow_temp
842
- Path to tmpfs mount for this step.
843
- persistent_volume_claims : Dict[str, str], optional, default None
844
- A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
845
- volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
846
- shared_memory: int, optional
847
- Shared memory size (in MiB) required for this step
848
- port: int, optional
849
- Port number to specify in the Kubernetes job object
850
- compute_pool : str, optional, default None
851
- Compute pool to be used for for this step.
852
- If not specified, any accessible compute pool within the perimeter is used.
853
- hostname_resolution_timeout: int, default 10 * 60
854
- Timeout in seconds for the workers tasks in the gang scheduled cluster to resolve the hostname of control task.
855
- Only applicable when @parallel is used.
856
- qos: str, default: Burstable
857
- Quality of Service class to assign to the pod. Supported values are: Guaranteed, Burstable, BestEffort
858
- """
859
- ...
860
-
861
- def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
862
- """
863
- Specifies what flows belong to the same project.
864
-
865
- A project-specific namespace is created for all flows that
866
- use the same `@project(name)`.
867
-
868
-
869
- Parameters
870
- ----------
871
- name : str
872
- Project name. Make sure that the name is unique amongst all
873
- projects that use the same production scheduler. The name may
874
- contain only lowercase alphanumeric characters and underscores.
875
-
876
- branch : Optional[str], default None
877
- The branch to use. If not specified, the branch is set to
878
- `user.<username>` unless `production` is set to `True`. This can
879
- also be set on the command line using `--branch` as a top-level option.
880
- It is an error to specify `branch` in the decorator and on the command line.
881
-
882
- production : bool, default False
883
- Whether or not the branch is the production branch. This can also be set on the
884
- command line using `--production` as a top-level option. It is an error to specify
885
- `production` in the decorator and on the command line.
886
- The project branch name will be:
887
- - if `branch` is specified:
888
- - if `production` is True: `prod.<branch>`
889
- - if `production` is False: `test.<branch>`
890
- - if `branch` is not specified:
891
- - if `production` is True: `prod`
892
- - if `production` is False: `user.<username>`
893
- """
894
- ...
895
-
896
- 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]]:
897
- """
898
- 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.
899
- 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.
900
-
901
-
902
- Parameters
903
- ----------
904
- timeout : int
905
- Time, in seconds before the task times out and fails. (Default: 3600)
906
- poke_interval : int
907
- Time in seconds that the job should wait in between each try. (Default: 60)
908
- mode : str
909
- How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
910
- exponential_backoff : bool
911
- allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
912
- pool : str
913
- the slot pool this task should run in,
914
- slot pools are a way to limit concurrency for certain tasks. (Default:None)
915
- soft_fail : bool
916
- Set to true to mark the task as SKIPPED on failure. (Default: False)
917
- name : str
918
- Name of the sensor on Airflow
919
- description : str
920
- Description of sensor in the Airflow UI
921
- external_dag_id : str
922
- The dag_id that contains the task you want to wait for.
923
- external_task_ids : List[str]
924
- The list of task_ids that you want to wait for.
925
- If None (default value) the sensor waits for the DAG. (Default: None)
926
- allowed_states : List[str]
927
- Iterable of allowed states, (Default: ['success'])
928
- failed_states : List[str]
929
- Iterable of failed or dis-allowed states. (Default: None)
930
- execution_delta : datetime.timedelta
931
- time difference with the previous execution to look at,
932
- the default is the same logical date as the current task or DAG. (Default: None)
933
- check_existence: bool
934
- Set to True to check if the external task exists or check if
935
- the DAG to wait for exists. (Default: True)
936
- """
937
- ...
938
-
939
- @typing.overload
940
- def conda_base(*, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
941
- """
942
- Specifies the Conda environment for all steps of the flow.
943
-
944
- Use `@conda_base` to set common libraries required by all
945
- steps and use `@conda` to specify step-specific additions.
946
-
947
-
948
- Parameters
949
- ----------
950
- packages : Dict[str, str], default {}
951
- Packages to use for this flow. The key is the name of the package
952
- and the value is the version to use.
953
- libraries : Dict[str, str], default {}
954
- Supported for backward compatibility. When used with packages, packages will take precedence.
955
- python : str, optional, default None
956
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
957
- that the version used will correspond to the version of the Python interpreter used to start the run.
958
- disabled : bool, default False
959
- If set to True, disables Conda.
960
- """
961
- ...
962
-
963
- @typing.overload
964
- def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
965
- ...
966
-
967
- def conda_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False):
968
- """
969
- Specifies the Conda environment for all steps of the flow.
970
-
971
- Use `@conda_base` to set common libraries required by all
972
- steps and use `@conda` to specify step-specific additions.
816
+ This can be used in conjunction with the `@catch` decorator. The `@catch`
817
+ decorator will execute a no-op task after all retries have been exhausted,
818
+ ensuring that the flow execution can continue.
973
819
 
974
820
 
975
821
  Parameters
976
822
  ----------
977
- packages : Dict[str, str], default {}
978
- Packages to use for this flow. The key is the name of the package
979
- and the value is the version to use.
980
- libraries : Dict[str, str], default {}
981
- Supported for backward compatibility. When used with packages, packages will take precedence.
982
- python : str, optional, default None
983
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
984
- that the version used will correspond to the version of the Python interpreter used to start the run.
985
- disabled : bool, default False
986
- If set to True, disables Conda.
823
+ times : int, default 3
824
+ Number of times to retry this task.
825
+ minutes_between_retries : int, default 2
826
+ Number of minutes between retries.
987
827
  """
988
828
  ...
989
829
 
990
830
  @typing.overload
991
- 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]]:
992
- """
993
- Specifies the flow(s) that this flow depends on.
994
-
995
- ```
996
- @trigger_on_finish(flow='FooFlow')
997
- ```
998
- or
999
- ```
1000
- @trigger_on_finish(flows=['FooFlow', 'BarFlow'])
1001
- ```
1002
- This decorator respects the @project decorator and triggers the flow
1003
- when upstream runs within the same namespace complete successfully
1004
-
1005
- Additionally, you can specify project aware upstream flow dependencies
1006
- by specifying the fully qualified project_flow_name.
1007
- ```
1008
- @trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
1009
- ```
1010
- or
1011
- ```
1012
- @trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
1013
- ```
1014
-
1015
- You can also specify just the project or project branch (other values will be
1016
- inferred from the current project or project branch):
1017
- ```
1018
- @trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
1019
- ```
1020
-
1021
- Note that `branch` is typically one of:
1022
- - `prod`
1023
- - `user.bob`
1024
- - `test.my_experiment`
1025
- - `prod.staging`
1026
-
1027
-
1028
- Parameters
1029
- ----------
1030
- flow : Union[str, Dict[str, str]], optional, default None
1031
- Upstream flow dependency for this flow.
1032
- flows : List[Union[str, Dict[str, str]]], default []
1033
- Upstream flow dependencies for this flow.
1034
- options : Dict[str, Any], default {}
1035
- Backend-specific configuration for tuning eventing behavior.
1036
- """
831
+ def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1037
832
  ...
1038
833
 
1039
834
  @typing.overload
1040
- def trigger_on_finish(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
835
+ def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1041
836
  ...
1042
837
 
1043
- def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, 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] = {}):
838
+ 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):
1044
839
  """
1045
- Specifies the flow(s) that this flow depends on.
1046
-
1047
- ```
1048
- @trigger_on_finish(flow='FooFlow')
1049
- ```
1050
- or
1051
- ```
1052
- @trigger_on_finish(flows=['FooFlow', 'BarFlow'])
1053
- ```
1054
- This decorator respects the @project decorator and triggers the flow
1055
- when upstream runs within the same namespace complete successfully
1056
-
1057
- Additionally, you can specify project aware upstream flow dependencies
1058
- by specifying the fully qualified project_flow_name.
1059
- ```
1060
- @trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
1061
- ```
1062
- or
1063
- ```
1064
- @trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
1065
- ```
840
+ Specifies the number of times the task corresponding
841
+ to a step needs to be retried.
1066
842
 
1067
- You can also specify just the project or project branch (other values will be
1068
- inferred from the current project or project branch):
1069
- ```
1070
- @trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
1071
- ```
843
+ This decorator is useful for handling transient errors, such as networking issues.
844
+ If your task contains operations that can't be retried safely, e.g. database updates,
845
+ it is advisable to annotate it with `@retry(times=0)`.
1072
846
 
1073
- Note that `branch` is typically one of:
1074
- - `prod`
1075
- - `user.bob`
1076
- - `test.my_experiment`
1077
- - `prod.staging`
847
+ This can be used in conjunction with the `@catch` decorator. The `@catch`
848
+ decorator will execute a no-op task after all retries have been exhausted,
849
+ ensuring that the flow execution can continue.
1078
850
 
1079
851
 
1080
852
  Parameters
1081
853
  ----------
1082
- flow : Union[str, Dict[str, str]], optional, default None
1083
- Upstream flow dependency for this flow.
1084
- flows : List[Union[str, Dict[str, str]]], default []
1085
- Upstream flow dependencies for this flow.
1086
- options : Dict[str, Any], default {}
1087
- Backend-specific configuration for tuning eventing behavior.
854
+ times : int, default 3
855
+ Number of times to retry this task.
856
+ minutes_between_retries : int, default 2
857
+ Number of minutes between retries.
1088
858
  """
1089
859
  ...
1090
860
 
@@ -1232,6 +1002,158 @@ def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, event: t
1232
1002
  """
1233
1003
  ...
1234
1004
 
1005
+ @typing.overload
1006
+ 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
+ """
1008
+ Specifies the flow(s) that this flow depends on.
1009
+
1010
+ ```
1011
+ @trigger_on_finish(flow='FooFlow')
1012
+ ```
1013
+ or
1014
+ ```
1015
+ @trigger_on_finish(flows=['FooFlow', 'BarFlow'])
1016
+ ```
1017
+ This decorator respects the @project decorator and triggers the flow
1018
+ when upstream runs within the same namespace complete successfully
1019
+
1020
+ Additionally, you can specify project aware upstream flow dependencies
1021
+ by specifying the fully qualified project_flow_name.
1022
+ ```
1023
+ @trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
1024
+ ```
1025
+ or
1026
+ ```
1027
+ @trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
1028
+ ```
1029
+
1030
+ You can also specify just the project or project branch (other values will be
1031
+ inferred from the current project or project branch):
1032
+ ```
1033
+ @trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
1034
+ ```
1035
+
1036
+ Note that `branch` is typically one of:
1037
+ - `prod`
1038
+ - `user.bob`
1039
+ - `test.my_experiment`
1040
+ - `prod.staging`
1041
+
1042
+
1043
+ Parameters
1044
+ ----------
1045
+ flow : Union[str, Dict[str, str]], optional, default None
1046
+ Upstream flow dependency for this flow.
1047
+ flows : List[Union[str, Dict[str, str]]], default []
1048
+ Upstream flow dependencies for this flow.
1049
+ options : Dict[str, Any], default {}
1050
+ Backend-specific configuration for tuning eventing behavior.
1051
+ """
1052
+ ...
1053
+
1054
+ @typing.overload
1055
+ def trigger_on_finish(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1056
+ ...
1057
+
1058
+ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, 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] = {}):
1059
+ """
1060
+ Specifies the flow(s) that this flow depends on.
1061
+
1062
+ ```
1063
+ @trigger_on_finish(flow='FooFlow')
1064
+ ```
1065
+ or
1066
+ ```
1067
+ @trigger_on_finish(flows=['FooFlow', 'BarFlow'])
1068
+ ```
1069
+ This decorator respects the @project decorator and triggers the flow
1070
+ when upstream runs within the same namespace complete successfully
1071
+
1072
+ Additionally, you can specify project aware upstream flow dependencies
1073
+ by specifying the fully qualified project_flow_name.
1074
+ ```
1075
+ @trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
1076
+ ```
1077
+ or
1078
+ ```
1079
+ @trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
1080
+ ```
1081
+
1082
+ You can also specify just the project or project branch (other values will be
1083
+ inferred from the current project or project branch):
1084
+ ```
1085
+ @trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
1086
+ ```
1087
+
1088
+ Note that `branch` is typically one of:
1089
+ - `prod`
1090
+ - `user.bob`
1091
+ - `test.my_experiment`
1092
+ - `prod.staging`
1093
+
1094
+
1095
+ Parameters
1096
+ ----------
1097
+ flow : Union[str, Dict[str, str]], optional, default None
1098
+ Upstream flow dependency for this flow.
1099
+ flows : List[Union[str, Dict[str, str]]], default []
1100
+ Upstream flow dependencies for this flow.
1101
+ options : Dict[str, Any], default {}
1102
+ Backend-specific configuration for tuning eventing behavior.
1103
+ """
1104
+ ...
1105
+
1106
+ @typing.overload
1107
+ def conda_base(*, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1108
+ """
1109
+ Specifies the Conda environment for all steps of the flow.
1110
+
1111
+ Use `@conda_base` to set common libraries required by all
1112
+ steps and use `@conda` to specify step-specific additions.
1113
+
1114
+
1115
+ Parameters
1116
+ ----------
1117
+ packages : Dict[str, str], default {}
1118
+ Packages to use for this flow. The key is the name of the package
1119
+ and the value is the version to use.
1120
+ libraries : Dict[str, str], default {}
1121
+ Supported for backward compatibility. When used with packages, packages will take precedence.
1122
+ python : str, optional, default None
1123
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1124
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1125
+ disabled : bool, default False
1126
+ If set to True, disables Conda.
1127
+ """
1128
+ ...
1129
+
1130
+ @typing.overload
1131
+ def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1132
+ ...
1133
+
1134
+ def conda_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False):
1135
+ """
1136
+ Specifies the Conda environment for all steps of the flow.
1137
+
1138
+ Use `@conda_base` to set common libraries required by all
1139
+ steps and use `@conda` to specify step-specific additions.
1140
+
1141
+
1142
+ Parameters
1143
+ ----------
1144
+ packages : Dict[str, str], default {}
1145
+ Packages to use for this flow. The key is the name of the package
1146
+ and the value is the version to use.
1147
+ libraries : Dict[str, str], default {}
1148
+ Supported for backward compatibility. When used with packages, packages will take precedence.
1149
+ python : str, optional, default None
1150
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1151
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1152
+ disabled : bool, default False
1153
+ If set to True, disables Conda.
1154
+ """
1155
+ ...
1156
+
1235
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]]:
1236
1158
  """
1237
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)
@@ -1275,6 +1197,84 @@ def airflow_s3_key_sensor(*, timeout: int, poke_interval: int, mode: str, expone
1275
1197
  """
1276
1198
  ...
1277
1199
 
1200
+ 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]]:
1201
+ """
1202
+ 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.
1203
+ 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.
1204
+
1205
+
1206
+ Parameters
1207
+ ----------
1208
+ timeout : int
1209
+ Time, in seconds before the task times out and fails. (Default: 3600)
1210
+ poke_interval : int
1211
+ Time in seconds that the job should wait in between each try. (Default: 60)
1212
+ mode : str
1213
+ How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1214
+ exponential_backoff : bool
1215
+ allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1216
+ pool : str
1217
+ the slot pool this task should run in,
1218
+ slot pools are a way to limit concurrency for certain tasks. (Default:None)
1219
+ soft_fail : bool
1220
+ Set to true to mark the task as SKIPPED on failure. (Default: False)
1221
+ name : str
1222
+ Name of the sensor on Airflow
1223
+ description : str
1224
+ Description of sensor in the Airflow UI
1225
+ external_dag_id : str
1226
+ The dag_id that contains the task you want to wait for.
1227
+ external_task_ids : List[str]
1228
+ The list of task_ids that you want to wait for.
1229
+ If None (default value) the sensor waits for the DAG. (Default: None)
1230
+ allowed_states : List[str]
1231
+ Iterable of allowed states, (Default: ['success'])
1232
+ failed_states : List[str]
1233
+ Iterable of failed or dis-allowed states. (Default: None)
1234
+ execution_delta : datetime.timedelta
1235
+ time difference with the previous execution to look at,
1236
+ the default is the same logical date as the current task or DAG. (Default: None)
1237
+ check_existence: bool
1238
+ Set to True to check if the external task exists or check if
1239
+ the DAG to wait for exists. (Default: True)
1240
+ """
1241
+ ...
1242
+
1243
+ def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1244
+ """
1245
+ Specifies what flows belong to the same project.
1246
+
1247
+ A project-specific namespace is created for all flows that
1248
+ use the same `@project(name)`.
1249
+
1250
+
1251
+ Parameters
1252
+ ----------
1253
+ name : str
1254
+ Project name. Make sure that the name is unique amongst all
1255
+ projects that use the same production scheduler. The name may
1256
+ contain only lowercase alphanumeric characters and underscores.
1257
+
1258
+ branch : Optional[str], default None
1259
+ The branch to use. If not specified, the branch is set to
1260
+ `user.<username>` unless `production` is set to `True`. This can
1261
+ also be set on the command line using `--branch` as a top-level option.
1262
+ It is an error to specify `branch` in the decorator and on the command line.
1263
+
1264
+ production : bool, default False
1265
+ Whether or not the branch is the production branch. This can also be set on the
1266
+ command line using `--production` as a top-level option. It is an error to specify
1267
+ `production` in the decorator and on the command line.
1268
+ The project branch name will be:
1269
+ - if `branch` is specified:
1270
+ - if `production` is True: `prod.<branch>`
1271
+ - if `production` is False: `test.<branch>`
1272
+ - if `branch` is not specified:
1273
+ - if `production` is True: `prod`
1274
+ - if `production` is False: `user.<username>`
1275
+ """
1276
+ ...
1277
+
1278
1278
  @typing.overload
1279
1279
  def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1280
1280
  """