ob-metaflow-stubs 6.0.3.143__py2.py3-none-any.whl → 6.0.3.144__py2.py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (197) hide show
  1. metaflow-stubs/__init__.pyi +556 -556
  2. metaflow-stubs/cards.pyi +2 -2
  3. metaflow-stubs/cli.pyi +2 -7
  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 +95 -6
  8. metaflow-stubs/client/filecache.pyi +2 -2
  9. metaflow-stubs/events.pyi +2 -2
  10. metaflow-stubs/exception.pyi +2 -2
  11. metaflow-stubs/flowspec.pyi +4 -4
  12. metaflow-stubs/generated_for.txt +1 -1
  13. metaflow-stubs/includefile.pyi +4 -4
  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 +3 -5
  20. metaflow-stubs/metaflow_current.pyi +54 -54
  21. metaflow-stubs/mf_extensions/__init__.pyi +2 -2
  22. metaflow-stubs/mf_extensions/obcheckpoint/__init__.pyi +2 -2
  23. metaflow-stubs/mf_extensions/obcheckpoint/plugins/__init__.pyi +2 -2
  24. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/__init__.pyi +2 -2
  25. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/__init__.pyi +2 -2
  26. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/async_cards.pyi +2 -2
  27. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/deco_injection_mixin.pyi +2 -2
  28. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/extra_components.pyi +2 -2
  29. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/__init__.pyi +2 -2
  30. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/__init__.pyi +2 -2
  31. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/checkpoint_lister.pyi +4 -4
  32. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/lineage_card.pyi +2 -2
  33. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/checkpoint_storage.pyi +4 -4
  34. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/constructors.pyi +2 -2
  35. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/core.pyi +4 -4
  36. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/decorator.pyi +4 -4
  37. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/exceptions.pyi +2 -2
  38. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/final_api.pyi +2 -2
  39. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/lineage.pyi +2 -2
  40. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/__init__.pyi +2 -2
  41. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/core.pyi +2 -2
  42. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/exceptions.pyi +2 -2
  43. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/task_utils.pyi +2 -2
  44. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/utils.pyi +2 -2
  45. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastructures.pyi +3 -3
  46. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/exceptions.pyi +2 -2
  47. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/hf_hub/__init__.pyi +2 -2
  48. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/hf_hub/decorator.pyi +2 -2
  49. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/__init__.pyi +2 -2
  50. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/core.pyi +3 -3
  51. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/exceptions.pyi +2 -2
  52. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/model_storage.pyi +3 -3
  53. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/__init__.pyi +2 -2
  54. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/flowspec_utils.pyi +2 -2
  55. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/general.pyi +2 -2
  56. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/identity_utils.pyi +2 -2
  57. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/__init__.pyi +2 -2
  58. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/base.pyi +2 -2
  59. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/tar.pyi +2 -2
  60. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/tar_utils.pyi +2 -2
  61. metaflow-stubs/mf_extensions/outerbounds/__init__.pyi +2 -2
  62. metaflow-stubs/mf_extensions/outerbounds/plugins/__init__.pyi +2 -2
  63. metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/__init__.pyi +2 -2
  64. metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/injector.pyi +2 -2
  65. metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/__init__.pyi +2 -2
  66. metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/ollama.pyi +2 -2
  67. metaflow-stubs/mf_extensions/outerbounds/plugins/snowflake/__init__.pyi +2 -2
  68. metaflow-stubs/mf_extensions/outerbounds/plugins/snowflake/snowflake.pyi +2 -2
  69. metaflow-stubs/mf_extensions/outerbounds/profilers/__init__.pyi +2 -2
  70. metaflow-stubs/mf_extensions/outerbounds/profilers/gpu.pyi +2 -2
  71. metaflow-stubs/mf_extensions/outerbounds/remote_config.pyi +2 -2
  72. metaflow-stubs/mf_extensions/outerbounds/toplevel/__init__.pyi +2 -2
  73. metaflow-stubs/mf_extensions/outerbounds/toplevel/global_aliases_for_metaflow_package.pyi +2 -2
  74. metaflow-stubs/multicore_utils.pyi +2 -2
  75. metaflow-stubs/parameters.pyi +4 -4
  76. metaflow-stubs/plugins/__init__.pyi +11 -11
  77. metaflow-stubs/plugins/airflow/__init__.pyi +2 -2
  78. metaflow-stubs/plugins/airflow/airflow_utils.pyi +2 -2
  79. metaflow-stubs/plugins/airflow/exception.pyi +2 -2
  80. metaflow-stubs/plugins/airflow/sensors/__init__.pyi +2 -2
  81. metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +2 -2
  82. metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +2 -2
  83. metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +2 -2
  84. metaflow-stubs/plugins/argo/__init__.pyi +2 -2
  85. metaflow-stubs/plugins/argo/argo_client.pyi +2 -2
  86. metaflow-stubs/plugins/argo/argo_events.pyi +2 -2
  87. metaflow-stubs/plugins/argo/argo_workflows.pyi +2 -2
  88. metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +3 -3
  89. metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +3 -3
  90. metaflow-stubs/plugins/argo/argo_workflows_deployer_objects.pyi +4 -4
  91. metaflow-stubs/plugins/aws/__init__.pyi +2 -2
  92. metaflow-stubs/plugins/aws/aws_client.pyi +2 -2
  93. metaflow-stubs/plugins/aws/aws_utils.pyi +2 -2
  94. metaflow-stubs/plugins/aws/batch/__init__.pyi +2 -2
  95. metaflow-stubs/plugins/aws/batch/batch.pyi +2 -2
  96. metaflow-stubs/plugins/aws/batch/batch_client.pyi +2 -2
  97. metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +2 -2
  98. metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +2 -2
  99. metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +3 -3
  100. metaflow-stubs/plugins/aws/step_functions/__init__.pyi +2 -2
  101. metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +2 -2
  102. metaflow-stubs/plugins/aws/step_functions/schedule_decorator.pyi +2 -2
  103. metaflow-stubs/plugins/aws/step_functions/step_functions.pyi +2 -2
  104. metaflow-stubs/plugins/aws/step_functions/step_functions_client.pyi +2 -2
  105. metaflow-stubs/plugins/aws/step_functions/step_functions_deployer.pyi +3 -3
  106. metaflow-stubs/plugins/aws/step_functions/step_functions_deployer_objects.pyi +3 -3
  107. metaflow-stubs/plugins/azure/__init__.pyi +2 -2
  108. metaflow-stubs/plugins/azure/azure_credential.pyi +2 -2
  109. metaflow-stubs/plugins/azure/azure_exceptions.pyi +2 -2
  110. metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +3 -3
  111. metaflow-stubs/plugins/azure/azure_utils.pyi +2 -2
  112. metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +2 -2
  113. metaflow-stubs/plugins/azure/includefile_support.pyi +2 -2
  114. metaflow-stubs/plugins/cards/__init__.pyi +2 -2
  115. metaflow-stubs/plugins/cards/card_client.pyi +2 -2
  116. metaflow-stubs/plugins/cards/card_creator.pyi +2 -2
  117. metaflow-stubs/plugins/cards/card_datastore.pyi +2 -2
  118. metaflow-stubs/plugins/cards/card_decorator.pyi +2 -2
  119. metaflow-stubs/plugins/cards/card_modules/__init__.pyi +2 -2
  120. metaflow-stubs/plugins/cards/card_modules/basic.pyi +3 -3
  121. metaflow-stubs/plugins/cards/card_modules/card.pyi +2 -2
  122. metaflow-stubs/plugins/cards/card_modules/components.pyi +3 -3
  123. metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +2 -2
  124. metaflow-stubs/plugins/cards/card_modules/renderer_tools.pyi +2 -2
  125. metaflow-stubs/plugins/cards/card_modules/test_cards.pyi +2 -2
  126. metaflow-stubs/plugins/cards/card_resolver.pyi +2 -2
  127. metaflow-stubs/plugins/cards/component_serializer.pyi +2 -2
  128. metaflow-stubs/plugins/cards/exception.pyi +2 -2
  129. metaflow-stubs/plugins/catch_decorator.pyi +2 -2
  130. metaflow-stubs/plugins/datatools/__init__.pyi +2 -2
  131. metaflow-stubs/plugins/datatools/local.pyi +2 -2
  132. metaflow-stubs/plugins/datatools/s3/__init__.pyi +2 -2
  133. metaflow-stubs/plugins/datatools/s3/s3.pyi +4 -4
  134. metaflow-stubs/plugins/datatools/s3/s3tail.pyi +2 -2
  135. metaflow-stubs/plugins/datatools/s3/s3util.pyi +2 -2
  136. metaflow-stubs/plugins/debug_logger.pyi +2 -2
  137. metaflow-stubs/plugins/debug_monitor.pyi +2 -2
  138. metaflow-stubs/plugins/environment_decorator.pyi +2 -2
  139. metaflow-stubs/plugins/events_decorator.pyi +2 -2
  140. metaflow-stubs/plugins/frameworks/__init__.pyi +2 -2
  141. metaflow-stubs/plugins/frameworks/pytorch.pyi +2 -2
  142. metaflow-stubs/plugins/gcp/__init__.pyi +2 -2
  143. metaflow-stubs/plugins/gcp/gcp_secret_manager_secrets_provider.pyi +3 -3
  144. metaflow-stubs/plugins/gcp/gs_exceptions.pyi +2 -2
  145. metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +2 -2
  146. metaflow-stubs/plugins/gcp/gs_utils.pyi +2 -2
  147. metaflow-stubs/plugins/gcp/includefile_support.pyi +2 -2
  148. metaflow-stubs/plugins/kubernetes/__init__.pyi +2 -2
  149. metaflow-stubs/plugins/kubernetes/kube_utils.pyi +2 -2
  150. metaflow-stubs/plugins/kubernetes/kubernetes.pyi +2 -2
  151. metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +2 -2
  152. metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +2 -2
  153. metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +2 -2
  154. metaflow-stubs/plugins/kubernetes/spot_monitor_sidecar.pyi +2 -2
  155. metaflow-stubs/plugins/ollama/__init__.pyi +2 -2
  156. metaflow-stubs/plugins/parallel_decorator.pyi +2 -2
  157. metaflow-stubs/plugins/perimeters.pyi +2 -2
  158. metaflow-stubs/plugins/project_decorator.pyi +2 -2
  159. metaflow-stubs/plugins/pypi/__init__.pyi +3 -3
  160. metaflow-stubs/plugins/pypi/conda_decorator.pyi +2 -2
  161. metaflow-stubs/plugins/pypi/conda_environment.pyi +3 -3
  162. metaflow-stubs/plugins/pypi/pypi_decorator.pyi +2 -2
  163. metaflow-stubs/plugins/pypi/pypi_environment.pyi +2 -2
  164. metaflow-stubs/plugins/pypi/utils.pyi +2 -2
  165. metaflow-stubs/plugins/resources_decorator.pyi +2 -2
  166. metaflow-stubs/plugins/retry_decorator.pyi +2 -2
  167. metaflow-stubs/plugins/secrets/__init__.pyi +3 -3
  168. metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +2 -2
  169. metaflow-stubs/plugins/secrets/secrets_decorator.pyi +2 -2
  170. metaflow-stubs/plugins/snowflake/__init__.pyi +2 -2
  171. metaflow-stubs/plugins/storage_executor.pyi +2 -2
  172. metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +3 -3
  173. metaflow-stubs/plugins/timeout_decorator.pyi +2 -2
  174. metaflow-stubs/profilers/__init__.pyi +2 -2
  175. metaflow-stubs/pylint_wrapper.pyi +2 -2
  176. metaflow-stubs/runner/__init__.pyi +2 -2
  177. metaflow-stubs/runner/deployer.pyi +4 -4
  178. metaflow-stubs/runner/deployer_impl.pyi +3 -3
  179. metaflow-stubs/runner/metaflow_runner.pyi +3 -3
  180. metaflow-stubs/runner/nbdeploy.pyi +2 -2
  181. metaflow-stubs/runner/nbrun.pyi +2 -2
  182. metaflow-stubs/runner/subprocess_manager.pyi +2 -2
  183. metaflow-stubs/runner/utils.pyi +3 -3
  184. metaflow-stubs/system/__init__.pyi +2 -2
  185. metaflow-stubs/system/system_logger.pyi +2 -2
  186. metaflow-stubs/system/system_monitor.pyi +2 -2
  187. metaflow-stubs/tagging_util.pyi +2 -2
  188. metaflow-stubs/tuple_util.pyi +2 -2
  189. metaflow-stubs/user_configs/__init__.pyi +2 -2
  190. metaflow-stubs/user_configs/config_decorators.pyi +5 -5
  191. metaflow-stubs/user_configs/config_options.pyi +3 -3
  192. metaflow-stubs/user_configs/config_parameters.pyi +6 -6
  193. {ob_metaflow_stubs-6.0.3.143.dist-info → ob_metaflow_stubs-6.0.3.144.dist-info}/METADATA +1 -1
  194. ob_metaflow_stubs-6.0.3.144.dist-info/RECORD +197 -0
  195. ob_metaflow_stubs-6.0.3.143.dist-info/RECORD +0 -197
  196. {ob_metaflow_stubs-6.0.3.143.dist-info → ob_metaflow_stubs-6.0.3.144.dist-info}/WHEEL +0 -0
  197. {ob_metaflow_stubs-6.0.3.143.dist-info → ob_metaflow_stubs-6.0.3.144.dist-info}/top_level.txt +0 -0
