ob-metaflow-stubs 6.0.3.187__py2.py3-none-any.whl → 6.0.3.188__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 (222) hide show
  1. metaflow-stubs/__init__.pyi +770 -766
  2. metaflow-stubs/cards.pyi +2 -2
  3. metaflow-stubs/cli.pyi +2 -2
  4. metaflow-stubs/cli_components/__init__.pyi +2 -2
  5. metaflow-stubs/cli_components/utils.pyi +2 -2
  6. metaflow-stubs/client/__init__.pyi +2 -2
  7. metaflow-stubs/client/core.pyi +4 -4
  8. metaflow-stubs/client/filecache.pyi +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 +3 -3
  14. metaflow-stubs/info_file.pyi +2 -2
  15. metaflow-stubs/metadata_provider/__init__.pyi +2 -2
  16. metaflow-stubs/metadata_provider/heartbeat.pyi +2 -2
  17. metaflow-stubs/metadata_provider/metadata.pyi +2 -2
  18. metaflow-stubs/metadata_provider/util.pyi +2 -2
  19. metaflow-stubs/metaflow_config.pyi +2 -2
  20. metaflow-stubs/metaflow_current.pyi +34 -34
  21. metaflow-stubs/metaflow_git.pyi +2 -2
  22. metaflow-stubs/mf_extensions/__init__.pyi +2 -2
  23. metaflow-stubs/mf_extensions/obcheckpoint/__init__.pyi +2 -2
  24. metaflow-stubs/mf_extensions/obcheckpoint/plugins/__init__.pyi +2 -2
  25. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/__init__.pyi +2 -2
  26. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/__init__.pyi +2 -2
  27. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/async_cards.pyi +2 -2
  28. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/deco_injection_mixin.pyi +2 -2
  29. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/extra_components.pyi +3 -3
  30. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/__init__.pyi +2 -2
  31. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/__init__.pyi +2 -2
  32. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/checkpoint_lister.pyi +4 -4
  33. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/lineage_card.pyi +2 -2
  34. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/checkpoint_storage.pyi +4 -4
  35. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/constructors.pyi +2 -2
  36. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/core.pyi +2 -2
  37. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/decorator.pyi +3 -3
  38. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/exceptions.pyi +2 -2
  39. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/final_api.pyi +2 -2
  40. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/lineage.pyi +2 -2
  41. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/__init__.pyi +2 -2
  42. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/context.pyi +3 -3
  43. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/core.pyi +2 -2
  44. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/decorator.pyi +2 -2
  45. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/exceptions.pyi +2 -2
  46. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/task_utils.pyi +3 -3
  47. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/utils.pyi +2 -2
  48. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastructures.pyi +2 -2
  49. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/exceptions.pyi +2 -2
  50. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/hf_hub/__init__.pyi +2 -2
  51. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/hf_hub/decorator.pyi +2 -2
  52. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/__init__.pyi +2 -2
  53. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/core.pyi +3 -3
  54. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/exceptions.pyi +2 -2
  55. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/model_storage.pyi +2 -2
  56. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/__init__.pyi +2 -2
  57. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/flowspec_utils.pyi +2 -2
  58. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/general.pyi +2 -2
  59. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/identity_utils.pyi +3 -3
  60. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/__init__.pyi +2 -2
  61. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/base.pyi +2 -2
  62. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/tar.pyi +2 -2
  63. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/tar_utils.pyi +2 -2
  64. metaflow-stubs/mf_extensions/outerbounds/__init__.pyi +2 -2
  65. metaflow-stubs/mf_extensions/outerbounds/plugins/__init__.pyi +2 -2
  66. metaflow-stubs/mf_extensions/outerbounds/plugins/aws/__init__.pyi +2 -2
  67. metaflow-stubs/mf_extensions/outerbounds/plugins/aws/assume_role_decorator.pyi +2 -2
  68. metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/__init__.pyi +2 -2
  69. metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/async_cards.pyi +3 -3
  70. metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/injector.pyi +2 -2
  71. metaflow-stubs/mf_extensions/outerbounds/plugins/checkpoint_datastores/__init__.pyi +2 -2
  72. metaflow-stubs/mf_extensions/outerbounds/plugins/checkpoint_datastores/coreweave.pyi +2 -2
  73. metaflow-stubs/mf_extensions/outerbounds/plugins/checkpoint_datastores/nebius.pyi +2 -2
  74. metaflow-stubs/mf_extensions/outerbounds/plugins/kubernetes/__init__.pyi +2 -2
  75. metaflow-stubs/mf_extensions/outerbounds/plugins/kubernetes/pod_killer.pyi +2 -2
  76. metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/__init__.pyi +2 -2
  77. metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/constants.pyi +2 -2
  78. metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/exceptions.pyi +2 -2
  79. metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/ollama.pyi +2 -2
  80. metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/status_card.pyi +2 -2
  81. metaflow-stubs/mf_extensions/outerbounds/plugins/snowflake/__init__.pyi +2 -2
  82. metaflow-stubs/mf_extensions/outerbounds/plugins/snowflake/snowflake.pyi +2 -2
  83. metaflow-stubs/mf_extensions/outerbounds/profilers/__init__.pyi +2 -2
  84. metaflow-stubs/mf_extensions/outerbounds/profilers/gpu.pyi +2 -2
  85. metaflow-stubs/mf_extensions/outerbounds/remote_config.pyi +2 -2
  86. metaflow-stubs/mf_extensions/outerbounds/toplevel/__init__.pyi +2 -2
  87. metaflow-stubs/mf_extensions/outerbounds/toplevel/global_aliases_for_metaflow_package.pyi +2 -2
  88. metaflow-stubs/multicore_utils.pyi +2 -2
  89. metaflow-stubs/ob_internal.pyi +2 -2
  90. metaflow-stubs/parameters.pyi +3 -3
  91. metaflow-stubs/plugins/__init__.pyi +12 -10
  92. metaflow-stubs/plugins/airflow/__init__.pyi +2 -2
  93. metaflow-stubs/plugins/airflow/airflow_utils.pyi +2 -2
  94. metaflow-stubs/plugins/airflow/exception.pyi +2 -2
  95. metaflow-stubs/plugins/airflow/sensors/__init__.pyi +2 -2
  96. metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +2 -2
  97. metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +2 -2
  98. metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +2 -2
  99. metaflow-stubs/plugins/argo/__init__.pyi +2 -2
  100. metaflow-stubs/plugins/argo/argo_client.pyi +2 -2
  101. metaflow-stubs/plugins/argo/argo_events.pyi +2 -2
  102. metaflow-stubs/plugins/argo/argo_workflows.pyi +5 -32
  103. metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +4 -4
  104. metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +3 -3
  105. metaflow-stubs/plugins/argo/argo_workflows_deployer_objects.pyi +3 -3
  106. metaflow-stubs/plugins/argo/exit_hooks.pyi +45 -0
  107. metaflow-stubs/plugins/aws/__init__.pyi +2 -2
  108. metaflow-stubs/plugins/aws/aws_client.pyi +2 -2
  109. metaflow-stubs/plugins/aws/aws_utils.pyi +2 -2
  110. metaflow-stubs/plugins/aws/batch/__init__.pyi +2 -2
  111. metaflow-stubs/plugins/aws/batch/batch.pyi +2 -2
  112. metaflow-stubs/plugins/aws/batch/batch_client.pyi +2 -2
  113. metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +2 -2
  114. metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +2 -2
  115. metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +4 -4
  116. metaflow-stubs/plugins/aws/step_functions/__init__.pyi +2 -2
  117. metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +2 -2
  118. metaflow-stubs/plugins/aws/step_functions/schedule_decorator.pyi +2 -2
  119. metaflow-stubs/plugins/aws/step_functions/step_functions.pyi +2 -2
  120. metaflow-stubs/plugins/aws/step_functions/step_functions_client.pyi +2 -2
  121. metaflow-stubs/plugins/aws/step_functions/step_functions_deployer.pyi +2 -2
  122. metaflow-stubs/plugins/aws/step_functions/step_functions_deployer_objects.pyi +3 -3
  123. metaflow-stubs/plugins/azure/__init__.pyi +2 -2
  124. metaflow-stubs/plugins/azure/azure_credential.pyi +2 -2
  125. metaflow-stubs/plugins/azure/azure_exceptions.pyi +2 -2
  126. metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +4 -4
  127. metaflow-stubs/plugins/azure/azure_utils.pyi +2 -2
  128. metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +2 -2
  129. metaflow-stubs/plugins/azure/includefile_support.pyi +2 -2
  130. metaflow-stubs/plugins/cards/__init__.pyi +6 -6
  131. metaflow-stubs/plugins/cards/card_client.pyi +3 -3
  132. metaflow-stubs/plugins/cards/card_creator.pyi +4 -3
  133. metaflow-stubs/plugins/cards/card_datastore.pyi +2 -2
  134. metaflow-stubs/plugins/cards/card_decorator.pyi +13 -2
  135. metaflow-stubs/plugins/cards/card_modules/__init__.pyi +2 -2
  136. metaflow-stubs/plugins/cards/card_modules/basic.pyi +3 -3
  137. metaflow-stubs/plugins/cards/card_modules/card.pyi +2 -2
  138. metaflow-stubs/plugins/cards/card_modules/components.pyi +3 -3
  139. metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +2 -2
  140. metaflow-stubs/plugins/cards/card_modules/renderer_tools.pyi +2 -2
  141. metaflow-stubs/plugins/cards/card_modules/test_cards.pyi +10 -2
  142. metaflow-stubs/plugins/cards/card_resolver.pyi +2 -2
  143. metaflow-stubs/plugins/cards/component_serializer.pyi +2 -2
  144. metaflow-stubs/plugins/cards/exception.pyi +2 -2
  145. metaflow-stubs/plugins/catch_decorator.pyi +2 -2
  146. metaflow-stubs/plugins/datatools/__init__.pyi +2 -2
  147. metaflow-stubs/plugins/datatools/local.pyi +2 -2
  148. metaflow-stubs/plugins/datatools/s3/__init__.pyi +2 -2
  149. metaflow-stubs/plugins/datatools/s3/s3.pyi +3 -3
  150. metaflow-stubs/plugins/datatools/s3/s3tail.pyi +2 -2
  151. metaflow-stubs/plugins/datatools/s3/s3util.pyi +2 -2
  152. metaflow-stubs/plugins/debug_logger.pyi +2 -2
  153. metaflow-stubs/plugins/debug_monitor.pyi +2 -2
  154. metaflow-stubs/plugins/environment_decorator.pyi +2 -2
  155. metaflow-stubs/plugins/events_decorator.pyi +2 -2
  156. metaflow-stubs/plugins/exit_hook/__init__.pyi +11 -0
  157. metaflow-stubs/plugins/exit_hook/exit_hook_decorator.pyi +20 -0
  158. metaflow-stubs/plugins/frameworks/__init__.pyi +2 -2
  159. metaflow-stubs/plugins/frameworks/pytorch.pyi +2 -2
  160. metaflow-stubs/plugins/gcp/__init__.pyi +2 -2
  161. metaflow-stubs/plugins/gcp/gcp_secret_manager_secrets_provider.pyi +4 -4
  162. metaflow-stubs/plugins/gcp/gs_exceptions.pyi +2 -2
  163. metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +2 -2
  164. metaflow-stubs/plugins/gcp/gs_utils.pyi +2 -2
  165. metaflow-stubs/plugins/gcp/includefile_support.pyi +2 -2
  166. metaflow-stubs/plugins/kubernetes/__init__.pyi +2 -2
  167. metaflow-stubs/plugins/kubernetes/kube_utils.pyi +2 -2
  168. metaflow-stubs/plugins/kubernetes/kubernetes.pyi +2 -2
  169. metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +2 -2
  170. metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +2 -2
  171. metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +2 -2
  172. metaflow-stubs/plugins/kubernetes/spot_monitor_sidecar.pyi +2 -2
  173. metaflow-stubs/plugins/ollama/__init__.pyi +3 -3
  174. metaflow-stubs/plugins/parallel_decorator.pyi +2 -2
  175. metaflow-stubs/plugins/perimeters.pyi +2 -2
  176. metaflow-stubs/plugins/project_decorator.pyi +2 -2
  177. metaflow-stubs/plugins/pypi/__init__.pyi +2 -2
  178. metaflow-stubs/plugins/pypi/conda_decorator.pyi +2 -2
  179. metaflow-stubs/plugins/pypi/conda_environment.pyi +6 -6
  180. metaflow-stubs/plugins/pypi/parsers.pyi +2 -2
  181. metaflow-stubs/plugins/pypi/pypi_decorator.pyi +2 -2
  182. metaflow-stubs/plugins/pypi/pypi_environment.pyi +2 -2
  183. metaflow-stubs/plugins/pypi/utils.pyi +2 -2
  184. metaflow-stubs/plugins/resources_decorator.pyi +2 -2
  185. metaflow-stubs/plugins/retry_decorator.pyi +2 -2
  186. metaflow-stubs/plugins/secrets/__init__.pyi +6 -2
  187. metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +4 -4
  188. metaflow-stubs/plugins/secrets/secrets_decorator.pyi +9 -49
  189. metaflow-stubs/plugins/secrets/secrets_func.pyi +31 -0
  190. metaflow-stubs/plugins/secrets/secrets_spec.pyi +42 -0
  191. metaflow-stubs/plugins/secrets/utils.pyi +28 -0
  192. metaflow-stubs/plugins/snowflake/__init__.pyi +2 -2
  193. metaflow-stubs/plugins/storage_executor.pyi +2 -2
  194. metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +2 -2
  195. metaflow-stubs/plugins/timeout_decorator.pyi +2 -2
  196. metaflow-stubs/plugins/torchtune/__init__.pyi +2 -2
  197. metaflow-stubs/plugins/uv/__init__.pyi +2 -2
  198. metaflow-stubs/plugins/uv/uv_environment.pyi +2 -2
  199. metaflow-stubs/profilers/__init__.pyi +2 -2
  200. metaflow-stubs/pylint_wrapper.pyi +2 -2
  201. metaflow-stubs/runner/__init__.pyi +2 -2
  202. metaflow-stubs/runner/deployer.pyi +29 -29
  203. metaflow-stubs/runner/deployer_impl.pyi +3 -3
  204. metaflow-stubs/runner/metaflow_runner.pyi +2 -2
  205. metaflow-stubs/runner/nbdeploy.pyi +2 -2
  206. metaflow-stubs/runner/nbrun.pyi +2 -2
  207. metaflow-stubs/runner/subprocess_manager.pyi +2 -2
  208. metaflow-stubs/runner/utils.pyi +3 -3
  209. metaflow-stubs/system/__init__.pyi +2 -2
  210. metaflow-stubs/system/system_logger.pyi +3 -3
  211. metaflow-stubs/system/system_monitor.pyi +2 -2
  212. metaflow-stubs/tagging_util.pyi +2 -2
  213. metaflow-stubs/tuple_util.pyi +2 -2
  214. metaflow-stubs/user_configs/__init__.pyi +2 -2
  215. metaflow-stubs/user_configs/config_decorators.pyi +6 -6
  216. metaflow-stubs/user_configs/config_options.pyi +2 -2
  217. metaflow-stubs/user_configs/config_parameters.pyi +6 -6
  218. {ob_metaflow_stubs-6.0.3.187.dist-info → ob_metaflow_stubs-6.0.3.188.dist-info}/METADATA +1 -1
  219. ob_metaflow_stubs-6.0.3.188.dist-info/RECORD +222 -0
  220. ob_metaflow_stubs-6.0.3.187.dist-info/RECORD +0 -216
  221. {ob_metaflow_stubs-6.0.3.187.dist-info → ob_metaflow_stubs-6.0.3.188.dist-info}/WHEEL +0 -0
  222. {ob_metaflow_stubs-6.0.3.187.dist-info → ob_metaflow_stubs-6.0.3.188.dist-info}/top_level.txt +0 -0
