ob-metaflow-stubs 6.0.3.187__py2.py3-none-any.whl → 6.0.3.188rc0__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 (239) hide show
  1. metaflow-stubs/__init__.pyi +917 -917
  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 +4 -4
  8. metaflow-stubs/client/filecache.pyi +1 -1
  9. metaflow-stubs/events.pyi +2 -2
  10. metaflow-stubs/exception.pyi +1 -1
  11. metaflow-stubs/flowspec.pyi +3 -3
  12. metaflow-stubs/generated_for.txt +1 -1
  13. metaflow-stubs/includefile.pyi +3 -3
  14. metaflow-stubs/info_file.pyi +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 +41 -41
  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 +3 -3
  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 +5 -5
  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 +2 -2
  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 +3 -3
  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/apps/__init__.pyi +6 -0
  67. metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/__init__.pyi +22 -0
  68. metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/_state_machine.pyi +119 -0
  69. metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/_vendor/__init__.pyi +6 -0
  70. metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/_vendor/spinner/__init__.pyi +6 -0
  71. metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/_vendor/spinner/spinners.pyi +19 -0
  72. metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/app_cli.pyi +126 -0
  73. metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/app_config.pyi +98 -0
  74. metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/capsule.pyi +233 -0
  75. metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/cli_to_config.pyi +17 -0
  76. metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/click_importer.pyi +12 -0
  77. metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/code_package/__init__.pyi +12 -0
  78. metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/code_package/code_packager.pyi +242 -0
  79. metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/dependencies.pyi +50 -0
  80. metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/experimental/__init__.pyi +27 -0
  81. metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/perimeters.pyi +30 -0
  82. metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/secrets.pyi +46 -0
  83. metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/utils.pyi +91 -0
  84. metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/validations.pyi +24 -0
  85. metaflow-stubs/mf_extensions/outerbounds/plugins/aws/__init__.pyi +1 -1
  86. metaflow-stubs/mf_extensions/outerbounds/plugins/aws/assume_role_decorator.pyi +1 -1
  87. metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/__init__.pyi +1 -1
  88. metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/async_cards.pyi +2 -2
  89. metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/injector.pyi +1 -1
  90. metaflow-stubs/mf_extensions/outerbounds/plugins/checkpoint_datastores/__init__.pyi +1 -1
  91. metaflow-stubs/mf_extensions/outerbounds/plugins/checkpoint_datastores/coreweave.pyi +1 -1
  92. metaflow-stubs/mf_extensions/outerbounds/plugins/checkpoint_datastores/nebius.pyi +1 -1
  93. metaflow-stubs/mf_extensions/outerbounds/plugins/fast_bakery/__init__.pyi +6 -0
  94. metaflow-stubs/mf_extensions/outerbounds/plugins/fast_bakery/baker.pyi +51 -0
  95. metaflow-stubs/mf_extensions/outerbounds/plugins/fast_bakery/docker_environment.pyi +65 -0
  96. metaflow-stubs/mf_extensions/outerbounds/plugins/fast_bakery/fast_bakery.pyi +74 -0
  97. metaflow-stubs/mf_extensions/outerbounds/plugins/kubernetes/__init__.pyi +1 -1
  98. metaflow-stubs/mf_extensions/outerbounds/plugins/kubernetes/pod_killer.pyi +1 -1
  99. metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/__init__.pyi +1 -1
  100. metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/constants.pyi +1 -1
  101. metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/exceptions.pyi +1 -1
  102. metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/ollama.pyi +1 -1
  103. metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/status_card.pyi +1 -1
  104. metaflow-stubs/mf_extensions/outerbounds/plugins/snowflake/__init__.pyi +1 -1
  105. metaflow-stubs/mf_extensions/outerbounds/plugins/snowflake/snowflake.pyi +1 -1
  106. metaflow-stubs/mf_extensions/outerbounds/profilers/__init__.pyi +1 -1
  107. metaflow-stubs/mf_extensions/outerbounds/profilers/gpu.pyi +1 -1
  108. metaflow-stubs/mf_extensions/outerbounds/remote_config.pyi +1 -1
  109. metaflow-stubs/mf_extensions/outerbounds/toplevel/__init__.pyi +1 -1
  110. metaflow-stubs/mf_extensions/outerbounds/toplevel/global_aliases_for_metaflow_package.pyi +1 -1
  111. metaflow-stubs/multicore_utils.pyi +1 -1
  112. metaflow-stubs/ob_internal.pyi +3 -1
  113. metaflow-stubs/parameters.pyi +3 -3
  114. metaflow-stubs/plugins/__init__.pyi +11 -11
  115. metaflow-stubs/plugins/airflow/__init__.pyi +1 -1
  116. metaflow-stubs/plugins/airflow/airflow_utils.pyi +1 -1
  117. metaflow-stubs/plugins/airflow/exception.pyi +1 -1
  118. metaflow-stubs/plugins/airflow/sensors/__init__.pyi +1 -1
  119. metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +1 -1
  120. metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +1 -1
  121. metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +1 -1
  122. metaflow-stubs/plugins/argo/__init__.pyi +1 -1
  123. metaflow-stubs/plugins/argo/argo_client.pyi +1 -1
  124. metaflow-stubs/plugins/argo/argo_events.pyi +1 -1
  125. metaflow-stubs/plugins/argo/argo_workflows.pyi +2 -2
  126. metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +1 -1
  127. metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +2 -2
  128. metaflow-stubs/plugins/argo/argo_workflows_deployer_objects.pyi +3 -3
  129. metaflow-stubs/plugins/aws/__init__.pyi +1 -1
  130. metaflow-stubs/plugins/aws/aws_client.pyi +1 -1
  131. metaflow-stubs/plugins/aws/aws_utils.pyi +1 -1
  132. metaflow-stubs/plugins/aws/batch/__init__.pyi +1 -1
  133. metaflow-stubs/plugins/aws/batch/batch.pyi +1 -1
  134. metaflow-stubs/plugins/aws/batch/batch_client.pyi +1 -1
  135. metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +1 -1
  136. metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +1 -1
  137. metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +2 -2
  138. metaflow-stubs/plugins/aws/step_functions/__init__.pyi +1 -1
  139. metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +1 -1
  140. metaflow-stubs/plugins/aws/step_functions/schedule_decorator.pyi +1 -1
  141. metaflow-stubs/plugins/aws/step_functions/step_functions.pyi +1 -1
  142. metaflow-stubs/plugins/aws/step_functions/step_functions_client.pyi +1 -1
  143. metaflow-stubs/plugins/aws/step_functions/step_functions_deployer.pyi +3 -3
  144. metaflow-stubs/plugins/aws/step_functions/step_functions_deployer_objects.pyi +3 -3
  145. metaflow-stubs/plugins/azure/__init__.pyi +1 -1
  146. metaflow-stubs/plugins/azure/azure_credential.pyi +1 -1
  147. metaflow-stubs/plugins/azure/azure_exceptions.pyi +1 -1
  148. metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +2 -2
  149. metaflow-stubs/plugins/azure/azure_utils.pyi +1 -1
  150. metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +1 -1
  151. metaflow-stubs/plugins/azure/includefile_support.pyi +1 -1
  152. metaflow-stubs/plugins/cards/__init__.pyi +5 -5
  153. metaflow-stubs/plugins/cards/card_client.pyi +1 -1
  154. metaflow-stubs/plugins/cards/card_creator.pyi +1 -1
  155. metaflow-stubs/plugins/cards/card_datastore.pyi +1 -1
  156. metaflow-stubs/plugins/cards/card_decorator.pyi +1 -1
  157. metaflow-stubs/plugins/cards/card_modules/__init__.pyi +1 -1
  158. metaflow-stubs/plugins/cards/card_modules/basic.pyi +1 -1
  159. metaflow-stubs/plugins/cards/card_modules/card.pyi +1 -1
  160. metaflow-stubs/plugins/cards/card_modules/components.pyi +3 -3
  161. metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +1 -1
  162. metaflow-stubs/plugins/cards/card_modules/renderer_tools.pyi +1 -1
  163. metaflow-stubs/plugins/cards/card_modules/test_cards.pyi +1 -1
  164. metaflow-stubs/plugins/cards/card_resolver.pyi +1 -1
  165. metaflow-stubs/plugins/cards/component_serializer.pyi +1 -1
  166. metaflow-stubs/plugins/cards/exception.pyi +1 -1
  167. metaflow-stubs/plugins/catch_decorator.pyi +1 -1
  168. metaflow-stubs/plugins/datatools/__init__.pyi +1 -1
  169. metaflow-stubs/plugins/datatools/local.pyi +1 -1
  170. metaflow-stubs/plugins/datatools/s3/__init__.pyi +1 -1
  171. metaflow-stubs/plugins/datatools/s3/s3.pyi +3 -3
  172. metaflow-stubs/plugins/datatools/s3/s3tail.pyi +1 -1
  173. metaflow-stubs/plugins/datatools/s3/s3util.pyi +1 -1
  174. metaflow-stubs/plugins/debug_logger.pyi +1 -1
  175. metaflow-stubs/plugins/debug_monitor.pyi +1 -1
  176. metaflow-stubs/plugins/environment_decorator.pyi +1 -1
  177. metaflow-stubs/plugins/events_decorator.pyi +1 -1
  178. metaflow-stubs/plugins/frameworks/__init__.pyi +1 -1
  179. metaflow-stubs/plugins/frameworks/pytorch.pyi +1 -1
  180. metaflow-stubs/plugins/gcp/__init__.pyi +1 -1
  181. metaflow-stubs/plugins/gcp/gcp_secret_manager_secrets_provider.pyi +2 -2
  182. metaflow-stubs/plugins/gcp/gs_exceptions.pyi +1 -1
  183. metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +1 -1
  184. metaflow-stubs/plugins/gcp/gs_utils.pyi +1 -1
  185. metaflow-stubs/plugins/gcp/includefile_support.pyi +1 -1
  186. metaflow-stubs/plugins/kubernetes/__init__.pyi +1 -1
  187. metaflow-stubs/plugins/kubernetes/kube_utils.pyi +2 -2
  188. metaflow-stubs/plugins/kubernetes/kubernetes.pyi +1 -1
  189. metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +1 -1
  190. metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +1 -1
  191. metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +1 -1
  192. metaflow-stubs/plugins/kubernetes/spot_monitor_sidecar.pyi +1 -1
  193. metaflow-stubs/plugins/ollama/__init__.pyi +2 -2
  194. metaflow-stubs/plugins/parallel_decorator.pyi +1 -1
  195. metaflow-stubs/plugins/perimeters.pyi +1 -1
  196. metaflow-stubs/plugins/project_decorator.pyi +1 -1
  197. metaflow-stubs/plugins/pypi/__init__.pyi +1 -1
  198. metaflow-stubs/plugins/pypi/conda_decorator.pyi +1 -1
  199. metaflow-stubs/plugins/pypi/conda_environment.pyi +3 -3
  200. metaflow-stubs/plugins/pypi/parsers.pyi +1 -1
  201. metaflow-stubs/plugins/pypi/pypi_decorator.pyi +1 -1
  202. metaflow-stubs/plugins/pypi/pypi_environment.pyi +1 -1
  203. metaflow-stubs/plugins/pypi/utils.pyi +1 -1
  204. metaflow-stubs/plugins/resources_decorator.pyi +1 -1
  205. metaflow-stubs/plugins/retry_decorator.pyi +1 -1
  206. metaflow-stubs/plugins/secrets/__init__.pyi +2 -2
  207. metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +2 -2
  208. metaflow-stubs/plugins/secrets/secrets_decorator.pyi +1 -1
  209. metaflow-stubs/plugins/snowflake/__init__.pyi +1 -1
  210. metaflow-stubs/plugins/storage_executor.pyi +1 -1
  211. metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +1 -1
  212. metaflow-stubs/plugins/timeout_decorator.pyi +1 -1
  213. metaflow-stubs/plugins/torchtune/__init__.pyi +1 -1
  214. metaflow-stubs/plugins/uv/__init__.pyi +1 -1
  215. metaflow-stubs/plugins/uv/uv_environment.pyi +1 -1
  216. metaflow-stubs/profilers/__init__.pyi +1 -1
  217. metaflow-stubs/pylint_wrapper.pyi +1 -1
  218. metaflow-stubs/runner/__init__.pyi +1 -1
  219. metaflow-stubs/runner/deployer.pyi +29 -29
  220. metaflow-stubs/runner/deployer_impl.pyi +2 -2
  221. metaflow-stubs/runner/metaflow_runner.pyi +3 -3
  222. metaflow-stubs/runner/nbdeploy.pyi +1 -1
  223. metaflow-stubs/runner/nbrun.pyi +1 -1
  224. metaflow-stubs/runner/subprocess_manager.pyi +1 -1
  225. metaflow-stubs/runner/utils.pyi +3 -3
  226. metaflow-stubs/system/__init__.pyi +1 -1
  227. metaflow-stubs/system/system_logger.pyi +1 -1
  228. metaflow-stubs/system/system_monitor.pyi +1 -1
  229. metaflow-stubs/tagging_util.pyi +1 -1
  230. metaflow-stubs/tuple_util.pyi +1 -1
  231. metaflow-stubs/user_configs/__init__.pyi +1 -1
  232. metaflow-stubs/user_configs/config_decorators.pyi +5 -5
  233. metaflow-stubs/user_configs/config_options.pyi +2 -2
  234. metaflow-stubs/user_configs/config_parameters.pyi +5 -5
  235. {ob_metaflow_stubs-6.0.3.187.dist-info → ob_metaflow_stubs-6.0.3.188rc0.dist-info}/METADATA +1 -1
  236. ob_metaflow_stubs-6.0.3.188rc0.dist-info/RECORD +239 -0
  237. ob_metaflow_stubs-6.0.3.187.dist-info/RECORD +0 -216
  238. {ob_metaflow_stubs-6.0.3.187.dist-info → ob_metaflow_stubs-6.0.3.188rc0.dist-info}/WHEEL +0 -0
  239. {ob_metaflow_stubs-6.0.3.187.dist-info → ob_metaflow_stubs-6.0.3.188rc0.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.18.1+obcheckpoint(0.2.4);ob(v1) #
4
- # Generated on 2025-07-01T15:21:03.639611 #
4
+ # Generated on 2025-07-03T01:34:48.431701 #
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
 
@@ -35,18 +35,18 @@ from .user_configs.config_parameters import ConfigValue as ConfigValue
35
35
  from .user_configs.config_parameters import config_expr as config_expr
36
36
  from .user_configs.config_decorators import CustomFlowDecorator as CustomFlowDecorator
37
37
  from .user_configs.config_decorators import CustomStepDecorator as CustomStepDecorator
38
- from . import events as events
38
+ from . import metaflow_git as metaflow_git
39
39
  from . import cards as cards
40
40
  from . import tuple_util as tuple_util
41
- from . import metaflow_git as metaflow_git
41
+ from . import events as events
42
42
  from . import runner as runner
43
43
  from . import plugins as plugins
44
44
  from .mf_extensions.outerbounds.toplevel.global_aliases_for_metaflow_package import S3 as S3
45
45
  from . import includefile as includefile
46
46
  from .includefile import IncludeFile as IncludeFile
47
- from .plugins.pypi.parsers import pyproject_toml_parser as pyproject_toml_parser
48
47
  from .plugins.pypi.parsers import conda_environment_yml_parser as conda_environment_yml_parser
49
48
  from .plugins.pypi.parsers import requirements_txt_parser as requirements_txt_parser
49
+ from .plugins.pypi.parsers import pyproject_toml_parser as pyproject_toml_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
@@ -156,209 +156,139 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
156
156
  ...
157
157
 
158
158
  @typing.overload
159
- 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]]]:
159
+ 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]]]:
160
160
  """
161
- Creates a human-readable report, a Metaflow Card, after this step completes.
161
+ Specifies the Conda environment for the step.
162
162
 
163
- Note that you may add multiple `@card` decorators in a step with different parameters.
163
+ Information in this decorator will augment any
164
+ attributes set in the `@conda_base` flow-level decorator. Hence,
165
+ you can use `@conda_base` to set packages required by all
166
+ steps and use `@conda` to specify step-specific overrides.
164
167
 
165
168
 
166
169
  Parameters
167
170
  ----------
168
- type : str, default 'default'
169
- Card type.
170
- id : str, optional, default None
171
- If multiple cards are present, use this id to identify this card.
172
- options : Dict[str, Any], default {}
173
- Options passed to the card. The contents depend on the card type.
174
- timeout : int, default 45
175
- Interrupt reporting if it takes more than this many seconds.
171
+ packages : Dict[str, str], default {}
172
+ Packages to use for this step. The key is the name of the package
173
+ and the value is the version to use.
174
+ libraries : Dict[str, str], default {}
175
+ Supported for backward compatibility. When used with packages, packages will take precedence.
176
+ python : str, optional, default None
177
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
178
+ that the version used will correspond to the version of the Python interpreter used to start the run.
179
+ disabled : bool, default False
180
+ If set to True, disables @conda.
176
181
  """
