ob-metaflow-stubs 6.0.3.182rc1__py2.py3-none-any.whl → 6.0.3.183rc0__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 (220) hide show
  1. metaflow-stubs/__init__.pyi +707 -707
  2. metaflow-stubs/cards.pyi +2 -2
  3. metaflow-stubs/cli.pyi +2 -2
  4. metaflow-stubs/cli_components/__init__.pyi +2 -2
  5. metaflow-stubs/cli_components/utils.pyi +2 -2
  6. metaflow-stubs/client/__init__.pyi +2 -2
  7. metaflow-stubs/client/core.pyi +5 -5
  8. metaflow-stubs/client/filecache.pyi +2 -2
  9. metaflow-stubs/events.pyi +2 -2
  10. metaflow-stubs/exception.pyi +2 -2
  11. metaflow-stubs/flowspec.pyi +5 -5
  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 +3 -3
  18. metaflow-stubs/metadata_provider/util.pyi +2 -2
  19. metaflow-stubs/metaflow_config.pyi +2 -4
  20. metaflow-stubs/metaflow_current.pyi +102 -102
  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 +3 -3
  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 +4 -4
  37. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/decorator.pyi +5 -5
  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 +3 -3
  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 +3 -3
  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 +3 -3
  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 +3 -3
  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 +4 -4
  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 +2 -2
  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 +3 -3
  63. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/tar_utils.pyi +3 -3
  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 +2 -2
  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/fast_bakery/__init__.pyi +2 -2
  75. metaflow-stubs/mf_extensions/outerbounds/plugins/fast_bakery/baker.pyi +4 -4
  76. metaflow-stubs/mf_extensions/outerbounds/plugins/fast_bakery/docker_environment.pyi +2 -2
  77. metaflow-stubs/mf_extensions/outerbounds/plugins/fast_bakery/fast_bakery.pyi +2 -2
  78. metaflow-stubs/mf_extensions/outerbounds/plugins/kubernetes/__init__.pyi +2 -2
  79. metaflow-stubs/mf_extensions/outerbounds/plugins/kubernetes/pod_killer.pyi +2 -2
  80. metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/__init__.pyi +2 -2
  81. metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/constants.pyi +2 -2
  82. metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/exceptions.pyi +2 -2
  83. metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/ollama.pyi +2 -2
  84. metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/status_card.pyi +2 -2
  85. metaflow-stubs/mf_extensions/outerbounds/plugins/snowflake/__init__.pyi +2 -2
  86. metaflow-stubs/mf_extensions/outerbounds/plugins/snowflake/snowflake.pyi +2 -2
  87. metaflow-stubs/mf_extensions/outerbounds/profilers/__init__.pyi +2 -2
  88. metaflow-stubs/mf_extensions/outerbounds/profilers/gpu.pyi +2 -2
  89. metaflow-stubs/mf_extensions/outerbounds/remote_config.pyi +2 -2
  90. metaflow-stubs/mf_extensions/outerbounds/toplevel/__init__.pyi +2 -2
  91. metaflow-stubs/mf_extensions/outerbounds/toplevel/global_aliases_for_metaflow_package.pyi +2 -2
  92. metaflow-stubs/multicore_utils.pyi +2 -2
  93. metaflow-stubs/ob_internal.pyi +2 -2
  94. metaflow-stubs/parameters.pyi +4 -4
  95. metaflow-stubs/plugins/__init__.pyi +13 -13
  96. metaflow-stubs/plugins/airflow/__init__.pyi +2 -2
  97. metaflow-stubs/plugins/airflow/airflow_utils.pyi +2 -2
  98. metaflow-stubs/plugins/airflow/exception.pyi +2 -2
  99. metaflow-stubs/plugins/airflow/sensors/__init__.pyi +2 -2
  100. metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +2 -2
  101. metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +2 -2
  102. metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +2 -2
  103. metaflow-stubs/plugins/argo/__init__.pyi +2 -2
  104. metaflow-stubs/plugins/argo/argo_client.pyi +2 -2
  105. metaflow-stubs/plugins/argo/argo_events.pyi +2 -2
  106. metaflow-stubs/plugins/argo/argo_workflows.pyi +3 -3
  107. metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +3 -3
  108. metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +3 -3
  109. metaflow-stubs/plugins/argo/argo_workflows_deployer_objects.pyi +3 -3
  110. metaflow-stubs/plugins/aws/__init__.pyi +2 -2
  111. metaflow-stubs/plugins/aws/aws_client.pyi +2 -2
  112. metaflow-stubs/plugins/aws/aws_utils.pyi +2 -2
  113. metaflow-stubs/plugins/aws/batch/__init__.pyi +2 -2
  114. metaflow-stubs/plugins/aws/batch/batch.pyi +2 -2
  115. metaflow-stubs/plugins/aws/batch/batch_client.pyi +2 -2
  116. metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +2 -2
  117. metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +2 -2
  118. metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +2 -2
  119. metaflow-stubs/plugins/aws/step_functions/__init__.pyi +2 -2
  120. metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +2 -2
  121. metaflow-stubs/plugins/aws/step_functions/schedule_decorator.pyi +2 -2
  122. metaflow-stubs/plugins/aws/step_functions/step_functions.pyi +2 -2
  123. metaflow-stubs/plugins/aws/step_functions/step_functions_client.pyi +2 -2
  124. metaflow-stubs/plugins/aws/step_functions/step_functions_deployer.pyi +4 -4
  125. metaflow-stubs/plugins/aws/step_functions/step_functions_deployer_objects.pyi +4 -4
  126. metaflow-stubs/plugins/azure/__init__.pyi +2 -2
  127. metaflow-stubs/plugins/azure/azure_credential.pyi +2 -2
  128. metaflow-stubs/plugins/azure/azure_exceptions.pyi +2 -2
  129. metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +2 -2
  130. metaflow-stubs/plugins/azure/azure_utils.pyi +2 -2
  131. metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +2 -2
  132. metaflow-stubs/plugins/azure/includefile_support.pyi +2 -2
  133. metaflow-stubs/plugins/cards/__init__.pyi +6 -6
  134. metaflow-stubs/plugins/cards/card_client.pyi +2 -2
  135. metaflow-stubs/plugins/cards/card_creator.pyi +2 -2
  136. metaflow-stubs/plugins/cards/card_datastore.pyi +2 -4
  137. metaflow-stubs/plugins/cards/card_decorator.pyi +2 -2
  138. metaflow-stubs/plugins/cards/card_modules/__init__.pyi +2 -2
  139. metaflow-stubs/plugins/cards/card_modules/basic.pyi +2 -2
  140. metaflow-stubs/plugins/cards/card_modules/card.pyi +2 -2
  141. metaflow-stubs/plugins/cards/card_modules/components.pyi +4 -4
  142. metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +2 -2
  143. metaflow-stubs/plugins/cards/card_modules/renderer_tools.pyi +2 -2
  144. metaflow-stubs/plugins/cards/card_modules/test_cards.pyi +2 -2
  145. metaflow-stubs/plugins/cards/card_resolver.pyi +2 -2
  146. metaflow-stubs/plugins/cards/component_serializer.pyi +2 -2
  147. metaflow-stubs/plugins/cards/exception.pyi +2 -2
  148. metaflow-stubs/plugins/catch_decorator.pyi +2 -2
  149. metaflow-stubs/plugins/datatools/__init__.pyi +2 -2
  150. metaflow-stubs/plugins/datatools/local.pyi +2 -2
  151. metaflow-stubs/plugins/datatools/s3/__init__.pyi +2 -2
  152. metaflow-stubs/plugins/datatools/s3/s3.pyi +3 -3
  153. metaflow-stubs/plugins/datatools/s3/s3tail.pyi +2 -2
  154. metaflow-stubs/plugins/datatools/s3/s3util.pyi +2 -2
  155. metaflow-stubs/plugins/debug_logger.pyi +2 -2
  156. metaflow-stubs/plugins/debug_monitor.pyi +2 -2
  157. metaflow-stubs/plugins/environment_decorator.pyi +2 -2
  158. metaflow-stubs/plugins/events_decorator.pyi +2 -2
  159. metaflow-stubs/plugins/frameworks/__init__.pyi +2 -2
  160. metaflow-stubs/plugins/frameworks/pytorch.pyi +2 -2
  161. metaflow-stubs/plugins/gcp/__init__.pyi +2 -2
  162. metaflow-stubs/plugins/gcp/gcp_secret_manager_secrets_provider.pyi +2 -2
  163. metaflow-stubs/plugins/gcp/gs_exceptions.pyi +2 -2
  164. metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +2 -2
  165. metaflow-stubs/plugins/gcp/gs_utils.pyi +2 -2
  166. metaflow-stubs/plugins/gcp/includefile_support.pyi +2 -2
  167. metaflow-stubs/plugins/kubernetes/__init__.pyi +2 -2
  168. metaflow-stubs/plugins/kubernetes/kube_utils.pyi +3 -3
  169. metaflow-stubs/plugins/kubernetes/kubernetes.pyi +2 -2
  170. metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +2 -2
  171. metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +2 -2
  172. metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +2 -2
  173. metaflow-stubs/plugins/kubernetes/spot_monitor_sidecar.pyi +2 -2
  174. metaflow-stubs/plugins/ollama/__init__.pyi +3 -3
  175. metaflow-stubs/plugins/parallel_decorator.pyi +2 -2
  176. metaflow-stubs/plugins/perimeters.pyi +2 -2
  177. metaflow-stubs/plugins/project_decorator.pyi +2 -2
  178. metaflow-stubs/plugins/pypi/__init__.pyi +3 -3
  179. metaflow-stubs/plugins/pypi/conda_decorator.pyi +2 -2
  180. metaflow-stubs/plugins/pypi/conda_environment.pyi +5 -5
  181. metaflow-stubs/plugins/pypi/parsers.pyi +2 -2
  182. metaflow-stubs/plugins/pypi/pypi_decorator.pyi +2 -2
  183. metaflow-stubs/plugins/pypi/pypi_environment.pyi +2 -2
  184. metaflow-stubs/plugins/pypi/utils.pyi +2 -2
  185. metaflow-stubs/plugins/resources_decorator.pyi +2 -2
  186. metaflow-stubs/plugins/retry_decorator.pyi +2 -2
  187. metaflow-stubs/plugins/secrets/__init__.pyi +2 -2
  188. metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +2 -2
  189. metaflow-stubs/plugins/secrets/secrets_decorator.pyi +2 -2
  190. metaflow-stubs/plugins/snowflake/__init__.pyi +2 -2
  191. metaflow-stubs/plugins/storage_executor.pyi +2 -2
  192. metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +3 -3
  193. metaflow-stubs/plugins/timeout_decorator.pyi +2 -2
  194. metaflow-stubs/plugins/torchtune/__init__.pyi +2 -2
  195. metaflow-stubs/plugins/uv/__init__.pyi +2 -2
  196. metaflow-stubs/plugins/uv/uv_environment.pyi +2 -2
  197. metaflow-stubs/profilers/__init__.pyi +2 -2
  198. metaflow-stubs/pylint_wrapper.pyi +2 -2
  199. metaflow-stubs/runner/__init__.pyi +2 -2
  200. metaflow-stubs/runner/deployer.pyi +5 -5
  201. metaflow-stubs/runner/deployer_impl.pyi +2 -2
  202. metaflow-stubs/runner/metaflow_runner.pyi +4 -4
  203. metaflow-stubs/runner/nbdeploy.pyi +2 -2
  204. metaflow-stubs/runner/nbrun.pyi +2 -2
  205. metaflow-stubs/runner/subprocess_manager.pyi +2 -2
  206. metaflow-stubs/runner/utils.pyi +4 -4
  207. metaflow-stubs/system/__init__.pyi +2 -2
  208. metaflow-stubs/system/system_logger.pyi +3 -3
  209. metaflow-stubs/system/system_monitor.pyi +2 -2
  210. metaflow-stubs/tagging_util.pyi +2 -2
  211. metaflow-stubs/tuple_util.pyi +2 -2
  212. metaflow-stubs/user_configs/__init__.pyi +2 -2
  213. metaflow-stubs/user_configs/config_decorators.pyi +5 -5
  214. metaflow-stubs/user_configs/config_options.pyi +3 -3
  215. metaflow-stubs/user_configs/config_parameters.pyi +6 -6
  216. {ob_metaflow_stubs-6.0.3.182rc1.dist-info → ob_metaflow_stubs-6.0.3.183rc0.dist-info}/METADATA +1 -1
  217. ob_metaflow_stubs-6.0.3.183rc0.dist-info/RECORD +220 -0
  218. ob_metaflow_stubs-6.0.3.182rc1.dist-info/RECORD +0 -220
  219. {ob_metaflow_stubs-6.0.3.182rc1.dist-info → ob_metaflow_stubs-6.0.3.183rc0.dist-info}/WHEEL +0 -0
  220. {ob_metaflow_stubs-6.0.3.182rc1.dist-info → ob_metaflow_stubs-6.0.3.183rc0.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.17.1+obcheckpoint(0.2.1);ob(v1) #
4
- # Generated on 2025-06-18T10:06:22.722981 #
3
+ # MF version: 2.15.18.1+obcheckpoint(0.2.1);ob(v1) #
4
+ # Generated on 2025-06-20T20:53:54.419355 #
5
5
  ######################################################################################################
6
6
 
7
7
  from __future__ import annotations
@@ -35,9 +35,9 @@ 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 metaflow_git as metaflow_git
39
38
  from . import tuple_util as tuple_util
40
39
  from . import cards as cards
40
+ from . import metaflow_git as metaflow_git
41
41
  from . import events as events
42
42
  from . import runner as runner
43
43
  from . import plugins as plugins
@@ -156,53 +156,170 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
156
156
  ...
157
157
 
158
158
  @typing.overload
159
- 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]]]:
159
+ def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
160
160
  """
161
- Specifies that the step will success under all circumstances.
161
+ Internal decorator to support Fast bakery
162
+ """
163
+ ...
164
+
165
+ @typing.overload
166
+ def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
167
+ ...
168
+
169
+ def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
170
+ """
171
+ Internal decorator to support Fast bakery
172
+ """
173
+ ...
174
+
175
+ @typing.overload
176
+ 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]]]:
177
+ """
178
+ Specifies secrets to be retrieved and injected as environment variables prior to
179
+ the execution of a step.
162
180
 
163
- The decorator will create an optional artifact, specified by `var`, which
164
- contains the exception raised. You can use it to detect the presence
165
- of errors, indicating that all happy-path artifacts produced by the step
166
- are missing.
181
+
182
+ Parameters
183
+ ----------
184
+ sources : List[Union[str, Dict[str, Any]]], default: []
185
+ List of secret specs, defining how the secrets are to be retrieved
186
+ """
187
+ ...
188
+
189
+ @typing.overload
190
+ def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
191
+ ...
192
+
193
+ @typing.overload
194
+ def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
195
+ ...
196
+
197
+ 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]]] = []):
198
+ """
199
+ Specifies secrets to be retrieved and injected as environment variables prior to
200
+ the execution of a step.
167
201
 
168
202
 
169
203
  Parameters
170
204
  ----------
171
- var : str, optional, default None
172
- Name of the artifact in which to store the caught exception.
173
- If not specified, the exception is not stored.
174
- print_exception : bool, default True
175
- Determines whether or not the exception is printed to
176
- stdout when caught.
205
+ sources : List[Union[str, Dict[str, Any]]], default: []
206
+ List of secret specs, defining how the secrets are to be retrieved
177
207
  """