@@ -1,7 +1,7 @@
1
1
  ######################################################################################################
2
2
  # Auto-generated Metaflow stub file #
3
- # MF version: 2.15.18.1+obcheckpoint(0.2.4);ob(v1) #
4
- # Generated on 2025-07-01T15:21:03.639611 #
3
+ # MF version: 2.15.21.1+obcheckpoint(0.2.4);ob(v1) #
4
+ # Generated on 2025-07-11T16:11:55.172406 #
5
5
  ######################################################################################################
6
6
 
7
7
  from __future__ import annotations
@@ -35,17 +35,17 @@ from .user_configs.config_parameters import ConfigValue as ConfigValue
35
35
  from .user_configs.config_parameters import config_expr as config_expr
36
36
  from .user_configs.config_decorators import CustomFlowDecorator as CustomFlowDecorator
37
37
  from .user_configs.config_decorators import CustomStepDecorator as CustomStepDecorator
38
- from . import events as events
39
38
  from . import cards as cards
40
- from . import tuple_util as tuple_util
41
39
  from . import metaflow_git as metaflow_git
40
+ from . import tuple_util as tuple_util
41
+ from . import events as events
42
42
  from . import runner as runner
43
43
  from . import plugins as plugins
44
44
  from .mf_extensions.outerbounds.toplevel.global_aliases_for_metaflow_package import S3 as S3
45
45
  from . import includefile as includefile
46
46
  from .includefile import IncludeFile as IncludeFile
47
- from .plugins.pypi.parsers import pyproject_toml_parser as pyproject_toml_parser
48
47
  from .plugins.pypi.parsers import conda_environment_yml_parser as conda_environment_yml_parser
48
+ from .plugins.pypi.parsers import pyproject_toml_parser as pyproject_toml_parser
49
49
  from .plugins.pypi.parsers import requirements_txt_parser as requirements_txt_parser
50
50
  from . import client as client
51
51
  from .client.core import namespace as namespace
