ob-metaflow-stubs 6.0.3.187__py2.py3-none-any.whl → 6.0.3.188rc1__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 +772 -772
  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 +3 -3
  8. metaflow-stubs/client/filecache.pyi +2 -2
  9. metaflow-stubs/events.pyi +1 -1
  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 +1 -1
  18. metaflow-stubs/metadata_provider/util.pyi +1 -1
  19. metaflow-stubs/metaflow_config.pyi +1 -1
  20. metaflow-stubs/metaflow_current.pyi +33 -33
  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 +1 -1
  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 +3 -3
  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 +2 -2
  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 +2 -2
  37. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/decorator.pyi +3 -3
  38. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/exceptions.pyi +1 -1
  39. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/final_api.pyi +1 -1
  40. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/lineage.pyi +1 -1
  41. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/__init__.pyi +1 -1
  42. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/context.pyi +2 -2
  43. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/core.pyi +2 -2
  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 +1 -1
  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 +1 -1
  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 +1 -1
  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 +2 -2
  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 +1 -1
  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 +1 -1
  63. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/tar_utils.pyi +1 -1
  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 +1 -1
  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 +1 -1
  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 +3 -3
  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 +2 -2
  144. metaflow-stubs/plugins/aws/step_functions/step_functions_deployer_objects.pyi +2 -2
  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 +3 -3
  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 +2 -2
  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 +2 -2
  159. metaflow-stubs/plugins/cards/card_modules/card.pyi +1 -1
  160. metaflow-stubs/plugins/cards/card_modules/components.pyi +2 -2
  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 +2 -2
  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 +2 -2
  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 +3 -3
  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 +1 -1
  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 +1 -1
  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 +2 -2
  198. metaflow-stubs/plugins/pypi/conda_decorator.pyi +1 -1
  199. metaflow-stubs/plugins/pypi/conda_environment.pyi +4 -4
  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 +1 -1
  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 +2 -2
  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 +2 -2
  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 +4 -4
  220. metaflow-stubs/runner/deployer_impl.pyi +1 -1
  221. metaflow-stubs/runner/metaflow_runner.pyi +2 -2
  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 +2 -2
  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.188rc1.dist-info}/METADATA +1 -1
  236. ob_metaflow_stubs-6.0.3.188rc1.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.188rc1.dist-info}/WHEEL +0 -0
  239. {ob_metaflow_stubs-6.0.3.187.dist-info → ob_metaflow_stubs-6.0.3.188rc1.dist-info}/top_level.txt +0 -0
@@ -1,7 +1,7 @@
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-07T22:26:05.548812 #
5
5
  ######################################################################################################
6
6
 
7
7
  from __future__ import annotations
@@ -36,8 +36,8 @@ from .user_configs.config_parameters import config_expr as config_expr
36
36
  from .user_configs.config_decorators import CustomFlowDecorator as CustomFlowDecorator
37
37
  from .user_configs.config_decorators import CustomStepDecorator as CustomStepDecorator
38
38
  from . import events as events
39
- from . import cards as cards
40
39
  from . import tuple_util as tuple_util
40
+ from . import cards as cards
41
41
  from . import metaflow_git as metaflow_git
42
42
  from . import runner as runner
43
43
  from . import plugins as plugins
@@ -45,8 +45,8 @@ from .mf_extensions.outerbounds.toplevel.global_aliases_for_metaflow_package imp
45
45
  from . import includefile as includefile
46
46
  from .includefile import IncludeFile as IncludeFile
47
47
  from .plugins.pypi.parsers import pyproject_toml_parser as pyproject_toml_parser
48
- 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 conda_environment_yml_parser as conda_environment_yml_parser
50
50
  from . import client as client
51
51
  from .client.core import namespace as namespace
52
52
  from .client.core import get_namespace as get_namespace
@@ -156,51 +156,131 @@ 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 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]]]:
160
160
  """
161
- Creates a human-readable report, a Metaflow Card, after this step completes.
161
+ Enables loading / saving of models within a step.
162
162
 
163
- Note that you may add multiple `@card` decorators in a step with different parameters.
163
+ > Examples
164
+ - Saving Models
165
+ ```python
166
+ @model
167
+ @step
168
+ def train(self):
169
+ # current.model.save returns a dictionary reference to the model saved
170
+ self.my_model = current.model.save(
171
+ path_to_my_model,
172
+ label="my_model",
173
+ metadata={
174
+ "epochs": 10,
175
+ "batch-size": 32,
176
+ "learning-rate": 0.001,
177
+ }
178
+ )
179
+ self.next(self.test)
180
+
181
+ @model(load="my_model")
182
+ @step
183
+ def test(self):
184
+ # `current.model.loaded` returns a dictionary of the loaded models
185
+ # where the key is the name of the artifact and the value is the path to the model
186
+ print(os.listdir(current.model.loaded["my_model"]))
187
+ self.next(self.end)
188
+ ```
189
+
190
+ - Loading models
191
+ ```python
192
+ @step
193
+ def train(self):
194
+ # current.model.load returns the path to the model loaded
195
+ checkpoint_path = current.model.load(
196
+ self.checkpoint_key,
197
+ )
198
+ model_path = current.model.load(
199
+ self.model,
200
+ )
201
+ self.next(self.test)
202
+ ```
164
203
 
165
204
 
166
205
  Parameters
167
206
  ----------
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.
207
+ load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
208
+ Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
209
+ 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`.
210
+ 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
211
+ the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
212
+ If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
213
+
214
+ temp_dir_root : str, default: None
215
+ The root directory under which `current.model.loaded` will store loaded models
176
216
  """
177
217
  ...
178
218
 
179
219
  @typing.overload