178
208
  ...
179
209
 
180
210
  @typing.overload
181
- def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
211
+ def model(*, load: typing.Union[typing.List[str], str, typing.List[typing.Tuple[str, typing.Optional[str]]]] = None, temp_dir_root: str = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
212
+ """
213
+ Enables loading / saving of models within a step.
214
+
215
+
216
+
217
+ Parameters
218
+ ----------
219
+ load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
220
+ Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
221
+ These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
222
+ - `current.checkpoint`
223
+ - `current.model`
224
+ - `current.huggingface_hub`
225
+
226
+ If a list of tuples is provided, the first element is the artifact name and the second element is the path the artifact needs be unpacked on
227
+ the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
228
+ If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
229
+
230
+ temp_dir_root : str, default: None
231
+ The root directory under which `current.model.loaded` will store loaded models
232
+ """
182
233
  ...
183
234
 
184
235
  @typing.overload
185
- def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
236
+ def model(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
186
237
  ...
187
238
 
188
- 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):
239
+ @typing.overload
240
+ def model(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
241
+ ...
242
+
243
+ def model(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, load: typing.Union[typing.List[str], str, typing.List[typing.Tuple[str, typing.Optional[str]]]] = None, temp_dir_root: str = None):
189
244
  """
190
- Specifies that the step will success under all circumstances.
245
+ Enables loading / saving of models within a step.
191
246
 
192
- The decorator will create an optional artifact, specified by `var`, which
193
- contains the exception raised. You can use it to detect the presence
194
- of errors, indicating that all happy-path artifacts produced by the step
195
- are missing.
196
247
 
197
248
 
198
249
  Parameters
199
250
  ----------
200
- var : str, optional, default None
201
- Name of the artifact in which to store the caught exception.
202
- If not specified, the exception is not stored.
203
- print_exception : bool, default True
204
- Determines whether or not the exception is printed to
205
- stdout when caught.
251
+ load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
252
+ Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
253
+ These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
254
+ - `current.checkpoint`
255
+ - `current.model`
256
+ - `current.huggingface_hub`
257
+
258
+ If a list of tuples is provided, the first element is the artifact name and the second element is the path the artifact needs be unpacked on
259
+ the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
260
+ If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
261
+
262
+ temp_dir_root : str, default: None
263
+ The root directory under which `current.model.loaded` will store loaded models
264
+ """
265
+ ...
266
+
267
+ @typing.overload
268
+ 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]]]:
269
+ """
270
+ Specifies a timeout for your step.
271
+
272
+ This decorator is useful if this step may hang indefinitely.
273
+
274
+ This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
275
+ A timeout is considered to be an exception thrown by the step. It will cause the step to be
276
+ retried if needed and the exception will be caught by the `@catch` decorator, if present.
277
+
278
+ Note that all the values specified in parameters are added together so if you specify
279
+ 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
280
+
281
+
282
+ Parameters
283
+ ----------
284
+ seconds : int, default 0
285
+ Number of seconds to wait prior to timing out.
286
+ minutes : int, default 0
287
+ Number of minutes to wait prior to timing out.
288
+ hours : int, default 0
289
+ Number of hours to wait prior to timing out.
290
+ """
291
+ ...
292
+
293
+ @typing.overload
294
+ def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
295
+ ...
296
+
297
+ @typing.overload
298
+ def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
299
+ ...
300
+
301
+ 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):
302
+ """
303
+ Specifies a timeout for your step.
304
+
305
+ This decorator is useful if this step may hang indefinitely.
306
+
307
+ This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
308
+ A timeout is considered to be an exception thrown by the step. It will cause the step to be
309
+ retried if needed and the exception will be caught by the `@catch` decorator, if present.
310
+
311
+ Note that all the values specified in parameters are added together so if you specify
312
+ 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
313
+
314
+
315
+ Parameters
316
+ ----------
317
+ seconds : int, default 0
318
+ Number of seconds to wait prior to timing out.
319
+ minutes : int, default 0
320
+ Number of minutes to wait prior to timing out.
321
+ hours : int, default 0
322
+ Number of hours to wait prior to timing out.
206
323
  """