@@ -1,15 +1,15 @@
1
1
  ######################################################################################################
2
2
  # Auto-generated Metaflow stub file #
3
- # MF version: 2.14.0.1+obcheckpoint(0.1.8);ob(v1) #
4
- # Generated on 2025-02-17T23:51:59.842077 #
3
+ # MF version: 2.14.2.1+obcheckpoint(0.1.8);ob(v1) #
4
+ # Generated on 2025-02-21T20:43:13.534812 #
5
5
  ######################################################################################################
6
6
 
7
7
  from __future__ import annotations
8
8
 
9
9
  import typing
10
10
  if typing.TYPE_CHECKING:
11
- import typing
12
11
  import datetime
12
+ import typing
13
13
  FlowSpecDerived = typing.TypeVar("FlowSpecDerived", bound="FlowSpec", contravariant=False, covariant=False)
14
14
  StepFlag = typing.NewType("StepFlag", bool)
15
15
 
@@ -35,8 +35,8 @@ 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 cards as cards
39
38
  from . import tuple_util as tuple_util
39
+ from . import cards as cards
40
40
  from . import events as events
41
41
  from . import runner as runner
42
42
  from . import plugins as plugins
@@ -146,39 +146,6 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
146
146
  """
147
147
  ...
148
148
 
149
- def nim(*, models: "list[NIM]", backend: str, queue_timeout: int) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
150
- """
151
- This decorator is used to run NIM containers in Metaflow tasks as sidecars.
152
-
153
- User code call
154
- -----------
155
- @nim(
156
- models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
157
- backend='managed'
158
- )
159
-
160
- Valid backend options
161
- ---------------------
162
- - 'managed': Outerbounds selects a compute provider based on the model.
163
-
164
- Valid model options
165
- ----------------
166
- - 'meta/llama3-8b-instruct': 8B parameter model
167
- - 'meta/llama3-70b-instruct': 70B parameter model
168
- - any model here: https://nvcf.ngc.nvidia.com/functions?filter=nvidia-functions
169
-
170
-
171
- Parameters
172
- ----------
173
- models: list[NIM]
174
- List of NIM containers running models in sidecars.
175
- backend: str
176
- Compute provider to run the NIM container.
177
- queue_timeout : int
178
- Time to keep the job in NVCF's queue.
179
- """
180
- ...
181
-
182
149
  @typing.overload
183
150
  def model(*, load: typing.Union[typing.List[str], str, typing.List[typing.Tuple[str, typing.Optional[str]]]] = None, temp_dir_root: 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]]]:
184
151
  """