180
- def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
220
+ def model(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
181
221
  ...
182
222
 
183
223
  @typing.overload
184
- def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
224
+ def model(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
185
225
  ...
186
226
 
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):
227
+ 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):
188
228
  """
189
- Creates a human-readable report, a Metaflow Card, after this step completes.
229
+ Enables loading / saving of models within a step.
190
230
 
191
- Note that you may add multiple `@card` decorators in a step with different parameters.
231
+ > Examples
232
+ - Saving Models
233
+ ```python
234
+ @model
235
+ @step
236
+ def train(self):
237
+ # current.model.save returns a dictionary reference to the model saved
238
+ self.my_model = current.model.save(
239
+ path_to_my_model,
240
+ label="my_model",
241
+ metadata={
242
+ "epochs": 10,
243
+ "batch-size": 32,
244
+ "learning-rate": 0.001,
245
+ }
246
+ )
247
+ self.next(self.test)
248
+
249
+ @model(load="my_model")
250
+ @step
251
+ def test(self):
252
+ # `current.model.loaded` returns a dictionary of the loaded models
253
+ # where the key is the name of the artifact and the value is the path to the model
254
+ print(os.listdir(current.model.loaded["my_model"]))
255
+ self.next(self.end)
256
+ ```
257
+
258
+ - Loading models
259
+ ```python
260
+ @step
261
+ def train(self):
262
+ # current.model.load returns the path to the model loaded
263
+ checkpoint_path = current.model.load(
264
+ self.checkpoint_key,
265
+ )
266
+ model_path = current.model.load(
267
+ self.model,
268
+ )
269
+ self.next(self.test)
270
+ ```
192
271
 
193
272
 
194
273
  Parameters
195
274
  ----------
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.
275
+ load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
276
+ Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
277
+ 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`.
278
+ 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
279
+ the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
280
+ If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
281
+
282
+ temp_dir_root : str, default: None
283
+ The root directory under which `current.model.loaded` will store loaded models
204
284
  """
205
285
  ...
206
286
 
@@ -218,6 +298,73 @@ def nvct(*, gpu: int, gpu_type: str) -> typing.Callable[[typing.Union[typing.Cal
218
298
  """
219
299
  ...
220
300
 
301
+ 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]]]:
302
+ """
303
+ Specifies that this step should execute on DGX cloud.
304
+
305
+
306
+ Parameters
307
+ ----------
308
+ gpu : int
309
+ Number of GPUs to use.
310
+ gpu_type : str
311
+ Type of Nvidia GPU to use.
312
+ queue_timeout : int
313
+ Time to keep the job in NVCF's queue.
314
+ """
315
+ ...
316
+
317
+ @typing.overload
318
+ 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]]]:
319
+ """
320
+ Specifies the PyPI packages for the step.
321
+
322
+ Information in this decorator will augment any
323
+ attributes set in the `@pyi_base` flow-level decorator. Hence,
324
+ you can use `@pypi_base` to set packages required by all
325
+ steps and use `@pypi` to specify step-specific overrides.
326
+
327
+
328
+ Parameters
329
+ ----------
330
+ packages : Dict[str, str], default: {}
331
+ Packages to use for this step. The key is the name of the package
332
+ and the value is the version to use.
333
+ python : str, optional, default: None
334
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
335
+ that the version used will correspond to the version of the Python interpreter used to start the run.
336
+ """
337
+ ...
338
+
339
+ @typing.overload
340
+ def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
341
+ ...
342
+
343
+ @typing.overload
344
+ def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
345
+ ...
346
+
347
+ 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):
348
+ """
349
+ Specifies the PyPI packages for the step.
350
+
351
+ Information in this decorator will augment any
352
+ attributes set in the `@pyi_base` flow-level decorator. Hence,
353
+ you can use `@pypi_base` to set packages required by all
354
+ steps and use `@pypi` to specify step-specific overrides.
355
+
356
+
357
+ Parameters
358
+ ----------
359
+ packages : Dict[str, str], default: {}
360
+ Packages to use for this step. The key is the name of the package
361
+ and the value is the version to use.
362
+ python : str, optional, default: None
363
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
364
+ that the version used will correspond to the version of the Python interpreter used to start the run.
365
+ """
366
+ ...
367
+
221
368
  @typing.overload
222
369
  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]]]:
223
370
  """
@@ -269,220 +416,117 @@ def catch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
269
416
  """
270
417
  ...
271
418
 
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]]]:
419
+ @typing.overload
420
+ 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]]]:
273
421
  """
274
- Specifies that this step should execute on Kubernetes.
422
+ Specifies the Conda environment for the step.
423
+
424
+ Information in this decorator will augment any
425
+ attributes set in the `@conda_base` flow-level decorator. Hence,
426
+ you can use `@conda_base` to set packages required by all
427
+ steps and use `@conda` to specify step-specific overrides.
275
428
 
276
429
 
277
430
  Parameters
278
431
  ----------
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
358
- """
359
- ...
360
-
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]]]:
362
- """
363
- Specifies that this step should execute on DGX cloud.
364
-
365
-
366
- Parameters
367
- ----------
368
- gpu : int
369
- Number of GPUs to use.
370
- gpu_type : str
371
- Type of Nvidia GPU to use.
372
- queue_timeout : int
373
- Time to keep the job in NVCF's queue.
374
- """
375
- ...
376
-
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]]]:
379
- """
380
- Specifies the resources needed when executing this step.
381
-
382
- Use `@resources` to specify the resource requirements
383
- independently of the specific compute layer (`@batch`, `@kubernetes`).
384
-
385
- You can choose the compute layer on the command line by executing e.g.
386
- ```
387
- python myflow.py run --with batch
388
- ```
389
- or
390
- ```
391
- python myflow.py run --with kubernetes
392
- ```
393
- which executes the flow on the desired system using the
394
- requirements specified in `@resources`.
395
-
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.
432
+ packages : Dict[str, str], default {}
433
+ Packages to use for this step. The key is the name of the package
434
+ and the value is the version to use.
435
+ libraries : Dict[str, str], default {}
436
+ Supported for backward compatibility. When used with packages, packages will take precedence.
437
+ python : str, optional, default None
438
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
439
+ that the version used will correspond to the version of the Python interpreter used to start the run.
440
+ disabled : bool, default False
441
+ If set to True, disables @conda.
410
442
  """
411
443
  ...
412
444
 
413
445
  @typing.overload
414
- def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
446
+ def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
415
447
  ...
416
448
 
417
449
  @typing.overload
418
- def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
450
+ def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
419
451
  ...
420
452
 
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):
453
+ 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):
422
454
  """
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`).
455
+ Specifies the Conda environment for the step.
427
456
 
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`.
457
+ Information in this decorator will augment any
458
+ attributes set in the `@conda_base` flow-level decorator. Hence,
459
+ you can use `@conda_base` to set packages required by all
460
+ steps and use `@conda` to specify step-specific overrides.
438
461
 
439
462
 
440
463
  Parameters
441
464
  ----------
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.
465
+ packages : Dict[str, str], default {}
466
+ Packages to use for this step. The key is the name of the package
467
+ and the value is the version to use.
468
+ libraries : Dict[str, str], default {}
469
+ Supported for backward compatibility. When used with packages, packages will take precedence.
470
+ python : str, optional, default None
471
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
472
+ that the version used will correspond to the version of the Python interpreter used to start the run.
473
+ disabled : bool, default False
474
+ If set to True, disables @conda.
453
475
  """
454
476
  ...
455
477
 
456
478
  @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]]]:
479
+ 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]]]:
458
480
  """
459
- Specifies environment variables to be set prior to the execution of a step.
481
+ Specifies the number of times the task corresponding
482
+ to a step needs to be retried.
483
+
484
+ This decorator is useful for handling transient errors, such as networking issues.
485
+ If your task contains operations that can't be retried safely, e.g. database updates,
486
+ it is advisable to annotate it with `@retry(times=0)`.
487
+
488
+ This can be used in conjunction with the `@catch` decorator. The `@catch`
489
+ decorator will execute a no-op task after all retries have been exhausted,
490
+ ensuring that the flow execution can continue.
460
491
 
461
492
 
462
493
  Parameters
463
494
  ----------
464
- vars : Dict[str, str], default {}
465
- Dictionary of environment variables to set.
495
+ times : int, default 3
496
+ Number of times to retry this task.
497
+ minutes_between_retries : int, default 2
498
+ Number of minutes between retries.
466
499
  """
467
500
  ...
468
501
 
469
502
  @typing.overload
470
- def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
503
+ def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
471
504
  ...
472
505
 
473
506
  @typing.overload
474
- def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
507
+ def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
475
508
  ...
476
509
 
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] = {}):
510
+ 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):
478
511
  """
479
- Specifies environment variables to be set prior to the execution of a step.
512
+ Specifies the number of times the task corresponding
513
+ to a step needs to be retried.
514
+
515
+ This decorator is useful for handling transient errors, such as networking issues.
516
+ If your task contains operations that can't be retried safely, e.g. database updates,
517
+ it is advisable to annotate it with `@retry(times=0)`.
518
+
519
+ This can be used in conjunction with the `@catch` decorator. The `@catch`
520
+ decorator will execute a no-op task after all retries have been exhausted,
521
+ ensuring that the flow execution can continue.
480
522
 
481
523
 
482
524
  Parameters
483
525
  ----------
484
- vars : Dict[str, str], default {}
485
- Dictionary of environment variables to set.
526
+ times : int, default 3
527
+ Number of times to retry this task.
528
+ minutes_between_retries : int, default 2
529
+ Number of minutes between retries.
486
530
  """
487
531
  ...
488
532
 
@@ -555,140 +599,52 @@ def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None],
555
599
  """
556
600
  ...
557
601
 
558
- def ollama(*, models: list, backend: str, force_pull: bool, cache_update_policy: str, force_cache_update: bool, debug: bool, circuit_breaker_config: dict, timeout_config: dict) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
559
- """
560
- This decorator is used to run Ollama APIs as Metaflow task sidecars.
561
-
562
- User code call
563
- --------------
564
- @ollama(
565
- models=[...],
566
- ...
567
- )
568
-
569
- Valid backend options
570
- ---------------------
571
- - 'local': Run as a separate process on the local task machine.
572
- - (TODO) 'managed': Outerbounds hosts and selects compute provider.
573
- - (TODO) 'remote': Spin up separate instance to serve Ollama models.
574
-
575
- Valid model options
576
- -------------------
577
- Any model here https://ollama.com/search, e.g. 'llama3.2', 'llama3.3'
578
-
579
-
580
- Parameters
581
- ----------
582
- models: list[str]
583
- List of Ollama containers running models in sidecars.
584
- backend: str
585
- Determines where and how to run the Ollama process.
586
- force_pull: bool
587
- Whether to run `ollama pull` no matter what, or first check the remote cache in Metaflow datastore for this model key.
588
- cache_update_policy: str
589
- Cache update policy: "auto", "force", or "never".
590
- force_cache_update: bool
591
- Simple override for "force" cache update policy.
592
- debug: bool
593
- Whether to turn on verbose debugging logs.
594
- circuit_breaker_config: dict
595
- Configuration for circuit breaker protection. Keys: failure_threshold, recovery_timeout, reset_timeout.
596
- timeout_config: dict
597
- Configuration for various operation timeouts. Keys: pull, stop, health_check, install, server_startup.
598
- """
599
- ...
600
-
601
602
  @typing.overload
602
- def secrets(*, sources: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = []) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
603
+ 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]]]:
603
604
  """
604
- Specifies secrets to be retrieved and injected as environment variables prior to
605
- the execution of a step.
605
+ Creates a human-readable report, a Metaflow Card, after this step completes.
606
+
607
+ Note that you may add multiple `@card` decorators in a step with different parameters.
606
608
 
607
609
 
608
610
  Parameters
609
611
  ----------
610
- sources : List[Union[str, Dict[str, Any]]], default: []
611
- List of secret specs, defining how the secrets are to be retrieved
612
+ type : str, default 'default'
613
+ Card type.
614
+ id : str, optional, default None
615
+ If multiple cards are present, use this id to identify this card.
616
+ options : Dict[str, Any], default {}
617
+ Options passed to the card. The contents depend on the card type.
618
+ timeout : int, default 45
619
+ Interrupt reporting if it takes more than this many seconds.
612
620
  """