@@ -155,6 +155,163 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
155
155
  """
156
156
  ...
157
157
 
158
+ @typing.overload
159
+ 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]]]:
160
+ """
161
+ Specifies environment variables to be set prior to the execution of a step.
162
+
163
+
164
+ Parameters
165
+ ----------
166
+ vars : Dict[str, str], default {}
167
+ Dictionary of environment variables to set.
168
+ """
169
+ ...
170
+
171
+ @typing.overload
172
+ def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
173
+ ...
174
+
175
+ @typing.overload
176
+ def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
177
+ ...
178
+
179
+ def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
180
+ """
181
+ Specifies environment variables to be set prior to the execution of a step.
182
+
183
+
184
+ Parameters
185
+ ----------
186
+ vars : Dict[str, str], default {}
187
+ Dictionary of environment variables to set.
188
+ """
189
+ ...
190
+
191
+ def app_deploy(*, app_port: int, app_name: 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]]]:
192
+ """
193
+ Specifies that this step is used to deploy an instance of the app.
194
+ Requires that self.app_name, self.app_port, self.entrypoint and self.deployDir is set.
195
+
196
+
197
+ Parameters
198
+ ----------
199
+ app_port : int
200
+ Number of GPUs to use.
201
+ app_name : str
202
+ Name of the app to deploy.
203
+ """
204
+ ...
205
+
206
+ def vllm(*, model: str, backend: str, openai_api_server: bool, debug: bool, card_refresh_interval: int, max_retries: int, retry_alert_frequency: int, engine_args: dict) -> 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
+ """
208
+ This decorator is used to run vllm APIs as Metaflow task sidecars.
209
+
210
+ User code call
211
+ --------------
212
+ @vllm(
213
+ model="...",
214
+ ...
215
+ )
216
+
217
+ Valid backend options
218
+ ---------------------
219
+ - 'local': Run as a separate process on the local task machine.
220
+
221
+ Valid model options
222
+ -------------------
223
+ Any HuggingFace model identifier, e.g. 'meta-llama/Llama-3.2-1B'
224
+
225
+ NOTE: vLLM's OpenAI-compatible server serves ONE model per server instance.
226
+ If you need multiple models, you must create multiple @vllm decorators.
227
+
228
+
229
+ Parameters
230
+ ----------
231
+ model: str
232
+ HuggingFace model identifier to be served by vLLM.
233
+ backend: str
234
+ Determines where and how to run the vLLM process.
235
+ openai_api_server: bool
236
+ Whether to use OpenAI-compatible API server mode (subprocess) instead of native engine.
237
+ Default is False (uses native engine).
238
+ Set to True for backward compatibility with existing code.
239
+ debug: bool
240
+ Whether to turn on verbose debugging logs.
241
+ card_refresh_interval: int
242
+ Interval in seconds for refreshing the vLLM status card.
243
+ Only used when openai_api_server=True.
244
+ max_retries: int
245
+ Maximum number of retries checking for vLLM server startup.
246
+ Only used when openai_api_server=True.
247
+ retry_alert_frequency: int
248
+ Frequency of alert logs for vLLM server startup retries.
249
+ Only used when openai_api_server=True.
250
+ engine_args : dict
251
+ Additional keyword arguments to pass to the vLLM engine.
252
+ For example, `tensor_parallel_size=2`.
253
+ """
254
+ ...
255
+
256
+ @typing.overload
257
+ 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]]]:
258
+ """
259
+ Specifies the Conda environment for the step.
260
+
261
+ Information in this decorator will augment any
262
+ attributes set in the `@conda_base` flow-level decorator. Hence,
263
+ you can use `@conda_base` to set packages required by all
264
+ steps and use `@conda` to specify step-specific overrides.
265
+
266
+
267
+ Parameters
268
+ ----------
269
+ packages : Dict[str, str], default {}
270
+ Packages to use for this step. The key is the name of the package
271
+ and the value is the version to use.
272
+ libraries : Dict[str, str], default {}
273
+ Supported for backward compatibility. When used with packages, packages will take precedence.
274
+ python : str, optional, default None
275
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
276
+ that the version used will correspond to the version of the Python interpreter used to start the run.
277
+ disabled : bool, default False
278
+ If set to True, disables @conda.
279
+ """
280
+ ...
281
+
282
+ @typing.overload
283
+ def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
284
+ ...
285
+
286
+ @typing.overload
287
+ def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
288
+ ...
289
+
290
+ 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):
291
+ """
292
+ Specifies the Conda environment for the step.
293
+
294
+ Information in this decorator will augment any
295
+ attributes set in the `@conda_base` flow-level decorator. Hence,
296
+ you can use `@conda_base` to set packages required by all
297
+ steps and use `@conda` to specify step-specific overrides.
298
+
299
+
300
+ Parameters
301
+ ----------
302
+ packages : Dict[str, str], default {}
303
+ Packages to use for this step. The key is the name of the package
304
+ and the value is the version to use.
305
+ libraries : Dict[str, str], default {}
306
+ Supported for backward compatibility. When used with packages, packages will take precedence.
307
+ python : str, optional, default None
308
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
309
+ that the version used will correspond to the version of the Python interpreter used to start the run.
310
+ disabled : bool, default False
311
+ If set to True, disables @conda.
312
+ """
313
+ ...
314
+
158
315
  @typing.overload
159
316
  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]]]:
160
317
  """