207
324
  ...
208
325
 
@@ -344,249 +461,85 @@ def card(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typ
344
461
  """
345
462
  ...
346
463
 
347
- @typing.overload
348
- 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]]]:
464
+ 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]]]:
349
465
  """
350
- Specifies the PyPI packages for the step.
351
-
352
- Information in this decorator will augment any
353
- attributes set in the `@pyi_base` flow-level decorator. Hence,
354
- you can use `@pypi_base` to set packages required by all
355
- steps and use `@pypi` to specify step-specific overrides.
466
+ Specifies that this step is used to deploy an instance of the app.
467
+ Requires that self.app_name, self.app_port, self.entrypoint and self.deployDir is set.
356
468
 
357
469
 
358
470
  Parameters
359
471
  ----------
360
- packages : Dict[str, str], default: {}
361
- Packages to use for this step. The key is the name of the package
362
- and the value is the version to use.
363
- python : str, optional, default: None
364
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
365
- that the version used will correspond to the version of the Python interpreter used to start the run.
472
+ app_port : int
473
+ Number of GPUs to use.
474
+ app_name : str
475
+ Name of the app to deploy.
366
476
  """
367
477
  ...
368
478
 
369
479
  @typing.overload
370
- def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
480
+ def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
481
+ """
482
+ Decorator prototype for all step decorators. This function gets specialized
483
+ and imported for all decorators types by _import_plugin_decorators().
484
+ """
371
485
  ...
372
486
 
373
487
  @typing.overload
374
- def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
488
+ def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
375
489
  ...
376
490
 
377
- 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):
491
+ def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
378
492
  """
379
- Specifies the PyPI packages for the step.
380
-
381
- Information in this decorator will augment any
382
- attributes set in the `@pyi_base` flow-level decorator. Hence,
383
- you can use `@pypi_base` to set packages required by all
384
- steps and use `@pypi` to specify step-specific overrides.
385
-
386
-
387
- Parameters
388
- ----------
389
- packages : Dict[str, str], default: {}
390
- Packages to use for this step. The key is the name of the package
391
- and the value is the version to use.
392
- python : str, optional, default: None
393
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
394
- that the version used will correspond to the version of the Python interpreter used to start the run.
493
+ Decorator prototype for all step decorators. This function gets specialized
494
+ and imported for all decorators types by _import_plugin_decorators().
395
495
  """
396
496
  ...
397
497
 
398
498
  @typing.overload
399
- def model(*, load: typing.Union[typing.List[str], str, typing.List[typing.Tuple[str, typing.Optional[str]]]] = None, temp_dir_root: str = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
499
+ 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]]]:
400
500
  """
401
- Enables loading / saving of models within a step.
501
+ Specifies the resources needed when executing this step.
402
502
 
503
+ Use `@resources` to specify the resource requirements
504
+ independently of the specific compute layer (`@batch`, `@kubernetes`).
505
+
506
+ You can choose the compute layer on the command line by executing e.g.
507
+ ```
508
+ python myflow.py run --with batch
509
+ ```
510
+ or
511
+ ```
512
+ python myflow.py run --with kubernetes
513
+ ```
514
+ which executes the flow on the desired system using the
515
+ requirements specified in `@resources`.
403
516
 
404
517
 
405
518
  Parameters
406
519
  ----------
407
- load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
408
- Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
409
- These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
410
- - `current.checkpoint`
411
- - `current.model`
412
- - `current.huggingface_hub`
413
-
414
- If a list of tuples is provided, the first element is the artifact name and the second element is the path the artifact needs be unpacked on
415
- the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
416
- If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
417
-
418
- temp_dir_root : str, default: None
419
- The root directory under which `current.model.loaded` will store loaded models
420
- """
421
- ...
422
-
423
- @typing.overload
424
- def model(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
425
- ...
426
-
427
- @typing.overload
428
- def model(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
429
- ...
430
-
431
- def model(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, load: typing.Union[typing.List[str], str, typing.List[typing.Tuple[str, typing.Optional[str]]]] = None, temp_dir_root: str = None):
432
- """
433
- Enables loading / saving of models within a step.
434
-
435
-
436
-
437
- Parameters
438
- ----------
439
- load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
440
- Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
441
- These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
442
- - `current.checkpoint`
443
- - `current.model`
444
- - `current.huggingface_hub`
445
-
446
- If a list of tuples is provided, the first element is the artifact name and the second element is the path the artifact needs be unpacked on
447
- the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
448
- If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
449
-
450
- temp_dir_root : str, default: None
451
- The root directory under which `current.model.loaded` will store loaded models
452
- """
453
- ...
454
-
455
- @typing.overload
456
- def checkpoint(*, load_policy: str = 'fresh', temp_dir_root: str = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
457
- """
458
- Enables checkpointing for a step.
459
-
460
-
461
-
462
- Parameters
463
- ----------
464
- load_policy : str, default: "fresh"
465
- The policy for loading the checkpoint. The following policies are supported:
466
- - "eager": Loads the the latest available checkpoint within the namespace.
467
- With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
468
- will be loaded at the start of the task.
469
- - "none": Do not load any checkpoint
470
- - "fresh": Loads the lastest checkpoint created within the running Task.
471
- This mode helps loading checkpoints across various retry attempts of the same task.
472
- With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
473
- created within the task will be loaded when the task is retries execution on failure.
474
-
475
- temp_dir_root : str, default: None
476
- The root directory under which `current.checkpoint.directory` will be created.
477
- """
478
- ...
479
-
480
- @typing.overload
481
- def checkpoint(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
482
- ...
483
-
484
- @typing.overload
485
- def checkpoint(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
486
- ...
487
-
488
- def checkpoint(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, load_policy: str = 'fresh', temp_dir_root: str = None):
489
- """
490
- Enables checkpointing for a step.
491
-
492
-
493
-
494
- Parameters
495
- ----------
496
- load_policy : str, default: "fresh"
497
- The policy for loading the checkpoint. The following policies are supported:
498
- - "eager": Loads the the latest available checkpoint within the namespace.
499
- With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
500
- will be loaded at the start of the task.
501
- - "none": Do not load any checkpoint
502
- - "fresh": Loads the lastest checkpoint created within the running Task.
503
- This mode helps loading checkpoints across various retry attempts of the same task.
504
- With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
505
- created within the task will be loaded when the task is retries execution on failure.
506
-
507
- temp_dir_root : str, default: None
508
- The root directory under which `current.checkpoint.directory` will be created.
509
- """
510
- ...
511
-
512
- @typing.overload
513
- 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]]]:
514
- """
515
- Specifies secrets to be retrieved and injected as environment variables prior to
516
- the execution of a step.
517
-
518
-
519
- Parameters
520
- ----------
521
- sources : List[Union[str, Dict[str, Any]]], default: []
522
- List of secret specs, defining how the secrets are to be retrieved
520
+ cpu : int, default 1
521
+ Number of CPUs required for this step.
522
+ gpu : int, optional, default None
523
+ Number of GPUs required for this step.
524
+ disk : int, optional, default None
525
+ Disk size (in MB) required for this step. Only applies on Kubernetes.
526
+ memory : int, default 4096
527
+ Memory size (in MB) required for this step.
528
+ shared_memory : int, optional, default None
529
+ The value for the size (in MiB) of the /dev/shm volume for this step.
530
+ This parameter maps to the `--shm-size` option in Docker.
523
531
  """
524
532
  ...
525
533
 
526
534
  @typing.overload
527
- def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
535
+ def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
528
536
  ...
529
537
 
530
538
  @typing.overload
531
- def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
532
- ...
533
-
534
- 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]]] = []):
535
- """
536
- Specifies secrets to be retrieved and injected as environment variables prior to
537
- the execution of a step.
538
-
539
-
540
- Parameters
541
- ----------
542
- sources : List[Union[str, Dict[str, Any]]], default: []
543
- List of secret specs, defining how the secrets are to be retrieved
544
- """
545
- ...
546
-
547
- def nvidia(*, gpu: int, gpu_type: str, queue_timeout: int) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
548
- """
549
- Specifies that this step should execute on DGX cloud.
550
-
551
-
552
- Parameters
553
- ----------
554
- gpu : int
555
- Number of GPUs to use.
556
- gpu_type : str
557
- Type of Nvidia GPU to use.
558
- queue_timeout : int
559
- Time to keep the job in NVCF's queue.
560
- """
561
- ...
562
-
563
- 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]]]:
564
- """
565
- Decorator that helps cache, version and store models/datasets from huggingface hub.
566
-
567
-
568
- Parameters
569
- ----------
570
- temp_dir_root : str, optional
571
- The root directory that will hold the temporary directory where objects will be downloaded.
572
-
573
- load: Union[List[str], List[Tuple[Dict, str]], List[Tuple[str, str]], List[Dict], None]
574
- The list of repos (models/datasets) to load.
575
-
576
- Loaded repos can be accessed via `current.huggingface_hub.loaded`. If load is set, then the following happens:
577
-
578
- - If repo (model/dataset) is not found in the datastore:
579
- - Downloads the repo from Hugging Face Hub to a temporary directory (or uses specified path) for local access
580
- - Stores it in Metaflow's datastore (s3/gcs/azure etc.) with a unique name based on repo_type/repo_id
581
- - All HF models loaded for a `@step` will be cached separately under flow/step/namespace.
582
-
583
- - If repo is found in the datastore:
584
- - Loads it directly from datastore to local path (can be temporary directory or specified path)
585
- """
539
+ def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
586
540
  ...
587
541
 
588
- @typing.overload
589
- 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]]]:
542
+ 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):
590
543
  """
591
544
  Specifies the resources needed when executing this step.
592
545
 
@@ -622,45 +575,61 @@ def resources(*, cpu: int = 1, gpu: typing.Optional[int] = None, disk: typing.Op
622
575
  ...
623
576
 
624
577
  @typing.overload
625
- def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
578
+ 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]]]:
579
+ """
580
+ Specifies the Conda environment for the step.
581
+
582
+ Information in this decorator will augment any
583
+ attributes set in the `@conda_base` flow-level decorator. Hence,
584
+ you can use `@conda_base` to set packages required by all
585
+ steps and use `@conda` to specify step-specific overrides.
586
+
587
+
588
+ Parameters
589
+ ----------
590
+ packages : Dict[str, str], default {}
591
+ Packages to use for this step. The key is the name of the package
592
+ and the value is the version to use.
593
+ libraries : Dict[str, str], default {}
594
+ Supported for backward compatibility. When used with packages, packages will take precedence.
595
+ python : str, optional, default None
596
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
597
+ that the version used will correspond to the version of the Python interpreter used to start the run.
598
+ disabled : bool, default False
599
+ If set to True, disables @conda.
600
+ """
626
601
  ...