@@ -236,135 +203,38 @@ def model(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
236
203
  """
237
204
  ...
238
205
 
239
- def ollama(*, models: "list[Ollama]", backend: 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]]]:
240
- """
241
- This decorator is used to run Ollama APIs as Metaflow task sidecars.
242
-
243
- User code call
244
- -----------
245
- @ollama(
246
- models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
247
- backend='local'
248
- )
249
-
250
- Valid backend options
251
- ---------------------
252
- - 'local': Run as a separate process on the local task machine.
253
- - (TODO) 'managed': Outerbounds hosts and selects compute provider.
254
- - (TODO) 'remote': Spin up separate instance to serve Ollama models.
255
-
256
- Valid model options
257
- ----------------
258
- - 'llama3.2'
259
- - 'llama3.3'
260
- - any model here https://ollama.com/search
261
-
262
-
263
- Parameters
264
- ----------
265
- models: list[Ollama]
266
- List of Ollama containers running models in sidecars.
267
- backend: str
268
- Determines where and how to run the Ollama process.
269
- """
270
- ...
271
-
272
- @typing.overload
273
- def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
274
- """
275
- Internal decorator to support Fast bakery
276
- Parameters
277
- ----------
278
- """
279
- ...
280
-
281
- @typing.overload
282
- def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
283
- ...
284
-
285
- def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
286
- """
287
- Internal decorator to support Fast bakery
288
- Parameters
289
- ----------
290
- """
291
- ...
292
-
293
206
  @typing.overload
294
- 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]]]:
207
+ 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]]]:
295
208
  """
296
- Specifies a timeout for your step.
297
-
298
- This decorator is useful if this step may hang indefinitely.
299
-
300
- This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
301
- A timeout is considered to be an exception thrown by the step. It will cause the step to be
302
- retried if needed and the exception will be caught by the `@catch` decorator, if present.
303
-
304
- Note that all the values specified in parameters are added together so if you specify
305
- 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
209
+ Specifies secrets to be retrieved and injected as environment variables prior to
210
+ the execution of a step.
306
211
 
307
212
 
308
213
  Parameters
309
214
  ----------
310
- seconds : int, default 0
311
- Number of seconds to wait prior to timing out.
312
- minutes : int, default 0
313
- Number of minutes to wait prior to timing out.
314
- hours : int, default 0
315
- Number of hours to wait prior to timing out.
215
+ sources : List[Union[str, Dict[str, Any]]], default: []
216
+ List of secret specs, defining how the secrets are to be retrieved
316
217
  """
317
218
  ...
318
219
 
319
220
  @typing.overload
320
- def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
221
+ def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
321
222
  ...
322
223
 
323
224
  @typing.overload
324
- def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
225
+ def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
325
226
  ...
326
227
 
327
- 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):
228
+ 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]]] = []):
328
229
  """
329
- Specifies a timeout for your step.
330
-
331
- This decorator is useful if this step may hang indefinitely.
332
-
333
- This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
334
- A timeout is considered to be an exception thrown by the step. It will cause the step to be
335
- retried if needed and the exception will be caught by the `@catch` decorator, if present.
336
-
337
- Note that all the values specified in parameters are added together so if you specify
338
- 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
230
+ Specifies secrets to be retrieved and injected as environment variables prior to
231
+ the execution of a step.
339
232
 
340
233
 
341
234
  Parameters
342
235
  ----------
343
- seconds : int, default 0
344
- Number of seconds to wait prior to timing out.
345
- minutes : int, default 0
346
- Number of minutes to wait prior to timing out.
347
- hours : int, default 0
348
- Number of hours to wait prior to timing out.
349
- """
350
- ...
351
-
352
- @typing.overload
353
- def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
354
- """
355
- Parameters
356
- ----------
357
- """
358
- ...
359
-
360
- @typing.overload
361
- def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
362
- ...
363
-
364
- def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
365
- """
366
- Parameters
367
- ----------
236
+ sources : List[Union[str, Dict[str, Any]]], default: []
237
+ List of secret specs, defining how the secrets are to be retrieved
368
238
  """
369
239
  ...
370
240
 
@@ -445,101 +315,6 @@ def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: ty
445
315
  """
446
316
  ...
447
317
 
448
- def nvidia(*, gpu: int, gpu_type: str, queue_timeout: int) -> 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]]]:
449
- """
450
- Specifies that this step should execute on DGX cloud.
451
-
452
-
453
- Parameters
454
- ----------
455
- gpu : int
456
- Number of GPUs to use.
457
- gpu_type : str
458
- Type of Nvidia GPU to use.
459
- queue_timeout : int
460
- Time to keep the job in NVCF's queue.
461
- """
462
- ...
463
-
464
- @typing.overload
465
- 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]]]:
466
- """
467
- Specifies the resources needed when executing this step.
468
-
469
- Use `@resources` to specify the resource requirements
470
- independently of the specific compute layer (`@batch`, `@kubernetes`).
471
-
472
- You can choose the compute layer on the command line by executing e.g.
473
- ```
474
- python myflow.py run --with batch
475
- ```
476
- or
477
- ```
478
- python myflow.py run --with kubernetes
479
- ```
480
- which executes the flow on the desired system using the
481
- requirements specified in `@resources`.
482
-
483
-
484
- Parameters
485
- ----------
486
- cpu : int, default 1
487
- Number of CPUs required for this step.
488
- gpu : int, optional, default None
489
- Number of GPUs required for this step.
490
- disk : int, optional, default None
491
- Disk size (in MB) required for this step. Only applies on Kubernetes.
492
- memory : int, default 4096
493
- Memory size (in MB) required for this step.
494
- shared_memory : int, optional, default None
495
- The value for the size (in MiB) of the /dev/shm volume for this step.
496
- This parameter maps to the `--shm-size` option in Docker.
497
- """
498
- ...
499
-
500
- @typing.overload
501
- def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
502
- ...
503
-
504
- @typing.overload
505
- def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
506
- ...
507
-
508
- 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):
509
- """
510
- Specifies the resources needed when executing this step.
511
-
512
- Use `@resources` to specify the resource requirements
513
- independently of the specific compute layer (`@batch`, `@kubernetes`).
514
-
515
- You can choose the compute layer on the command line by executing e.g.
516
- ```
517
- python myflow.py run --with batch
518
- ```
519
- or
520
- ```
521
- python myflow.py run --with kubernetes
522
- ```
523
- which executes the flow on the desired system using the
524
- requirements specified in `@resources`.
525
-
526
-
527
- Parameters
528
- ----------
529
- cpu : int, default 1
530
- Number of CPUs required for this step.
531
- gpu : int, optional, default None
532
- Number of GPUs required for this step.
533
- disk : int, optional, default None
534
- Disk size (in MB) required for this step. Only applies on Kubernetes.
535
- memory : int, default 4096
536
- Memory size (in MB) required for this step.
537
- shared_memory : int, optional, default None
538
- The value for the size (in MiB) of the /dev/shm volume for this step.
539
- This parameter maps to the `--shm-size` option in Docker.
540
- """
541
- ...
542
-
543
318
  @typing.overload