177
182
  ...
178
183
 
179
184
  @typing.overload
180
- def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
185
+ def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
181
186
  ...
182
187
 
183
188
  @typing.overload
184
- def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
189
+ def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
185
190
  ...
186
191
 
187
- 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):
192
+ 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):
188
193
  """
189
- Creates a human-readable report, a Metaflow Card, after this step completes.
194
+ Specifies the Conda environment for the step.
190
195
 
191
- Note that you may add multiple `@card` decorators in a step with different parameters.
196
+ Information in this decorator will augment any
197
+ attributes set in the `@conda_base` flow-level decorator. Hence,
198
+ you can use `@conda_base` to set packages required by all
199
+ steps and use `@conda` to specify step-specific overrides.
192
200
 
193
201
 
194
202
  Parameters
195
203
  ----------
196
- type : str, default 'default'
197
- Card type.
198
- id : str, optional, default None
199
- If multiple cards are present, use this id to identify this card.
200
- options : Dict[str, Any], default {}
201
- Options passed to the card. The contents depend on the card type.
202
- timeout : int, default 45
203
- Interrupt reporting if it takes more than this many seconds.
204
+ packages : Dict[str, str], default {}
205
+ Packages to use for this step. The key is the name of the package
206
+ and the value is the version to use.
207
+ libraries : Dict[str, str], default {}
208
+ Supported for backward compatibility. When used with packages, packages will take precedence.
209
+ python : str, optional, default None
210
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
211
+ that the version used will correspond to the version of the Python interpreter used to start the run.
212
+ disabled : bool, default False
213
+ If set to True, disables @conda.
204
214
  """
205
215
  ...
206
216
 
207
- def nvct(*, gpu: int, gpu_type: str) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
217
+ @typing.overload
218
+ def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
208
219
  """
209
- Specifies that this step should execute on DGX cloud.
210
-
211
-
212
- Parameters
213
- ----------
214
- gpu : int
215
- Number of GPUs to use.
216
- gpu_type : str
217
- Type of Nvidia GPU to use.
220
+ Decorator prototype for all step decorators. This function gets specialized
221
+ and imported for all decorators types by _import_plugin_decorators().
218
222
  """
219
223
  ...
220
224
 
221
225
  @typing.overload
222
- def catch(*, var: typing.Optional[str] = None, print_exception: bool = True) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
226
+ def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
227
+ ...
228
+
229
+ def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
223
230
  """
224
- Specifies that the step will success under all circumstances.
231
+ Decorator prototype for all step decorators. This function gets specialized
232
+ and imported for all decorators types by _import_plugin_decorators().
233
+ """
234
+ ...
235
+
236
+ @typing.overload
237
+ 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]]]:
238
+ """
239
+ Specifies the number of times the task corresponding
240
+ to a step needs to be retried.
225
241
 
226
- The decorator will create an optional artifact, specified by `var`, which
227
- contains the exception raised. You can use it to detect the presence
228
- of errors, indicating that all happy-path artifacts produced by the step
229
- are missing.
242
+ This decorator is useful for handling transient errors, such as networking issues.
243
+ If your task contains operations that can't be retried safely, e.g. database updates,
244
+ it is advisable to annotate it with `@retry(times=0)`.
245
+
246
+ This can be used in conjunction with the `@catch` decorator. The `@catch`
247
+ decorator will execute a no-op task after all retries have been exhausted,
248
+ ensuring that the flow execution can continue.
230
249
 
231
250
 
232
251
  Parameters
233
252
  ----------
234
- var : str, optional, default None
235
- Name of the artifact in which to store the caught exception.
236
- If not specified, the exception is not stored.
237
- print_exception : bool, default True
238
- Determines whether or not the exception is printed to
239
- stdout when caught.
253
+ times : int, default 3
254
+ Number of times to retry this task.
255
+ minutes_between_retries : int, default 2
256
+ Number of minutes between retries.
240
257
  """
241
258
  ...
242
259
 
243
260
  @typing.overload
244
- def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
261
+ def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
245
262
  ...
246
263
 
247
264
  @typing.overload
248
- def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
265
+ def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
249
266
  ...
250
267
 
251
- def catch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, var: typing.Optional[str] = None, print_exception: bool = True):
268
+ 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):
252
269
  """
253
- Specifies that the step will success under all circumstances.
254
-
255
- The decorator will create an optional artifact, specified by `var`, which
256
- contains the exception raised. You can use it to detect the presence
257
- of errors, indicating that all happy-path artifacts produced by the step
258
- are missing.
270
+ Specifies the number of times the task corresponding
271
+ to a step needs to be retried.
259
272
 
273
+ This decorator is useful for handling transient errors, such as networking issues.
274
+ If your task contains operations that can't be retried safely, e.g. database updates,
275
+ it is advisable to annotate it with `@retry(times=0)`.
260
276
 
261
- Parameters
262
- ----------
263
- var : str, optional, default None
264
- Name of the artifact in which to store the caught exception.
265
- If not specified, the exception is not stored.
266
- print_exception : bool, default True
267
- Determines whether or not the exception is printed to
268
- stdout when caught.
269
- """
270
- ...
271
-
272
- 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]]]:
273
- """
274
- Specifies that this step should execute on Kubernetes.
277
+ This can be used in conjunction with the `@catch` decorator. The `@catch`
278
+ decorator will execute a no-op task after all retries have been exhausted,
279
+ ensuring that the flow execution can continue.
275
280
 
276
281
 
277
282
  Parameters
278
283
  ----------
279
- cpu : int, default 1
280
- Number of CPUs required for this step. If `@resources` is
281
- also present, the maximum value from all decorators is used.
282
- memory : int, default 4096
283
- Memory size (in MB) required for this step. If
284
- `@resources` is also present, the maximum value from all decorators is
285
- used.
286
- disk : int, default 10240
287
- Disk size (in MB) required for this step. If
288
- `@resources` is also present, the maximum value from all decorators is
289
- used.
290
- image : str, optional, default None
291
- Docker image to use when launching on Kubernetes. If not specified, and
292
- METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
293
- not, a default Docker image mapping to the current version of Python is used.
294
- image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
295
- If given, the imagePullPolicy to be applied to the Docker image of the step.
296
- image_pull_secrets: List[str], default []
297
- The default is extracted from METAFLOW_KUBERNETES_IMAGE_PULL_SECRETS.
298
- Kubernetes image pull secrets to use when pulling container images
299
- in Kubernetes.
300
- service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
301
- Kubernetes service account to use when launching pod in Kubernetes.
302
- secrets : List[str], optional, default None
303
- Kubernetes secrets to use when launching pod in Kubernetes. These
304
- secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
305
- in Metaflow configuration.
306
- node_selector: Union[Dict[str,str], str], optional, default None
307
- Kubernetes node selector(s) to apply to the pod running the task.
308
- Can be passed in as a comma separated string of values e.g.
309
- 'kubernetes.io/os=linux,kubernetes.io/arch=amd64' or as a dictionary
310
- {'kubernetes.io/os': 'linux', 'kubernetes.io/arch': 'amd64'}
311
- namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
312
- Kubernetes namespace to use when launching pod in Kubernetes.
313
- gpu : int, optional, default None
314
- Number of GPUs required for this step. A value of zero implies that
315
- the scheduled node should not have GPUs.
316
- gpu_vendor : str, default KUBERNETES_GPU_VENDOR
317
- The vendor of the GPUs to be used for this step.
318
- tolerations : List[str], default []
319
- The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
320
- Kubernetes tolerations to use when launching pod in Kubernetes.
321
- labels: Dict[str, str], default: METAFLOW_KUBERNETES_LABELS
322
- Kubernetes labels to use when launching pod in Kubernetes.
323
- annotations: Dict[str, str], default: METAFLOW_KUBERNETES_ANNOTATIONS
324
- Kubernetes annotations to use when launching pod in Kubernetes.
325
- use_tmpfs : bool, default False
326
- This enables an explicit tmpfs mount for this step.
327
- tmpfs_tempdir : bool, default True
328
- sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
329
- tmpfs_size : int, optional, default: None
330
- The value for the size (in MiB) of the tmpfs mount for this step.
331
- This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
332
- memory allocated for this step.
333
- tmpfs_path : str, optional, default /metaflow_temp
334
- Path to tmpfs mount for this step.
335
- persistent_volume_claims : Dict[str, str], optional, default None
336
- A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
337
- volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
338
- shared_memory: int, optional
339
- Shared memory size (in MiB) required for this step
340
- port: int, optional
341
- Port number to specify in the Kubernetes job object
342
- compute_pool : str, optional, default None
343
- Compute pool to be used for for this step.
344
- If not specified, any accessible compute pool within the perimeter is used.
345
- hostname_resolution_timeout: int, default 10 * 60
346
- Timeout in seconds for the workers tasks in the gang scheduled cluster to resolve the hostname of control task.
347
- Only applicable when @parallel is used.
348
- qos: str, default: Burstable
349
- Quality of Service class to assign to the pod. Supported values are: Guaranteed, Burstable, BestEffort
350
-
351
- security_context: Dict[str, Any], optional, default None
352
- Container security context. Applies to the task container. Allows the following keys:
353
- - privileged: bool, optional, default None
354
- - allow_privilege_escalation: bool, optional, default None
355
- - run_as_user: int, optional, default None
356
- - run_as_group: int, optional, default None
357
- - run_as_non_root: bool, optional, default None
284
+ times : int, default 3
285
+ Number of times to retry this task.
286
+ minutes_between_retries : int, default 2
287
+ Number of minutes between retries.
358
288
  """