@@ -204,68 +361,125 @@ def card(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typ
204
361
  """
205
362
  ...
206
363
 
207
- def nvct(*, gpu: int, gpu_type: 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]]]:
364
+ def ollama(*, models: list, backend: str, force_pull: bool, cache_update_policy: str, force_cache_update: bool, debug: bool, circuit_breaker_config: dict, timeout_config: dict) -> 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]]]:
208
365
  """
209
- Specifies that this step should execute on DGX cloud.
366
+ This decorator is used to run Ollama APIs as Metaflow task sidecars.
367
+
368
+ User code call
369
+ --------------
370
+ @ollama(
371
+ models=[...],
372
+ ...
373
+ )
374
+
375
+ Valid backend options
376
+ ---------------------
377
+ - 'local': Run as a separate process on the local task machine.
378
+ - (TODO) 'managed': Outerbounds hosts and selects compute provider.
379
+ - (TODO) 'remote': Spin up separate instance to serve Ollama models.
380
+
381
+ Valid model options
382
+ -------------------
383
+ Any model here https://ollama.com/search, e.g. 'llama3.2', 'llama3.3'
210
384
 
211
385
 
212
386
  Parameters
213
387
  ----------
214
- gpu : int
215
- Number of GPUs to use.
216
- gpu_type : str
217
- Type of Nvidia GPU to use.
388
+ models: list[str]
389
+ List of Ollama containers running models in sidecars.
390
+ backend: str
391
+ Determines where and how to run the Ollama process.
392
+ force_pull: bool
393
+ Whether to run `ollama pull` no matter what, or first check the remote cache in Metaflow datastore for this model key.
394
+ cache_update_policy: str
395
+ Cache update policy: "auto", "force", or "never".
396
+ force_cache_update: bool
397
+ Simple override for "force" cache update policy.
398
+ debug: bool
399
+ Whether to turn on verbose debugging logs.
400
+ circuit_breaker_config: dict
401
+ Configuration for circuit breaker protection. Keys: failure_threshold, recovery_timeout, reset_timeout.
402
+ timeout_config: dict
403
+ Configuration for various operation timeouts. Keys: pull, stop, health_check, install, server_startup.
218
404
  """
219
405
  ...
220
406
 
221
407
  @typing.overload
222
- 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]]]:
408
+ 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]]]:
223
409
  """
224
- Specifies that the step will success under all circumstances.
410
+ Specifies the resources needed when executing this step.
225
411
 
226
- The decorator will create an optional artifact, specified by `var`, which
227
- contains the exception raised. You can use it to detect the presence
228
- of errors, indicating that all happy-path artifacts produced by the step
229
- are missing.
412
+ Use `@resources` to specify the resource requirements
413
+ independently of the specific compute layer (`@batch`, `@kubernetes`).
414
+
415
+ You can choose the compute layer on the command line by executing e.g.
416
+ ```
417
+ python myflow.py run --with batch
418
+ ```
419
+ or
420
+ ```
421
+ python myflow.py run --with kubernetes
422
+ ```
423
+ which executes the flow on the desired system using the
424
+ requirements specified in `@resources`.
230
425
 
231
426
 
232
427
  Parameters
233
428
  ----------
234
- var : str, optional, default None
235
- Name of the artifact in which to store the caught exception.
236
- If not specified, the exception is not stored.
237
- print_exception : bool, default True
238
- Determines whether or not the exception is printed to
239
- stdout when caught.
429
+ cpu : int, default 1
430
+ Number of CPUs required for this step.
431
+ gpu : int, optional, default None
432
+ Number of GPUs required for this step.
433
+ disk : int, optional, default None
434
+ Disk size (in MB) required for this step. Only applies on Kubernetes.
435
+ memory : int, default 4096
436
+ Memory size (in MB) required for this step.
437
+ shared_memory : int, optional, default None
438
+ The value for the size (in MiB) of the /dev/shm volume for this step.
439
+ This parameter maps to the `--shm-size` option in Docker.
240
440
  """
241
441
  ...
242
442
 
243
443
  @typing.overload
244
- def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
444
+ def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
245
445
  ...
246
446
 
247
447
  @typing.overload
248
- def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
448
+ def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
249
449
  ...
250
450
 
251
- 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):
451
+ 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):
252
452
  """
253
- Specifies that the step will success under all circumstances.
453
+ Specifies the resources needed when executing this step.
254
454
 
255
- The decorator will create an optional artifact, specified by `var`, which
256
- contains the exception raised. You can use it to detect the presence
257
- of errors, indicating that all happy-path artifacts produced by the step
258
- are missing.
455
+ Use `@resources` to specify the resource requirements
456
+ independently of the specific compute layer (`@batch`, `@kubernetes`).
457
+
458
+ You can choose the compute layer on the command line by executing e.g.
459
+ ```
460
+ python myflow.py run --with batch
461
+ ```
462
+ or
463
+ ```
464
+ python myflow.py run --with kubernetes
465
+ ```
466
+ which executes the flow on the desired system using the
467
+ requirements specified in `@resources`.
259
468
 
260
469
 
261
470
  Parameters
262
471
  ----------
263
- var : str, optional, default None
264
- Name of the artifact in which to store the caught exception.
265
- If not specified, the exception is not stored.
266
- print_exception : bool, default True
267
- Determines whether or not the exception is printed to
268
- stdout when caught.
472
+ cpu : int, default 1
473
+ Number of CPUs required for this step.
474
+ gpu : int, optional, default None
475
+ Number of GPUs required for this step.
476
+ disk : int, optional, default None
477
+ Disk size (in MB) required for this step. Only applies on Kubernetes.
478
+ memory : int, default 4096
479
+ Memory size (in MB) required for this step.
480
+ shared_memory : int, optional, default None
481
+ The value for the size (in MiB) of the /dev/shm volume for this step.
482
+ This parameter maps to the `--shm-size` option in Docker.
269
483
  """
270
484
  ...
271
485
 
@@ -374,338 +588,83 @@ def nvidia(*, gpu: int, gpu_type: str, queue_timeout: int) -> typing.Callable[[t
374
588
  """
375
589
  ...
376
590
 
377
- @typing.overload
378
- 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]]]:
591
+ 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]]]:
379
592
  """
380
- Specifies the resources needed when executing this step.
381
-
382
- Use `@resources` to specify the resource requirements
383
- independently of the specific compute layer (`@batch`, `@kubernetes`).
384
-
385
- You can choose the compute layer on the command line by executing e.g.
386
- ```
387
- python myflow.py run --with batch
388
- ```
389
- or
390
- ```
391
- python myflow.py run --with kubernetes
392
- ```
393
- which executes the flow on the desired system using the
394
- requirements specified in `@resources`.
395
-
593
+ Decorator that helps cache, version and store models/datasets from huggingface hub.
396
594
 
397
- Parameters
398
- ----------
399
- cpu : int, default 1
400
- Number of CPUs required for this step.
401
- gpu : int, optional, default None
402
- Number of GPUs required for this step.
403
- disk : int, optional, default None
404
- Disk size (in MB) required for this step. Only applies on Kubernetes.
405
- memory : int, default 4096
406
- Memory size (in MB) required for this step.
407
- shared_memory : int, optional, default None
408
- The value for the size (in MiB) of the /dev/shm volume for this step.
409
- This parameter maps to the `--shm-size` option in Docker.
410
- """
411
- ...
412
-
413
- @typing.overload
414
- def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
415
- ...
416
-
417
- @typing.overload
418
- def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
419
- ...
420
-
421
- 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):
422
- """
423
- Specifies the resources needed when executing this step.
595
+ > Examples
424
596
 
425
- Use `@resources` to specify the resource requirements
426
- independently of the specific compute layer (`@batch`, `@kubernetes`).
597
+ **Usage: creating references of models from huggingface that may be loaded in downstream steps**
598
+ ```python
599
+ @huggingface_hub
600
+ @step
601
+ def pull_model_from_huggingface(self):
602
+ # `current.huggingface_hub.snapshot_download` downloads the model from the Hugging Face Hub
603
+ # and saves it in the backend storage based on the model's `repo_id`. If there exists a model
604
+ # with the same `repo_id` in the backend storage, it will not download the model again. The return
605
+ # value of the function is a reference to the model in the backend storage.
606
+ # This reference can be used to load the model in the subsequent steps via `@model(load=["llama_model"])`
427
607
 
428
- You can choose the compute layer on the command line by executing e.g.
429
- ```
430
- python myflow.py run --with batch
431
- ```
432
- or
433
- ```
434
- python myflow.py run --with kubernetes
608
+ self.model_id = "mistralai/Mistral-7B-Instruct-v0.1"
609
+ self.llama_model = current.huggingface_hub.snapshot_download(
610
+ repo_id=self.model_id,
611
+ allow_patterns=["*.safetensors", "*.json", "tokenizer.*"],
612
+ )
613
+ self.next(self.train)
435
614
  ```
436
- which executes the flow on the desired system using the
437
- requirements specified in `@resources`.
438
-
439
-
440
- Parameters
441
- ----------
442
- cpu : int, default 1
443
- Number of CPUs required for this step.
444
- gpu : int, optional, default None
445
- Number of GPUs required for this step.
446
- disk : int, optional, default None
447
- Disk size (in MB) required for this step. Only applies on Kubernetes.
448
- memory : int, default 4096
449
- Memory size (in MB) required for this step.
450
- shared_memory : int, optional, default None
451
- The value for the size (in MiB) of the /dev/shm volume for this step.
452
- This parameter maps to the `--shm-size` option in Docker.
453
- """
454
- ...
455
-
456
- @typing.overload
457
- 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]]]:
458
- """
459
- Specifies environment variables to be set prior to the execution of a step.
460
-
461
-
462
- Parameters
463
- ----------
464
- vars : Dict[str, str], default {}
465
- Dictionary of environment variables to set.
466
- """
467
- ...
468
-
469
- @typing.overload
470
- def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
471
- ...
472
-
473
- @typing.overload
474
- def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
475
- ...
476
-
477
- def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
478
- """
479
- Specifies environment variables to be set prior to the execution of a step.
480
-
481
-
482
- Parameters
483
- ----------
484
- vars : Dict[str, str], default {}
485
- Dictionary of environment variables to set.
486
- """
487
- ...
488
-
489
- def vllm(*, model: str, backend: str, openai_api_server: bool, debug: bool, card_refresh_interval: int, max_retries: int, retry_alert_frequency: int, engine_args: dict) -> 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]]]:
490
- """
491
- This decorator is used to run vllm APIs as Metaflow task sidecars.
492
-
493
- User code call
494
- --------------
495
- @vllm(
496
- model="...",
497
- ...
498
- )
499
-
500
- Valid backend options
501
- ---------------------
502
- - 'local': Run as a separate process on the local task machine.
503
-
504
- Valid model options
505
- -------------------
506
- Any HuggingFace model identifier, e.g. 'meta-llama/Llama-3.2-1B'
507
-
508
- NOTE: vLLM's OpenAI-compatible server serves ONE model per server instance.
509
- If you need multiple models, you must create multiple @vllm decorators.
510
-
511
-
512
- Parameters
513
- ----------
514
- model: str
515
- HuggingFace model identifier to be served by vLLM.
516
- backend: str
517
- Determines where and how to run the vLLM process.
518
- openai_api_server: bool
519
- Whether to use OpenAI-compatible API server mode (subprocess) instead of native engine.
520
- Default is False (uses native engine).
521
- Set to True for backward compatibility with existing code.
522
- debug: bool
523
- Whether to turn on verbose debugging logs.
524
- card_refresh_interval: int
525
- Interval in seconds for refreshing the vLLM status card.
526
- Only used when openai_api_server=True.
527
- max_retries: int
528
- Maximum number of retries checking for vLLM server startup.
529
- Only used when openai_api_server=True.
530
- retry_alert_frequency: int
531
- Frequency of alert logs for vLLM server startup retries.
532
- Only used when openai_api_server=True.
533
- engine_args : dict
534
- Additional keyword arguments to pass to the vLLM engine.
535
- For example, `tensor_parallel_size=2`.
536
- """
537
- ...
538
-
539
- @typing.overload
540
- def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
541
- """
542
- Decorator prototype for all step decorators. This function gets specialized
543
- and imported for all decorators types by _import_plugin_decorators().
544
- """
545
- ...
546
-
547
- @typing.overload
548
- def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
549
- ...
550
-
551
- def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
552
- """
553
- Decorator prototype for all step decorators. This function gets specialized
554
- and imported for all decorators types by _import_plugin_decorators().
555
- """
556
- ...
557
-
558
- def ollama(*, models: list, backend: str, force_pull: bool, cache_update_policy: str, force_cache_update: bool, debug: bool, circuit_breaker_config: dict, timeout_config: dict) -> 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]]]:
559
- """
560
- This decorator is used to run Ollama APIs as Metaflow task sidecars.
561
-
562
- User code call
563
- --------------
564
- @ollama(
565
- models=[...],
566
- ...
567
- )
568
-
569
- Valid backend options
570
- ---------------------
571
- - 'local': Run as a separate process on the local task machine.
572
- - (TODO) 'managed': Outerbounds hosts and selects compute provider.
573
- - (TODO) 'remote': Spin up separate instance to serve Ollama models.
574
-
575
- Valid model options
576
- -------------------
577
- Any model here https://ollama.com/search, e.g. 'llama3.2', 'llama3.3'
578
-
579
-
580
- Parameters
581
- ----------
582
- models: list[str]
583
- List of Ollama containers running models in sidecars.
584
- backend: str
585
- Determines where and how to run the Ollama process.
586
- force_pull: bool
587
- Whether to run `ollama pull` no matter what, or first check the remote cache in Metaflow datastore for this model key.
588
- cache_update_policy: str
589
- Cache update policy: "auto", "force", or "never".
590
- force_cache_update: bool
591
- Simple override for "force" cache update policy.
592
- debug: bool
593
- Whether to turn on verbose debugging logs.
594
- circuit_breaker_config: dict
595
- Configuration for circuit breaker protection. Keys: failure_threshold, recovery_timeout, reset_timeout.
596
- timeout_config: dict
597
- Configuration for various operation timeouts. Keys: pull, stop, health_check, install, server_startup.
598
- """
599
- ...
600
-
601
- @typing.overload
602
- 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]]]:
603
- """
604
- Specifies secrets to be retrieved and injected as environment variables prior to
605
- the execution of a step.
606
615
 
616
+ **Usage: loading models directly from huggingface hub or from cache (from metaflow's datastore)**
617
+ ```python
618
+ @huggingface_hub(load=["mistralai/Mistral-7B-Instruct-v0.1"])
619
+ @step
620
+ def pull_model_from_huggingface(self):
621
+ path_to_model = current.huggingface_hub.loaded["mistralai/Mistral-7B-Instruct-v0.1"]
622
+ ```
607
623
 
608
- Parameters
609
- ----------
610
- sources : List[Union[str, Dict[str, Any]]], default: []
611
- List of secret specs, defining how the secrets are to be retrieved
612
- """
613
- ...
614
-
615
- @typing.overload
616
- def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
617
- ...
618
-
619
- @typing.overload
620
- def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
621
- ...
622
-
623
- 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]]] = []):
624
- """
625
- Specifies secrets to be retrieved and injected as environment variables prior to
626
- the execution of a step.
627
-
628
-
629
- Parameters
630
- ----------
631
- sources : List[Union[str, Dict[str, Any]]], default: []
632
- List of secret specs, defining how the secrets are to be retrieved
633
- """
634
- ...
635
-
636
- @typing.overload
637
- 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]]]:
638
- """
639
- Specifies a timeout for your step.
640
-
641
- This decorator is useful if this step may hang indefinitely.
642
-
643
- This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
644
- A timeout is considered to be an exception thrown by the step. It will cause the step to be
645
- retried if needed and the exception will be caught by the `@catch` decorator, if present.
624
+ ```python
625
+ @huggingface_hub(load=[("mistralai/Mistral-7B-Instruct-v0.1", "/my-directory"), ("myorg/mistral-lora, "/my-lora-directory")])
626
+ @step
627
+ def finetune_model(self):
628
+ path_to_model = current.huggingface_hub.loaded["mistralai/Mistral-7B-Instruct-v0.1"]
629
+ # path_to_model will be /my-directory
630
+ ```
646
631
 
647
- Note that all the values specified in parameters are added together so if you specify
648
- 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
632
+ ```python
633
+ # Takes all the arguments passed to `snapshot_download`
634
+ # except for `local_dir`
635
+ @huggingface_hub(load=[
636
+ {
637
+ "repo_id": "mistralai/Mistral-7B-Instruct-v0.1",
638
+ },
639
+ {
640
+ "repo_id": "myorg/mistral-lora",
641
+ "repo_type": "model",
642
+ },
643
+ ])
644
+ @step
645
+ def finetune_model(self):
646
+ path_to_model = current.huggingface_hub.loaded["mistralai/Mistral-7B-Instruct-v0.1"]
647
+ # path_to_model will be /my-directory
648
+ ```
649
649
 
650
650
 
651
651
  Parameters
652
652
  ----------
653
- seconds : int, default 0
654
- Number of seconds to wait prior to timing out.
655
- minutes : int, default 0
656
- Number of minutes to wait prior to timing out.
657
- hours : int, default 0
658
- Number of hours to wait prior to timing out.
659
- """
660
- ...
661
-
662
- @typing.overload
663
- def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
664
- ...
665
-
666
- @typing.overload
667
- def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
668
- ...
669
-
670
- 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):
671
- """
672
- Specifies a timeout for your step.
673
-
674
- This decorator is useful if this step may hang indefinitely.
653
+ temp_dir_root : str, optional
654
+ The root directory that will hold the temporary directory where objects will be downloaded.
675
655
 
676
- This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
677
- A timeout is considered to be an exception thrown by the step. It will cause the step to be
678
- retried if needed and the exception will be caught by the `@catch` decorator, if present.
656
+ load: Union[List[str], List[Tuple[Dict, str]], List[Tuple[str, str]], List[Dict], None]
657
+ The list of repos (models/datasets) to load.
679
658
 
680
- Note that all the values specified in parameters are added together so if you specify
681
- 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
659
+ Loaded repos can be accessed via `current.huggingface_hub.loaded`. If load is set, then the following happens:
682
660
 
661
+ - If repo (model/dataset) is not found in the datastore:
662
+ - Downloads the repo from Hugging Face Hub to a temporary directory (or uses specified path) for local access
663
+ - Stores it in Metaflow's datastore (s3/gcs/azure etc.) with a unique name based on repo_type/repo_id
664
+ - All HF models loaded for a `@step` will be cached separately under flow/step/namespace.
683
665
 
684
- Parameters
685
- ----------
686
- seconds : int, default 0
687
- Number of seconds to wait prior to timing out.
688
- minutes : int, default 0
689
- Number of minutes to wait prior to timing out.
690
- hours : int, default 0
691
- Number of hours to wait prior to timing out.
692
- """
693
- ...
694
-
695
- @typing.overload
696
- def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
697
- """
698
- Internal decorator to support Fast bakery
699
- """
700
- ...
701
-
702
- @typing.overload
703
- def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
704
- ...
705
-
706
- def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
707
- """
708
- Internal decorator to support Fast bakery
666
+ - If repo is found in the datastore:
667
+ - Loads it directly from datastore to local path (can be temporary directory or specified path)
709
668
  """