613
621
  ...
614
622
 
615
623
  @typing.overload
616
- def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
624
+ def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
617
625
  ...
618
626
 
619
627
  @typing.overload
620
- def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
628
+ def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
621
629
  ...
622
630
 
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]]] = []):
631
+ 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):
624
632
  """
625
- Specifies secrets to be retrieved and injected as environment variables prior to
626
- the execution of a step.
633
+ Creates a human-readable report, a Metaflow Card, after this step completes.
634
+
635
+ Note that you may add multiple `@card` decorators in a step with different parameters.
627
636
 
628
637
 
629
638
  Parameters
630
639
  ----------
631
- sources : List[Union[str, Dict[str, Any]]], default: []
632
- List of secret specs, defining how the secrets are to be retrieved
633
- """
634
- ...
635
-
636
- @typing.overload
637
- def timeout(*, seconds: int = 0, minutes: int = 0, hours: int = 0) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
638
- """
639
- Specifies a timeout for your step.
640
-
641
- This decorator is useful if this step may hang indefinitely.
642
-
643
- This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
644
- A timeout is considered to be an exception thrown by the step. It will cause the step to be
645
- retried if needed and the exception will be caught by the `@catch` decorator, if present.
646
-
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.
649
-
650
-
651
- Parameters
652
- ----------
653
- seconds : int, default 0
654
- Number of seconds to wait prior to timing out.
655
- minutes : int, default 0
656
- Number of minutes to wait prior to timing out.
657
- hours : int, default 0
658
- Number of hours to wait prior to timing out.
659
- """
660
- ...
661
-
662
- @typing.overload
663
- def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
664
- ...
665
-
666
- @typing.overload
667
- def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
668
- ...
669
-
670
- def timeout(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, seconds: int = 0, minutes: int = 0, hours: int = 0):
671
- """
672
- Specifies a timeout for your step.
673
-
674
- This decorator is useful if this step may hang indefinitely.
675
-
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.
679
-
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.
682
-
683
-
684
- Parameters
685
- ----------
686
- seconds : int, default 0
687
- Number of seconds to wait prior to timing out.
688
- minutes : int, default 0
689
- Number of minutes to wait prior to timing out.
690
- hours : int, default 0
691
- Number of hours to wait prior to timing out.
640
+ type : str, default 'default'
641
+ Card type.
642
+ id : str, optional, default None
643
+ If multiple cards are present, use this id to identify this card.
644
+ options : Dict[str, Any], default {}
645
+ Options passed to the card. The contents depend on the card type.
646
+ timeout : int, default 45
647
+ Interrupt reporting if it takes more than this many seconds.
692
648
  """