359
289
  ...
360
290
 
361
- def nvidia(*, gpu: int, gpu_type: str, queue_timeout: int) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
291
+ 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]]]:
362
292
  """
363
293
  Specifies that this step should execute on DGX cloud.
364
294
 
@@ -369,202 +299,19 @@ def nvidia(*, gpu: int, gpu_type: str, queue_timeout: int) -> typing.Callable[[t
369
299
  Number of GPUs to use.
370
300
  gpu_type : str
371
301
  Type of Nvidia GPU to use.
372
- queue_timeout : int
373
- Time to keep the job in NVCF's queue.
374
302
  """
375
303
  ...
376
304
 
377
- @typing.overload
378
- def resources(*, cpu: int = 1, gpu: typing.Optional[int] = None, disk: typing.Optional[int] = None, memory: int = 4096, shared_memory: typing.Optional[int] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
305
+ 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]]]:
379
306
  """
380
- Specifies the resources needed when executing this step.
307
+ This decorator is used to run Ollama APIs as Metaflow task sidecars.
381
308
 
382
- Use `@resources` to specify the resource requirements
383
- independently of the specific compute layer (`@batch`, `@kubernetes`).
384
-
385
- You can choose the compute layer on the command line by executing e.g.
386
- ```
387
- python myflow.py run --with batch
388
- ```
389
- or
390
- ```
391
- python myflow.py run --with kubernetes
392
- ```
393
- which executes the flow on the desired system using the
394
- requirements specified in `@resources`.
395
-
396
-
397
- Parameters
398
- ----------
399
- cpu : int, default 1
400
- Number of CPUs required for this step.
401
- gpu : int, optional, default None
402
- Number of GPUs required for this step.
403
- disk : int, optional, default None
404
- Disk size (in MB) required for this step. Only applies on Kubernetes.
405
- memory : int, default 4096
406
- Memory size (in MB) required for this step.
407
- shared_memory : int, optional, default None
408
- The value for the size (in MiB) of the /dev/shm volume for this step.
409
- This parameter maps to the `--shm-size` option in Docker.
410
- """
411
- ...
412
-
413
- @typing.overload
414
- def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
415
- ...
416
-
417
- @typing.overload
418
- def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
419
- ...
420
-
421
- def resources(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, cpu: int = 1, gpu: typing.Optional[int] = None, disk: typing.Optional[int] = None, memory: int = 4096, shared_memory: typing.Optional[int] = None):
422
- """
423
- Specifies the resources needed when executing this step.
424
-
425
- Use `@resources` to specify the resource requirements
426
- independently of the specific compute layer (`@batch`, `@kubernetes`).
427
-
428
- You can choose the compute layer on the command line by executing e.g.
429
- ```
430
- python myflow.py run --with batch
431
- ```
432
- or
433
- ```
434
- python myflow.py run --with kubernetes
435
- ```
436
- which executes the flow on the desired system using the
437
- requirements specified in `@resources`.
438
-
439
-
440
- Parameters
441
- ----------
442
- cpu : int, default 1
443
- Number of CPUs required for this step.
444
- gpu : int, optional, default None
445
- Number of GPUs required for this step.
446
- disk : int, optional, default None
447
- Disk size (in MB) required for this step. Only applies on Kubernetes.
448
- memory : int, default 4096
449
- Memory size (in MB) required for this step.
450
- shared_memory : int, optional, default None
451
- The value for the size (in MiB) of the /dev/shm volume for this step.
452
- This parameter maps to the `--shm-size` option in Docker.
453
- """
454
- ...
455
-
456
- @typing.overload
457
- def environment(*, vars: typing.Dict[str, str] = {}) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
458
- """
459
- Specifies environment variables to be set prior to the execution of a step.
460
-
461
-
462
- Parameters
463
- ----------
464
- vars : Dict[str, str], default {}
465
- Dictionary of environment variables to set.
466
- """
467
- ...
468
-
469
- @typing.overload
470
- def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
471
- ...
472
-
473
- @typing.overload
474
- def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
475
- ...
476
-
477
- def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
478
- """
479
- Specifies environment variables to be set prior to the execution of a step.
480
-
481
-
482
- Parameters
483
- ----------
484
- vars : Dict[str, str], default {}
485
- Dictionary of environment variables to set.
486
- """
487
- ...
488
-
489
- def vllm(*, model: str, backend: str, openai_api_server: bool, debug: bool, card_refresh_interval: int, max_retries: int, retry_alert_frequency: int, engine_args: dict) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
490
- """
491
- This decorator is used to run vllm APIs as Metaflow task sidecars.
492
-
493
- User code call
494
- --------------
495
- @vllm(
496
- model="...",
497
- ...
498
- )
499
-
500
- Valid backend options
501
- ---------------------
502
- - 'local': Run as a separate process on the local task machine.
503
-
504
- Valid model options
505
- -------------------
506
- Any HuggingFace model identifier, e.g. 'meta-llama/Llama-3.2-1B'
507
-
508
- NOTE: vLLM's OpenAI-compatible server serves ONE model per server instance.
509
- If you need multiple models, you must create multiple @vllm decorators.
510
-
511
-
512
- Parameters
513
- ----------
514
- model: str
515
- HuggingFace model identifier to be served by vLLM.
516
- backend: str
517
- Determines where and how to run the vLLM process.
518
- openai_api_server: bool
519
- Whether to use OpenAI-compatible API server mode (subprocess) instead of native engine.
520
- Default is False (uses native engine).
521
- Set to True for backward compatibility with existing code.
522
- debug: bool
523
- Whether to turn on verbose debugging logs.
524
- card_refresh_interval: int
525
- Interval in seconds for refreshing the vLLM status card.
526
- Only used when openai_api_server=True.
527
- max_retries: int
528
- Maximum number of retries checking for vLLM server startup.
529
- Only used when openai_api_server=True.
530
- retry_alert_frequency: int
531
- Frequency of alert logs for vLLM server startup retries.
532
- Only used when openai_api_server=True.
533
- engine_args : dict
534
- Additional keyword arguments to pass to the vLLM engine.
535
- For example, `tensor_parallel_size=2`.
536
- """
537
- ...
538
-
539
- @typing.overload
540
- def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
541
- """
542
- Decorator prototype for all step decorators. This function gets specialized
543
- and imported for all decorators types by _import_plugin_decorators().
544
- """
545
- ...
546
-
547
- @typing.overload
548
- def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
549
- ...
550
-
551
- def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
552
- """
553
- Decorator prototype for all step decorators. This function gets specialized
554
- and imported for all decorators types by _import_plugin_decorators().
555
- """
556
- ...
557
-
558
- def ollama(*, models: list, backend: str, force_pull: bool, cache_update_policy: str, force_cache_update: bool, debug: bool, circuit_breaker_config: dict, timeout_config: dict) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
559
- """
560
- This decorator is used to run Ollama APIs as Metaflow task sidecars.
561
-
562
- User code call
563
- --------------
564
- @ollama(
565
- models=[...],
566
- ...
567
- )
309
+ User code call
310
+ --------------
311
+ @ollama(
312
+ models=[...],
313
+ ...
314
+ )
568
315
 
569
316
  Valid backend options
570
317
  ---------------------
@@ -599,113 +346,211 @@ def ollama(*, models: list, backend: str, force_pull: bool, cache_update_policy:
599
346
  ...
600
347
 
601
348
  @typing.overload
602
- def secrets(*, sources: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = []) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
349
+ 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]]]:
603
350
  """
604
- Specifies secrets to be retrieved and injected as environment variables prior to
605
- the execution of a step.
351
+ Enables loading / saving of models within a step.
352
+
353
+ > Examples
354
+ - Saving Models
355
+ ```python
356
+ @model
357
+ @step
358
+ def train(self):
359
+ # current.model.save returns a dictionary reference to the model saved
360
+ self.my_model = current.model.save(
361
+ path_to_my_model,
362
+ label="my_model",
363
+ metadata={
364
+ "epochs": 10,
365
+ "batch-size": 32,
366
+ "learning-rate": 0.001,
367
+ }
368
+ )
369
+ self.next(self.test)
370
+
371
+ @model(load="my_model")
372
+ @step
373
+ def test(self):
374
+ # `current.model.loaded` returns a dictionary of the loaded models
375
+ # where the key is the name of the artifact and the value is the path to the model
376
+ print(os.listdir(current.model.loaded["my_model"]))
377
+ self.next(self.end)
378
+ ```
379
+
380
+ - Loading models
381
+ ```python
382
+ @step
383
+ def train(self):
384
+ # current.model.load returns the path to the model loaded
385
+ checkpoint_path = current.model.load(
386
+ self.checkpoint_key,
387
+ )
388
+ model_path = current.model.load(
389
+ self.model,
390
+ )
391
+ self.next(self.test)
392
+ ```
606
393
 
607
394
 
608
395
  Parameters
609
396
  ----------