544
319
  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]]]:
545
320
  """
@@ -574,53 +349,141 @@ def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], Non
574
349
  ...
575
350
 
576
351
  @typing.overload
577
- 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]]]:
352
+ 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]]]:
578
353
  """
579
- Specifies that the step will success under all circumstances.
354
+ Specifies the Conda environment for the step.
580
355
 
581
- The decorator will create an optional artifact, specified by `var`, which
582
- contains the exception raised. You can use it to detect the presence
583
- of errors, indicating that all happy-path artifacts produced by the step
584
- are missing.
356
+ Information in this decorator will augment any
357
+ attributes set in the `@conda_base` flow-level decorator. Hence,
358
+ you can use `@conda_base` to set packages required by all
359
+ steps and use `@conda` to specify step-specific overrides.
585
360
 
586
361
 
587
362
  Parameters
588
363
  ----------
589
- var : str, optional, default None
590
- Name of the artifact in which to store the caught exception.
591
- If not specified, the exception is not stored.
592
- print_exception : bool, default True
593
- Determines whether or not the exception is printed to
594
- stdout when caught.
364
+ packages : Dict[str, str], default {}
365
+ Packages to use for this step. The key is the name of the package
366
+ and the value is the version to use.
367
+ libraries : Dict[str, str], default {}
368
+ Supported for backward compatibility. When used with packages, packages will take precedence.
369
+ python : str, optional, default None
370
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
371
+ that the version used will correspond to the version of the Python interpreter used to start the run.
372
+ disabled : bool, default False
373
+ If set to True, disables @conda.
595
374
  """
596
375
  ...
597
376
 
598
377
  @typing.overload
599
- def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
378
+ def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
600
379
  ...
601
380
 
602
381
  @typing.overload
603
- def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
382
+ def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
604
383
  ...
605
384
 
606
- 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):
385
+ 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):
607
386
  """
608
- Specifies that the step will success under all circumstances.
387
+ Specifies the Conda environment for the step.
609
388
 
610
- The decorator will create an optional artifact, specified by `var`, which
611
- contains the exception raised. You can use it to detect the presence
612
- of errors, indicating that all happy-path artifacts produced by the step
613
- are missing.
389
+ Information in this decorator will augment any
390
+ attributes set in the `@conda_base` flow-level decorator. Hence,
391
+ you can use `@conda_base` to set packages required by all
392
+ steps and use `@conda` to specify step-specific overrides.
614
393
 
615
394
 
616
395
  Parameters
617
396
  ----------
618
- var : str, optional, default None
619
- Name of the artifact in which to store the caught exception.
620
- If not specified, the exception is not stored.
621
- print_exception : bool, default True
622
- Determines whether or not the exception is printed to
623
- stdout when caught.
397
+ packages : Dict[str, str], default {}
398
+ Packages to use for this step. The key is the name of the package
399
+ and the value is the version to use.
400
+ libraries : Dict[str, str], default {}
401
+ Supported for backward compatibility. When used with packages, packages will take precedence.
402
+ python : str, optional, default None
403
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
404
+ that the version used will correspond to the version of the Python interpreter used to start the run.
405
+ disabled : bool, default False
406
+ If set to True, disables @conda.
407
+ """
408
+ ...
409
+
410
+ @typing.overload
411
+ 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]]]:
412
+ """
413
+ Specifies the number of times the task corresponding
414
+ to a step needs to be retried.
415
+
416
+ This decorator is useful for handling transient errors, such as networking issues.
417
+ If your task contains operations that can't be retried safely, e.g. database updates,
418
+ it is advisable to annotate it with `@retry(times=0)`.
419
+
420
+ This can be used in conjunction with the `@catch` decorator. The `@catch`
421
+ decorator will execute a no-op task after all retries have been exhausted,
422
+ ensuring that the flow execution can continue.
423
+
424
+
425
+ Parameters
426
+ ----------
427
+ times : int, default 3
428
+ Number of times to retry this task.
429
+ minutes_between_retries : int, default 2
430
+ Number of minutes between retries.
431
+ """
432
+ ...
433
+
434
+ @typing.overload
435
+ def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
436
+ ...
437
+
438
+ @typing.overload
439
+ def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
440
+ ...
441
+
442
+ 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):
443
+ """
444
+ Specifies the number of times the task corresponding
445
+ to a step needs to be retried.
446
+
447
+ This decorator is useful for handling transient errors, such as networking issues.
448
+ If your task contains operations that can't be retried safely, e.g. database updates,
449
+ it is advisable to annotate it with `@retry(times=0)`.
450
+
451
+ This can be used in conjunction with the `@catch` decorator. The `@catch`
452
+ decorator will execute a no-op task after all retries have been exhausted,
453
+ ensuring that the flow execution can continue.
454
+
455
+
456
+ Parameters
457
+ ----------
458
+ times : int, default 3
459
+ Number of times to retry this task.
460
+ minutes_between_retries : int, default 2
461
+ Number of minutes between retries.
462
+ """
463
+ ...
464
+
465
+ def huggingface_hub(*, temp_dir_root: typing.Optional[str] = None, load: typing.Union[typing.List[str], typing.List[typing.Tuple[typing.Dict, str]], typing.List[typing.Tuple[str, str]], typing.List[typing.Dict], 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]]]:
466
+ """
467
+ Decorator that helps cache, version and store models/datasets from huggingface hub.
468
+
469
+
470
+ Parameters
471
+ ----------
472
+ temp_dir_root : str, optional
473
+ The root directory that will hold the temporary directory where objects will be downloaded.
474
+
475
+ load: Union[List[str], List[Tuple[Dict, str]], List[Tuple[str, str]], List[Dict], None]
476
+ The list of repos (models/datasets) to load.
477
+
478
+ Loaded repos can be accessed via `current.huggingface_hub.loaded`. If load is set, then the following happens:
479
+
480
+ - If repo (model/dataset) is not found in the datastore:
481
+ - Downloads the repo from Hugging Face Hub to a temporary directory (or uses specified path) for local access
482
+ - Stores it in Metaflow's datastore (s3/gcs/azure etc.) with a unique name based on repo_type/repo_id
483
+ - All HF models loaded for a `@step` will be cached separately under flow/step/namespace.
484
+
485
+ - If repo is found in the datastore:
486
+ - Loads it directly from datastore to local path (can be temporary directory or specified path)
624
487
  """
625
488
  ...
626
489
 
@@ -673,28 +536,218 @@ def card(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typ
673
536
  """