693
649
  ...
694
650
 
@@ -856,58 +812,127 @@ def checkpoint(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None
856
812
  """
857
813
  ...
858
814
 
859
- @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]]]:
815
+ 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]]]:
861
816
  """
862
- Specifies the number of times the task corresponding
863
- to a step needs to be retried.
817
+ Specifies that this step should execute on Kubernetes.
864
818
 
865
- This decorator is useful for handling transient errors, such as networking issues.
866
- If your task contains operations that can't be retried safely, e.g. database updates,
867
- it is advisable to annotate it with `@retry(times=0)`.
868
819
 
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.
820
+ Parameters
821
+ ----------
822
+ cpu : int, default 1
823
+ Number of CPUs required for this step. If `@resources` is
824
+ also present, the maximum value from all decorators is used.
825
+ memory : int, default 4096
826
+ Memory size (in MB) required for this step. If
827
+ `@resources` is also present, the maximum value from all decorators is
828
+ used.
829
+ disk : int, default 10240
830
+ Disk size (in MB) required for this step. If
831
+ `@resources` is also present, the maximum value from all decorators is
832
+ used.
833
+ image : str, optional, default None
834
+ Docker image to use when launching on Kubernetes. If not specified, and
835
+ METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
836
+ not, a default Docker image mapping to the current version of Python is used.
837
+ image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
838
+ If given, the imagePullPolicy to be applied to the Docker image of the step.
839
+ image_pull_secrets: List[str], default []
840
+ The default is extracted from METAFLOW_KUBERNETES_IMAGE_PULL_SECRETS.
841
+ Kubernetes image pull secrets to use when pulling container images
842
+ in Kubernetes.
843
+ service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
844
+ Kubernetes service account to use when launching pod in Kubernetes.
845
+ secrets : List[str], optional, default None
846
+ Kubernetes secrets to use when launching pod in Kubernetes. These
847
+ secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
848
+ in Metaflow configuration.
849
+ node_selector: Union[Dict[str,str], str], optional, default None
850
+ Kubernetes node selector(s) to apply to the pod running the task.
851
+ Can be passed in as a comma separated string of values e.g.
852
+ 'kubernetes.io/os=linux,kubernetes.io/arch=amd64' or as a dictionary
853
+ {'kubernetes.io/os': 'linux', 'kubernetes.io/arch': 'amd64'}
854
+ namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
855
+ Kubernetes namespace to use when launching pod in Kubernetes.
856
+ gpu : int, optional, default None
857
+ Number of GPUs required for this step. A value of zero implies that
858
+ the scheduled node should not have GPUs.
859
+ gpu_vendor : str, default KUBERNETES_GPU_VENDOR
860
+ The vendor of the GPUs to be used for this step.
861
+ tolerations : List[str], default []
862
+ The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
863
+ Kubernetes tolerations to use when launching pod in Kubernetes.
864
+ labels: Dict[str, str], default: METAFLOW_KUBERNETES_LABELS
865
+ Kubernetes labels to use when launching pod in Kubernetes.
866
+ annotations: Dict[str, str], default: METAFLOW_KUBERNETES_ANNOTATIONS
867
+ Kubernetes annotations to use when launching pod in Kubernetes.
868
+ use_tmpfs : bool, default False
869
+ This enables an explicit tmpfs mount for this step.
870
+ tmpfs_tempdir : bool, default True
871
+ sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
872
+ tmpfs_size : int, optional, default: None
873
+ The value for the size (in MiB) of the tmpfs mount for this step.
874
+ This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
875
+ memory allocated for this step.
876
+ tmpfs_path : str, optional, default /metaflow_temp
877
+ Path to tmpfs mount for this step.
878
+ persistent_volume_claims : Dict[str, str], optional, default None
879
+ A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
880
+ volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
881
+ shared_memory: int, optional
882
+ Shared memory size (in MiB) required for this step
883
+ port: int, optional
884
+ Port number to specify in the Kubernetes job object
885
+ compute_pool : str, optional, default None
886
+ Compute pool to be used for for this step.
887
+ If not specified, any accessible compute pool within the perimeter is used.
888
+ hostname_resolution_timeout: int, default 10 * 60
889
+ Timeout in seconds for the workers tasks in the gang scheduled cluster to resolve the hostname of control task.
890
+ Only applicable when @parallel is used.
891
+ qos: str, default: Burstable
892
+ Quality of Service class to assign to the pod. Supported values are: Guaranteed, Burstable, BestEffort
893
+
894
+ security_context: Dict[str, Any], optional, default None
895
+ Container security context. Applies to the task container. Allows the following keys:
896
+ - privileged: bool, optional, default None
897
+ - allow_privilege_escalation: bool, optional, default None
898
+ - run_as_user: int, optional, default None
899
+ - run_as_group: int, optional, default None
900
+ - run_as_non_root: bool, optional, default None
901
+ """
902
+ ...
903
+
904
+ @typing.overload
905
+ 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]]]:
906
+ """
907
+ Specifies secrets to be retrieved and injected as environment variables prior to
908
+ the execution of a step.
872
909
 
873
910
 
874
911
  Parameters
875
912
  ----------
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.
913
+ sources : List[Union[str, Dict[str, Any]]], default: []
914
+ List of secret specs, defining how the secrets are to be retrieved
880
915
  """
881
916
  ...
882
917
 
883
918
  @typing.overload
884
- def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
919
+ def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
885
920
  ...
886
921
 
887
922
  @typing.overload
888
- def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
923
+ def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
889
924
  ...
890
925
 
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):
926
+ 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]]] = []):
892
927
  """
893
- Specifies the number of times the task corresponding
894
- to a step needs to be retried.
895
-
896
- This decorator is useful for handling transient errors, such as networking issues.
897
- If your task contains operations that can't be retried safely, e.g. database updates,
898
- it is advisable to annotate it with `@retry(times=0)`.
899
-
900
- This can be used in conjunction with the `@catch` decorator. The `@catch`
901
- decorator will execute a no-op task after all retries have been exhausted,
902
- ensuring that the flow execution can continue.
928
+ Specifies secrets to be retrieved and injected as environment variables prior to
929
+ the execution of a step.
903
930
 
904
931
 
905
932
  Parameters
906
933
  ----------
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.
934
+ sources : List[Union[str, Dict[str, Any]]], default: []
935
+ List of secret specs, defining how the secrets are to be retrieved
911
936
  """
912
937
  ...
913
938
 
@@ -927,241 +952,183 @@ def app_deploy(*, app_port: int, app_name: str) -> typing.Callable[[typing.Union
927
952
  ...
928
953
 
929
954
  @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]]]:
955
+ 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]]]:
931
956
  """
932
- Specifies the Conda environment for the step.
957
+ Specifies the resources needed when executing this step.
933
958
 
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.
959
+ Use `@resources` to specify the resource requirements
960
+ independently of the specific compute layer (`@batch`, `@kubernetes`).
961
+
962
+ You can choose the compute layer on the command line by executing e.g.
963
+ ```
964
+ python myflow.py run --with batch
965
+ ```
966
+ or
967
+ ```
968
+ python myflow.py run --with kubernetes
969
+ ```
970
+ which executes the flow on the desired system using the
971
+ requirements specified in `@resources`.
938
972
 
939
973
 
940
974
  Parameters
941
975
  ----------
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.
976
+ cpu : int, default 1
977
+ Number of CPUs required for this step.
978
+ gpu : int, optional, default None
979
+ Number of GPUs required for this step.
980
+ disk : int, optional, default None
981
+ Disk size (in MB) required for this step. Only applies on Kubernetes.
982
+ memory : int, default 4096
983
+ Memory size (in MB) required for this step.
984
+ shared_memory : int, optional, default None
985
+ The value for the size (in MiB) of the /dev/shm volume for this step.
986
+ This parameter maps to the `--shm-size` option in Docker.
952
987
  """
953
988
  ...
954
989
 
955
990
  @typing.overload
956
- def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
991
+ def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
957
992
  ...
958
993
 
959
994
  @typing.overload
960
- def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
995
+ def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
961
996
  ...
962
997
 
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):
998
+ 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):
964
999
  """
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.
1000
+ Specifies the resources needed when executing this step.
971
1001
 
1002
+ Use `@resources` to specify the resource requirements
1003
+ independently of the specific compute layer (`@batch`, `@kubernetes`).
972
1004
 
973
- Parameters
974
- ----------
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.
985
- """
986
- ...
987
-
988
- @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]]]:
990
- """
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.
1005
+ You can choose the compute layer on the command line by executing e.g.
1006
+ ```
1007
+ python myflow.py run --with batch
1008
+ ```
1009
+ or
1010
+ ```
1011
+ python myflow.py run --with kubernetes
1012
+ ```
1013
+ which executes the flow on the desired system using the
1014
+ requirements specified in `@resources`.
997
1015
 
998
1016
 
999
1017
  Parameters
1000
1018
  ----------
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.
1019
+ cpu : int, default 1
1020
+ Number of CPUs required for this step.
1021
+ gpu : int, optional, default None
1022
+ Number of GPUs required for this step.
1023
+ disk : int, optional, default None
1024
+ Disk size (in MB) required for this step. Only applies on Kubernetes.
1025
+ memory : int, default 4096
1026
+ Memory size (in MB) required for this step.
1027
+ shared_memory : int, optional, default None
1028
+ The value for the size (in MiB) of the /dev/shm volume for this step.
1029
+ This parameter maps to the `--shm-size` option in Docker.
1007
1030
  """
1008
1031
  ...
1009
1032
 
1010
- @typing.overload
1011
- def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1012
- ...
1013
-
1014
- @typing.overload
1015
- def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1016
- ...
1017
-
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):
1033
+ 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]]]:
1019
1034
  """
1020
- Specifies the PyPI packages for the step.
1035
+ This decorator is used to run Ollama APIs as Metaflow task sidecars.
1021
1036
 
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.
1037
+ User code call
1038
+ --------------
1039
+ @ollama(
1040
+ models=[...],
1041
+ ...
1042
+ )
1043
+
1044
+ Valid backend options
1045
+ ---------------------
1046
+ - 'local': Run as a separate process on the local task machine.
1047
+ - (TODO) 'managed': Outerbounds hosts and selects compute provider.
1048
+ - (TODO) 'remote': Spin up separate instance to serve Ollama models.
1049
+
1050
+ Valid model options
1051
+ -------------------
1052
+ Any model here https://ollama.com/search, e.g. 'llama3.2', 'llama3.3'
1026
1053
 
1027
1054
 
1028
1055
  Parameters
1029
1056
  ----------
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.
1057
+ models: list[str]
1058
+ List of Ollama containers running models in sidecars.
1059
+ backend: str
1060
+ Determines where and how to run the Ollama process.
1061
+ force_pull: bool
1062
+ Whether to run `ollama pull` no matter what, or first check the remote cache in Metaflow datastore for this model key.
1063
+ cache_update_policy: str
1064
+ Cache update policy: "auto", "force", or "never".
1065
+ force_cache_update: bool
1066
+ Simple override for "force" cache update policy.
1067
+ debug: bool
1068
+ Whether to turn on verbose debugging logs.
1069
+ circuit_breaker_config: dict
1070
+ Configuration for circuit breaker protection. Keys: failure_threshold, recovery_timeout, reset_timeout.
1071
+ timeout_config: dict
1072
+ Configuration for various operation timeouts. Keys: pull, stop, health_check, install, server_startup.
1036
1073
  """
1037
1074
  ...
1038
1075
 
1039
1076
  @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]]]:
1077
+ 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]]]:
1041
1078
  """
1042
- Enables loading / saving of models within a step.
1079
+ Specifies a timeout for your step.
1043
1080
 
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)
1081
+ This decorator is useful if this step may hang indefinitely.
1061
1082
 
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)
1069
- ```
1083
+ This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
1084
+ A timeout is considered to be an exception thrown by the step. It will cause the step to be
1085
+ retried if needed and the exception will be caught by the `@catch` decorator, if present.
1070
1086
 
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)
1083
- ```
1087
+ Note that all the values specified in parameters are added together so if you specify
1088
+ 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
1084
1089
 