627
602
 
628
603
  @typing.overload
629
- def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
604
+ def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
630
605
  ...
631
606
 
632
- 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):
607
+ @typing.overload
608
+ def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
609
+ ...
610
+
611
+ 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):
633
612
  """
634
- Specifies the resources needed when executing this step.
635
-
636
- Use `@resources` to specify the resource requirements
637
- independently of the specific compute layer (`@batch`, `@kubernetes`).
613
+ Specifies the Conda environment for the step.
638
614
 
639
- You can choose the compute layer on the command line by executing e.g.
640
- ```
641
- python myflow.py run --with batch
642
- ```
643
- or
644
- ```
645
- python myflow.py run --with kubernetes
646
- ```
647
- which executes the flow on the desired system using the
648
- requirements specified in `@resources`.
615
+ Information in this decorator will augment any
616
+ attributes set in the `@conda_base` flow-level decorator. Hence,
617
+ you can use `@conda_base` to set packages required by all
618
+ steps and use `@conda` to specify step-specific overrides.
649
619
 
650
620
 
651
621
  Parameters
652
622
  ----------
653
- cpu : int, default 1
654
- Number of CPUs required for this step.
655
- gpu : int, optional, default None
656
- Number of GPUs required for this step.
657
- disk : int, optional, default None
658
- Disk size (in MB) required for this step. Only applies on Kubernetes.
659
- memory : int, default 4096
660
- Memory size (in MB) required for this step.
661
- shared_memory : int, optional, default None
662
- The value for the size (in MiB) of the /dev/shm volume for this step.
663
- This parameter maps to the `--shm-size` option in Docker.
623
+ packages : Dict[str, str], default {}
624
+ Packages to use for this step. The key is the name of the package
625
+ and the value is the version to use.
626
+ libraries : Dict[str, str], default {}
627
+ Supported for backward compatibility. When used with packages, packages will take precedence.
628
+ python : str, optional, default None
629
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
630
+ that the version used will correspond to the version of the Python interpreter used to start the run.
631
+ disabled : bool, default False
632
+ If set to True, disables @conda.
664
633
  """
665
634
  ...
666
635
 