674
537
  ...
675
538
 
676
- def huggingface_hub(*, temp_dir_root: typing.Optional[str] = None, load: typing.Union[typing.List[str], typing.List[typing.Tuple[typing.Dict, str]], typing.List[typing.Tuple[str, str]], typing.List[typing.Dict], 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]]]:
539
+ def ollama(*, models: "list[Ollama]", backend: 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]]]:
677
540
  """
678
- Decorator that helps cache, version and store models/datasets from huggingface hub.
541
+ This decorator is used to run Ollama APIs as Metaflow task sidecars.
542
+
543
+ User code call
544
+ -----------
545
+ @ollama(
546
+ models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
547
+ backend='local'
548
+ )
549
+
550
+ Valid backend options
551
+ ---------------------
552
+ - 'local': Run as a separate process on the local task machine.
553
+ - (TODO) 'managed': Outerbounds hosts and selects compute provider.
554
+ - (TODO) 'remote': Spin up separate instance to serve Ollama models.
555
+
556
+ Valid model options
557
+ ----------------
558
+ - 'llama3.2'
559
+ - 'llama3.3'
560
+ - any model here https://ollama.com/search
679
561
 
680
562
 
681
563
  Parameters
682
564
  ----------
683
- temp_dir_root : str, optional
684
- The root directory that will hold the temporary directory where objects will be downloaded.
565
+ models: list[Ollama]
566
+ List of Ollama containers running models in sidecars.
567
+ backend: str
568
+ Determines where and how to run the Ollama process.
569
+ """
570
+ ...
571
+
572
+ @typing.overload
573
+ def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
574
+ """
575
+ Parameters
576
+ ----------
577
+ """
578
+ ...
579
+
580
+ @typing.overload
581
+ def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
582
+ ...
583
+
584
+ def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
585
+ """
586
+ Parameters
587
+ ----------
588
+ """
589
+ ...
590
+
591
+ @typing.overload
592
+ 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]]]:
593
+ """
594
+ Specifies the resources needed when executing this step.
685
595
 
686
- load: Union[List[str], List[Tuple[Dict, str]], List[Tuple[str, str]], List[Dict], None]
687
- The list of repos (models/datasets) to load.
596
+ Use `@resources` to specify the resource requirements
597
+ independently of the specific compute layer (`@batch`, `@kubernetes`).
688
598
 
689
- Loaded repos can be accessed via `current.huggingface_hub.loaded`. If load is set, then the following happens:
599
+ You can choose the compute layer on the command line by executing e.g.
600
+ ```
601
+ python myflow.py run --with batch
602
+ ```
603
+ or
604
+ ```
605
+ python myflow.py run --with kubernetes
606
+ ```
607
+ which executes the flow on the desired system using the
608
+ requirements specified in `@resources`.
690
609
 
691
- - If repo (model/dataset) is not found in the datastore:
692
- - Downloads the repo from Hugging Face Hub to a temporary directory (or uses specified path) for local access
693
- - Stores it in Metaflow's datastore (s3/gcs/azure etc.) with a unique name based on repo_type/repo_id
694
- - All HF models loaded for a `@step` will be cached separately under flow/step/namespace.
695
610
 
696
- - If repo is found in the datastore:
697
- - Loads it directly from datastore to local path (can be temporary directory or specified path)
611
+ Parameters
612
+ ----------
613
+ cpu : int, default 1
614
+ Number of CPUs required for this step.
615
+ gpu : int, optional, default None
616
+ Number of GPUs required for this step.
617
+ disk : int, optional, default None
618
+ Disk size (in MB) required for this step. Only applies on Kubernetes.
619
+ memory : int, default 4096
620
+ Memory size (in MB) required for this step.
621
+ shared_memory : int, optional, default None
622
+ The value for the size (in MiB) of the /dev/shm volume for this step.
623
+ This parameter maps to the `--shm-size` option in Docker.
624
+ """
625
+ ...
626
+
627
+ @typing.overload
628
+ def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
629
+ ...
630
+
631
+ @typing.overload
632
+ def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
633
+ ...
634
+
635
+ 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):
636
+ """
637
+ Specifies the resources needed when executing this step.
638
+
639
+ Use `@resources` to specify the resource requirements
640
+ independently of the specific compute layer (`@batch`, `@kubernetes`).
641
+
642
+ You can choose the compute layer on the command line by executing e.g.
643
+ ```
644
+ python myflow.py run --with batch
645
+ ```
646
+ or
647
+ ```
648
+ python myflow.py run --with kubernetes
649
+ ```
650
+ which executes the flow on the desired system using the
651
+ requirements specified in `@resources`.
652
+
653
+
654
+ Parameters
655
+ ----------
656
+ cpu : int, default 1
657
+ Number of CPUs required for this step.
658
+ gpu : int, optional, default None
659
+ Number of GPUs required for this step.
660
+ disk : int, optional, default None
661
+ Disk size (in MB) required for this step. Only applies on Kubernetes.
662
+ memory : int, default 4096
663
+ Memory size (in MB) required for this step.
664
+ shared_memory : int, optional, default None
665
+ The value for the size (in MiB) of the /dev/shm volume for this step.
666
+ This parameter maps to the `--shm-size` option in Docker.
667
+ """
668
+ ...
669
+
670
+ @typing.overload
671
+ 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]]]:
672
+ """
673
+ Specifies that the step will success under all circumstances.
674
+
675
+ The decorator will create an optional artifact, specified by `var`, which
676
+ contains the exception raised. You can use it to detect the presence
677
+ of errors, indicating that all happy-path artifacts produced by the step
678
+ are missing.
679
+
680
+
681
+ Parameters
682
+ ----------
683
+ var : str, optional, default None
684
+ Name of the artifact in which to store the caught exception.
685
+ If not specified, the exception is not stored.
686
+ print_exception : bool, default True
687
+ Determines whether or not the exception is printed to
688
+ stdout when caught.
689
+ """
690
+ ...
691
+
692
+ @typing.overload
693
+ def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
694
+ ...
695
+
696
+ @typing.overload
697
+ def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
698
+ ...
699
+
700
+ 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):
701
+ """
702
+ Specifies that the step will success under all circumstances.
703
+
704
+ The decorator will create an optional artifact, specified by `var`, which
705
+ contains the exception raised. You can use it to detect the presence
706
+ of errors, indicating that all happy-path artifacts produced by the step
707
+ are missing.
708
+
709
+
710
+ Parameters
711
+ ----------
712
+ var : str, optional, default None
713
+ Name of the artifact in which to store the caught exception.
714
+ If not specified, the exception is not stored.
715
+ print_exception : bool, default True
716
+ Determines whether or not the exception is printed to
717
+ stdout when caught.
718
+ """
719
+ ...
720
+
721
+ def nim(*, models: "list[NIM]", backend: str, queue_timeout: int) -> 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]]]:
722
+ """
723
+ This decorator is used to run NIM containers in Metaflow tasks as sidecars.
724
+
725
+ User code call
726
+ -----------
727
+ @nim(
728
+ models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
729
+ backend='managed'
730
+ )
731
+
732
+ Valid backend options
733
+ ---------------------
734
+ - 'managed': Outerbounds selects a compute provider based on the model.
735
+
736
+ Valid model options
737
+ ----------------
738
+ - 'meta/llama3-8b-instruct': 8B parameter model
739
+ - 'meta/llama3-70b-instruct': 70B parameter model
740
+ - any model here: https://nvcf.ngc.nvidia.com/functions?filter=nvidia-functions
741
+
742
+
743
+ Parameters
744
+ ----------
745
+ models: list[NIM]
746
+ List of NIM containers running models in sidecars.
747
+ backend: str
748
+ Compute provider to run the NIM container.
749
+ queue_timeout : int
750
+ Time to keep the job in NVCF's queue.
698
751
  """