1085
1090
 
1086
1091
  Parameters
1087
1092
  ----------
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
1093
+ seconds : int, default 0
1094
+ Number of seconds to wait prior to timing out.
1095
+ minutes : int, default 0
1096
+ Number of minutes to wait prior to timing out.
1097
+ hours : int, default 0
1098
+ Number of hours to wait prior to timing out.
1097
1099
  """
1098
1100
  ...
1099
1101
 
1100
1102
  @typing.overload
1101
- def model(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1103
+ def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1102
1104
  ...
1103
1105
 
1104
1106
  @typing.overload
1105
- def model(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1107
+ def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1106
1108
  ...
1107
1109
 
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):
1110
+ 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):
1109
1111
  """
1110
- Enables loading / saving of models within a step.
1112
+ Specifies a timeout for your step.
1111
1113
 
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)
1114
+ This decorator is useful if this step may hang indefinitely.
1129
1115
 
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)
1137
- ```
1116
+ This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
1117
+ A timeout is considered to be an exception thrown by the step. It will cause the step to be
1118
+ retried if needed and the exception will be caught by the `@catch` decorator, if present.
1138
1119
 
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)
1151
- ```
1120
+ Note that all the values specified in parameters are added together so if you specify
1121
+ 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
1152
1122
 
1153
1123
 