610
- sources : List[Union[str, Dict[str, Any]]], default: []
611
- List of secret specs, defining how the secrets are to be retrieved
397
+ load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
398
+ Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
399
+ These artifact names give to `load` be reference objects or reference `key` string's from objects created by `current.checkpoint` / `current.model` / `current.huggingface_hub`.
400
+ 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
401
+ the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
402
+ If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
403
+
404
+ temp_dir_root : str, default: None
405
+ The root directory under which `current.model.loaded` will store loaded models
612
406
  """
613
407
  ...
614
408
 
615
409
  @typing.overload
616
- def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
410
+ def model(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
617
411
  ...
618
412
 
619
413
  @typing.overload
620
- def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
621
- ...
622
-
623
- def secrets(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, sources: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = []):
624
- """
625
- Specifies secrets to be retrieved and injected as environment variables prior to
626
- the execution of a step.
627
-
628
-
629
- Parameters
630
- ----------
631
- sources : List[Union[str, Dict[str, Any]]], default: []
632
- List of secret specs, defining how the secrets are to be retrieved
633
- """
414
+ def model(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
634
415
  ...
635
416
 
636
- @typing.overload
637
- def timeout(*, seconds: int = 0, minutes: int = 0, hours: int = 0) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
417
+ 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):
638
418
  """
639
- Specifies a timeout for your step.
419
+ Enables loading / saving of models within a step.
640
420
 
641
- This decorator is useful if this step may hang indefinitely.
421
+ > Examples
422
+ - Saving Models
423
+ ```python
424
+ @model
425
+ @step
426
+ def train(self):
427
+ # current.model.save returns a dictionary reference to the model saved
428
+ self.my_model = current.model.save(
429
+ path_to_my_model,
430
+ label="my_model",
431
+ metadata={
432
+ "epochs": 10,
433
+ "batch-size": 32,
434
+ "learning-rate": 0.001,
435
+ }
436
+ )
437
+ self.next(self.test)
642
438
 
643
- This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
644
- A timeout is considered to be an exception thrown by the step. It will cause the step to be
645
- retried if needed and the exception will be caught by the `@catch` decorator, if present.
439
+ @model(load="my_model")
440
+ @step
441
+ def test(self):
442
+ # `current.model.loaded` returns a dictionary of the loaded models
443
+ # where the key is the name of the artifact and the value is the path to the model
444
+ print(os.listdir(current.model.loaded["my_model"]))
445
+ self.next(self.end)
446
+ ```
646
447
 
647
- Note that all the values specified in parameters are added together so if you specify
648
- 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
448
+ - Loading models
449
+ ```python
450
+ @step
451
+ def train(self):
452
+ # current.model.load returns the path to the model loaded
453
+ checkpoint_path = current.model.load(
454
+ self.checkpoint_key,
455
+ )
456
+ model_path = current.model.load(
457
+ self.model,
458
+ )
459
+ self.next(self.test)
460
+ ```
649
461
 
650
462
 
651
463
  Parameters
652
464
  ----------
653
- seconds : int, default 0
654
- Number of seconds to wait prior to timing out.
655
- minutes : int, default 0
656
- Number of minutes to wait prior to timing out.
657
- hours : int, default 0
658
- Number of hours to wait prior to timing out.
465
+ load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
466
+ Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
467
+ These artifact names give to `load` be reference objects or reference `key` string's from objects created by `current.checkpoint` / `current.model` / `current.huggingface_hub`.
468
+ 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
469
+ the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
470
+ If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
471
+
472
+ temp_dir_root : str, default: None
473
+ The root directory under which `current.model.loaded` will store loaded models
659
474
  """
660
475
  ...
661
476
 
662
- @typing.overload
663
- def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
664
- ...
665
-
666
- @typing.overload
667
- def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
668
- ...
669
-
670
- def timeout(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, seconds: int = 0, minutes: int = 0, hours: int = 0):
477
+ 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]]]:
671
478
  """
672
- Specifies a timeout for your step.
479
+ Decorator that helps cache, version and store models/datasets from huggingface hub.
673
480
 
674
- This decorator is useful if this step may hang indefinitely.
481
+ > Examples
675
482
 
676
- This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
677
- A timeout is considered to be an exception thrown by the step. It will cause the step to be
678
- retried if needed and the exception will be caught by the `@catch` decorator, if present.
483
+ **Usage: creating references of models from huggingface that may be loaded in downstream steps**
484
+ ```python
485
+ @huggingface_hub
486
+ @step
487
+ def pull_model_from_huggingface(self):
488
+ # `current.huggingface_hub.snapshot_download` downloads the model from the Hugging Face Hub
489
+ # and saves it in the backend storage based on the model's `repo_id`. If there exists a model
490
+ # with the same `repo_id` in the backend storage, it will not download the model again. The return
491
+ # value of the function is a reference to the model in the backend storage.
492
+ # This reference can be used to load the model in the subsequent steps via `@model(load=["llama_model"])`
679
493
 
680
- Note that all the values specified in parameters are added together so if you specify
681
- 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
494
+ self.model_id = "mistralai/Mistral-7B-Instruct-v0.1"
495
+ self.llama_model = current.huggingface_hub.snapshot_download(
496
+ repo_id=self.model_id,
497
+ allow_patterns=["*.safetensors", "*.json", "tokenizer.*"],
498
+ )
499
+ self.next(self.train)
500
+ ```
501
+
502
+ **Usage: loading models directly from huggingface hub or from cache (from metaflow's datastore)**
503
+ ```python
504
+ @huggingface_hub(load=["mistralai/Mistral-7B-Instruct-v0.1"])
505
+ @step
506
+ def pull_model_from_huggingface(self):
507
+ path_to_model = current.huggingface_hub.loaded["mistralai/Mistral-7B-Instruct-v0.1"]
508
+ ```
509
+
510
+ ```python
511
+ @huggingface_hub(load=[("mistralai/Mistral-7B-Instruct-v0.1", "/my-directory"), ("myorg/mistral-lora, "/my-lora-directory")])
512
+ @step
513
+ def finetune_model(self):
514
+ path_to_model = current.huggingface_hub.loaded["mistralai/Mistral-7B-Instruct-v0.1"]
515
+ # path_to_model will be /my-directory
516
+ ```
517
+
518
+ ```python
519
+ # Takes all the arguments passed to `snapshot_download`
520
+ # except for `local_dir`
521
+ @huggingface_hub(load=[
522
+ {
523
+ "repo_id": "mistralai/Mistral-7B-Instruct-v0.1",
524
+ },
525
+ {
526
+ "repo_id": "myorg/mistral-lora",
527
+ "repo_type": "model",
528
+ },
529
+ ])
530
+ @step
531
+ def finetune_model(self):
532
+ path_to_model = current.huggingface_hub.loaded["mistralai/Mistral-7B-Instruct-v0.1"]
533
+ # path_to_model will be /my-directory
534
+ ```
682
535
 
683
536
 
684
537
  Parameters
685
538
  ----------
686
- seconds : int, default 0
687
- Number of seconds to wait prior to timing out.
688
- minutes : int, default 0
689
- Number of minutes to wait prior to timing out.
690
- hours : int, default 0
691
- Number of hours to wait prior to timing out.
692
- """
693
- ...
694
-
695
- @typing.overload
696
- def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
697
- """
698
- Internal decorator to support Fast bakery
699
- """
700
- ...
701
-
702
- @typing.overload
703
- def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
704
- ...
705
-
706
- def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
707
- """
708
- Internal decorator to support Fast bakery
539
+ temp_dir_root : str, optional
540
+ The root directory that will hold the temporary directory where objects will be downloaded.
541
+
542
+ load: Union[List[str], List[Tuple[Dict, str]], List[Tuple[str, str]], List[Dict], None]
543
+ The list of repos (models/datasets) to load.
544
+
545
+ Loaded repos can be accessed via `current.huggingface_hub.loaded`. If load is set, then the following happens:
546
+
547
+ - If repo (model/dataset) is not found in the datastore:
548
+ - Downloads the repo from Hugging Face Hub to a temporary directory (or uses specified path) for local access
549
+ - Stores it in Metaflow's datastore (s3/gcs/azure etc.) with a unique name based on repo_type/repo_id
550
+ - All HF models loaded for a `@step` will be cached separately under flow/step/namespace.
551
+
552
+ - If repo is found in the datastore:
553
+ - Loads it directly from datastore to local path (can be temporary directory or specified path)
709
554
  """
710
555
  ...
711
556
 
@@ -857,57 +702,68 @@ def checkpoint(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None
857
702
  ...
858
703
 
859
704
  @typing.overload
860
- def retry(*, times: int = 3, minutes_between_retries: int = 2) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
705
+ 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]]]:
861
706
  """
862
- Specifies the number of times the task corresponding
863
- to a step needs to be retried.
864
-
865
- This decorator is useful for handling transient errors, such as networking issues.
866
- If your task contains operations that can't be retried safely, e.g. database updates,
867
- it is advisable to annotate it with `@retry(times=0)`.
707
+ Creates a human-readable report, a Metaflow Card, after this step completes.
868
708
 
869
- This can be used in conjunction with the `@catch` decorator. The `@catch`
870
- decorator will execute a no-op task after all retries have been exhausted,
871
- ensuring that the flow execution can continue.
709
+ Note that you may add multiple `@card` decorators in a step with different parameters.
872
710
 
873
711
 
874
712
  Parameters
875
713
  ----------
876
- times : int, default 3
877
- Number of times to retry this task.
878
- minutes_between_retries : int, default 2
879
- Number of minutes between retries.
714
+ type : str, default 'default'
715
+ Card type.
716
+ id : str, optional, default None
717
+ If multiple cards are present, use this id to identify this card.
718
+ options : Dict[str, Any], default {}
719
+ Options passed to the card. The contents depend on the card type.
720
+ timeout : int, default 45
721
+ Interrupt reporting if it takes more than this many seconds.
880
722
  """
881
723
  ...
882
724
 
883
725
  @typing.overload
884
- def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
726
+ def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
885
727
  ...
886
728
 
887
729
  @typing.overload
888
- def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
730
+ def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
889
731
  ...
890
732
 
891
- def retry(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, times: int = 3, minutes_between_retries: int = 2):
733
+ 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):
892
734
  """
893
- Specifies the number of times the task corresponding
894
- to a step needs to be retried.
895
-
896
- This decorator is useful for handling transient errors, such as networking issues.
897
- If your task contains operations that can't be retried safely, e.g. database updates,
898
- it is advisable to annotate it with `@retry(times=0)`.
735
+ Creates a human-readable report, a Metaflow Card, after this step completes.
899
736
 
900
- This can be used in conjunction with the `@catch` decorator. The `@catch`
901
- decorator will execute a no-op task after all retries have been exhausted,
902
- ensuring that the flow execution can continue.
737
+ Note that you may add multiple `@card` decorators in a step with different parameters.
903
738
 
904
739
 
905
740
  Parameters
906
741
  ----------
907
- times : int, default 3
908
- Number of times to retry this task.
909
- minutes_between_retries : int, default 2
910
- Number of minutes between retries.
742
+ type : str, default 'default'
743
+ Card type.
744
+ id : str, optional, default None
745
+ If multiple cards are present, use this id to identify this card.
746
+ options : Dict[str, Any], default {}
747
+ Options passed to the card. The contents depend on the card type.
748
+ timeout : int, default 45
749
+ Interrupt reporting if it takes more than this many seconds.
750
+ """
751
+ ...
752
+
753
+ @typing.overload
754
+ def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
755
+ """
756
+ Internal decorator to support Fast bakery
757
+ """
758
+ ...
759
+
760
+ @typing.overload
761
+ def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
762
+ ...
763
+
764
+ def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
765
+ """
766
+ Internal decorator to support Fast bakery
911
767
  """
912
768
  ...
913
769
 
@@ -917,346 +773,316 @@ def app_deploy(*, app_port: int, app_name: str) -> typing.Callable[[typing.Union
917
773
  Requires that self.app_name, self.app_port, self.entrypoint and self.deployDir is set.
918
774
 
919
775
 
920
- Parameters
921
- ----------
922
- app_port : int
923
- Number of GPUs to use.
924
- app_name : str
925
- Name of the app to deploy.
776
+ Parameters
777
+ ----------
778
+ app_port : int
779
+ Number of GPUs to use.
780
+ app_name : str
781
+ Name of the app to deploy.
782
+ """
783
+ ...
784
+
785
+ 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]]]:
786
+ """
787
+ Specifies that this step should execute on Kubernetes.
788
+
789
+
790
+ Parameters
791
+ ----------
792
+ cpu : int, default 1
793
+ Number of CPUs required for this step. If `@resources` is
794
+ also present, the maximum value from all decorators is used.
795
+ memory : int, default 4096
796
+ Memory size (in MB) required for this step. If
797
+ `@resources` is also present, the maximum value from all decorators is
798
+ used.
799
+ disk : int, default 10240
800
+ Disk size (in MB) required for this step. If
801
+ `@resources` is also present, the maximum value from all decorators is
802
+ used.
803
+ image : str, optional, default None
804
+ Docker image to use when launching on Kubernetes. If not specified, and
805
+ METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
806
+ not, a default Docker image mapping to the current version of Python is used.
807
+ image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
808
+ If given, the imagePullPolicy to be applied to the Docker image of the step.
809
+ image_pull_secrets: List[str], default []
810
+ The default is extracted from METAFLOW_KUBERNETES_IMAGE_PULL_SECRETS.
811
+ Kubernetes image pull secrets to use when pulling container images
812
+ in Kubernetes.
813
+ service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
814
+ Kubernetes service account to use when launching pod in Kubernetes.
815
+ secrets : List[str], optional, default None
816
+ Kubernetes secrets to use when launching pod in Kubernetes. These
817
+ secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
818
+ in Metaflow configuration.
819
+ node_selector: Union[Dict[str,str], str], optional, default None
820
+ Kubernetes node selector(s) to apply to the pod running the task.
821
+ Can be passed in as a comma separated string of values e.g.
822
+ 'kubernetes.io/os=linux,kubernetes.io/arch=amd64' or as a dictionary
823
+ {'kubernetes.io/os': 'linux', 'kubernetes.io/arch': 'amd64'}
824
+ namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
825
+ Kubernetes namespace to use when launching pod in Kubernetes.
826
+ gpu : int, optional, default None
827
+ Number of GPUs required for this step. A value of zero implies that
828
+ the scheduled node should not have GPUs.
829
+ gpu_vendor : str, default KUBERNETES_GPU_VENDOR
830
+ The vendor of the GPUs to be used for this step.
831
+ tolerations : List[str], default []
832
+ The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
833
+ Kubernetes tolerations to use when launching pod in Kubernetes.
834
+ labels: Dict[str, str], default: METAFLOW_KUBERNETES_LABELS
835
+ Kubernetes labels to use when launching pod in Kubernetes.
836
+ annotations: Dict[str, str], default: METAFLOW_KUBERNETES_ANNOTATIONS
837
+ Kubernetes annotations to use when launching pod in Kubernetes.
838
+ use_tmpfs : bool, default False
839
+ This enables an explicit tmpfs mount for this step.
840
+ tmpfs_tempdir : bool, default True
841
+ sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
842
+ tmpfs_size : int, optional, default: None
843
+ The value for the size (in MiB) of the tmpfs mount for this step.
844
+ This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
845
+ memory allocated for this step.
846
+ tmpfs_path : str, optional, default /metaflow_temp
847
+ Path to tmpfs mount for this step.
848
+ persistent_volume_claims : Dict[str, str], optional, default None
849
+ A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
850
+ volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
851
+ shared_memory: int, optional
852
+ Shared memory size (in MiB) required for this step
853
+ port: int, optional
854
+ Port number to specify in the Kubernetes job object
855
+ compute_pool : str, optional, default None
856
+ Compute pool to be used for for this step.
857
+ If not specified, any accessible compute pool within the perimeter is used.
858
+ hostname_resolution_timeout: int, default 10 * 60
859
+ Timeout in seconds for the workers tasks in the gang scheduled cluster to resolve the hostname of control task.
860
+ Only applicable when @parallel is used.
861
+ qos: str, default: Burstable
862
+ Quality of Service class to assign to the pod. Supported values are: Guaranteed, Burstable, BestEffort
863
+
864
+ security_context: Dict[str, Any], optional, default None
865
+ Container security context. Applies to the task container. Allows the following keys:
866
+ - privileged: bool, optional, default None
867
+ - allow_privilege_escalation: bool, optional, default None
868
+ - run_as_user: int, optional, default None
869
+ - run_as_group: int, optional, default None
870
+ - run_as_non_root: bool, optional, default None
926
871
  """