699
752
  ...
700
753
 
@@ -750,151 +803,98 @@ def pypi(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typ
750
803
  ...
751
804
 
752
805
  @typing.overload
753
- 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]]]:
806
+ def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
754
807
  """
755
- Specifies secrets to be retrieved and injected as environment variables prior to
756
- the execution of a step.
757
-
758
-
808
+ Internal decorator to support Fast bakery
759
809
  Parameters
760
810
  ----------
761
- sources : List[Union[str, Dict[str, Any]]], default: []
762
- List of secret specs, defining how the secrets are to be retrieved
763
811
  """
764
812
  ...
765
813
 
766
814
  @typing.overload
767
- def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
768
- ...
769
-
770
- @typing.overload
771
- def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
815
+ def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
772
816
  ...
773
817
 
774
- 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]]] = []):
818
+ def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
775
819
  """
776
- Specifies secrets to be retrieved and injected as environment variables prior to
777
- the execution of a step.
778
-
779
-
820
+ Internal decorator to support Fast bakery
780
821
  Parameters
781
822
  ----------
782
- sources : List[Union[str, Dict[str, Any]]], default: []
783
- List of secret specs, defining how the secrets are to be retrieved
784
823
  """
785
824
  ...
786
825
 
787
- @typing.overload
788
- 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]]]:
826
+ def nvidia(*, gpu: int, gpu_type: str, queue_timeout: int) -> 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]]]:
789
827
  """
790
- Specifies the number of times the task corresponding
791
- to a step needs to be retried.
792
-
793
- This decorator is useful for handling transient errors, such as networking issues.
794
- If your task contains operations that can't be retried safely, e.g. database updates,
795
- it is advisable to annotate it with `@retry(times=0)`.
796
-
797
- This can be used in conjunction with the `@catch` decorator. The `@catch`
798
- decorator will execute a no-op task after all retries have been exhausted,
799
- ensuring that the flow execution can continue.
828
+ Specifies that this step should execute on DGX cloud.
800
829
 
801
830
 
802
831
  Parameters
803
832
  ----------
804
- times : int, default 3
805
- Number of times to retry this task.
806
- minutes_between_retries : int, default 2
807
- Number of minutes between retries.
833
+ gpu : int
834
+ Number of GPUs to use.
835
+ gpu_type : str
836
+ Type of Nvidia GPU to use.
837
+ queue_timeout : int
838
+ Time to keep the job in NVCF's queue.
808
839
  """
809
840
  ...
810
841
 
811
842
  @typing.overload
812
- def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
813
- ...
814
-
815
- @typing.overload
816
- def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
817
- ...
818
-
819
- 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):
843
+ 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]]]:
820
844
  """
821
- Specifies the number of times the task corresponding
822
- to a step needs to be retried.
823
-
824
- This decorator is useful for handling transient errors, such as networking issues.
825
- If your task contains operations that can't be retried safely, e.g. database updates,
826
- it is advisable to annotate it with `@retry(times=0)`.
827
-
828
- This can be used in conjunction with the `@catch` decorator. The `@catch`
829
- decorator will execute a no-op task after all retries have been exhausted,
830
- ensuring that the flow execution can continue.
845
+ Specifies a timeout for your step.
831
846
 
847
+ This decorator is useful if this step may hang indefinitely.
832
848
 
833
- Parameters
834
- ----------
835
- times : int, default 3
836
- Number of times to retry this task.
837
- minutes_between_retries : int, default 2
838
- Number of minutes between retries.
839
- """
840
- ...
841
-
842
- @typing.overload
843
- 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]]]:
844
- """
845
- Specifies the Conda environment for the step.
849
+ This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
850
+ A timeout is considered to be an exception thrown by the step. It will cause the step to be
851
+ retried if needed and the exception will be caught by the `@catch` decorator, if present.
846
852
 
847
- Information in this decorator will augment any
848
- attributes set in the `@conda_base` flow-level decorator. Hence,
849
- you can use `@conda_base` to set packages required by all
850
- steps and use `@conda` to specify step-specific overrides.
853
+ Note that all the values specified in parameters are added together so if you specify
854
+ 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
851
855
 
852
856
 
853
857
  Parameters
854
858
  ----------
855
- packages : Dict[str, str], default {}
856
- Packages to use for this step. The key is the name of the package
857
- and the value is the version to use.
858
- libraries : Dict[str, str], default {}
859
- Supported for backward compatibility. When used with packages, packages will take precedence.
860
- python : str, optional, default None
861
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
862
- that the version used will correspond to the version of the Python interpreter used to start the run.
863
- disabled : bool, default False
864
- If set to True, disables @conda.
859
+ seconds : int, default 0
860
+ Number of seconds to wait prior to timing out.
861
+ minutes : int, default 0
862
+ Number of minutes to wait prior to timing out.
863
+ hours : int, default 0
864
+ Number of hours to wait prior to timing out.
865
865
  """