1154
1124
  Parameters
1155
1125
  ----------
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
1126
+ seconds : int, default 0
1127
+ Number of seconds to wait prior to timing out.
1128
+ minutes : int, default 0
1129
+ Number of minutes to wait prior to timing out.
1130
+ hours : int, default 0
1131
+ Number of hours to wait prior to timing out.
1165
1132
  """
1166
1133
  ...
1167
1134
 
@@ -1235,147 +1202,191 @@ def huggingface_hub(*, temp_dir_root: typing.Optional[str] = None, load: typing.
1235
1202
 
1236
1203
  Loaded repos can be accessed via `current.huggingface_hub.loaded`. If load is set, then the following happens:
1237
1204
 
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.
1205
+ - If repo (model/dataset) is not found in the datastore:
1206
+ - Downloads the repo from Hugging Face Hub to a temporary directory (or uses specified path) for local access
1207
+ - Stores it in Metaflow's datastore (s3/gcs/azure etc.) with a unique name based on repo_type/repo_id
1208
+ - All HF models loaded for a `@step` will be cached separately under flow/step/namespace.
1209
+
1210
+ - If repo is found in the datastore:
1211
+ - Loads it directly from datastore to local path (can be temporary directory or specified path)
1212
+ """
1213
+ ...
1214
+
1215
+ @typing.overload
1216
+ 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]]]:
1217
+ """
1218
+ Specifies environment variables to be set prior to the execution of a step.
1219
+
1220
+
1221
+ Parameters
1222
+ ----------
1223
+ vars : Dict[str, str], default {}
1224
+ Dictionary of environment variables to set.
1225
+ """
1226
+ ...
1227
+
1228
+ @typing.overload
1229
+ def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1230
+ ...
1231
+
1232
+ @typing.overload
1233
+ def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1234
+ ...
1235
+
1236
+ def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
1237
+ """
1238
+ Specifies environment variables to be set prior to the execution of a step.
1239
+
1242
1240
 
1243
- - If repo is found in the datastore:
1244
- - Loads it directly from datastore to local path (can be temporary directory or specified path)
1241
+ Parameters
1242
+ ----------
1243
+ vars : Dict[str, str], default {}
1244
+ Dictionary of environment variables to set.
1245
1245
  """
1246
1246
  ...
1247
1247
 
1248
1248
  @typing.overload
1249
- def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1249
+ 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]]:
1250
1250
  """
1251
- Specifies the PyPI packages for all steps of the flow.
1251
+ Specifies the times when the flow should be run when running on a
1252
+ production scheduler.
1252
1253
 
1253
- Use `@pypi_base` to set common packages required by all
1254
- steps and use `@pypi` to specify step-specific overrides.
1255
1254
 
1256
1255
  Parameters
1257
1256
  ----------
1258
- packages : Dict[str, str], default: {}
1259
- Packages to use for this flow. The key is the name of the package
1260
- and the value is the version to use.
1261
- python : str, optional, default: None
1262
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1263
- that the version used will correspond to the version of the Python interpreter used to start the run.
1257
+ hourly : bool, default False
1258
+ Run the workflow hourly.
1259
+ daily : bool, default True
1260
+ Run the workflow daily.
1261
+ weekly : bool, default False
1262
+ Run the workflow weekly.
1263
+ cron : str, optional, default None
1264
+ Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1265
+ specified by this expression.
1266
+ timezone : str, optional, default None
1267
+ Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1268
+ which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1264
1269
  """
1265
1270
  ...
1266
1271
 
1267
1272
  @typing.overload
1268
- def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1273
+ def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1269
1274
  ...
1270
1275
 
1271
- def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
1276
+ 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):
1272
1277
  """
1273
- Specifies the PyPI packages for all steps of the flow.
1278
+ Specifies the times when the flow should be run when running on a
1279
+ production scheduler.
1274
1280
 
1275
- Use `@pypi_base` to set common packages required by all
1276
- steps and use `@pypi` to specify step-specific overrides.
1277
1281
 
1278
1282
  Parameters
1279
1283
  ----------
1280
- packages : Dict[str, str], default: {}
1281
- Packages to use for this flow. The key is the name of the package
1282
- and the value is the version to use.
1283
- python : str, optional, default: None
1284
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1285
- that the version used will correspond to the version of the Python interpreter used to start the run.
1284
+ hourly : bool, default False
1285
+ Run the workflow hourly.
1286
+ daily : bool, default True
1287
+ Run the workflow daily.
1288
+ weekly : bool, default False
1289
+ Run the workflow weekly.
1290
+ cron : str, optional, default None
1291
+ Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1292
+ specified by this expression.
1293
+ timezone : str, optional, default None
1294
+ Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1295
+ which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1286
1296
  """
1287
1297
  ...
1288
1298
 