@@ -719,231 +688,117 @@ def retry(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
719
688
  """
720
689
  ...
721
690
 
722
- 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]]]:
691
+ def vllm(*, model: str, backend: str, debug: bool, kwargs: 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]]]:
723
692
  """
724
- This decorator is used to run Ollama APIs as Metaflow task sidecars.
693
+ This decorator is used to run vllm APIs as Metaflow task sidecars.
725
694
 
726
695
  User code call
727
696
  --------------
728
- @ollama(
729
- models=[...],
697
+ @vllm(
698
+ model="...",
730
699
  ...
731
700
  )
732
701
 
733
702
  Valid backend options
734
703
  ---------------------
735
704
  - 'local': Run as a separate process on the local task machine.
736
- - (TODO) 'managed': Outerbounds hosts and selects compute provider.
737
- - (TODO) 'remote': Spin up separate instance to serve Ollama models.
738
705
 
739
706
  Valid model options
740
707
  -------------------
741
- Any model here https://ollama.com/search, e.g. 'llama3.2', 'llama3.3'
708
+ Any HuggingFace model identifier, e.g. 'meta-llama/Llama-3.2-1B'
709
+
710
+ NOTE: vLLM's OpenAI-compatible server serves ONE model per server instance.
711
+ If you need multiple models, you must create multiple @vllm decorators.
742
712
 
743
713
 
744
714
  Parameters
745
715
  ----------
746
- models: list[str]
747
- List of Ollama containers running models in sidecars.
716
+ model: str
717
+ HuggingFace model identifier to be served by vLLM.
748
718
  backend: str
749
- Determines where and how to run the Ollama process.
750
- force_pull: bool
751
- Whether to run `ollama pull` no matter what, or first check the remote cache in Metaflow datastore for this model key.
752
- cache_update_policy: str
753
- Cache update policy: "auto", "force", or "never".
754
- force_cache_update: bool
755
- Simple override for "force" cache update policy.
719
+ Determines where and how to run the vLLM process.
756
720
  debug: bool
757
721
  Whether to turn on verbose debugging logs.
758
- circuit_breaker_config: dict
759
- Configuration for circuit breaker protection. Keys: failure_threshold, recovery_timeout, reset_timeout.
760
- timeout_config: dict
761
- Configuration for various operation timeouts. Keys: pull, stop, health_check, install, server_startup.
762
- """
763
- ...
764
-
765
- @typing.overload
766
- 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]]]:
767
- """
768
- Specifies a timeout for your step.
769
-
770
- This decorator is useful if this step may hang indefinitely.
771
-
772
- This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
773
- A timeout is considered to be an exception thrown by the step. It will cause the step to be
774
- retried if needed and the exception will be caught by the `@catch` decorator, if present.
775
-
776
- Note that all the values specified in parameters are added together so if you specify
777
- 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
778
-
779
-
780
- Parameters
781
- ----------
782
- seconds : int, default 0
783
- Number of seconds to wait prior to timing out.
784
- minutes : int, default 0
785
- Number of minutes to wait prior to timing out.
786
- hours : int, default 0
787
- Number of hours to wait prior to timing out.
788
- """
789
- ...
790
-
791
- @typing.overload
792
- def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
793
- ...
794
-
795
- @typing.overload
796
- def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
797
- ...
798
-
799
- 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):
800
- """
801
- Specifies a timeout for your step.
802
-
803
- This decorator is useful if this step may hang indefinitely.
804
-
805
- This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
806
- A timeout is considered to be an exception thrown by the step. It will cause the step to be
807
- retried if needed and the exception will be caught by the `@catch` decorator, if present.
808
-
809
- Note that all the values specified in parameters are added together so if you specify
810
- 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
811
-
812
-
813
- Parameters
814
- ----------
815
- seconds : int, default 0
816
- Number of seconds to wait prior to timing out.
817
- minutes : int, default 0
818
- Number of minutes to wait prior to timing out.
819
- hours : int, default 0
820
- Number of hours to wait prior to timing out.
722
+ kwargs : Any
723
+ Any other keyword arguments are passed directly to the vLLM engine.
724
+ This allows for flexible configuration of vLLM server settings.
725
+ For example, `tensor_parallel_size=2`.
821
726
  """
822
727
  ...
823
728
 
824
729
  @typing.overload
825
- 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]]]:
730
+ 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]]]:
826
731
  """
827
- Specifies the Conda environment for the step.
732
+ Specifies the PyPI packages for the step.
828
733
 
829
734
  Information in this decorator will augment any
830
- attributes set in the `@conda_base` flow-level decorator. Hence,
831
- you can use `@conda_base` to set packages required by all
832
- steps and use `@conda` to specify step-specific overrides.
735
+ attributes set in the `@pyi_base` flow-level decorator. Hence,
736
+ you can use `@pypi_base` to set packages required by all
737
+ steps and use `@pypi` to specify step-specific overrides.
833
738
 
834
739
 
835
740
  Parameters
836
741
  ----------
837
- packages : Dict[str, str], default {}
742
+ packages : Dict[str, str], default: {}
838
743
  Packages to use for this step. The key is the name of the package
839
744
  and the value is the version to use.
840
- libraries : Dict[str, str], default {}
841
- Supported for backward compatibility. When used with packages, packages will take precedence.
842
- python : str, optional, default None
745
+ python : str, optional, default: None
843
746
  Version of Python to use, e.g. '3.7.4'. A default value of None implies
844
747
  that the version used will correspond to the version of the Python interpreter used to start the run.
845
- disabled : bool, default False
846
- If set to True, disables @conda.
847
748
  """
848
749
  ...
849
750
 
850
751
  @typing.overload
851
- def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
752
+ def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
852
753
  ...
853
754
 
854
755
  @typing.overload
855
- def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
756
+ def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
856
757
  ...
857
758
 
858
- 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):
759
+ 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):
859
760
  """
860
- Specifies the Conda environment for the step.
761
+ Specifies the PyPI packages for the step.
861
762
 
862
763
  Information in this decorator will augment any
863
- attributes set in the `@conda_base` flow-level decorator. Hence,
864
- you can use `@conda_base` to set packages required by all
865
- steps and use `@conda` to specify step-specific overrides.
764
+ attributes set in the `@pyi_base` flow-level decorator. Hence,
765
+ you can use `@pypi_base` to set packages required by all
766
+ steps and use `@pypi` to specify step-specific overrides.
866
767
 
867
768
 
868
769
  Parameters
869
770
  ----------
870
- packages : Dict[str, str], default {}
771
+ packages : Dict[str, str], default: {}
871
772
  Packages to use for this step. The key is the name of the package
872
773
  and the value is the version to use.
873
- libraries : Dict[str, str], default {}
874
- Supported for backward compatibility. When used with packages, packages will take precedence.
875
- python : str, optional, default None
774
+ python : str, optional, default: None
876
775
  Version of Python to use, e.g. '3.7.4'. A default value of None implies
877
776
  that the version used will correspond to the version of the Python interpreter used to start the run.
878
- disabled : bool, default False
879
- If set to True, disables @conda.
880
- """
881
- ...
882
-
883
- @typing.overload
884
- def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
885
- """
886
- Decorator prototype for all step decorators. This function gets specialized
887
- and imported for all decorators types by _import_plugin_decorators().
888
- """
889
- ...
890
-
891
- @typing.overload
892
- def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
893
- ...
894
-
895
- def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
896
- """
897
- Decorator prototype for all step decorators. This function gets specialized
898
- and imported for all decorators types by _import_plugin_decorators().
899
777
  """
900
778
  ...
901
779
 
902
- @typing.overload
903
- 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]]]:
780
+ 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]]]:
904
781
  """
905
- Specifies environment variables to be set prior to the execution of a step.
782
+ Decorator that helps cache, version and store models/datasets from huggingface hub.
906
783
 
907
784
 
908
785
  Parameters
909
786
  ----------
910
- vars : Dict[str, str], default {}
911
- Dictionary of environment variables to set.
912
- """
913
- ...
914
-
915
- @typing.overload
916
- def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
917
- ...
918
-
919
- @typing.overload
920
- def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
921
- ...
922
-
923
- def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
924
- """
925
- Specifies environment variables to be set prior to the execution of a step.
787
+ temp_dir_root : str, optional
788
+ The root directory that will hold the temporary directory where objects will be downloaded.
926
789
 
790
+ load: Union[List[str], List[Tuple[Dict, str]], List[Tuple[str, str]], List[Dict], None]
791
+ The list of repos (models/datasets) to load.
927
792
 
928
- Parameters
929
- ----------
930
- vars : Dict[str, str], default {}
931
- Dictionary of environment variables to set.
932
- """
933
- ...
934
-
935
- 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]]]:
936
- """
937
- Specifies that this step is used to deploy an instance of the app.
938
- Requires that self.app_name, self.app_port, self.entrypoint and self.deployDir is set.
793
+ Loaded repos can be accessed via `current.huggingface_hub.loaded`. If load is set, then the following happens:
939
794
 
795
+ - If repo (model/dataset) is not found in the datastore:
796
+ - Downloads the repo from Hugging Face Hub to a temporary directory (or uses specified path) for local access
797
+ - Stores it in Metaflow's datastore (s3/gcs/azure etc.) with a unique name based on repo_type/repo_id
798
+ - All HF models loaded for a `@step` will be cached separately under flow/step/namespace.
940
799
 
941
- Parameters
942
- ----------
943
- app_port : int
944
- Number of GPUs to use.
945
- app_name : str
946
- Name of the app to deploy.
800
+ - If repo is found in the datastore:
801
+ - Loads it directly from datastore to local path (can be temporary directory or specified path)
947
802
  """
948
803
  ...
949
804
 
@@ -961,291 +816,203 @@ def nvct(*, gpu: int, gpu_type: str) -> typing.Callable[[typing.Union[typing.Cal
961
816
  """
962
817
  ...
963
818
 
964
- def vllm(*, model: str, backend: str, debug: bool, kwargs: 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]]]:
819
+ 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]]]:
965
820
  """
966
- This decorator is used to run vllm APIs as Metaflow task sidecars.
821
+ This decorator is used to run Ollama APIs as Metaflow task sidecars.
967
822
 
968
823
  User code call
969
824
  --------------
970
- @vllm(
971
- model="...",
825
+ @ollama(
826
+ models=[...],
972
827
  ...
973
828
  )
974
829
 
975
830
  Valid backend options
976
831
  ---------------------
977
832
  - 'local': Run as a separate process on the local task machine.
833
+ - (TODO) 'managed': Outerbounds hosts and selects compute provider.
834
+ - (TODO) 'remote': Spin up separate instance to serve Ollama models.
978
835
 
979
836
  Valid model options
980
837
  -------------------
981
- Any HuggingFace model identifier, e.g. 'meta-llama/Llama-3.2-1B'
982
-
983
- NOTE: vLLM's OpenAI-compatible server serves ONE model per server instance.
984
- If you need multiple models, you must create multiple @vllm decorators.
838
+ Any model here https://ollama.com/search, e.g. 'llama3.2', 'llama3.3'
985
839
 
986
840
 
987
841
  Parameters
988
842
  ----------
989
- model: str
990
- HuggingFace model identifier to be served by vLLM.
843
+ models: list[str]
844
+ List of Ollama containers running models in sidecars.
991
845
  backend: str
992
- Determines where and how to run the vLLM process.
846
+ Determines where and how to run the Ollama process.
847
+ force_pull: bool
848
+ Whether to run `ollama pull` no matter what, or first check the remote cache in Metaflow datastore for this model key.
849
+ cache_update_policy: str
850
+ Cache update policy: "auto", "force", or "never".
851
+ force_cache_update: bool
852
+ Simple override for "force" cache update policy.
993
853
  debug: bool
994
854
  Whether to turn on verbose debugging logs.
995
- kwargs : Any
996
- Any other keyword arguments are passed directly to the vLLM engine.
997
- This allows for flexible configuration of vLLM server settings.
998
- For example, `tensor_parallel_size=2`.
855
+ circuit_breaker_config: dict
856
+ Configuration for circuit breaker protection. Keys: failure_threshold, recovery_timeout, reset_timeout.
857
+ timeout_config: dict
858
+ Configuration for various operation timeouts. Keys: pull, stop, health_check, install, server_startup.
999
859
  """
1000
860
  ...
1001
861
 
1002
- @typing.overload
1003
- def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
862
+ def nvidia(*, gpu: int, gpu_type: str, queue_timeout: int) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
1004
863
  """
1005
- Internal decorator to support Fast bakery
864
+ Specifies that this step should execute on DGX cloud.
865
+
866
+
867
+ Parameters
868
+ ----------
869
+ gpu : int
870
+ Number of GPUs to use.
871
+ gpu_type : str
872
+ Type of Nvidia GPU to use.
873
+ queue_timeout : int
874
+ Time to keep the job in NVCF's queue.
1006
875
  """
1007
876
  ...
1008
877
 
1009
878
  @typing.overload
