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