710
669
  ...
711
670
 
@@ -857,182 +816,233 @@ def checkpoint(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None
857
816
  ...
858
817
 
859
818
  @typing.overload
860
- 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]]]:
819
+ def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
861
820
  """
862
- Specifies the number of times the task corresponding
863
- to a step needs to be retried.
821
+ Internal decorator to support Fast bakery
822
+ """
823
+ ...
824
+
825
+ @typing.overload
826
+ def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
827
+ ...
828
+
829
+ def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
830
+ """
831
+ Internal decorator to support Fast bakery
832
+ """
833
+ ...
834
+
835
+ def nvct(*, gpu: int, gpu_type: 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]]]:
836
+ """
837
+ Specifies that this step should execute on DGX cloud.
864
838
 
865
- This decorator is useful for handling transient errors, such as networking issues.
866
- If your task contains operations that can't be retried safely, e.g. database updates,
867
- it is advisable to annotate it with `@retry(times=0)`.
868
839
 
869
- This can be used in conjunction with the `@catch` decorator. The `@catch`
870
- decorator will execute a no-op task after all retries have been exhausted,
871
- ensuring that the flow execution can continue.
840
+ Parameters
841
+ ----------
842
+ gpu : int
843
+ Number of GPUs to use.
844
+ gpu_type : str
845
+ Type of Nvidia GPU to use.
846
+ """
847
+ ...
848
+
849
+ @typing.overload
850
+ 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]]]:
851
+ """
852
+ Specifies the PyPI packages for the step.
853
+
854
+ Information in this decorator will augment any
855
+ attributes set in the `@pyi_base` flow-level decorator. Hence,
856
+ you can use `@pypi_base` to set packages required by all
857
+ steps and use `@pypi` to specify step-specific overrides.
872
858
 
873
859
 
874
860
  Parameters
875
861
  ----------
876
- times : int, default 3
877
- Number of times to retry this task.
878
- minutes_between_retries : int, default 2
879
- Number of minutes between retries.
862
+ packages : Dict[str, str], default: {}
863
+ Packages to use for this step. The key is the name of the package
864
+ and the value is the version to use.
865
+ python : str, optional, default: None
866
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
867
+ that the version used will correspond to the version of the Python interpreter used to start the run.
868
+ """
869
+ ...
870
+
871
+ @typing.overload
872
+ def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
873
+ ...
874
+
875
+ @typing.overload
876
+ def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
877
+ ...
878
+
879
+ 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):
880
+ """
881
+ Specifies the PyPI packages for the step.
882
+
883
+ Information in this decorator will augment any
884
+ attributes set in the `@pyi_base` flow-level decorator. Hence,
885
+ you can use `@pypi_base` to set packages required by all
886
+ steps and use `@pypi` to specify step-specific overrides.
887
+
888
+
889
+ Parameters
890
+ ----------
891
+ packages : Dict[str, str], default: {}
892
+ Packages to use for this step. The key is the name of the package
893
+ and the value is the version to use.
894
+ python : str, optional, default: None
895
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
896
+ that the version used will correspond to the version of the Python interpreter used to start the run.
897
+ """
898
+ ...
899
+
900
+ @typing.overload
901
+ 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]]]:
902
+ """
903
+ Specifies that the step will success under all circumstances.
904
+
905
+ The decorator will create an optional artifact, specified by `var`, which
906
+ contains the exception raised. You can use it to detect the presence
907
+ of errors, indicating that all happy-path artifacts produced by the step
908
+ are missing.
909
+
910
+
911
+ Parameters
912
+ ----------
913
+ var : str, optional, default None
914
+ Name of the artifact in which to store the caught exception.
915
+ If not specified, the exception is not stored.
916
+ print_exception : bool, default True
917
+ Determines whether or not the exception is printed to
918
+ stdout when caught.
880
919
  """
881
920
  ...
882
921
 
883
922
  @typing.overload
884
- def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
923
+ def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
885
924
  ...
886
925
 
887
926
  @typing.overload
888
- def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
927
+ def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
889
928
  ...
890
929
 
891
- 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):
930
+ 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):
892
931
  """
893
- Specifies the number of times the task corresponding
894
- to a step needs to be retried.
895
-
896
- This decorator is useful for handling transient errors, such as networking issues.
897
- If your task contains operations that can't be retried safely, e.g. database updates,
898
- it is advisable to annotate it with `@retry(times=0)`.
899
-
900
- This can be used in conjunction with the `@catch` decorator. The `@catch`
901
- decorator will execute a no-op task after all retries have been exhausted,
902
- ensuring that the flow execution can continue.
903
-
932
+ Specifies that the step will success under all circumstances.
904
933
 
905
- Parameters
906
- ----------
907
- times : int, default 3
908
- Number of times to retry this task.
909
- minutes_between_retries : int, default 2
910
- Number of minutes between retries.
911
- """
912
- ...
913
-
914
- def app_deploy(*, app_port: int, app_name: 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]]]:
915
- """
916
- Specifies that this step is used to deploy an instance of the app.
917
- Requires that self.app_name, self.app_port, self.entrypoint and self.deployDir is set.
934
+ The decorator will create an optional artifact, specified by `var`, which
935
+ contains the exception raised. You can use it to detect the presence
936
+ of errors, indicating that all happy-path artifacts produced by the step
937
+ are missing.
918
938
 
919
939
 
920
940
  Parameters
921
941
  ----------
922
- app_port : int
923
- Number of GPUs to use.
924
- app_name : str
925
- Name of the app to deploy.
942
+ var : str, optional, default None
943
+ Name of the artifact in which to store the caught exception.
944
+ If not specified, the exception is not stored.
945
+ print_exception : bool, default True
946
+ Determines whether or not the exception is printed to
947
+ stdout when caught.
926
948
  """
927
949
  ...
928
950
 
929
951
  @typing.overload