927
872
  ...
928
873
 
929
874
  @typing.overload
930
- def conda(*, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
875
+ def environment(*, vars: typing.Dict[str, str] = {}) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
931
876
  """
932
- Specifies the Conda environment for the step.
933
-
934
- Information in this decorator will augment any
935
- attributes set in the `@conda_base` flow-level decorator. Hence,
936
- you can use `@conda_base` to set packages required by all
937
- steps and use `@conda` to specify step-specific overrides.
877
+ Specifies environment variables to be set prior to the execution of a step.
938
878
 
939
879
 
940
880
  Parameters
941
881
  ----------
942
- packages : Dict[str, str], default {}
943
- Packages to use for this step. The key is the name of the package
944
- and the value is the version to use.
945
- libraries : Dict[str, str], default {}
946
- Supported for backward compatibility. When used with packages, packages will take precedence.
947
- python : str, optional, default None
948
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
949
- that the version used will correspond to the version of the Python interpreter used to start the run.
950
- disabled : bool, default False
951
- If set to True, disables @conda.
882
+ vars : Dict[str, str], default {}
883
+ Dictionary of environment variables to set.
952
884
  """
953
885
  ...
954
886
 
955
887
  @typing.overload
956
- def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
888
+ def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
957
889
  ...
958
890
 
959
891
  @typing.overload
960
- def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
892
+ def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
961
893
  ...
962
894
 
963
- def conda(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False):
895
+ def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
964
896
  """
965
- Specifies the Conda environment for the step.
966
-
967
- Information in this decorator will augment any
968
- attributes set in the `@conda_base` flow-level decorator. Hence,
969
- you can use `@conda_base` to set packages required by all
970
- steps and use `@conda` to specify step-specific overrides.
897
+ Specifies environment variables to be set prior to the execution of a step.
971
898
 
972
899
 
973
900
  Parameters
974
901
  ----------
975
- packages : Dict[str, str], default {}
976
- Packages to use for this step. The key is the name of the package
977
- and the value is the version to use.
978
- libraries : Dict[str, str], default {}
979
- Supported for backward compatibility. When used with packages, packages will take precedence.
980
- python : str, optional, default None
981
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
982
- that the version used will correspond to the version of the Python interpreter used to start the run.
983
- disabled : bool, default False
984
- If set to True, disables @conda.
902
+ vars : Dict[str, str], default {}
903
+ Dictionary of environment variables to set.
985
904
  """
986
905
  ...
987
906
 
988
907
  @typing.overload
989
- def pypi(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
908
+ 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]]]:
990
909
  """
991
- Specifies the PyPI packages for the step.
992
-
993
- Information in this decorator will augment any
994
- attributes set in the `@pyi_base` flow-level decorator. Hence,
995
- you can use `@pypi_base` to set packages required by all
996
- steps and use `@pypi` to specify step-specific overrides.
910
+ Specifies secrets to be retrieved and injected as environment variables prior to
911
+ the execution of a step.
997
912
 
998
913
 
999
914
  Parameters
1000
915
  ----------
1001
- packages : Dict[str, str], default: {}
1002
- Packages to use for this step. The key is the name of the package
1003
- and the value is the version to use.
1004
- python : str, optional, default: None
1005
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1006
- that the version used will correspond to the version of the Python interpreter used to start the run.
916
+ sources : List[Union[str, Dict[str, Any]]], default: []
917
+ List of secret specs, defining how the secrets are to be retrieved
1007
918
  """
1008
919
  ...
1009
920
 
1010
921
  @typing.overload
1011
- def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
922
+ def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1012
923
  ...
1013
924
 
1014
925
  @typing.overload
1015
- def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
926
+ def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1016
927
  ...
1017
928
 
1018
- def pypi(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
929
+ 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]]] = []):
1019
930
  """
1020
- Specifies the PyPI packages for the step.
1021
-
1022
- Information in this decorator will augment any
1023
- attributes set in the `@pyi_base` flow-level decorator. Hence,
1024
- you can use `@pypi_base` to set packages required by all
1025
- steps and use `@pypi` to specify step-specific overrides.
931
+ Specifies secrets to be retrieved and injected as environment variables prior to
932
+ the execution of a step.
1026
933
 
1027
934
 
1028
935
  Parameters
1029
936
  ----------
1030
- packages : Dict[str, str], default: {}
1031
- Packages to use for this step. The key is the name of the package
1032
- and the value is the version to use.
1033
- python : str, optional, default: None
1034
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1035
- that the version used will correspond to the version of the Python interpreter used to start the run.
937
+ sources : List[Union[str, Dict[str, Any]]], default: []
938
+ List of secret specs, defining how the secrets are to be retrieved
1036
939
  """
1037
940
  ...
1038
941
 
1039
942
  @typing.overload