1010
- def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1011
- ...
1012
-
1013
- def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
1014
- """
1015
- Internal decorator to support Fast bakery
1016
- """
1017
- ...
1018
-
1019
- def with_artifact_store(f: typing.Optional[typing.Type[FlowSpecDerived]] = None):
879
+ def checkpoint(*, load_policy: str = 'fresh', temp_dir_root: str = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
1020
880
  """
1021
- Allows setting external datastores to save data for the
1022
- `@checkpoint`/`@model`/`@huggingface_hub` decorators.
881
+ Enables checkpointing for a step.
1023
882
 
1024
- This decorator is useful when users wish to save data to a different datastore
1025
- than what is configured in Metaflow. This can be for variety of reasons:
1026
883
 
1027
- 1. Data security: The objects needs to be stored in a bucket (object storage) that is not accessible by other flows.
1028
- 2. Data Locality: The location where the task is executing is not located in the same region as the datastore.
1029
- - Example: Metaflow datastore lives in US East, but the task is executing in Finland datacenters.
1030
- 3. Data Lifecycle Policies: The objects need to be archived / managed separately from the Metaflow managed objects.
1031
- - Example: Flow is training very large models that need to be stored separately and will be deleted more aggressively than the Metaflow managed objects.
1032
884
 
1033
- Usage:
885
+ Parameters
1034
886
  ----------
887
+ load_policy : str, default: "fresh"
888
+ The policy for loading the checkpoint. The following policies are supported:
889
+ - "eager": Loads the the latest available checkpoint within the namespace.
890
+ With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
891
+ will be loaded at the start of the task.
892
+ - "none": Do not load any checkpoint
893
+ - "fresh": Loads the lastest checkpoint created within the running Task.
894
+ This mode helps loading checkpoints across various retry attempts of the same task.
895
+ With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
896
+ created within the task will be loaded when the task is retries execution on failure.
1035
897
 
1036
- - Using a custom IAM role to access the datastore.
1037
-
1038
- ```python
1039
- @with_artifact_store(
1040
- type="s3",
1041
- config=lambda: {
1042
- "root": "s3://my-bucket-foo/path/to/root",
1043
- "role_arn": ROLE,
1044
- },
1045
- )
1046
- class MyFlow(FlowSpec):
1047
-
1048
- @checkpoint
1049
- @step
1050
- def start(self):
1051
- with open("my_file.txt", "w") as f:
1052
- f.write("Hello, World!")
1053
- self.external_bucket_checkpoint = current.checkpoint.save("my_file.txt")
1054
- self.next(self.end)
1055
-
1056
- ```
1057
-
1058
- - Using credentials to access the s3-compatible datastore.
1059
-
1060
- ```python
1061
- @with_artifact_store(
1062
- type="s3",
1063
- config=lambda: {
1064
- "root": "s3://my-bucket-foo/path/to/root",
1065
- "client_params": {
1066
- "aws_access_key_id": os.environ.get("MY_CUSTOM_ACCESS_KEY"),
1067
- "aws_secret_access_key": os.environ.get("MY_CUSTOM_SECRET_KEY"),
1068
- },
1069
- },
1070
- )
1071
- class MyFlow(FlowSpec):
1072
-
1073
- @checkpoint
1074
- @step
1075
- def start(self):
1076
- with open("my_file.txt", "w") as f:
1077
- f.write("Hello, World!")
1078
- self.external_bucket_checkpoint = current.checkpoint.save("my_file.txt")
1079
- self.next(self.end)
1080
-
1081
- ```
898
+ temp_dir_root : str, default: None
899
+ The root directory under which `current.checkpoint.directory` will be created.
900
+ """
901
+ ...
902
+
903
+ @typing.overload
904
+ def checkpoint(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
905
+ ...
906
+
907
+ @typing.overload
908
+ def checkpoint(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
909
+ ...
910
+
911
+ def checkpoint(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, load_policy: str = 'fresh', temp_dir_root: str = None):
912
+ """
913
+ Enables checkpointing for a step.
1082
914
 
1083
- - Accessing objects stored in external datastores after task execution.
1084
915
 
1085
- ```python
1086
- run = Run("CheckpointsTestsFlow/8992")
1087
- with artifact_store_from(run=run, config={
1088
- "client_params": {
1089
- "aws_access_key_id": os.environ.get("MY_CUSTOM_ACCESS_KEY"),
1090
- "aws_secret_access_key": os.environ.get("MY_CUSTOM_SECRET_KEY"),
1091
- },
1092
- }):
1093
- with Checkpoint() as cp:
1094
- latest = cp.list(
1095
- task=run["start"].task
1096
- )[0]
1097
- print(latest)
1098
- cp.load(
1099
- latest,
1100
- "test-checkpoints"
1101
- )
1102
916
 
1103
- task = Task("TorchTuneFlow/8484/train/53673")
1104
- with artifact_store_from(run=run, config={
1105
- "client_params": {
1106
- "aws_access_key_id": os.environ.get("MY_CUSTOM_ACCESS_KEY"),
1107
- "aws_secret_access_key": os.environ.get("MY_CUSTOM_SECRET_KEY"),
1108
- },
1109
- }):
1110
- load_model(
1111
- task.data.model_ref,
1112
- "test-models"
1113
- )
1114
- ```
1115
- Parameters:
917
+ Parameters
1116
918
  ----------
1117
-
1118
- type: str
1119
- The type of the datastore. Can be one of 's3', 'gcs', 'azure' or any other supported metaflow Datastore.
1120
-
1121
- config: dict or Callable
1122
- Dictionary of configuration options for the datastore. The following keys are required:
1123
- - root: The root path in the datastore where the data will be saved. (needs to be in the format expected by the datastore)
1124
- - example: 's3://bucket-name/path/to/root'
1125
- - example: 'gs://bucket-name/path/to/root'
1126
- - example: 'https://myblockacc.blob.core.windows.net/metaflow/'
1127
- - role_arn (optional): AWS IAM role to access s3 bucket (only when `type` is 's3')
1128
- - session_vars (optional): AWS session variables to access s3 bucket (only when `type` is 's3')
1129
- - client_params (optional): AWS client parameters to access s3 bucket (only when `type` is 's3')
919
+ load_policy : str, default: "fresh"
920
+ The policy for loading the checkpoint. The following policies are supported:
921
+ - "eager": Loads the the latest available checkpoint within the namespace.
922
+ With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
923
+ will be loaded at the start of the task.
924
+ - "none": Do not load any checkpoint
925
+ - "fresh": Loads the lastest checkpoint created within the running Task.
926
+ This mode helps loading checkpoints across various retry attempts of the same task.
927
+ With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
928
+ created within the task will be loaded when the task is retries execution on failure.
929
+
930
+ temp_dir_root : str, default: None
931
+ The root directory under which `current.checkpoint.directory` will be created.
1130
932
  """
1131
933
  ...
1132
934
 
1133
935
  @typing.overload
1134
- def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
936
+ 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]]]:
1135
937
  """
1136
- Specifies the PyPI packages for all steps of the flow.
938
+ Specifies that the step will success under all circumstances.
939
+
940
+ The decorator will create an optional artifact, specified by `var`, which
941
+ contains the exception raised. You can use it to detect the presence
942
+ of errors, indicating that all happy-path artifacts produced by the step
943
+ are missing.
1137
944
 
1138
- Use `@pypi_base` to set common packages required by all
1139
- steps and use `@pypi` to specify step-specific overrides.
1140
945
 
1141
946
  Parameters
1142
947
  ----------
1143
- packages : Dict[str, str], default: {}
1144
- Packages to use for this flow. The key is the name of the package
1145
- and the value is the version to use.
1146
- python : str, optional, default: None
1147
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1148
- that the version used will correspond to the version of the Python interpreter used to start the run.
948
+ var : str, optional, default None
949
+ Name of the artifact in which to store the caught exception.
950
+ If not specified, the exception is not stored.
951
+ print_exception : bool, default True
952
+ Determines whether or not the exception is printed to
953
+ stdout when caught.
1149
954
  """
1150
955
  ...
1151
956
 
1152
957
  @typing.overload
1153
- def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
958
+ def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1154
959
  ...
1155
960
 
1156
- def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
961
+ @typing.overload
962
+ def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
963
+ ...
964
+
965
+ 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):
1157
966
  """
1158
- Specifies the PyPI packages for all steps of the flow.
967
+ Specifies that the step will success under all circumstances.
968
+
969
+ The decorator will create an optional artifact, specified by `var`, which
970
+ contains the exception raised. You can use it to detect the presence
971
+ of errors, indicating that all happy-path artifacts produced by the step
972
+ are missing.
1159
973
 
1160
- Use `@pypi_base` to set common packages required by all
1161
- steps and use `@pypi` to specify step-specific overrides.
1162
974
 
1163
975
  Parameters
1164
976
  ----------
1165
- packages : Dict[str, str], default: {}
1166
- Packages to use for this flow. The key is the name of the package
1167
- and the value is the version to use.
1168
- python : str, optional, default: None
1169
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1170
- that the version used will correspond to the version of the Python interpreter used to start the run.
977
+ var : str, optional, default None
978
+ Name of the artifact in which to store the caught exception.
979
+ If not specified, the exception is not stored.
980
+ print_exception : bool, default True
981
+ Determines whether or not the exception is printed to
982
+ stdout when caught.
1171
983
  """
1172
984
  ...
1173
985
 
1174
- def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
986
+ @typing.overload
987
+ 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]]]:
1175
988
  """
1176
- Specifies what flows belong to the same project.
1177
-
1178
- A project-specific namespace is created for all flows that
1179
- use the same `@project(name)`.
989
+ Specifies environment variables to be set prior to the execution of a step.
1180
990
 
1181
991
 
1182
992
  Parameters
1183
993
  ----------
1184
- name : str
1185
- Project name. Make sure that the name is unique amongst all
1186
- projects that use the same production scheduler. The name may
1187
- contain only lowercase alphanumeric characters and underscores.
1188
-
1189
- branch : Optional[str], default None
1190
- The branch to use. If not specified, the branch is set to
1191
- `user.<username>` unless `production` is set to `True`. This can
1192
- also be set on the command line using `--branch` as a top-level option.
1193
- It is an error to specify `branch` in the decorator and on the command line.
1194
-
1195
- production : bool, default False
1196
- Whether or not the branch is the production branch. This can also be set on the
1197
- command line using `--production` as a top-level option. It is an error to specify
1198
- `production` in the decorator and on the command line.
1199
- The project branch name will be:
1200
- - if `branch` is specified:
1201
- - if `production` is True: `prod.<branch>`
1202
- - if `production` is False: `test.<branch>`
1203
- - if `branch` is not specified:
1204
- - if `production` is True: `prod`
1205
- - if `production` is False: `user.<username>`
994
+ vars : Dict[str, str], default {}
995
+ Dictionary of environment variables to set.
1206
996
  """
1207
997
  ...
1208
998
 