930
- 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]]]:
952
+ def secrets(*, sources: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = [], role: typing.Optional[str] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
931
953
  """
932
- Specifies the Conda environment for the step.
933
-
934
- Information in this decorator will augment any
935
- attributes set in the `@conda_base` flow-level decorator. Hence,
936
- you can use `@conda_base` to set packages required by all
937
- steps and use `@conda` to specify step-specific overrides.
954
+ Specifies secrets to be retrieved and injected as environment variables prior to
955
+ the execution of a step.
938
956
 
939
957
 
940
958
  Parameters
941
959
  ----------
942
- packages : Dict[str, str], default {}
943
- Packages to use for this step. The key is the name of the package
944
- and the value is the version to use.
945
- libraries : Dict[str, str], default {}
946
- Supported for backward compatibility. When used with packages, packages will take precedence.
947
- python : str, optional, default None
948
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
949
- that the version used will correspond to the version of the Python interpreter used to start the run.
950
- disabled : bool, default False
951
- If set to True, disables @conda.
960
+ sources : List[Union[str, Dict[str, Any]]], default: []
961
+ List of secret specs, defining how the secrets are to be retrieved
962
+ role : str, optional, default: None
963
+ Role to use for fetching secrets
952
964
  """
953
965
  ...
954
966
 
955
967
  @typing.overload
956
- def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
968
+ def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
957
969
  ...
958
970
 
959
971
  @typing.overload
960
- def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
972
+ def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
961
973
  ...
962
974
 
963
- 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):
975
+ def secrets(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, sources: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = [], role: typing.Optional[str] = None):
964
976
  """
965
- Specifies the Conda environment for the step.
966
-
967
- Information in this decorator will augment any
968
- attributes set in the `@conda_base` flow-level decorator. Hence,
969
- you can use `@conda_base` to set packages required by all
970
- steps and use `@conda` to specify step-specific overrides.
977
+ Specifies secrets to be retrieved and injected as environment variables prior to
978
+ the execution of a step.
971
979
 
972
980
 
973
981
  Parameters
974
982
  ----------
975
- packages : Dict[str, str], default {}
976
- Packages to use for this step. The key is the name of the package
977
- and the value is the version to use.
978
- libraries : Dict[str, str], default {}
979
- Supported for backward compatibility. When used with packages, packages will take precedence.
980
- python : str, optional, default None
981
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
982
- that the version used will correspond to the version of the Python interpreter used to start the run.
983
- disabled : bool, default False
984
- If set to True, disables @conda.
983
+ sources : List[Union[str, Dict[str, Any]]], default: []
984
+ List of secret specs, defining how the secrets are to be retrieved
985
+ role : str, optional, default: None
986
+ Role to use for fetching secrets
985
987
  """
986
988
  ...
987
989
 
988
990
  @typing.overload
989
- 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]]]:
991
+ 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]]]:
990
992
  """
991
- Specifies the PyPI packages for the step.
993
+ Specifies a timeout for your step.
992
994
 
993
- Information in this decorator will augment any
994
- attributes set in the `@pyi_base` flow-level decorator. Hence,
995
- you can use `@pypi_base` to set packages required by all
996
- steps and use `@pypi` to specify step-specific overrides.
995
+ This decorator is useful if this step may hang indefinitely.
996
+
997
+ This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
998
+ A timeout is considered to be an exception thrown by the step. It will cause the step to be
999
+ retried if needed and the exception will be caught by the `@catch` decorator, if present.
1000
+
1001
+ Note that all the values specified in parameters are added together so if you specify
1002
+ 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
997
1003
 
998
1004
 
999
1005
  Parameters
1000
1006
  ----------
1001
- packages : Dict[str, str], default: {}
1002
- Packages to use for this step. The key is the name of the package
1003
- and the value is the version to use.
1004
- python : str, optional, default: None
1005
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1006
- that the version used will correspond to the version of the Python interpreter used to start the run.
1007
+ seconds : int, default 0
1008
+ Number of seconds to wait prior to timing out.
1009
+ minutes : int, default 0
1010
+ Number of minutes to wait prior to timing out.
1011
+ hours : int, default 0
1012
+ Number of hours to wait prior to timing out.
1007
1013
  """
1008
1014
  ...
1009
1015
 
1010
1016
  @typing.overload
1011
- def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1017
+ def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1012
1018
  ...
1013
1019
 
1014
1020
  @typing.overload
1015
- def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1021
+ def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1016
1022
  ...
1017
1023
 
1018
- 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):
1024
+ 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):
1019
1025
  """
1020
- Specifies the PyPI packages for the step.
1026
+ Specifies a timeout for your step.
1021
1027
 
1022
- Information in this decorator will augment any
1023
- attributes set in the `@pyi_base` flow-level decorator. Hence,
1024
- you can use `@pypi_base` to set packages required by all
1025
- steps and use `@pypi` to specify step-specific overrides.
1028
+ This decorator is useful if this step may hang indefinitely.
1029
+
1030
+ This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
1031
+ A timeout is considered to be an exception thrown by the step. It will cause the step to be
1032
+ retried if needed and the exception will be caught by the `@catch` decorator, if present.
1033
+
1034
+ Note that all the values specified in parameters are added together so if you specify
1035
+ 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
1026
1036
 
1027
1037
 
1028
1038
  Parameters
1029
1039
  ----------
1030
- packages : Dict[str, str], default: {}
1031
- Packages to use for this step. The key is the name of the package
1032
- and the value is the version to use.
1033
- python : str, optional, default: None
1034
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1035
- that the version used will correspond to the version of the Python interpreter used to start the run.
1040
+ seconds : int, default 0
1041
+ Number of seconds to wait prior to timing out.
1042
+ minutes : int, default 0
1043
+ Number of minutes to wait prior to timing out.
1044
+ hours : int, default 0
1045
+ Number of hours to wait prior to timing out.
1036
1046
  """
1037
1047
  ...
1038
1048
 