866
866
  ...
867
867
 
868
868
  @typing.overload
869
- def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
869
+ def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
870
870
  ...
871
871
 
872
872
  @typing.overload
873
- def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
873
+ def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
874
874
  ...
875
875
 
876
- 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):
876
+ 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):
877
877
  """
878
- Specifies the Conda environment for the step.
878
+ Specifies a timeout for your step.
879
879
 
880
- Information in this decorator will augment any
881
- attributes set in the `@conda_base` flow-level decorator. Hence,
882
- you can use `@conda_base` to set packages required by all
883
- steps and use `@conda` to specify step-specific overrides.
880
+ This decorator is useful if this step may hang indefinitely.
881
+
882
+ This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
883
+ A timeout is considered to be an exception thrown by the step. It will cause the step to be
884
+ retried if needed and the exception will be caught by the `@catch` decorator, if present.
885
+
886
+ Note that all the values specified in parameters are added together so if you specify
887
+ 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
884
888
 
885
889
 
886
890
  Parameters
887
891
  ----------
888
- packages : Dict[str, str], default {}
889
- Packages to use for this step. The key is the name of the package
890
- and the value is the version to use.
891
- libraries : Dict[str, str], default {}
892
- Supported for backward compatibility. When used with packages, packages will take precedence.
893
- python : str, optional, default None
894
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
895
- that the version used will correspond to the version of the Python interpreter used to start the run.
896
- disabled : bool, default False
897
- If set to True, disables @conda.
892
+ seconds : int, default 0
893
+ Number of seconds to wait prior to timing out.
894
+ minutes : int, default 0
895
+ Number of minutes to wait prior to timing out.
896
+ hours : int, default 0
897
+ Number of hours to wait prior to timing out.
898
898
  """
899
899
  ...
900
900
 
@@ -996,106 +996,13 @@ def schedule(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, hourly:
996
996
  daily : bool, default True
997
997
  Run the workflow daily.
998
998
  weekly : bool, default False
999
- Run the workflow weekly.
1000
- cron : str, optional, default None
1001
- Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1002
- specified by this expression.
1003
- timezone : str, optional, default None
1004
- Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1005
- which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1006
- """
1007
- ...
1008
-
1009
- @typing.overload
1010
- 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]]:
1011
- """
1012
- Specifies the event(s) that this flow depends on.
1013
-
1014
- ```
1015
- @trigger(event='foo')
1016
- ```
1017
- or
1018
- ```
1019
- @trigger(events=['foo', 'bar'])
1020
- ```
1021
-
1022
- Additionally, you can specify the parameter mappings
1023
- to map event payload to Metaflow parameters for the flow.
1024
- ```
1025
- @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1026
- ```
1027
- or
1028
- ```
1029
- @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1030
- {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1031
- ```
1032
-
1033
- 'parameters' can also be a list of strings and tuples like so:
1034
- ```
1035
- @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1036
- ```
1037
- This is equivalent to:
1038
- ```
1039
- @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1040
- ```
1041
-
1042
-
1043
- Parameters
1044
- ----------
1045
- event : Union[str, Dict[str, Any]], optional, default None
1046
- Event dependency for this flow.
1047
- events : List[Union[str, Dict[str, Any]]], default []
1048
- Events dependency 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(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1056
- ...
1057
-
1058
- 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] = {}):
1059
- """
1060
- Specifies the event(s) that this flow depends on.
1061
-
1062
- ```
1063
- @trigger(event='foo')
1064
- ```
1065
- or
1066
- ```
1067
- @trigger(events=['foo', 'bar'])
1068
- ```
1069
-
1070
- Additionally, you can specify the parameter mappings
1071
- to map event payload to Metaflow parameters for the flow.
1072
- ```
1073
- @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1074
- ```
1075
- or
1076
- ```
1077
- @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1078
- {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1079
- ```
1080
-
1081
- 'parameters' can also be a list of strings and tuples like so:
1082
- ```
1083
- @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1084
- ```
1085
- This is equivalent to:
1086
- ```
1087
- @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1088
- ```
1089
-
1090
-
1091
- Parameters
1092
- ----------
1093
- event : Union[str, Dict[str, Any]], optional, default None
1094
- Event dependency for this flow.
1095
- events : List[Union[str, Dict[str, Any]]], default []
1096
- Events dependency for this flow.
1097
- options : Dict[str, Any], default {}
1098
- Backend-specific configuration for tuning eventing behavior.
999
+ Run the workflow weekly.
1000
+ cron : str, optional, default None
1001
+ Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1002
+ specified by this expression.
1003
+ timezone : str, optional, default None
1004
+ Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1005
+ which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1099
1006
  """
1100
1007
  ...
1101
1008
 
@@ -1150,49 +1057,6 @@ def conda_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packa
1150
1057
  """
1151
1058
  ...
1152
1059
 
1153
- 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]]:
1154
- """
1155
- 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)
1156
- before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
1157
- and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
1158
- added as a flow decorators. Adding more than one decorator will ensure that `start` step
1159
- starts only after all sensors finish.
1160
-
1161
-
1162
- Parameters
1163
- ----------
1164
- timeout : int
1165
- Time, in seconds before the task times out and fails. (Default: 3600)
1166
- poke_interval : int
1167
- Time in seconds that the job should wait in between each try. (Default: 60)
1168
- mode : str
1169
- How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1170
- exponential_backoff : bool
1171
- allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1172
- pool : str
1173
- the slot pool this task should run in,
1174
- slot pools are a way to limit concurrency for certain tasks. (Default:None)
1175
- soft_fail : bool
1176
- Set to true to mark the task as SKIPPED on failure. (Default: False)
1177
- name : str
1178
- Name of the sensor on Airflow
1179
- description : str
1180
- Description of sensor in the Airflow UI
1181
- bucket_key : Union[str, List[str]]
1182
- The key(s) being waited on. Supports full s3:// style url or relative path from root level.
1183
- When it's specified as a full s3:// url, please leave `bucket_name` as None
1184
- bucket_name : str
1185
- Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
1186
- When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
1187
- wildcard_match : bool
1188
- whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
1189
- aws_conn_id : str
1190
- a reference to the s3 connection on Airflow. (Default: None)
1191
- verify : bool
1192
- Whether or not to verify SSL certificates for S3 connection. (Default: None)
1193
- """
1194
- ...
1195
-
1196
1060
  @typing.overload
1197
1061
  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]]:
1198
1062
  """