1040
- 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]]]:
943
+ 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]]]:
1041
944
  """
1042
- Enables loading / saving of models within a step.
945
+ Specifies the resources needed when executing this step.
1043
946
 
1044
- > Examples
1045
- - Saving Models
1046
- ```python
1047
- @model
1048
- @step
1049
- def train(self):
1050
- # current.model.save returns a dictionary reference to the model saved
1051
- self.my_model = current.model.save(
1052
- path_to_my_model,
1053
- label="my_model",
1054
- metadata={
1055
- "epochs": 10,
1056
- "batch-size": 32,
1057
- "learning-rate": 0.001,
1058
- }
1059
- )
1060
- self.next(self.test)
947
+ Use `@resources` to specify the resource requirements
948
+ independently of the specific compute layer (`@batch`, `@kubernetes`).
1061
949
 
1062
- @model(load="my_model")
1063
- @step
1064
- def test(self):
1065
- # `current.model.loaded` returns a dictionary of the loaded models
1066
- # where the key is the name of the artifact and the value is the path to the model
1067
- print(os.listdir(current.model.loaded["my_model"]))
1068
- self.next(self.end)
950
+ You can choose the compute layer on the command line by executing e.g.
1069
951
  ```
1070
-
1071
- - Loading models
1072
- ```python
1073
- @step
1074
- def train(self):
1075
- # current.model.load returns the path to the model loaded
1076
- checkpoint_path = current.model.load(
1077
- self.checkpoint_key,
1078
- )
1079
- model_path = current.model.load(
1080
- self.model,
1081
- )
1082
- self.next(self.test)
952
+ python myflow.py run --with batch
1083
953
  ```
1084
-
1085
-
1086
- Parameters
1087
- ----------
1088
- load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
1089
- Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
1090
- These artifact names give to `load` be reference objects or reference `key` string's from objects created by `current.checkpoint` / `current.model` / `current.huggingface_hub`.
1091
- 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
1092
- the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
1093
- If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
1094
-
1095
- temp_dir_root : str, default: None
1096
- The root directory under which `current.model.loaded` will store loaded models
1097
- """
1098
- ...
1099
-
1100
- @typing.overload
1101
- def model(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1102
- ...
1103
-
1104
- @typing.overload
1105
- def model(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1106
- ...
1107
-
1108
- 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):
1109
- """
1110
- Enables loading / saving of models within a step.
1111
-
1112
- > Examples
1113
- - Saving Models
1114
- ```python
1115
- @model
1116
- @step
1117
- def train(self):
1118
- # current.model.save returns a dictionary reference to the model saved
1119
- self.my_model = current.model.save(
1120
- path_to_my_model,
1121
- label="my_model",
1122
- metadata={
1123
- "epochs": 10,
1124
- "batch-size": 32,
1125
- "learning-rate": 0.001,
1126
- }
1127
- )
1128
- self.next(self.test)
1129
-
1130
- @model(load="my_model")
1131
- @step
1132
- def test(self):
1133
- # `current.model.loaded` returns a dictionary of the loaded models
1134
- # where the key is the name of the artifact and the value is the path to the model
1135
- print(os.listdir(current.model.loaded["my_model"]))
1136
- self.next(self.end)
954
+ or
1137
955
  ```
1138
-
1139
- - Loading models
1140
- ```python
1141
- @step
1142
- def train(self):
1143
- # current.model.load returns the path to the model loaded
1144
- checkpoint_path = current.model.load(
1145
- self.checkpoint_key,
1146
- )
1147
- model_path = current.model.load(
1148
- self.model,
1149
- )
1150
- self.next(self.test)
956
+ python myflow.py run --with kubernetes
1151
957
  ```
958
+ which executes the flow on the desired system using the
959
+ requirements specified in `@resources`.
1152
960
 
1153
961
 
1154
962
  Parameters
1155
963
  ----------
1156
- load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
1157
- Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
1158
- These artifact names give to `load` be reference objects or reference `key` string's from objects created by `current.checkpoint` / `current.model` / `current.huggingface_hub`.
1159
- 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
1160
- the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
1161
- If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
1162
-
1163
- temp_dir_root : str, default: None
1164
- The root directory under which `current.model.loaded` will store loaded models
964
+ cpu : int, default 1
965
+ Number of CPUs required for this step.
966
+ gpu : int, optional, default None
967
+ Number of GPUs required for this step.
968
+ disk : int, optional, default None
969
+ Disk size (in MB) required for this step. Only applies on Kubernetes.
970
+ memory : int, default 4096
971
+ Memory size (in MB) required for this step.
972
+ shared_memory : int, optional, default None
973
+ The value for the size (in MiB) of the /dev/shm volume for this step.
974
+ This parameter maps to the `--shm-size` option in Docker.
1165
975
  """
1166
976
  ...
1167
977
 
1168
- def huggingface_hub(*, temp_dir_root: typing.Optional[str] = None, load: typing.Union[typing.List[str], typing.List[typing.Tuple[typing.Dict, str]], typing.List[typing.Tuple[str, str]], typing.List[typing.Dict], None]) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
978
+ @typing.overload
979
+ def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
980
+ ...
981
+
982
+ @typing.overload
983
+ def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
984
+ ...
985
+
986
+ 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):
1169
987
  """
1170
- Decorator that helps cache, version and store models/datasets from huggingface hub.
1171
-
1172
- > Examples
988
+ Specifies the resources needed when executing this step.
1173
989
 
1174
- **Usage: creating references of models from huggingface that may be loaded in downstream steps**
1175
- ```python
1176
- @huggingface_hub
1177
- @step
1178
- def pull_model_from_huggingface(self):
1179
- # `current.huggingface_hub.snapshot_download` downloads the model from the Hugging Face Hub
1180
- # and saves it in the backend storage based on the model's `repo_id`. If there exists a model
1181
- # with the same `repo_id` in the backend storage, it will not download the model again. The return
1182
- # value of the function is a reference to the model in the backend storage.
1183
- # This reference can be used to load the model in the subsequent steps via `@model(load=["llama_model"])`
990
+ Use `@resources` to specify the resource requirements
991
+ independently of the specific compute layer (`@batch`, `@kubernetes`).
1184
992
 
1185
- self.model_id = "mistralai/Mistral-7B-Instruct-v0.1"
1186
- self.llama_model = current.huggingface_hub.snapshot_download(
1187
- repo_id=self.model_id,
1188
- allow_patterns=["*.safetensors", "*.json", "tokenizer.*"],
1189
- )
1190
- self.next(self.train)
993
+ You can choose the compute layer on the command line by executing e.g.
1191
994
  ```
1192
-
1193
- **Usage: loading models directly from huggingface hub or from cache (from metaflow's datastore)**
1194
- ```python
1195
- @huggingface_hub(load=["mistralai/Mistral-7B-Instruct-v0.1"])
1196
- @step
1197
- def pull_model_from_huggingface(self):
1198
- path_to_model = current.huggingface_hub.loaded["mistralai/Mistral-7B-Instruct-v0.1"]
995
+ python myflow.py run --with batch
1199
996
  ```
1200
-
1201
- ```python
1202
- @huggingface_hub(load=[("mistralai/Mistral-7B-Instruct-v0.1", "/my-directory"), ("myorg/mistral-lora, "/my-lora-directory")])
1203
- @step
1204
- def finetune_model(self):
1205
- path_to_model = current.huggingface_hub.loaded["mistralai/Mistral-7B-Instruct-v0.1"]
1206
- # path_to_model will be /my-directory
997
+ or
1207
998
  ```
1208
-
1209
- ```python
1210
- # Takes all the arguments passed to `snapshot_download`
1211
- # except for `local_dir`
1212
- @huggingface_hub(load=[
1213
- {
1214
- "repo_id": "mistralai/Mistral-7B-Instruct-v0.1",
1215
- },
1216
- {
1217
- "repo_id": "myorg/mistral-lora",
1218
- "repo_type": "model",
1219
- },
1220
- ])
1221
- @step
1222
- def finetune_model(self):
1223
- path_to_model = current.huggingface_hub.loaded["mistralai/Mistral-7B-Instruct-v0.1"]
1224
- # path_to_model will be /my-directory
999
+ python myflow.py run --with kubernetes
1225
1000
  ```
1001
+ which executes the flow on the desired system using the
1002
+ requirements specified in `@resources`.
1226
1003
 
1227
1004
 
1228
1005
  Parameters
1229
1006
  ----------
1230
- temp_dir_root : str, optional
1231
- The root directory that will hold the temporary directory where objects will be downloaded.
1007
+ cpu : int, default 1
1008
+ Number of CPUs required for this step.
1009
+ gpu : int, optional, default None
1010
+ Number of GPUs required for this step.
1011
+ disk : int, optional, default None
1012
+ Disk size (in MB) required for this step. Only applies on Kubernetes.
1013
+ memory : int, default 4096
1014
+ Memory size (in MB) required for this step.
1015
+ shared_memory : int, optional, default None
1016
+ The value for the size (in MiB) of the /dev/shm volume for this step.
1017
+ This parameter maps to the `--shm-size` option in Docker.
1018
+ """
1019
+ ...
1020
+
1021
+ def vllm(*, model: str, backend: str, openai_api_server: bool, debug: bool, card_refresh_interval: int, max_retries: int, retry_alert_frequency: int, engine_args: dict) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
1022
+ """
1023
+ This decorator is used to run vllm APIs as Metaflow task sidecars.
1232
1024
 
1233
- load: Union[List[str], List[Tuple[Dict, str]], List[Tuple[str, str]], List[Dict], None]
1234
- The list of repos (models/datasets) to load.
1025
+ User code call
1026
+ --------------
1027
+ @vllm(
1028
+ model="...",
1029
+ ...
1030
+ )
1235
1031
 
1236
- Loaded repos can be accessed via `current.huggingface_hub.loaded`. If load is set, then the following happens:
1032
+ Valid backend options
1033
+ ---------------------
1034
+ - 'local': Run as a separate process on the local task machine.
1237
1035
 
1238
- - If repo (model/dataset) is not found in the datastore:
1239
- - Downloads the repo from Hugging Face Hub to a temporary directory (or uses specified path) for local access
1240
- - Stores it in Metaflow's datastore (s3/gcs/azure etc.) with a unique name based on repo_type/repo_id
1241
- - All HF models loaded for a `@step` will be cached separately under flow/step/namespace.
1036
+ Valid model options
1037
+ -------------------
1038
+ Any HuggingFace model identifier, e.g. 'meta-llama/Llama-3.2-1B'
1242
1039
 
1243
- - If repo is found in the datastore:
1244
- - Loads it directly from datastore to local path (can be temporary directory or specified path)
1040
+ NOTE: vLLM's OpenAI-compatible server serves ONE model per server instance.
1041
+ If you need multiple models, you must create multiple @vllm decorators.
1042
+
1043
+
1044
+ Parameters
1045
+ ----------
1046
+ model: str
1047
+ HuggingFace model identifier to be served by vLLM.
1048
+ backend: str
1049
+ Determines where and how to run the vLLM process.
1050
+ openai_api_server: bool
1051
+ Whether to use OpenAI-compatible API server mode (subprocess) instead of native engine.
1052
+ Default is False (uses native engine).
1053
+ Set to True for backward compatibility with existing code.
1054
+ debug: bool
1055
+ Whether to turn on verbose debugging logs.
1056
+ card_refresh_interval: int
1057
+ Interval in seconds for refreshing the vLLM status card.
1058
+ Only used when openai_api_server=True.
1059
+ max_retries: int
1060
+ Maximum number of retries checking for vLLM server startup.
1061
+ Only used when openai_api_server=True.
1062
+ retry_alert_frequency: int
1063
+ Frequency of alert logs for vLLM server startup retries.
1064
+ Only used when openai_api_server=True.
1065
+ engine_args : dict
1066
+ Additional keyword arguments to pass to the vLLM engine.
1067
+ For example, `tensor_parallel_size=2`.
1245
1068
  """
1246
1069
  ...
1247
1070
 
1248
1071
  @typing.overload
1249
- def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1072
+ 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]]]:
1250
1073
  """
1251
- Specifies the PyPI packages for all steps of the flow.
1074
+ Specifies the PyPI packages for the step.
1252
1075
 
1253
- Use `@pypi_base` to set common packages required by all
1076
+ Information in this decorator will augment any
1077
+ attributes set in the `@pyi_base` flow-level decorator. Hence,
1078
+ you can use `@pypi_base` to set packages required by all
1254
1079
  steps and use `@pypi` to specify step-specific overrides.
1255
1080
 
1081
+
1256
1082
  Parameters
1257
1083
  ----------
1258
1084
  packages : Dict[str, str], default: {}
1259
- Packages to use for this flow. The key is the name of the package
1085
+ Packages to use for this step. The key is the name of the package
1260
1086
  and the value is the version to use.
1261
1087
  python : str, optional, default: None
1262
1088
  Version of Python to use, e.g. '3.7.4'. A default value of None implies
@@ -1265,20 +1091,27 @@ def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[s
1265
1091
  ...
1266
1092
 
1267
1093
  @typing.overload
1268
- def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1094
+ def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1269
1095
  ...
1270
1096
 
1271
- def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
1097
+ @typing.overload
1098
+ def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1099
+ ...
1100
+
1101
+ 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):
1272
1102
  """
1273
- Specifies the PyPI packages for all steps of the flow.
1103
+ Specifies the PyPI packages for the step.
1274
1104
 
1275
- Use `@pypi_base` to set common packages required by all
1105
+ Information in this decorator will augment any
1106
+ attributes set in the `@pyi_base` flow-level decorator. Hence,
1107
+ you can use `@pypi_base` to set packages required by all
1276
1108
  steps and use `@pypi` to specify step-specific overrides.
1277
1109
 
1110
+
1278
1111
  Parameters
1279
1112
  ----------
1280
1113
  packages : Dict[str, str], default: {}
1281
- Packages to use for this flow. The key is the name of the package
1114
+ Packages to use for this step. The key is the name of the package
1282
1115
  and the value is the version to use.
1283
1116
  python : str, optional, default: None
1284
1117
  Version of Python to use, e.g. '3.7.4'. A default value of None implies
@@ -1287,95 +1120,128 @@ def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packag
1287
1120
  ...
1288
1121
 
1289
1122
  @typing.overload