@@ -1165,217 +1175,77 @@ def model(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
1165
1175
  """
1166
1176
  ...
1167
1177
 
1168
- 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]]]:
1169
- """
1170
- Decorator that helps cache, version and store models/datasets from huggingface hub.
1171
-
1172
- > Examples
1173
-
1174
- **Usage: creating references of models from huggingface that may be loaded in downstream steps**
1175
- ```python
1176
- @huggingface_hub
1177
- @step
1178
- def pull_model_from_huggingface(self):
1179
- # `current.huggingface_hub.snapshot_download` downloads the model from the Hugging Face Hub
1180
- # and saves it in the backend storage based on the model's `repo_id`. If there exists a model
1181
- # with the same `repo_id` in the backend storage, it will not download the model again. The return
1182
- # value of the function is a reference to the model in the backend storage.
1183
- # This reference can be used to load the model in the subsequent steps via `@model(load=["llama_model"])`
1184
-
1185
- self.model_id = "mistralai/Mistral-7B-Instruct-v0.1"
1186
- self.llama_model = current.huggingface_hub.snapshot_download(
1187
- repo_id=self.model_id,
1188
- allow_patterns=["*.safetensors", "*.json", "tokenizer.*"],
1189
- )
1190
- self.next(self.train)
1191
- ```
1192
-
1193
- **Usage: loading models directly from huggingface hub or from cache (from metaflow's datastore)**
1194
- ```python
1195
- @huggingface_hub(load=["mistralai/Mistral-7B-Instruct-v0.1"])
1196
- @step
1197
- def pull_model_from_huggingface(self):
1198
- path_to_model = current.huggingface_hub.loaded["mistralai/Mistral-7B-Instruct-v0.1"]
1199
- ```
1200
-
1201
- ```python
1202
- @huggingface_hub(load=[("mistralai/Mistral-7B-Instruct-v0.1", "/my-directory"), ("myorg/mistral-lora, "/my-lora-directory")])
1203
- @step
1204
- def finetune_model(self):
1205
- path_to_model = current.huggingface_hub.loaded["mistralai/Mistral-7B-Instruct-v0.1"]
1206
- # path_to_model will be /my-directory
1207
- ```
1208
-
1209
- ```python
1210
- # Takes all the arguments passed to `snapshot_download`
1211
- # except for `local_dir`
1212
- @huggingface_hub(load=[
1213
- {
1214
- "repo_id": "mistralai/Mistral-7B-Instruct-v0.1",
1215
- },
1216
- {
1217
- "repo_id": "myorg/mistral-lora",
1218
- "repo_type": "model",
1219
- },
1220
- ])
1221
- @step
1222
- def finetune_model(self):
1223
- path_to_model = current.huggingface_hub.loaded["mistralai/Mistral-7B-Instruct-v0.1"]
1224
- # path_to_model will be /my-directory
1225
- ```
1226
-
1227
-
1228
- Parameters
1229
- ----------
1230
- temp_dir_root : str, optional
1231
- The root directory that will hold the temporary directory where objects will be downloaded.
1232
-
1233
- load: Union[List[str], List[Tuple[Dict, str]], List[Tuple[str, str]], List[Dict], None]
1234
- The list of repos (models/datasets) to load.
1235
-
1236
- Loaded repos can be accessed via `current.huggingface_hub.loaded`. If load is set, then the following happens:
1237
-
1238
- - If repo (model/dataset) is not found in the datastore:
1239
- - Downloads the repo from Hugging Face Hub to a temporary directory (or uses specified path) for local access
1240
- - Stores it in Metaflow's datastore (s3/gcs/azure etc.) with a unique name based on repo_type/repo_id
1241
- - All HF models loaded for a `@step` will be cached separately under flow/step/namespace.
1242
-
1243
- - If repo is found in the datastore:
1244
- - Loads it directly from datastore to local path (can be temporary directory or specified path)
1245
- """
1246
- ...
1247
-
1248
1178
  @typing.overload
1249
- def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1179
+ def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1250
1180
  """
1251
- Specifies the PyPI packages for all steps of the flow.
1252
-
1253
- Use `@pypi_base` to set common packages required by all
1254
- steps and use `@pypi` to specify step-specific overrides.
1255
-
1256
- Parameters
1257
- ----------
1258
- packages : Dict[str, str], default: {}
1259
- Packages to use for this flow. The key is the name of the package
1260
- and the value is the version to use.
1261
- python : str, optional, default: None
1262
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1263
- that the version used will correspond to the version of the Python interpreter used to start the run.
1181
+ Decorator prototype for all step decorators. This function gets specialized
1182
+ and imported for all decorators types by _import_plugin_decorators().
1264
1183
  """
1265
1184
  ...
1266
1185
 
1267
1186
  @typing.overload
1268
- def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1187
+ def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1269
1188
  ...
1270
1189
 
1271
- def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
1190
+ def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
1272
1191
  """
1273
- Specifies the PyPI packages for all steps of the flow.
1274
-
1275
- Use `@pypi_base` to set common packages required by all
1276
- steps and use `@pypi` to specify step-specific overrides.
1277
-
1278
- Parameters
1279
- ----------
1280
- packages : Dict[str, str], default: {}
1281
- Packages to use for this flow. The key is the name of the package
1282
- and the value is the version to use.
1283
- python : str, optional, default: None
1284
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1285
- that the version used will correspond to the version of the Python interpreter used to start the run.
1192
+ Decorator prototype for all step decorators. This function gets specialized
1193
+ and imported for all decorators types by _import_plugin_decorators().
1286
1194
  """
1287
1195
  ...
1288
1196
 
1289
1197
  @typing.overload
1290
- 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]]:
1198
+ 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]]]:
1291
1199
  """
1292
- Specifies the event(s) that this flow depends on.
1293
-
1294
- ```
1295
- @trigger(event='foo')
1296
- ```
1297
- or
1298
- ```
1299
- @trigger(events=['foo', 'bar'])
1300
- ```
1200
+ Specifies the number of times the task corresponding
1201
+ to a step needs to be retried.
1301
1202
 
1302
- Additionally, you can specify the parameter mappings
1303
- to map event payload to Metaflow parameters for the flow.
1304
- ```
1305
- @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1306
- ```
1307
- or
1308
- ```
1309
- @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1310
- {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1311
- ```
1203
+ This decorator is useful for handling transient errors, such as networking issues.
1204
+ If your task contains operations that can't be retried safely, e.g. database updates,
1205
+ it is advisable to annotate it with `@retry(times=0)`.
1312
1206
 
1313
- 'parameters' can also be a list of strings and tuples like so:
1314
- ```
1315
- @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1316
- ```
1317
- This is equivalent to:
1318
- ```
1319
- @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1320
- ```
1207
+ This can be used in conjunction with the `@catch` decorator. The `@catch`
1208
+ decorator will execute a no-op task after all retries have been exhausted,
1209
+ ensuring that the flow execution can continue.
1321
1210
 
1322
1211
 
1323
1212
  Parameters
1324
1213
  ----------
1325
- event : Union[str, Dict[str, Any]], optional, default None
1326
- Event dependency for this flow.
1327
- events : List[Union[str, Dict[str, Any]]], default []
1328
- Events dependency for this flow.
1329
- options : Dict[str, Any], default {}
1330
- Backend-specific configuration for tuning eventing behavior.
1214
+ times : int, default 3
1215
+ Number of times to retry this task.
1216
+ minutes_between_retries : int, default 2
1217
+ Number of minutes between retries.
1331
1218
  """
1332
1219
  ...
1333
1220
 
1334
1221
  @typing.overload
1335
- def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1222
+ def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1336
1223
  ...
1337
1224
 
1338
- 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] = {}):
1225
+ @typing.overload
1226
+ def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1227
+ ...
1228
+
1229
+ 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):
1339
1230
  """
1340
- Specifies the event(s) that this flow depends on.
1341
-
1342
- ```
1343
- @trigger(event='foo')
1344
- ```
1345
- or
1346
- ```
1347
- @trigger(events=['foo', 'bar'])
1348
- ```
1231
+ Specifies the number of times the task corresponding
1232
+ to a step needs to be retried.
1349
1233
 
1350
- Additionally, you can specify the parameter mappings
1351
- to map event payload to Metaflow parameters for the flow.
1352
- ```
1353
- @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1354
- ```
1355
- or
1356
- ```
1357
- @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1358
- {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1359
- ```
1234
+ This decorator is useful for handling transient errors, such as networking issues.
1235
+ If your task contains operations that can't be retried safely, e.g. database updates,
1236
+ it is advisable to annotate it with `@retry(times=0)`.
1360
1237
 
1361
- 'parameters' can also be a list of strings and tuples like so:
1362
- ```
1363
- @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1364
- ```
1365
- This is equivalent to:
1366
- ```
1367
- @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1368
- ```
1238
+ This can be used in conjunction with the `@catch` decorator. The `@catch`
1239
+ decorator will execute a no-op task after all retries have been exhausted,
1240
+ ensuring that the flow execution can continue.
1369
1241
 
1370
1242
 
1371
1243
  Parameters
1372
1244
  ----------
1373
- event : Union[str, Dict[str, Any]], optional, default None
1374
- Event dependency for this flow.
1375
- events : List[Union[str, Dict[str, Any]]], default []
1376
- Events dependency for this flow.
1377
- options : Dict[str, Any], default {}
1378
- Backend-specific configuration for tuning eventing behavior.
1245
+ times : int, default 3
1246
+ Number of times to retry this task.
1247
+ minutes_between_retries : int, default 2
1248
+ Number of minutes between retries.
1379
1249
  """
1380
1250
  ...
1381
1251
 
@@ -1480,100 +1350,6 @@ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *
1480
1350
  """
1481
1351
  ...
1482
1352
 
1483
- @typing.overload
1484
- def schedule(*, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: typing.Optional[str] = None, timezone: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1485
- """
1486
- Specifies the times when the flow should be run when running on a
1487
- production scheduler.
1488
-
1489
-
1490
- Parameters
1491
- ----------
1492
- hourly : bool, default False
1493
- Run the workflow hourly.
1494
- daily : bool, default True
1495
- Run the workflow daily.
1496
- weekly : bool, default False
1497
- Run the workflow weekly.
1498
- cron : str, optional, default None
1499
- Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1500
- specified by this expression.
1501
- timezone : str, optional, default None
1502
- Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1503
- which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1504
- """
1505
- ...
1506
-
1507
- @typing.overload
1508
- def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1509
- ...
1510
-
1511
- def schedule(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: typing.Optional[str] = None, timezone: typing.Optional[str] = None):
1512
- """
1513
- Specifies the times when the flow should be run when running on a
1514
- production scheduler.
1515
-
1516
-
1517
- Parameters
1518
- ----------
1519
- hourly : bool, default False
1520
- Run the workflow hourly.
1521
- daily : bool, default True
1522
- Run the workflow daily.
1523
- weekly : bool, default False
1524
- Run the workflow weekly.
1525
- cron : str, optional, default None
1526
- Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1527
- specified by this expression.
1528
- timezone : str, optional, default None
1529
- Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1530
- which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1531
- """
1532
- ...
1533
-
1534
- 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]]:
1535
- """
1536
- 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)
1537
- before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
1538
- and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
1539
- added as a flow decorators. Adding more than one decorator will ensure that `start` step
1540
- starts only after all sensors finish.
1541
-
1542
-
1543
- Parameters
1544
- ----------
1545
- timeout : int
1546
- Time, in seconds before the task times out and fails. (Default: 3600)
1547
- poke_interval : int
1548
- Time in seconds that the job should wait in between each try. (Default: 60)
1549
- mode : str
1550
- How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1551
- exponential_backoff : bool
1552
- allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1553
- pool : str
1554
- the slot pool this task should run in,
1555
- slot pools are a way to limit concurrency for certain tasks. (Default:None)
1556
- soft_fail : bool
1557
- Set to true to mark the task as SKIPPED on failure. (Default: False)
1558
- name : str
1559
- Name of the sensor on Airflow
1560
- description : str
1561
- Description of sensor in the Airflow UI
1562
- bucket_key : Union[str, List[str]]
1563
- The key(s) being waited on. Supports full s3:// style url or relative path from root level.
1564
- When it's specified as a full s3:// url, please leave `bucket_name` as None
1565
- bucket_name : str
1566
- Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
1567
- When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
1568
- wildcard_match : bool
1569
- whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
1570
- aws_conn_id : str
1571
- a reference to the s3 connection on Airflow. (Default: None)
1572
- verify : bool
1573
- Whether or not to verify SSL certificates for S3 connection. (Default: None)
1574
- """
1575
- ...
1576
-
1577
1353
  @typing.overload
1578
1354
  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]]:
1579
1355
  """
@@ -1625,46 +1401,54 @@ def conda_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packa
1625
1401
  """
1626
1402
  ...
1627
1403
 