@@ -1294,6 +1158,99 @@ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *
1294
1158
  """
1295
1159
  ...
1296
1160
 
1161
+ @typing.overload
1162
+ 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]]:
1163
+ """
1164
+ Specifies the event(s) that this flow depends on.
1165
+
1166
+ ```
1167
+ @trigger(event='foo')
1168
+ ```
1169
+ or
1170
+ ```
1171
+ @trigger(events=['foo', 'bar'])
1172
+ ```
1173
+
1174
+ Additionally, you can specify the parameter mappings
1175
+ to map event payload to Metaflow parameters for the flow.
1176
+ ```
1177
+ @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1178
+ ```
1179
+ or
1180
+ ```
1181
+ @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1182
+ {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1183
+ ```
1184
+
1185
+ 'parameters' can also be a list of strings and tuples like so:
1186
+ ```
1187
+ @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1188
+ ```
1189
+ This is equivalent to:
1190
+ ```
1191
+ @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1192
+ ```
1193
+
1194
+
1195
+ Parameters
1196
+ ----------
1197
+ event : Union[str, Dict[str, Any]], optional, default None
1198
+ Event dependency for this flow.
1199
+ events : List[Union[str, Dict[str, Any]]], default []
1200
+ Events dependency for this flow.
1201
+ options : Dict[str, Any], default {}
1202
+ Backend-specific configuration for tuning eventing behavior.
1203
+ """
1204
+ ...
1205
+
1206
+ @typing.overload
1207
+ def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1208
+ ...
1209
+
1210
+ 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] = {}):
1211
+ """
1212
+ Specifies the event(s) that this flow depends on.
1213
+
1214
+ ```
1215
+ @trigger(event='foo')
1216
+ ```
1217
+ or
1218
+ ```
1219
+ @trigger(events=['foo', 'bar'])
1220
+ ```
1221
+
1222
+ Additionally, you can specify the parameter mappings
1223
+ to map event payload to Metaflow parameters for the flow.
1224
+ ```
1225
+ @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1226
+ ```
1227
+ or
1228
+ ```
1229
+ @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1230
+ {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1231
+ ```
1232
+
1233
+ 'parameters' can also be a list of strings and tuples like so:
1234
+ ```
1235
+ @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1236
+ ```
1237
+ This is equivalent to:
1238
+ ```
1239
+ @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1240
+ ```
1241
+
1242
+
1243
+ Parameters
1244
+ ----------
1245
+ event : Union[str, Dict[str, Any]], optional, default None
1246
+ Event dependency for this flow.
1247
+ events : List[Union[str, Dict[str, Any]]], default []
1248
+ Events dependency for this flow.
1249
+ options : Dict[str, Any], default {}
1250
+ Backend-specific configuration for tuning eventing behavior.
1251
+ """
1252
+ ...
1253
+
1297
1254
  @typing.overload
1298
1255
  def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1299
1256
  """
@@ -1335,6 +1292,84 @@ def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packag
1335
1292
  """
1336
1293
  ...
1337
1294
 
1295
+ def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1296
+ """
1297
+ Specifies what flows belong to the same project.
1298
+
1299
+ A project-specific namespace is created for all flows that
1300
+ use the same `@project(name)`.
1301
+
1302
+
1303
+ Parameters
1304
+ ----------
1305
+ name : str
1306
+ Project name. Make sure that the name is unique amongst all
1307
+ projects that use the same production scheduler. The name may
1308
+ contain only lowercase alphanumeric characters and underscores.
1309
+
1310
+ branch : Optional[str], default None
1311
+ The branch to use. If not specified, the branch is set to
1312
+ `user.<username>` unless `production` is set to `True`. This can
1313
+ also be set on the command line using `--branch` as a top-level option.
1314
+ It is an error to specify `branch` in the decorator and on the command line.
1315
+
1316
+ production : bool, default False
1317
+ Whether or not the branch is the production branch. This can also be set on the
1318
+ command line using `--production` as a top-level option. It is an error to specify
1319
+ `production` in the decorator and on the command line.
1320
+ The project branch name will be:
1321
+ - if `branch` is specified:
1322
+ - if `production` is True: `prod.<branch>`
1323
+ - if `production` is False: `test.<branch>`
1324
+ - if `branch` is not specified:
1325
+ - if `production` is True: `prod`
1326
+ - if `production` is False: `user.<username>`
1327
+ """
1328
+ ...
1329
+
1330
+ 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]]:
1331
+ """
1332
+ 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)
1333
+ before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
1334
+ and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
1335
+ added as a flow decorators. Adding more than one decorator will ensure that `start` step
1336
+ starts only after all sensors finish.
1337
+
1338
+
1339
+ Parameters
1340
+ ----------
1341
+ timeout : int
1342
+ Time, in seconds before the task times out and fails. (Default: 3600)
1343
+ poke_interval : int
1344
+ Time in seconds that the job should wait in between each try. (Default: 60)
1345
+ mode : str
1346
+ How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1347
+ exponential_backoff : bool
1348
+ allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1349
+ pool : str
1350
+ the slot pool this task should run in,
1351
+ slot pools are a way to limit concurrency for certain tasks. (Default:None)
1352
+ soft_fail : bool
1353
+ Set to true to mark the task as SKIPPED on failure. (Default: False)
1354
+ name : str
1355
+ Name of the sensor on Airflow
1356
+ description : str
1357
+ Description of sensor in the Airflow UI
1358
+ bucket_key : Union[str, List[str]]
1359
+ The key(s) being waited on. Supports full s3:// style url or relative path from root level.
1360
+ When it's specified as a full s3:// url, please leave `bucket_name` as None
1361
+ bucket_name : str
1362
+ Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
1363
+ When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
1364
+ wildcard_match : bool
1365
+ whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
1366
+ aws_conn_id : str
1367
+ a reference to the s3 connection on Airflow. (Default: None)
1368
+ verify : bool
1369
+ Whether or not to verify SSL certificates for S3 connection. (Default: None)
1370
+ """
1371
+ ...
1372
+
1338
1373
  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]]:
1339
1374
  """
1340
1375
  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.
@@ -1378,40 +1413,5 @@ def airflow_external_task_sensor(*, timeout: int, poke_interval: int, mode: str,
1378
1413
  """
1379
1414
  ...
1380
1415
 
1381
- def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1382
- """
1383
- Specifies what flows belong to the same project.
1384
-
1385
- A project-specific namespace is created for all flows that
1386
- use the same `@project(name)`.
1387
-
1388
-
1389
- Parameters
1390
- ----------
1391
- name : str
1392
- Project name. Make sure that the name is unique amongst all
1393
- projects that use the same production scheduler. The name may
1394
- contain only lowercase alphanumeric characters and underscores.
1395
-
1396
- branch : Optional[str], default None
1397
- The branch to use. If not specified, the branch is set to
1398
- `user.<username>` unless `production` is set to `True`. This can
1399
- also be set on the command line using `--branch` as a top-level option.
1400
- It is an error to specify `branch` in the decorator and on the command line.
1401
-
1402
- production : bool, default False
1403
- Whether or not the branch is the production branch. This can also be set on the
1404
- command line using `--production` as a top-level option. It is an error to specify
1405
- `production` in the decorator and on the command line.
1406
- The project branch name will be:
1407
- - if `branch` is specified:
1408
- - if `production` is True: `prod.<branch>`
1409
- - if `production` is False: `test.<branch>`
1410
- - if `branch` is not specified:
1411
- - if `production` is True: `prod`
1412
- - if `production` is False: `user.<username>`
1413
- """
1414
- ...
1415
-
1416
1416
  pkg_name: str
1417
1417