1290
- def trigger(*, event: typing.Union[str, typing.Dict[str, typing.Any], None] = None, events: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = [], options: typing.Dict[str, typing.Any] = {}) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1123
+ 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]]]:
1291
1124
  """
1292
- Specifies the event(s) that this flow depends on.
1125
+ Specifies that the step will success under all circumstances.
1293
1126
 
1294
- ```
1295
- @trigger(event='foo')
1296
- ```
1297
- or
1298
- ```
1299
- @trigger(events=['foo', 'bar'])
1300
- ```
1127
+ The decorator will create an optional artifact, specified by `var`, which
1128
+ contains the exception raised. You can use it to detect the presence
1129
+ of errors, indicating that all happy-path artifacts produced by the step
1130
+ are missing.
1301
1131
 
1302
- Additionally, you can specify the parameter mappings
1303
- to map event payload to Metaflow parameters for the flow.
1304
- ```
1305
- @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1306
- ```
1307
- or
1308
- ```
1309
- @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1310
- {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1311
- ```
1312
1132
 
1313
- 'parameters' can also be a list of strings and tuples like so:
1314
- ```
1315
- @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1316
- ```
1317
- This is equivalent to:
1318
- ```
1319
- @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1320
- ```
1133
+ Parameters
1134
+ ----------
1135
+ var : str, optional, default None
1136
+ Name of the artifact in which to store the caught exception.
1137
+ If not specified, the exception is not stored.
1138
+ print_exception : bool, default True
1139
+ Determines whether or not the exception is printed to
1140
+ stdout when caught.
1141
+ """
1142
+ ...
1143
+
1144
+ @typing.overload
1145
+ def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1146
+ ...
1147
+
1148
+ @typing.overload
1149
+ def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1150
+ ...
1151
+
1152
+ 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):
1153
+ """
1154
+ Specifies that the step will success under all circumstances.
1155
+
1156
+ The decorator will create an optional artifact, specified by `var`, which
1157
+ contains the exception raised. You can use it to detect the presence
1158
+ of errors, indicating that all happy-path artifacts produced by the step
1159
+ are missing.
1160
+
1161
+
1162
+ Parameters
1163
+ ----------
1164
+ var : str, optional, default None
1165
+ Name of the artifact in which to store the caught exception.
1166
+ If not specified, the exception is not stored.
1167
+ print_exception : bool, default True
1168
+ Determines whether or not the exception is printed to
1169
+ stdout when caught.
1170
+ """
1171
+ ...
1172
+
1173
+ @typing.overload
1174
+ 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]]]:
1175
+ """
1176
+ Specifies a timeout for your step.
1177
+
1178
+ This decorator is useful if this step may hang indefinitely.
1179
+
1180
+ This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
1181
+ A timeout is considered to be an exception thrown by the step. It will cause the step to be
1182
+ retried if needed and the exception will be caught by the `@catch` decorator, if present.
1183
+
1184
+ Note that all the values specified in parameters are added together so if you specify
1185
+ 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
1321
1186
 
1322
1187
 
1323
1188
  Parameters
1324
1189
  ----------
1325
- event : Union[str, Dict[str, Any]], optional, default None
1326
- Event dependency for this flow.
1327
- events : List[Union[str, Dict[str, Any]]], default []
1328
- Events dependency for this flow.
1329
- options : Dict[str, Any], default {}
1330
- Backend-specific configuration for tuning eventing behavior.
1190
+ seconds : int, default 0
1191
+ Number of seconds to wait prior to timing out.
1192
+ minutes : int, default 0
1193
+ Number of minutes to wait prior to timing out.
1194
+ hours : int, default 0
1195
+ Number of hours to wait prior to timing out.
1331
1196
  """
1332
1197
  ...
1333
1198
 
1334
1199
  @typing.overload
1335
- def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1200
+ def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1336
1201
  ...
1337
1202
 
1338
- def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, event: typing.Union[str, typing.Dict[str, typing.Any], None] = None, events: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = [], options: typing.Dict[str, typing.Any] = {}):
1203
+ @typing.overload
1204
+ def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1205
+ ...
1206
+
1207
+ 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):
1339
1208
  """
1340
- Specifies the event(s) that this flow depends on.
1209
+ Specifies a timeout for your step.
1341
1210
 
1342
- ```
1343
- @trigger(event='foo')
1344
- ```
1345
- or
1346
- ```
1347
- @trigger(events=['foo', 'bar'])
1348
- ```
1211
+ This decorator is useful if this step may hang indefinitely.
1349
1212
 
1350
- Additionally, you can specify the parameter mappings
1351
- to map event payload to Metaflow parameters for the flow.
1352
- ```
1353
- @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1354
- ```
1355
- or
1356
- ```
1357
- @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1358
- {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1359
- ```
1213
+ This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
1214
+ A timeout is considered to be an exception thrown by the step. It will cause the step to be
1215
+ retried if needed and the exception will be caught by the `@catch` decorator, if present.
1360
1216
 
1361
- 'parameters' can also be a list of strings and tuples like so:
1362
- ```
1363
- @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1364
- ```
1365
- This is equivalent to:
1366
- ```
1367
- @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1368
- ```
1217
+ Note that all the values specified in parameters are added together so if you specify
1218
+ 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
1369
1219
 
1370
1220
 
1371
1221
  Parameters
1372
1222
  ----------
1373
- event : Union[str, Dict[str, Any]], optional, default None
1374
- Event dependency for this flow.
1375
- events : List[Union[str, Dict[str, Any]]], default []
1376
- Events dependency for this flow.
1377
- options : Dict[str, Any], default {}
1378
- Backend-specific configuration for tuning eventing behavior.
1223
+ seconds : int, default 0
1224
+ Number of seconds to wait prior to timing out.
1225
+ minutes : int, default 0
1226
+ Number of minutes to wait prior to timing out.
1227
+ hours : int, default 0
1228
+ Number of hours to wait prior to timing out.
1229
+ """
1230
+ ...
1231
+
1232
+ def nvidia(*, gpu: int, gpu_type: str, queue_timeout: int) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
1233
+ """
1234
+ Specifies that this step should execute on DGX cloud.
1235
+
1236
+
1237
+ Parameters
1238
+ ----------
1239
+ gpu : int
1240
+ Number of GPUs to use.
1241
+ gpu_type : str
1242
+ Type of Nvidia GPU to use.
1243
+ queue_timeout : int
1244
+ Time to keep the job in NVCF's queue.
1379
1245
  """
1380
1246
  ...
1381
1247
 
@@ -1481,190 +1347,136 @@ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *
1481
1347
  ...
1482
1348
 
1483
1349
  @typing.overload