1628
- 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]]:
1404
+ @typing.overload
1405
+ def schedule(*, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: typing.Optional[str] = None, timezone: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1629
1406
  """
1630
- 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.
1631
- 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.
1407
+ Specifies the times when the flow should be run when running on a
1408
+ production scheduler.
1632
1409
 
1633
1410
 
1634
1411
  Parameters
1635
1412
  ----------
1636
- timeout : int
1637
- Time, in seconds before the task times out and fails. (Default: 3600)
1638
- poke_interval : int
1639
- Time in seconds that the job should wait in between each try. (Default: 60)
1640
- mode : str
1641
- How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1642
- exponential_backoff : bool
1643
- allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1644
- pool : str
1645
- the slot pool this task should run in,
1646
- slot pools are a way to limit concurrency for certain tasks. (Default:None)
1647
- soft_fail : bool
1648
- Set to true to mark the task as SKIPPED on failure. (Default: False)
1649
- name : str
1650
- Name of the sensor on Airflow
1651
- description : str
1652
- Description of sensor in the Airflow UI
1653
- external_dag_id : str
1654
- The dag_id that contains the task you want to wait for.
1655
- external_task_ids : List[str]
1656
- The list of task_ids that you want to wait for.
1657
- If None (default value) the sensor waits for the DAG. (Default: None)
1658
- allowed_states : List[str]
1659
- Iterable of allowed states, (Default: ['success'])
1660
- failed_states : List[str]
1661
- Iterable of failed or dis-allowed states. (Default: None)
1662
- execution_delta : datetime.timedelta
1663
- time difference with the previous execution to look at,
1664
- the default is the same logical date as the current task or DAG. (Default: None)
1665
- check_existence: bool
1666
- Set to True to check if the external task exists or check if
1667
- the DAG to wait for exists. (Default: True)
1413
+ hourly : bool, default False
1414
+ Run the workflow hourly.
1415
+ daily : bool, default True
1416
+ Run the workflow daily.
1417
+ weekly : bool, default False
1418
+ Run the workflow weekly.
1419
+ cron : str, optional, default None
1420
+ Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1421
+ specified by this expression.
1422
+ timezone : str, optional, default None
1423
+ Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1424
+ which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1425
+ """
1426
+ ...
1427
+
1428
+ @typing.overload
1429
+ def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1430
+ ...
1431
+
1432
+ def schedule(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: typing.Optional[str] = None, timezone: typing.Optional[str] = None):
1433
+ """
1434
+ Specifies the times when the flow should be run when running on a
1435
+ production scheduler.
1436
+
1437
+
1438
+ Parameters
1439
+ ----------
1440
+ hourly : bool, default False
1441
+ Run the workflow hourly.
1442
+ daily : bool, default True
1443
+ Run the workflow daily.
1444
+ weekly : bool, default False
1445
+ Run the workflow weekly.
1446
+ cron : str, optional, default None
1447
+ Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1448
+ specified by this expression.
1449
+ timezone : str, optional, default None
1450
+ Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1451
+ which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1668
1452
  """
1669
1453
  ...
1670
1454
 
@@ -1782,6 +1566,183 @@ def with_artifact_store(f: typing.Optional[typing.Type[FlowSpecDerived]] = None)
1782
1566
  """
1783
1567
  ...
1784
1568
 
1569
+ @typing.overload
1570
+ def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1571
+ """
1572
+ Specifies the PyPI packages for all steps of the flow.
1573
+
1574
+ Use `@pypi_base` to set common packages required by all
1575
+ steps and use `@pypi` to specify step-specific overrides.
1576
+
1577
+ Parameters
1578
+ ----------
1579
+ packages : Dict[str, str], default: {}
1580
+ Packages to use for this flow. The key is the name of the package
1581
+ and the value is the version to use.
1582
+ python : str, optional, default: None
1583
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1584
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1585
+ """
1586
+ ...
1587
+
1588
+ @typing.overload
1589
+ def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1590
+ ...
1591
+
1592
+ def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
1593
+ """
1594
+ Specifies the PyPI packages for all steps of the flow.
1595
+
1596
+ Use `@pypi_base` to set common packages required by all
1597
+ steps and use `@pypi` to specify step-specific overrides.
1598
+
1599
+ Parameters
1600
+ ----------
1601
+ packages : Dict[str, str], default: {}
1602
+ Packages to use for this flow. The key is the name of the package
1603
+ and the value is the version to use.
1604
+ python : str, optional, default: None
1605
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1606
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1607
+ """
1608
+ ...
1609
+
1610
+ 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]]:
1611
+ """
1612
+ 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)
1613
+ before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
1614
+ and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
1615
+ added as a flow decorators. Adding more than one decorator will ensure that `start` step
1616
+ starts only after all sensors finish.
1617
+
1618
+
1619
+ Parameters
1620
+ ----------
1621
+ timeout : int
1622
+ Time, in seconds before the task times out and fails. (Default: 3600)
1623
+ poke_interval : int
1624
+ Time in seconds that the job should wait in between each try. (Default: 60)
1625
+ mode : str
1626
+ How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1627
+ exponential_backoff : bool
1628
+ allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1629
+ pool : str
1630
+ the slot pool this task should run in,
1631
+ slot pools are a way to limit concurrency for certain tasks. (Default:None)
1632
+ soft_fail : bool
1633
+ Set to true to mark the task as SKIPPED on failure. (Default: False)
1634
+ name : str
1635
+ Name of the sensor on Airflow
1636
+ description : str
1637
+ Description of sensor in the Airflow UI
1638
+ bucket_key : Union[str, List[str]]
1639
+ The key(s) being waited on. Supports full s3:// style url or relative path from root level.
1640
+ When it's specified as a full s3:// url, please leave `bucket_name` as None
1641
+ bucket_name : str
1642
+ Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
1643
+ When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
1644
+ wildcard_match : bool
1645
+ whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
1646
+ aws_conn_id : str
1647
+ a reference to the s3 connection on Airflow. (Default: None)
1648
+ verify : bool
1649
+ Whether or not to verify SSL certificates for S3 connection. (Default: None)
1650
+ """
1651
+ ...
1652
+
1653
+ @typing.overload
1654
+ 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]]:
1655
+ """
1656
+ Specifies the event(s) that this flow depends on.
1657
+
1658
+ ```
1659
+ @trigger(event='foo')
1660
+ ```
1661
+ or
1662
+ ```
1663
+ @trigger(events=['foo', 'bar'])
1664
+ ```
1665
+
1666
+ Additionally, you can specify the parameter mappings
1667
+ to map event payload to Metaflow parameters for the flow.
1668
+ ```
1669
+ @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1670
+ ```
1671
+ or
1672
+ ```
1673
+ @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1674
+ {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1675
+ ```
1676
+
1677
+ 'parameters' can also be a list of strings and tuples like so:
1678
+ ```
1679
+ @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1680
+ ```
1681
+ This is equivalent to:
1682
+ ```
1683
+ @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1684
+ ```
1685
+
1686
+
1687
+ Parameters
1688
+ ----------
1689
+ event : Union[str, Dict[str, Any]], optional, default None
1690
+ Event dependency for this flow.
1691
+ events : List[Union[str, Dict[str, Any]]], default []
1692
+ Events dependency for this flow.
1693
+ options : Dict[str, Any], default {}
1694
+ Backend-specific configuration for tuning eventing behavior.
1695
+ """
1696
+ ...
1697
+
1698
+ @typing.overload
1699
+ def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1700
+ ...
1701
+
1702
+ 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] = {}):
1703
+ """
1704
+ Specifies the event(s) that this flow depends on.
1705
+
1706
+ ```
1707
+ @trigger(event='foo')
1708
+ ```
1709
+ or
1710
+ ```
1711
+ @trigger(events=['foo', 'bar'])
1712
+ ```
1713
+
1714
+ Additionally, you can specify the parameter mappings
1715
+ to map event payload to Metaflow parameters for the flow.
1716
+ ```
1717
+ @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1718
+ ```
1719
+ or
1720
+ ```
1721
+ @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1722
+ {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1723
+ ```
1724
+
1725
+ 'parameters' can also be a list of strings and tuples like so:
1726
+ ```
1727
+ @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1728
+ ```
1729
+ This is equivalent to:
1730
+ ```
1731
+ @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1732
+ ```
1733
+
1734
+
1735
+ Parameters
1736
+ ----------
1737
+ event : Union[str, Dict[str, Any]], optional, default None
1738
+ Event dependency for this flow.
1739
+ events : List[Union[str, Dict[str, Any]]], default []
1740
+ Events dependency for this flow.
1741
+ options : Dict[str, Any], default {}
1742
+ Backend-specific configuration for tuning eventing behavior.
1743
+ """
1744
+ ...
1745
+
1785
1746
  def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1786
1747
  """
1787
1748
  Specifies what flows belong to the same project.
@@ -1817,5 +1778,48 @@ def project(*, name: str, branch: typing.Optional[str] = None, production: bool
1817
1778
  """
1818
1779
  ...
1819
1780
 
1781
+ 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]]:
1782
+ """
1783
+ 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.
1784
+ 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.
1785
+
1786
+
1787
+ Parameters
1788
+ ----------
1789
+ timeout : int
1790
+ Time, in seconds before the task times out and fails. (Default: 3600)
1791
+ poke_interval : int
1792
+ Time in seconds that the job should wait in between each try. (Default: 60)
1793
+ mode : str
1794
+ How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1795
+ exponential_backoff : bool
1796
+ allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1797
+ pool : str
1798
+ the slot pool this task should run in,
1799
+ slot pools are a way to limit concurrency for certain tasks. (Default:None)
1800
+ soft_fail : bool
1801
+ Set to true to mark the task as SKIPPED on failure. (Default: False)
1802
+ name : str
1803
+ Name of the sensor on Airflow
1804
+ description : str
1805
+ Description of sensor in the Airflow UI
1806
+ external_dag_id : str
1807
+ The dag_id that contains the task you want to wait for.
1808
+ external_task_ids : List[str]
1809
+ The list of task_ids that you want to wait for.
1810
+ If None (default value) the sensor waits for the DAG. (Default: None)
1811
+ allowed_states : List[str]
1812
+ Iterable of allowed states, (Default: ['success'])
1813
+ failed_states : List[str]
1814
+ Iterable of failed or dis-allowed states. (Default: None)
1815
+ execution_delta : datetime.timedelta
1816
+ time difference with the previous execution to look at,
1817
+ the default is the same logical date as the current task or DAG. (Default: None)
1818
+ check_existence: bool
1819
+ Set to True to check if the external task exists or check if
1820
+ the DAG to wait for exists. (Default: True)
1821
+ """
1822
+ ...
1823
+
1820
1824
  pkg_name: str
1821
1825