1289
- @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]]:
1299
+ 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]]:
1291
1300
  """
1292
- Specifies the event(s) that this flow depends on.
1301
+ 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)
1302
+ before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
1303
+ and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
1304
+ added as a flow decorators. Adding more than one decorator will ensure that `start` step
1305
+ starts only after all sensors finish.
1293
1306
 
1294
- ```
1295
- @trigger(event='foo')
1296
- ```
1297
- or
1298
- ```
1299
- @trigger(events=['foo', 'bar'])
1300
- ```
1301
1307
 
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
- ```
1308
+ Parameters
1309
+ ----------
1310
+ timeout : int
1311
+ Time, in seconds before the task times out and fails. (Default: 3600)
1312
+ poke_interval : int
1313
+ Time in seconds that the job should wait in between each try. (Default: 60)
1314
+ mode : str
1315
+ How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1316
+ exponential_backoff : bool
1317
+ allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1318
+ pool : str
1319
+ the slot pool this task should run in,
1320
+ slot pools are a way to limit concurrency for certain tasks. (Default:None)
1321
+ soft_fail : bool
1322
+ Set to true to mark the task as SKIPPED on failure. (Default: False)
1323
+ name : str
1324
+ Name of the sensor on Airflow
1325
+ description : str
1326
+ Description of sensor in the Airflow UI
1327
+ bucket_key : Union[str, List[str]]
1328
+ The key(s) being waited on. Supports full s3:// style url or relative path from root level.
1329
+ When it's specified as a full s3:// url, please leave `bucket_name` as None
1330
+ bucket_name : str
1331
+ Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
1332
+ When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
1333
+ wildcard_match : bool
1334
+ whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
1335
+ aws_conn_id : str
1336
+ a reference to the s3 connection on Airflow. (Default: None)
1337
+ verify : bool
1338
+ Whether or not to verify SSL certificates for S3 connection. (Default: None)
1339
+ """
1340
+ ...
1341
+
1342
+ @typing.overload
1343
+ 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]]:
1344
+ """
1345
+ Specifies the Conda environment for all steps of the flow.
1312
1346
 
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
- ```
1347
+ Use `@conda_base` to set common libraries required by all
1348
+ steps and use `@conda` to specify step-specific additions.
1321
1349
 
1322
1350
 
1323
1351
  Parameters
1324
1352
  ----------
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.
1353
+ packages : Dict[str, str], default {}
1354
+ Packages to use for this flow. The key is the name of the package
1355
+ and the value is the version to use.
1356
+ libraries : Dict[str, str], default {}
1357
+ Supported for backward compatibility. When used with packages, packages will take precedence.
1358
+ python : str, optional, default None
1359
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1360
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1361
+ disabled : bool, default False
1362
+ If set to True, disables Conda.
1331
1363
  """
1332
1364
  ...
1333
1365
 
1334
1366
  @typing.overload
1335
- def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1367
+ def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1336
1368
  ...
1337
1369
 
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] = {}):
1370
+ 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):
1339
1371
  """
1340
- Specifies the event(s) that this flow depends on.
1341
-
1342
- ```
1343
- @trigger(event='foo')
1344
- ```
1345
- or
1346
- ```
1347
- @trigger(events=['foo', 'bar'])
1348
- ```
1349
-
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
- ```
1372
+ Specifies the Conda environment for all steps of the flow.
1360
1373
 
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
- ```
1374
+ Use `@conda_base` to set common libraries required by all
1375
+ steps and use `@conda` to specify step-specific additions.
1369
1376
 
1370
1377
 
1371
1378
  Parameters
1372
1379
  ----------
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.
1380
+ packages : Dict[str, str], default {}
1381
+ Packages to use for this flow. The key is the name of the package
1382
+ and the value is the version to use.
1383
+ libraries : Dict[str, str], default {}
1384
+ Supported for backward compatibility. When used with packages, packages will take precedence.
1385
+ python : str, optional, default None
1386
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1387
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1388
+ disabled : bool, default False
1389
+ If set to True, disables Conda.
1379
1390
  """
1380
1391
  ...
1381
1392
 
@@ -1465,206 +1476,152 @@ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *
1465
1476
  Note that `branch` is typically one of:
1466
1477
  - `prod`
1467
1478
  - `user.bob`
1468
- - `test.my_experiment`
1469
- - `prod.staging`
1470
-
1471
-
1472
- Parameters
1473
- ----------
1474
- flow : Union[str, Dict[str, str]], optional, default None
1475
- Upstream flow dependency for this flow.
1476
- flows : List[Union[str, Dict[str, str]]], default []
1477
- Upstream flow dependencies for this flow.
1478
- options : Dict[str, Any], default {}
1479
- Backend-specific configuration for tuning eventing behavior.
1480
- """
1481
- ...
1482
-
1483
- @typing.overload
1484
- def schedule(*, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: typing.Optional[str] = None, timezone: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1485
- """
1486
- Specifies the times when the flow should be run when running on a
1487
- production scheduler.
1488
-
1489
-
1490
- Parameters
1491
- ----------
1492
- hourly : bool, default False
1493
- Run the workflow hourly.
1494
- daily : bool, default True
1495
- Run the workflow daily.
1496
- weekly : bool, default False
1497
- Run the workflow weekly.
1498
- cron : str, optional, default None
1499
- Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1500
- specified by this expression.
1501
- timezone : str, optional, default None
1502
- Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1503
- which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1504
- """
1505
- ...
1506
-
1507
- @typing.overload
1508
- def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1509
- ...
1510
-
1511
- def schedule(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: typing.Optional[str] = None, timezone: typing.Optional[str] = None):
1512
- """
1513
- Specifies the times when the flow should be run when running on a
1514
- production scheduler.
1479
+ - `test.my_experiment`
1480
+ - `prod.staging`
1515
1481
 
1516
1482
 
1517
1483
  Parameters
1518
1484
  ----------
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).
1485
+ flow : Union[str, Dict[str, str]], optional, default None
1486
+ Upstream flow dependency for this flow.
1487
+ flows : List[Union[str, Dict[str, str]]], default []
1488
+ Upstream flow dependencies for this flow.
1489
+ options : Dict[str, Any], default {}
1490
+ Backend-specific configuration for tuning eventing behavior.
1531
1491
  """
1532
1492
  ...
1533
1493
 
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]]:
1494
+ @typing.overload
1495
+ def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1535
1496
  """
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.
1497
+ Specifies the PyPI packages for all steps of the flow.
1541
1498
 
1499
+ Use `@pypi_base` to set common packages required by all
1500
+ steps and use `@pypi` to specify step-specific overrides.
1542
1501
 
1543
1502
  Parameters