1209
- 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]]:
999
+ @typing.overload
1000
+ def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1001
+ ...
1002
+
1003
+ @typing.overload
1004
+ def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1005
+ ...
1006
+
1007
+ def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
1210
1008
  """
1211
- 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.
1212
- 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.
1009
+ Specifies environment variables to be set prior to the execution of a step.
1213
1010
 
1214
1011
 
1215
1012
  Parameters
1216
1013
  ----------
1217
- timeout : int
1218
- Time, in seconds before the task times out and fails. (Default: 3600)
1219
- poke_interval : int
1220
- Time in seconds that the job should wait in between each try. (Default: 60)
1221
- mode : str
1222
- How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1223
- exponential_backoff : bool
1224
- allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1225
- pool : str
1226
- the slot pool this task should run in,
1227
- slot pools are a way to limit concurrency for certain tasks. (Default:None)
1228
- soft_fail : bool
1229
- Set to true to mark the task as SKIPPED on failure. (Default: False)
1230
- name : str
1231
- Name of the sensor on Airflow
1232
- description : str
1233
- Description of sensor in the Airflow UI
1234
- external_dag_id : str
1235
- The dag_id that contains the task you want to wait for.
1236
- external_task_ids : List[str]
1237
- The list of task_ids that you want to wait for.
1238
- If None (default value) the sensor waits for the DAG. (Default: None)
1239
- allowed_states : List[str]
1240
- Iterable of allowed states, (Default: ['success'])
1241
- failed_states : List[str]
1242
- Iterable of failed or dis-allowed states. (Default: None)
1243
- execution_delta : datetime.timedelta
1244
- time difference with the previous execution to look at,
1245
- the default is the same logical date as the current task or DAG. (Default: None)
1246
- check_existence: bool
1247
- Set to True to check if the external task exists or check if
1248
- the DAG to wait for exists. (Default: True)
1014
+ vars : Dict[str, str], default {}
1015
+ Dictionary of environment variables to set.
1249
1016
  """
1250
1017
  ...
1251
1018
 
@@ -1342,54 +1109,287 @@ def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, event: t
1342
1109
  """
1343
1110
  ...
1344
1111
 
1112
+ 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]]:
1113
+ """
1114
+ 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)
1115
+ before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
1116
+ and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
1117
+ added as a flow decorators. Adding more than one decorator will ensure that `start` step
1118
+ starts only after all sensors finish.
1119
+
1120
+
1121
+ Parameters
1122
+ ----------
1123
+ timeout : int
1124
+ Time, in seconds before the task times out and fails. (Default: 3600)
1125
+ poke_interval : int
1126
+ Time in seconds that the job should wait in between each try. (Default: 60)
1127
+ mode : str
1128
+ How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1129
+ exponential_backoff : bool
1130
+ allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1131
+ pool : str
1132
+ the slot pool this task should run in,
1133
+ slot pools are a way to limit concurrency for certain tasks. (Default:None)
1134
+ soft_fail : bool
1135
+ Set to true to mark the task as SKIPPED on failure. (Default: False)
1136
+ name : str
1137
+ Name of the sensor on Airflow
1138
+ description : str
1139
+ Description of sensor in the Airflow UI
1140
+ bucket_key : Union[str, List[str]]
1141
+ The key(s) being waited on. Supports full s3:// style url or relative path from root level.
1142
+ When it's specified as a full s3:// url, please leave `bucket_name` as None
1143
+ bucket_name : str
1144
+ Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
1145
+ When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
1146
+ wildcard_match : bool
1147
+ whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
1148
+ aws_conn_id : str
1149
+ a reference to the s3 connection on Airflow. (Default: None)
1150
+ verify : bool
1151
+ Whether or not to verify SSL certificates for S3 connection. (Default: None)
1152
+ """
1153
+ ...
1154
+
1155
+ @typing.overload
1156
+ 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]]:
1157
+ """
1158
+ Specifies the times when the flow should be run when running on a
1159
+ production scheduler.
1160
+
1161
+
1162
+ Parameters
1163
+ ----------
1164
+ hourly : bool, default False
1165
+ Run the workflow hourly.
1166
+ daily : bool, default True
1167
+ Run the workflow daily.
1168
+ weekly : bool, default False
1169
+ Run the workflow weekly.
1170
+ cron : str, optional, default None
1171
+ Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1172
+ specified by this expression.
1173
+ timezone : str, optional, default None
1174
+ Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1175
+ which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1176
+ """
1177
+ ...
1178
+
1179
+ @typing.overload
1180
+ def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1181
+ ...
1182
+
1183
+ 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):
1184
+ """
1185
+ Specifies the times when the flow should be run when running on a
1186
+ production scheduler.
1187
+
1188
+
1189
+ Parameters
1190
+ ----------
1191
+ hourly : bool, default False
1192
+ Run the workflow hourly.
1193
+ daily : bool, default True
1194
+ Run the workflow daily.
1195
+ weekly : bool, default False
1196
+ Run the workflow weekly.
1197
+ cron : str, optional, default None
1198
+ Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1199
+ specified by this expression.
1200
+ timezone : str, optional, default None
1201
+ Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1202
+ which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1203
+ """
1204
+ ...
1205
+
1206
+ def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1207
+ """
1208
+ Specifies what flows belong to the same project.
1209
+
1210
+ A project-specific namespace is created for all flows that
1211
+ use the same `@project(name)`.
1212
+
1213
+
1214
+ Parameters
1215
+ ----------
1216
+ name : str
1217
+ Project name. Make sure that the name is unique amongst all
1218
+ projects that use the same production scheduler. The name may
1219
+ contain only lowercase alphanumeric characters and underscores.
1220
+
1221
+ branch : Optional[str], default None
1222
+ The branch to use. If not specified, the branch is set to
1223
+ `user.<username>` unless `production` is set to `True`. This can
1224
+ also be set on the command line using `--branch` as a top-level option.
1225
+ It is an error to specify `branch` in the decorator and on the command line.
1226
+
1227
+ production : bool, default False
1228
+ Whether or not the branch is the production branch. This can also be set on the
1229
+ command line using `--production` as a top-level option. It is an error to specify
1230
+ `production` in the decorator and on the command line.
1231
+ The project branch name will be:
1232
+ - if `branch` is specified:
1233
+ - if `production` is True: `prod.<branch>`
1234
+ - if `production` is False: `test.<branch>`
1235
+ - if `branch` is not specified:
1236
+ - if `production` is True: `prod`
1237
+ - if `production` is False: `user.<username>`
1238
+ """
1239
+ ...
1240
+
1345
1241
  @typing.overload
1346
- 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]]:
1242
+ def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1347
1243
  """
1348
- Specifies the Conda environment for all steps of the flow.
1349
-
1350
- Use `@conda_base` to set common libraries required by all
1351
- steps and use `@conda` to specify step-specific additions.
1244
+ Specifies the PyPI packages for all steps of the flow.
1352
1245
 
1246
+ Use `@pypi_base` to set common packages required by all
1247
+ steps and use `@pypi` to specify step-specific overrides.
1353
1248
 
1354
1249
  Parameters
1355
1250
  ----------
1356
- packages : Dict[str, str], default {}
1251
+ packages : Dict[str, str], default: {}
1357
1252
  Packages to use for this flow. The key is the name of the package
1358
1253
  and the value is the version to use.
1359
- libraries : Dict[str, str], default {}
1360
- Supported for backward compatibility. When used with packages, packages will take precedence.
1361
- python : str, optional, default None
1254
+ python : str, optional, default: None
1362
1255
  Version of Python to use, e.g. '3.7.4'. A default value of None implies
1363
1256
  that the version used will correspond to the version of the Python interpreter used to start the run.
1364
- disabled : bool, default False
1365
- If set to True, disables Conda.
1366
1257
  """
1367
1258
  ...
1368
1259
 
1369
1260
  @typing.overload
1370
- def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1261
+ def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1371
1262
  ...
1372
1263
 
1373
- def conda_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False):
1264
+ def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
1374
1265
  """
1375
- Specifies the Conda environment for all steps of the flow.
1376
-
1377
- Use `@conda_base` to set common libraries required by all
1378
- steps and use `@conda` to specify step-specific additions.
1266
+ Specifies the PyPI packages for all steps of the flow.
1379
1267
 
1268
+ Use `@pypi_base` to set common packages required by all
1269
+ steps and use `@pypi` to specify step-specific overrides.
1380
1270
 
1381
1271
  Parameters
1382
1272
  ----------
1383
- packages : Dict[str, str], default {}
1273
+ packages : Dict[str, str], default: {}
1384
1274
  Packages to use for this flow. The key is the name of the package
1385
1275
  and the value is the version to use.
1386
- libraries : Dict[str, str], default {}
1387
- Supported for backward compatibility. When used with packages, packages will take precedence.
1388
- python : str, optional, default None
1276
+ python : str, optional, default: None
1389
1277
  Version of Python to use, e.g. '3.7.4'. A default value of None implies
1390
1278
  that the version used will correspond to the version of the Python interpreter used to start the run.