1484
- def schedule(*, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: typing.Optional[str] = None, timezone: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1350
+ def trigger(*, event: typing.Union[str, typing.Dict[str, typing.Any], None] = None, events: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = [], options: typing.Dict[str, typing.Any] = {}) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1485
1351
  """
1486
- Specifies the times when the flow should be run when running on a
1487
- production scheduler.
1352
+ Specifies the event(s) that this flow depends on.
1353
+
1354
+ ```
1355
+ @trigger(event='foo')
1356
+ ```
1357
+ or
1358
+ ```
1359
+ @trigger(events=['foo', 'bar'])
1360
+ ```
1361
+
1362
+ Additionally, you can specify the parameter mappings
1363
+ to map event payload to Metaflow parameters for the flow.
1364
+ ```
1365
+ @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1366
+ ```
1367
+ or
1368
+ ```
1369
+ @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1370
+ {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1371
+ ```
1372
+
1373
+ 'parameters' can also be a list of strings and tuples like so:
1374
+ ```
1375
+ @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1376
+ ```
1377
+ This is equivalent to:
1378
+ ```
1379
+ @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1380
+ ```
1488
1381
 
1489
1382
 
1490
1383
  Parameters
1491
1384
  ----------
1492
- hourly : bool, default False
1493
- Run the workflow hourly.
1494
- daily : bool, default True
1495
- Run the workflow daily.
1496
- weekly : bool, default False
1497
- Run the workflow weekly.
1498
- cron : str, optional, default None
1499
- Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1500
- specified by this expression.
1501
- timezone : str, optional, default None
1502
- Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1503
- which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1385
+ event : Union[str, Dict[str, Any]], optional, default None
1386
+ Event dependency for this flow.
1387
+ events : List[Union[str, Dict[str, Any]]], default []
1388
+ Events dependency for this flow.
1389
+ options : Dict[str, Any], default {}
1390
+ Backend-specific configuration for tuning eventing behavior.
1504
1391
  """
1505
1392
  ...
1506
1393
 
1507
1394
  @typing.overload
1508
- def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1509
- ...
1510
-
1511
- def schedule(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: typing.Optional[str] = None, timezone: typing.Optional[str] = None):
1512
- """
1513
- Specifies the times when the flow should be run when running on a
1514
- production scheduler.
1515
-
1516
-
1517
- Parameters
1518
- ----------
1519
- hourly : bool, default False
1520
- Run the workflow hourly.
1521
- daily : bool, default True
1522
- Run the workflow daily.
1523
- weekly : bool, default False
1524
- Run the workflow weekly.
1525
- cron : str, optional, default None
1526
- Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1527
- specified by this expression.
1528
- timezone : str, optional, default None
1529
- Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1530
- which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1531
- """
1395
+ def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1532
1396
  ...
1533
1397
 
1534
- def airflow_s3_key_sensor(*, timeout: int, poke_interval: int, mode: str, exponential_backoff: bool, pool: str, soft_fail: bool, name: str, description: str, bucket_key: typing.Union[str, typing.List[str]], bucket_name: str, wildcard_match: bool, aws_conn_id: str, verify: bool) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1398
+ def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, event: typing.Union[str, typing.Dict[str, typing.Any], None] = None, events: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = [], options: typing.Dict[str, typing.Any] = {}):
1535
1399
  """
1536
- The `@airflow_s3_key_sensor` decorator attaches a Airflow [S3KeySensor](https://airflow.apache.org/docs/apache-airflow-providers-amazon/stable/_api/airflow/providers/amazon/aws/sensors/s3/index.html#airflow.providers.amazon.aws.sensors.s3.S3KeySensor)
1537
- before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
1538
- and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
1539
- added as a flow decorators. Adding more than one decorator will ensure that `start` step
1540
- starts only after all sensors finish.
1400
+ Specifies the event(s) that this flow depends on.
1541
1401
 
1402
+ ```
1403
+ @trigger(event='foo')
1404
+ ```
1405
+ or
1406
+ ```
1407
+ @trigger(events=['foo', 'bar'])
1408
+ ```
1542
1409
 
1543
- Parameters
1544
- ----------
1545
- timeout : int
1546
- Time, in seconds before the task times out and fails. (Default: 3600)
1547
- poke_interval : int
1548
- Time in seconds that the job should wait in between each try. (Default: 60)
1549
- mode : str
1550
- How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1551
- exponential_backoff : bool
1552
- allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1553
- pool : str
1554
- the slot pool this task should run in,
1555
- slot pools are a way to limit concurrency for certain tasks. (Default:None)
1556
- soft_fail : bool
1557
- Set to true to mark the task as SKIPPED on failure. (Default: False)
1558
- name : str
1559
- Name of the sensor on Airflow
1560
- description : str
1561
- Description of sensor in the Airflow UI
1562
- bucket_key : Union[str, List[str]]
1563
- The key(s) being waited on. Supports full s3:// style url or relative path from root level.
1564
- When it's specified as a full s3:// url, please leave `bucket_name` as None
1565
- bucket_name : str
1566
- Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
1567
- When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
1568
- wildcard_match : bool
1569
- whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
1570
- aws_conn_id : str
1571
- a reference to the s3 connection on Airflow. (Default: None)
1572
- verify : bool
1573
- Whether or not to verify SSL certificates for S3 connection. (Default: None)
1574
- """
1575
- ...
1576
-
1577
- @typing.overload
1578
- def conda_base(*, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1579
- """
1580
- Specifies the Conda environment for all steps of the flow.
1410
+ Additionally, you can specify the parameter mappings
1411
+ to map event payload to Metaflow parameters for the flow.
1412
+ ```
1413
+ @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1414
+ ```
1415
+ or
1416
+ ```
1417
+ @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1418
+ {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1419
+ ```
1581
1420
 
1582
- Use `@conda_base` to set common libraries required by all
1583
- steps and use `@conda` to specify step-specific additions.
1421
+ 'parameters' can also be a list of strings and tuples like so:
1422
+ ```
1423
+ @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1424
+ ```
1425
+ This is equivalent to:
1426
+ ```
1427
+ @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1428
+ ```
1584
1429
 
1585
1430
 
1586
1431
  Parameters
1587
1432
  ----------
1588
- packages : Dict[str, str], default {}
1589
- Packages to use for this flow. The key is the name of the package
1590
- and the value is the version to use.
1591
- libraries : Dict[str, str], default {}
1592
- Supported for backward compatibility. When used with packages, packages will take precedence.
1593
- python : str, optional, default None
1594
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1595
- that the version used will correspond to the version of the Python interpreter used to start the run.
1596
- disabled : bool, default False
1597
- If set to True, disables Conda.
1598
- """
1599
- ...
1600
-
1601
- @typing.overload
1602
- def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1433
+ event : Union[str, Dict[str, Any]], optional, default None
1434
+ Event dependency for this flow.
1435
+ events : List[Union[str, Dict[str, Any]]], default []
1436
+ Events dependency for this flow.
1437
+ options : Dict[str, Any], default {}
1438
+ Backend-specific configuration for tuning eventing behavior.
1439
+ """
1603
1440
  ...
1604
1441
 
1605
- 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):
1442
+ @typing.overload
1443
+ def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1606
1444
  """
1607
- Specifies the Conda environment for all steps of the flow.
1608
-
1609
- Use `@conda_base` to set common libraries required by all
1610
- steps and use `@conda` to specify step-specific additions.
1445
+ Specifies the PyPI packages for all steps of the flow.
1611
1446
 
1447
+ Use `@pypi_base` to set common packages required by all
1448
+ steps and use `@pypi` to specify step-specific overrides.
1612
1449
 
1613
1450
  Parameters
1614
1451
  ----------
1615
- packages : Dict[str, str], default {}
1452
+ packages : Dict[str, str], default: {}
1616
1453
  Packages to use for this flow. The key is the name of the package
1617
1454
  and the value is the version to use.
1618
- libraries : Dict[str, str], default {}
1619
- Supported for backward compatibility. When used with packages, packages will take precedence.
1620
- python : str, optional, default None
1455
+ python : str, optional, default: None
1621
1456
  Version of Python to use, e.g. '3.7.4'. A default value of None implies
1622
1457
  that the version used will correspond to the version of the Python interpreter used to start the run.
1623
- disabled : bool, default False
1624
- If set to True, disables Conda.
1625
1458
  """
1626
1459
  ...
1627
1460
 
1628
- def airflow_external_task_sensor(*, timeout: int, poke_interval: int, mode: str, exponential_backoff: bool, pool: str, soft_fail: bool, name: str, description: str, external_dag_id: str, external_task_ids: typing.List[str], allowed_states: typing.List[str], failed_states: typing.List[str], execution_delta: "datetime.timedelta", check_existence: bool) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1461
+ @typing.overload
1462
+ def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1463
+ ...
1464
+
1465
+ def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
1629
1466
  """
1630
- The `@airflow_external_task_sensor` decorator attaches a Airflow [ExternalTaskSensor](https://airflow.apache.org/docs/apache-airflow/stable/_api/airflow/sensors/external_task/index.html#airflow.sensors.external_task.ExternalTaskSensor) before the start step of the flow.
1631
- This decorator only works when a flow is scheduled on Airflow and is compiled using `airflow create`. More than one `@airflow_external_task_sensor` can be added as a flow decorators. Adding more than one decorator will ensure that `start` step starts only after all sensors finish.
1467
+ Specifies the PyPI packages for all steps of the flow.
1632
1468
 
1469
+ Use `@pypi_base` to set common packages required by all
1470
+ steps and use `@pypi` to specify step-specific overrides.
1633
1471
 
1634
1472
  Parameters
1635
1473
  ----------
1636
- timeout : int
1637
- Time, in seconds before the task times out and fails. (Default: 3600)
1638
- poke_interval : int
1639
- Time in seconds that the job should wait in between each try. (Default: 60)
1640
- mode : str
1641
- How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1642
- exponential_backoff : bool
1643
- allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1644
- pool : str
1645
- the slot pool this task should run in,
1646
- slot pools are a way to limit concurrency for certain tasks. (Default:None)
1647
- soft_fail : bool
1648
- Set to true to mark the task as SKIPPED on failure. (Default: False)
1649
- name : str
1650
- Name of the sensor on Airflow
1651
- description : str
1652
- Description of sensor in the Airflow UI
1653
- external_dag_id : str
1654
- The dag_id that contains the task you want to wait for.
1655
- external_task_ids : List[str]
1656
- The list of task_ids that you want to wait for.
1657
- If None (default value) the sensor waits for the DAG. (Default: None)
1658
- allowed_states : List[str]
1659
- Iterable of allowed states, (Default: ['success'])
1660
- failed_states : List[str]
1661
- Iterable of failed or dis-allowed states. (Default: None)
1662
- execution_delta : datetime.timedelta
1663
- time difference with the previous execution to look at,
1664
- the default is the same logical date as the current task or DAG. (Default: None)
1665
- check_existence: bool
1666
- Set to True to check if the external task exists or check if
1667
- the DAG to wait for exists. (Default: True)
1474
+ packages : Dict[str, str], default: {}
1475
+ Packages to use for this flow. The key is the name of the package
1476
+ and the value is the version to use.
1477
+ python : str, optional, default: None
1478
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1479
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1668
1480
  """
1669
1481
  ...
1670
1482
 
@@ -1782,6 +1594,57 @@ def with_artifact_store(f: typing.Optional[typing.Type[FlowSpecDerived]] = None)
1782
1594
  """
1783
1595
  ...
1784
1596
 
1597
+ @typing.overload
1598
+ 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]]:
1599
+ """
1600
+ Specifies the times when the flow should be run when running on a
1601
+ production scheduler.
1602
+
1603
+
1604
+ Parameters
1605
+ ----------
1606
+ hourly : bool, default False
1607
+ Run the workflow hourly.
1608
+ daily : bool, default True
1609
+ Run the workflow daily.
1610
+ weekly : bool, default False
1611
+ Run the workflow weekly.
1612
+ cron : str, optional, default None
1613
+ Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1614
+ specified by this expression.
1615
+ timezone : str, optional, default None
1616
+ Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1617
+ which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1618
+ """
1619
+ ...
1620
+
1621
+ @typing.overload
1622
+ def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1623
+ ...
1624
+
1625
+ 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):
1626
+ """
1627
+ Specifies the times when the flow should be run when running on a
1628
+ production scheduler.
1629
+
1630
+
1631
+ Parameters
1632
+ ----------
1633
+ hourly : bool, default False
1634
+ Run the workflow hourly.
1635
+ daily : bool, default True
1636
+ Run the workflow daily.
1637
+ weekly : bool, default False
1638
+ Run the workflow weekly.
1639
+ cron : str, optional, default None
1640
+ Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1641
+ specified by this expression.
1642
+ timezone : str, optional, default None
1643
+ Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1644
+ which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1645
+ """
1646
+ ...
1647
+
1785
1648
  def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1786
1649
  """
1787
1650
  Specifies what flows belong to the same project.
@@ -1817,5 +1680,142 @@ def project(*, name: str, branch: typing.Optional[str] = None, production: bool
1817
1680
  """
1818
1681
  ...
1819
1682
 
1683
+ 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]]:
1684
+ """
1685
+ 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.
1686
+ 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.
1687
+
1688
+
1689
+ Parameters
1690
+ ----------
1691
+ timeout : int
1692
+ Time, in seconds before the task times out and fails. (Default: 3600)
1693
+ poke_interval : int
1694
+ Time in seconds that the job should wait in between each try. (Default: 60)
1695
+ mode : str
1696
+ How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1697
+ exponential_backoff : bool
1698
+ allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1699
+ pool : str
1700
+ the slot pool this task should run in,
1701
+ slot pools are a way to limit concurrency for certain tasks. (Default:None)
1702
+ soft_fail : bool
1703
+ Set to true to mark the task as SKIPPED on failure. (Default: False)
1704
+ name : str
1705
+ Name of the sensor on Airflow
1706
+ description : str
1707
+ Description of sensor in the Airflow UI
1708
+ external_dag_id : str
1709
+ The dag_id that contains the task you want to wait for.
1710
+ external_task_ids : List[str]
1711
+ The list of task_ids that you want to wait for.
1712
+ If None (default value) the sensor waits for the DAG. (Default: None)
1713
+ allowed_states : List[str]
1714
+ Iterable of allowed states, (Default: ['success'])
1715
+ failed_states : List[str]
1716
+ Iterable of failed or dis-allowed states. (Default: None)
1717
+ execution_delta : datetime.timedelta
1718
+ time difference with the previous execution to look at,
1719
+ the default is the same logical date as the current task or DAG. (Default: None)
1720
+ check_existence: bool
1721
+ Set to True to check if the external task exists or check if
1722
+ the DAG to wait for exists. (Default: True)
1723
+ """
1724
+ ...
1725
+
1726
+ 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]]:
1727
+ """
1728
+ 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)
1729
+ before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
1730
+ and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
1731
+ added as a flow decorators. Adding more than one decorator will ensure that `start` step
1732
+ starts only after all sensors finish.
1733
+
1734
+
1735
+ Parameters
1736
+ ----------
1737
+ timeout : int
1738
+ Time, in seconds before the task times out and fails. (Default: 3600)
1739
+ poke_interval : int
1740
+ Time in seconds that the job should wait in between each try. (Default: 60)
1741
+ mode : str
1742
+ How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1743
+ exponential_backoff : bool
1744
+ allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1745
+ pool : str
1746
+ the slot pool this task should run in,
1747
+ slot pools are a way to limit concurrency for certain tasks. (Default:None)
1748
+ soft_fail : bool
1749
+ Set to true to mark the task as SKIPPED on failure. (Default: False)
1750
+ name : str
1751
+ Name of the sensor on Airflow
1752
+ description : str
1753
+ Description of sensor in the Airflow UI
1754
+ bucket_key : Union[str, List[str]]
1755
+ The key(s) being waited on. Supports full s3:// style url or relative path from root level.
1756
+ When it's specified as a full s3:// url, please leave `bucket_name` as None
1757
+ bucket_name : str
1758
+ Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
1759
+ When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
1760
+ wildcard_match : bool
1761
+ whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
1762
+ aws_conn_id : str
1763
+ a reference to the s3 connection on Airflow. (Default: None)
1764
+ verify : bool
1765
+ Whether or not to verify SSL certificates for S3 connection. (Default: None)
1766
+ """
1767
+ ...
1768
+
1769
+ @typing.overload
1770
+ 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]]:
1771
+ """
1772
+ Specifies the Conda environment for all steps of the flow.
1773
+
1774
+ Use `@conda_base` to set common libraries required by all
1775
+ steps and use `@conda` to specify step-specific additions.
1776
+
1777
+
1778
+ Parameters
1779
+ ----------
1780
+ packages : Dict[str, str], default {}
1781
+ Packages to use for this flow. The key is the name of the package
1782
+ and the value is the version to use.
1783
+ libraries : Dict[str, str], default {}
1784
+ Supported for backward compatibility. When used with packages, packages will take precedence.
1785
+ python : str, optional, default None
1786
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1787
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1788
+ disabled : bool, default False
1789
+ If set to True, disables Conda.
1790
+ """
1791
+ ...
1792
+
1793
+ @typing.overload
1794
+ def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1795
+ ...
1796
+
1797
+ 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):
1798
+ """
1799
+ Specifies the Conda environment for all steps of the flow.
1800
+
1801
+ Use `@conda_base` to set common libraries required by all
1802
+ steps and use `@conda` to specify step-specific additions.
1803
+
1804
+
1805
+ Parameters
1806
+ ----------
1807
+ packages : Dict[str, str], default {}
1808
+ Packages to use for this flow. The key is the name of the package
1809
+ and the value is the version to use.
1810
+ libraries : Dict[str, str], default {}
1811
+ Supported for backward compatibility. When used with packages, packages will take precedence.
1812
+ python : str, optional, default None
1813
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1814
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1815
+ disabled : bool, default False
1816
+ If set to True, disables Conda.
1817
+ """
1818
+ ...
1819
+
1820
1820
  pkg_name: str
1821
1821