1544
1503
  ----------
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)
1504
+ packages : Dict[str, str], default: {}
1505
+ Packages to use for this flow. The key is the name of the package
1506
+ and the value is the version to use.
1507
+ python : str, optional, default: None
1508
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1509
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1574
1510
  """
1575
1511
  ...
1576
1512
 
1577
1513
  @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]]:
1514
+ def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1515
+ ...
1516
+
1517
+ def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
1579
1518
  """
1580
- Specifies the Conda environment for all steps of the flow.
1581
-
1582
- Use `@conda_base` to set common libraries required by all
1583
- steps and use `@conda` to specify step-specific additions.
1519
+ Specifies the PyPI packages for all steps of the flow.
1584
1520
 
1521
+ Use `@pypi_base` to set common packages required by all
1522
+ steps and use `@pypi` to specify step-specific overrides.
1585
1523
 
1586
1524
  Parameters
1587
1525
  ----------
1588
- packages : Dict[str, str], default {}
1526
+ packages : Dict[str, str], default: {}
1589
1527
  Packages to use for this flow. The key is the name of the package
1590
1528
  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
1529
+ python : str, optional, default: None
1594
1530
  Version of Python to use, e.g. '3.7.4'. A default value of None implies
1595
1531
  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
1532
  """
1599
1533
  ...
1600
1534
 
1601
1535
  @typing.overload
1602
- def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1603
- ...
1604
-
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):
1536
+ 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]]:
1606
1537
  """
1607
- Specifies the Conda environment for all steps of the flow.
1538
+ Specifies the event(s) that this flow depends on.
1608
1539
 
1609
- Use `@conda_base` to set common libraries required by all
1610
- steps and use `@conda` to specify step-specific additions.
1540
+ ```
1541
+ @trigger(event='foo')
1542
+ ```
1543
+ or
1544
+ ```
1545
+ @trigger(events=['foo', 'bar'])
1546
+ ```
1547
+
1548
+ Additionally, you can specify the parameter mappings
1549
+ to map event payload to Metaflow parameters for the flow.
1550
+ ```
1551
+ @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1552
+ ```
1553
+ or
1554
+ ```
1555
+ @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1556
+ {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1557
+ ```
1558
+
1559
+ 'parameters' can also be a list of strings and tuples like so:
1560
+ ```
1561
+ @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1562
+ ```
1563
+ This is equivalent to:
1564
+ ```
1565
+ @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1566
+ ```
1611
1567
 
1612
1568
 
1613
1569
  Parameters
1614
1570
  ----------
1615
- packages : Dict[str, str], default {}
1616
- Packages to use for this flow. The key is the name of the package
1617
- 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
1621
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1622
- 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.
1571
+ event : Union[str, Dict[str, Any]], optional, default None
1572
+ Event dependency for this flow.
1573
+ events : List[Union[str, Dict[str, Any]]], default []
1574
+ Events dependency for this flow.
1575
+ options : Dict[str, Any], default {}
1576
+ Backend-specific configuration for tuning eventing behavior.
1625
1577
  """
1626
1578
  ...
1627
1579
 
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]]:
1580
+ @typing.overload
1581
+ def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1582
+ ...
1583
+
1584
+ 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] = {}):
1629
1585
  """
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.
1586
+ Specifies the event(s) that this flow depends on.
1587
+
1588
+ ```
1589
+ @trigger(event='foo')
1590
+ ```
1591
+ or
1592
+ ```
1593
+ @trigger(events=['foo', 'bar'])
1594
+ ```
1595
+
1596
+ Additionally, you can specify the parameter mappings
1597
+ to map event payload to Metaflow parameters for the flow.
1598
+ ```
1599
+ @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1600
+ ```
1601
+ or
1602
+ ```
1603
+ @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1604
+ {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1605
+ ```
1606
+
1607
+ 'parameters' can also be a list of strings and tuples like so:
1608
+ ```
1609
+ @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1610
+ ```
1611
+ This is equivalent to:
1612
+ ```
1613
+ @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1614
+ ```
1632
1615
 
1633
1616
 
1634
1617
  Parameters
1635
1618
  ----------
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)
1619
+ event : Union[str, Dict[str, Any]], optional, default None
1620
+ Event dependency for this flow.
1621
+ events : List[Union[str, Dict[str, Any]]], default []
1622
+ Events dependency for this flow.
1623
+ options : Dict[str, Any], default {}
1624
+ Backend-specific configuration for tuning eventing behavior.
1668
1625
  """
1669
1626
  ...
1670
1627
 
@@ -1782,6 +1739,49 @@ def with_artifact_store(f: typing.Optional[typing.Type[FlowSpecDerived]] = None)
1782
1739
  """
1783
1740
  ...
1784
1741
 
1742
+ 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]]:
1743
+ """
1744
+ 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.
1745
+ 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.
1746
+
1747
+
1748
+ Parameters
1749
+ ----------
1750
+ timeout : int
1751
+ Time, in seconds before the task times out and fails. (Default: 3600)
1752
+ poke_interval : int
1753
+ Time in seconds that the job should wait in between each try. (Default: 60)
1754
+ mode : str
1755
+ How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1756
+ exponential_backoff : bool
1757
+ allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1758
+ pool : str
1759
+ the slot pool this task should run in,
1760
+ slot pools are a way to limit concurrency for certain tasks. (Default:None)
1761
+ soft_fail : bool
1762
+ Set to true to mark the task as SKIPPED on failure. (Default: False)
1763
+ name : str
1764
+ Name of the sensor on Airflow
1765
+ description : str
1766
+ Description of sensor in the Airflow UI
1767
+ external_dag_id : str
1768
+ The dag_id that contains the task you want to wait for.
1769
+ external_task_ids : List[str]
1770
+ The list of task_ids that you want to wait for.
1771
+ If None (default value) the sensor waits for the DAG. (Default: None)
1772
+ allowed_states : List[str]
1773
+ Iterable of allowed states, (Default: ['success'])
1774
+ failed_states : List[str]
1775
+ Iterable of failed or dis-allowed states. (Default: None)
1776
+ execution_delta : datetime.timedelta
1777
+ time difference with the previous execution to look at,
1778
+ the default is the same logical date as the current task or DAG. (Default: None)
1779
+ check_existence: bool
1780
+ Set to True to check if the external task exists or check if
1781
+ the DAG to wait for exists. (Default: True)
1782
+ """
1783
+ ...
1784
+
1785
1785
  def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1786
1786
  """
1787
1787
  Specifies what flows belong to the same project.