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