1391
- disabled : bool, default False
1392
- If set to True, disables Conda.
1279
+ """
1280
+ ...
1281
+
1282
+ def with_artifact_store(f: typing.Optional[typing.Type[FlowSpecDerived]] = None):
1283
+ """
1284
+ Allows setting external datastores to save data for the
1285
+ `@checkpoint`/`@model`/`@huggingface_hub` decorators.
1286
+
1287
+ This decorator is useful when users wish to save data to a different datastore
1288
+ than what is configured in Metaflow. This can be for variety of reasons:
1289
+
1290
+ 1. Data security: The objects needs to be stored in a bucket (object storage) that is not accessible by other flows.
1291
+ 2. Data Locality: The location where the task is executing is not located in the same region as the datastore.
1292
+ - Example: Metaflow datastore lives in US East, but the task is executing in Finland datacenters.
1293
+ 3. Data Lifecycle Policies: The objects need to be archived / managed separately from the Metaflow managed objects.
1294
+ - Example: Flow is training very large models that need to be stored separately and will be deleted more aggressively than the Metaflow managed objects.
1295
+
1296
+ Usage:
1297
+ ----------
1298
+
1299
+ - Using a custom IAM role to access the datastore.
1300
+
1301
+ ```python
1302
+ @with_artifact_store(
1303
+ type="s3",
1304
+ config=lambda: {
1305
+ "root": "s3://my-bucket-foo/path/to/root",
1306
+ "role_arn": ROLE,
1307
+ },
1308
+ )
1309
+ class MyFlow(FlowSpec):
1310
+
1311
+ @checkpoint
1312
+ @step
1313
+ def start(self):
1314
+ with open("my_file.txt", "w") as f:
1315
+ f.write("Hello, World!")
1316
+ self.external_bucket_checkpoint = current.checkpoint.save("my_file.txt")
1317
+ self.next(self.end)
1318
+
1319
+ ```
1320
+
1321
+ - Using credentials to access the s3-compatible datastore.
1322
+
1323
+ ```python
1324
+ @with_artifact_store(
1325
+ type="s3",
1326
+ config=lambda: {
1327
+ "root": "s3://my-bucket-foo/path/to/root",
1328
+ "client_params": {
1329
+ "aws_access_key_id": os.environ.get("MY_CUSTOM_ACCESS_KEY"),
1330
+ "aws_secret_access_key": os.environ.get("MY_CUSTOM_SECRET_KEY"),
1331
+ },
1332
+ },
1333
+ )
1334
+ class MyFlow(FlowSpec):
1335
+
1336
+ @checkpoint
1337
+ @step
1338
+ def start(self):
1339
+ with open("my_file.txt", "w") as f:
1340
+ f.write("Hello, World!")
1341
+ self.external_bucket_checkpoint = current.checkpoint.save("my_file.txt")
1342
+ self.next(self.end)
1343
+
1344
+ ```
1345
+
1346
+ - Accessing objects stored in external datastores after task execution.
1347
+
1348
+ ```python
1349
+ run = Run("CheckpointsTestsFlow/8992")
1350
+ with artifact_store_from(run=run, config={
1351
+ "client_params": {
1352
+ "aws_access_key_id": os.environ.get("MY_CUSTOM_ACCESS_KEY"),
1353
+ "aws_secret_access_key": os.environ.get("MY_CUSTOM_SECRET_KEY"),
1354
+ },
1355
+ }):
1356
+ with Checkpoint() as cp:
1357
+ latest = cp.list(
1358
+ task=run["start"].task
1359
+ )[0]
1360
+ print(latest)
1361
+ cp.load(
1362
+ latest,
1363
+ "test-checkpoints"
1364
+ )
1365
+
1366
+ task = Task("TorchTuneFlow/8484/train/53673")
1367
+ with artifact_store_from(run=run, config={
1368
+ "client_params": {
1369
+ "aws_access_key_id": os.environ.get("MY_CUSTOM_ACCESS_KEY"),
1370
+ "aws_secret_access_key": os.environ.get("MY_CUSTOM_SECRET_KEY"),
1371
+ },
1372
+ }):
1373
+ load_model(
1374
+ task.data.model_ref,
1375
+ "test-models"
1376
+ )
1377
+ ```
1378
+ Parameters:
1379
+ ----------
1380
+
1381
+ type: str
1382
+ The type of the datastore. Can be one of 's3', 'gcs', 'azure' or any other supported metaflow Datastore.
1383
+
1384
+ config: dict or Callable
1385
+ Dictionary of configuration options for the datastore. The following keys are required:
1386
+ - root: The root path in the datastore where the data will be saved. (needs to be in the format expected by the datastore)
1387
+ - example: 's3://bucket-name/path/to/root'
1388
+ - example: 'gs://bucket-name/path/to/root'
1389
+ - example: 'https://myblockacc.blob.core.windows.net/metaflow/'
1390
+ - role_arn (optional): AWS IAM role to access s3 bucket (only when `type` is 's3')
1391
+ - session_vars (optional): AWS session variables to access s3 bucket (only when `type` is 's3')
1392
+ - client_params (optional): AWS client parameters to access s3 bucket (only when `type` is 's3')
1393
1393
  """
1394
1394
  ...
1395
1395
 
@@ -1495,63 +1495,60 @@ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *
1495
1495
  ...
1496
1496
 
1497
1497
  @typing.overload
1498
- 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]]:
1498
+ 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]]:
1499
1499
  """
1500
- Specifies the times when the flow should be run when running on a
1501
- production scheduler.
1500
+ Specifies the Conda environment for all steps of the flow.
1501
+
1502
+ Use `@conda_base` to set common libraries required by all
1503
+ steps and use `@conda` to specify step-specific additions.
1502
1504
 
1503
1505
 
1504
1506
  Parameters
1505
1507
  ----------
1506
- hourly : bool, default False
1507
- Run the workflow hourly.
1508
- daily : bool, default True
1509
- Run the workflow daily.
1510
- weekly : bool, default False
1511
- Run the workflow weekly.
1512
- cron : str, optional, default None
1513
- Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1514
- specified by this expression.
1515
- timezone : str, optional, default None
1516
- Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1517
- which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1508
+ packages : Dict[str, str], default {}
1509
+ Packages to use for this flow. The key is the name of the package
1510
+ and the value is the version to use.
1511
+ libraries : Dict[str, str], default {}
1512
+ Supported for backward compatibility. When used with packages, packages will take precedence.
1513
+ python : str, optional, default None
1514
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1515
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1516
+ disabled : bool, default False
1517
+ If set to True, disables Conda.
1518
1518
  """
1519
1519
  ...
1520
1520
 
1521
1521
  @typing.overload
1522
- def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1522
+ def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1523
1523
  ...
1524
1524
 
1525
- 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):
1525
+ def conda_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False):
1526
1526
  """
1527
- Specifies the times when the flow should be run when running on a
1528
- production scheduler.
1527
+ Specifies the Conda environment for all steps of the flow.
1528
+
1529
+ Use `@conda_base` to set common libraries required by all
1530
+ steps and use `@conda` to specify step-specific additions.
1529
1531
 
1530
1532
 
1531
1533
  Parameters
1532
1534
  ----------
1533
- hourly : bool, default False
1534
- Run the workflow hourly.
1535
- daily : bool, default True
1536
- Run the workflow daily.
1537
- weekly : bool, default False
1538
- Run the workflow weekly.
1539
- cron : str, optional, default None
1540
- Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1541
- specified by this expression.
1542
- timezone : str, optional, default None
1543
- Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1544
- which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1535
+ packages : Dict[str, str], default {}
1536
+ Packages to use for this flow. The key is the name of the package
1537
+ and the value is the version to use.
1538
+ libraries : Dict[str, str], default {}
1539
+ Supported for backward compatibility. When used with packages, packages will take precedence.
1540
+ python : str, optional, default None
1541
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1542
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1543
+ disabled : bool, default False
1544
+ If set to True, disables Conda.
1545
1545
  """
1546
1546
  ...
1547
1547
 
1548
- 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]]:
1548
+ 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]]:
1549
1549
  """
1550
- 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)
1551
- before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
1552
- and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
1553
- added as a flow decorators. Adding more than one decorator will ensure that `start` step
1554
- starts only after all sensors finish.
1550
+ 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.
1551
+ 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.
1555
1552
 
1556
1553
 
1557
1554
  Parameters
@@ -1573,18 +1570,21 @@ def airflow_s3_key_sensor(*, timeout: int, poke_interval: int, mode: str, expone
1573
1570
  Name of the sensor on Airflow
1574
1571
  description : str
1575
1572
  Description of sensor in the Airflow UI
1576
- bucket_key : Union[str, List[str]]
1577
- The key(s) being waited on. Supports full s3:// style url or relative path from root level.
1578
- When it's specified as a full s3:// url, please leave `bucket_name` as None
1579
- bucket_name : str
1580
- Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
1581
- When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
1582
- wildcard_match : bool
1583
- whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
1584
- aws_conn_id : str
1585
- a reference to the s3 connection on Airflow. (Default: None)
1586
- verify : bool
1587
- Whether or not to verify SSL certificates for S3 connection. (Default: None)
1573
+ external_dag_id : str
1574
+ The dag_id that contains the task you want to wait for.
1575
+ external_task_ids : List[str]
1576
+ The list of task_ids that you want to wait for.
1577
+ If None (default value) the sensor waits for the DAG. (Default: None)
1578
+ allowed_states : List[str]
1579
+ Iterable of allowed states, (Default: ['success'])
1580
+ failed_states : List[str]
1581
+ Iterable of failed or dis-allowed states. (Default: None)
1582
+ execution_delta : datetime.timedelta
1583
+ time difference with the previous execution to look at,
1584
+ the default is the same logical date as the current task or DAG. (Default: None)
1585
+ check_existence: bool
1586
+ Set to True to check if the external task exists or check if
1587
+ the DAG to wait for exists. (Default: True)
1588
1588
  """
1589
1589
  ...
1590
1590