ob-metaflow-stubs 6.0.3.180rc5__py2.py3-none-any.whl → 6.0.3.181__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (220) hide show
  1. metaflow-stubs/__init__.pyi +707 -708
  2. metaflow-stubs/cards.pyi +1 -1
  3. metaflow-stubs/cli.pyi +1 -1
  4. metaflow-stubs/cli_components/__init__.pyi +1 -1
  5. metaflow-stubs/cli_components/utils.pyi +1 -1
  6. metaflow-stubs/client/__init__.pyi +1 -1
  7. metaflow-stubs/client/core.pyi +3 -3
  8. metaflow-stubs/client/filecache.pyi +1 -1
  9. metaflow-stubs/events.pyi +1 -1
  10. metaflow-stubs/exception.pyi +1 -1
  11. metaflow-stubs/flowspec.pyi +3 -3
  12. metaflow-stubs/generated_for.txt +1 -1
  13. metaflow-stubs/includefile.pyi +2 -2
  14. metaflow-stubs/info_file.pyi +1 -1
  15. metaflow-stubs/metadata_provider/__init__.pyi +1 -1
  16. metaflow-stubs/metadata_provider/heartbeat.pyi +1 -1
  17. metaflow-stubs/metadata_provider/metadata.pyi +1 -1
  18. metaflow-stubs/metadata_provider/util.pyi +1 -1
  19. metaflow-stubs/metaflow_config.pyi +1 -1
  20. metaflow-stubs/metaflow_current.pyi +114 -114
  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 +2 -2
  28. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/deco_injection_mixin.pyi +1 -1
  29. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/extra_components.pyi +2 -2
  30. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/__init__.pyi +1 -1
  31. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/__init__.pyi +1 -1
  32. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/checkpoint_lister.pyi +3 -3
  33. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/lineage_card.pyi +1 -1
  34. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/checkpoint_storage.pyi +2 -2
  35. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/constructors.pyi +1 -1
  36. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/core.pyi +2 -2
  37. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/decorator.pyi +3 -3
  38. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/exceptions.pyi +1 -1
  39. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/final_api.pyi +2 -2
  40. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/lineage.pyi +1 -1
  41. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/__init__.pyi +1 -1
  42. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/context.pyi +2 -2
  43. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/core.pyi +2 -2
  44. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/decorator.pyi +1 -1
  45. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/exceptions.pyi +1 -1
  46. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/task_utils.pyi +1 -1
  47. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/utils.pyi +1 -1
  48. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastructures.pyi +1 -1
  49. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/exceptions.pyi +1 -1
  50. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/hf_hub/__init__.pyi +1 -1
  51. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/hf_hub/decorator.pyi +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 +2 -2
  56. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/__init__.pyi +1 -1
  57. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/flowspec_utils.pyi +1 -1
  58. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/general.pyi +1 -1
  59. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/identity_utils.pyi +1 -1
  60. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/__init__.pyi +1 -1
  61. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/base.pyi +1 -1
  62. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/tar.pyi +1 -1
  63. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/tar_utils.pyi +1 -1
  64. metaflow-stubs/mf_extensions/outerbounds/__init__.pyi +1 -1
  65. metaflow-stubs/mf_extensions/outerbounds/plugins/__init__.pyi +1 -1
  66. metaflow-stubs/mf_extensions/outerbounds/plugins/aws/__init__.pyi +1 -1
  67. metaflow-stubs/mf_extensions/outerbounds/plugins/aws/assume_role_decorator.pyi +1 -1
  68. metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/__init__.pyi +1 -1
  69. metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/async_cards.pyi +1 -1
  70. metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/injector.pyi +1 -1
  71. metaflow-stubs/mf_extensions/outerbounds/plugins/checkpoint_datastores/__init__.pyi +1 -1
  72. metaflow-stubs/mf_extensions/outerbounds/plugins/checkpoint_datastores/coreweave.pyi +1 -1
  73. metaflow-stubs/mf_extensions/outerbounds/plugins/checkpoint_datastores/nebius.pyi +1 -1
  74. metaflow-stubs/mf_extensions/outerbounds/plugins/kubernetes/__init__.pyi +1 -1
  75. metaflow-stubs/mf_extensions/outerbounds/plugins/kubernetes/pod_killer.pyi +12 -2
  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 +1 -2
  88. metaflow-stubs/multicore_utils.pyi +1 -1
  89. metaflow-stubs/parameters.pyi +2 -2
  90. metaflow-stubs/plugins/__init__.pyi +12 -12
  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 +1 -1
  104. metaflow-stubs/plugins/argo/argo_workflows_deployer_objects.pyi +2 -2
  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 +2 -2
  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 +1 -1
  120. metaflow-stubs/plugins/aws/step_functions/step_functions_deployer_objects.pyi +2 -2
  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 +2 -2
  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 +1 -1
  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 +2 -2
  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 +3 -3
  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 +2 -2
  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 +1 -1
  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 +1 -1
  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 +2 -2
  174. metaflow-stubs/plugins/pypi/conda_decorator.pyi +1 -1
  175. metaflow-stubs/plugins/pypi/conda_environment.pyi +3 -3
  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 +2 -2
  183. metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +2 -2
  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 +1 -1
  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 +1 -1
  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 +27 -27
  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 +2 -2
  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 +5 -5
  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.180rc5.dist-info → ob_metaflow_stubs-6.0.3.181.dist-info}/METADATA +1 -1
  212. ob_metaflow_stubs-6.0.3.181.dist-info/RECORD +215 -0
  213. metaflow-stubs/mf_extensions/outerbounds/plugins/fast_bakery/__init__.pyi +0 -6
  214. metaflow-stubs/mf_extensions/outerbounds/plugins/fast_bakery/baker.pyi +0 -51
  215. metaflow-stubs/mf_extensions/outerbounds/plugins/fast_bakery/docker_environment.pyi +0 -65
  216. metaflow-stubs/mf_extensions/outerbounds/plugins/fast_bakery/fast_bakery.pyi +0 -74
  217. metaflow-stubs/ob_internal.pyi +0 -11
  218. ob_metaflow_stubs-6.0.3.180rc5.dist-info/RECORD +0 -220
  219. {ob_metaflow_stubs-6.0.3.180rc5.dist-info → ob_metaflow_stubs-6.0.3.181.dist-info}/WHEEL +0 -0
  220. {ob_metaflow_stubs-6.0.3.180rc5.dist-info → ob_metaflow_stubs-6.0.3.181.dist-info}/top_level.txt +0 -0
@@ -1,15 +1,15 @@
1
1
  ######################################################################################################
2
2
  # Auto-generated Metaflow stub file #
3
3
  # MF version: 2.15.17.1+obcheckpoint(0.2.1);ob(v1) #
4
- # Generated on 2025-06-17T20:32:02.265213 #
4
+ # Generated on 2025-06-18T08:04:08.962280 #
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,9 +35,9 @@ from .user_configs.config_parameters import ConfigValue as ConfigValue
35
35
  from .user_configs.config_parameters import config_expr as config_expr
36
36
  from .user_configs.config_decorators import CustomFlowDecorator as CustomFlowDecorator
37
37
  from .user_configs.config_decorators import CustomStepDecorator as CustomStepDecorator
38
- from . import tuple_util as tuple_util
39
38
  from . import cards as cards
40
39
  from . import events as events
40
+ from . import tuple_util as tuple_util
41
41
  from . import metaflow_git as metaflow_git
42
42
  from . import runner as runner
43
43
  from . import plugins as plugins
@@ -78,7 +78,6 @@ from . import system as system
78
78
  from . import pylint_wrapper as pylint_wrapper
79
79
  from . import cli as cli
80
80
  from . import profilers as profilers
81
- from . import ob_internal as ob_internal
82
81
 
83
82
  EXT_PKG: str
84
83
 
@@ -155,57 +154,6 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
155
154
  """
156
155
  ...
157
156
 
158
- @typing.overload
159
- 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]]]:
160
- """
161
- Specifies secrets to be retrieved and injected as environment variables prior to
162
- the execution of a step.
163
-
164
-
165
- Parameters
166
- ----------
167
- sources : List[Union[str, Dict[str, Any]]], default: []
168
- List of secret specs, defining how the secrets are to be retrieved
169
- """
170
- ...
171
-
172
- @typing.overload
173
- def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
174
- ...
175
-
176
- @typing.overload
177
- def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
178
- ...
179
-
180
- 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]]] = []):
181
- """
182
- Specifies secrets to be retrieved and injected as environment variables prior to
183
- the execution of a step.
184
-
185
-
186
- Parameters
187
- ----------
188
- sources : List[Union[str, Dict[str, Any]]], default: []
189
- List of secret specs, defining how the secrets are to be retrieved
190
- """
191
- ...
192
-
193
- 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]]]:
194
- """
195
- Specifies that this step should execute on DGX cloud.
196
-
197
-
198
- Parameters
199
- ----------
200
- gpu : int
201
- Number of GPUs to use.
202
- gpu_type : str
203
- Type of Nvidia GPU to use.
204
- queue_timeout : int
205
- Time to keep the job in NVCF's queue.
206
- """
207
- ...
208
-
209
157
  @typing.overload
210
158
  def catch(*, var: typing.Optional[str] = None, print_exception: bool = True) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
211
159
  """
@@ -257,152 +205,6 @@ def catch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
257
205
  """
258
206
  ...
259
207
 
260
- @typing.overload
261
- 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]]]:
262
- """
263
- Enables loading / saving of models within a step.
264
-
265
-
266
-
267
- Parameters
268
- ----------
269
- load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
270
- Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
271
- These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
272
- - `current.checkpoint`
273
- - `current.model`
274
- - `current.huggingface_hub`
275
-
276
- 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
277
- the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
278
- If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
279
-
280
- temp_dir_root : str, default: None
281
- The root directory under which `current.model.loaded` will store loaded models
282
- """
283
- ...
284
-
285
- @typing.overload
286
- def model(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
287
- ...
288
-
289
- @typing.overload
290
- def model(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
291
- ...
292
-
293
- 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):
294
- """
295
- Enables loading / saving of models within a step.
296
-
297
-
298
-
299
- Parameters
300
- ----------
301
- load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
302
- Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
303
- These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
304
- - `current.checkpoint`
305
- - `current.model`
306
- - `current.huggingface_hub`
307
-
308
- 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
309
- the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
310
- If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
311
-
312
- temp_dir_root : str, default: None
313
- The root directory under which `current.model.loaded` will store loaded models
314
- """
315
- ...
316
-
317
- def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: typing.Optional[str] = None, image_pull_policy: str = 'KUBERNETES_IMAGE_PULL_POLICY', image_pull_secrets: typing.List[str] = [], service_account: str = 'METAFLOW_KUBERNETES_SERVICE_ACCOUNT', secrets: typing.Optional[typing.List[str]] = None, node_selector: typing.Union[typing.Dict[str, str], str, None] = None, namespace: str = 'METAFLOW_KUBERNETES_NAMESPACE', gpu: typing.Optional[int] = None, gpu_vendor: str = 'KUBERNETES_GPU_VENDOR', tolerations: typing.List[str] = [], labels: typing.Dict[str, str] = 'METAFLOW_KUBERNETES_LABELS', annotations: typing.Dict[str, str] = 'METAFLOW_KUBERNETES_ANNOTATIONS', use_tmpfs: bool = False, tmpfs_tempdir: bool = True, tmpfs_size: typing.Optional[int] = None, tmpfs_path: typing.Optional[str] = '/metaflow_temp', persistent_volume_claims: typing.Optional[typing.Dict[str, str]] = None, shared_memory: typing.Optional[int] = None, port: typing.Optional[int] = None, compute_pool: typing.Optional[str] = None, hostname_resolution_timeout: int = 600, qos: str = 'Burstable', security_context: typing.Optional[typing.Dict[str, typing.Any]] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
318
- """
319
- Specifies that this step should execute on Kubernetes.
320
-
321
-
322
- Parameters
323
- ----------
324
- cpu : int, default 1
325
- Number of CPUs required for this step. If `@resources` is
326
- also present, the maximum value from all decorators is used.
327
- memory : int, default 4096
328
- Memory size (in MB) required for this step. If
329
- `@resources` is also present, the maximum value from all decorators is
330
- used.
331
- disk : int, default 10240
332
- Disk size (in MB) required for this step. If
333
- `@resources` is also present, the maximum value from all decorators is
334
- used.
335
- image : str, optional, default None
336
- Docker image to use when launching on Kubernetes. If not specified, and
337
- METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
338
- not, a default Docker image mapping to the current version of Python is used.
339
- image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
340
- If given, the imagePullPolicy to be applied to the Docker image of the step.
341
- image_pull_secrets: List[str], default []
342
- The default is extracted from METAFLOW_KUBERNETES_IMAGE_PULL_SECRETS.
343
- Kubernetes image pull secrets to use when pulling container images
344
- in Kubernetes.
345
- service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
346
- Kubernetes service account to use when launching pod in Kubernetes.
347
- secrets : List[str], optional, default None
348
- Kubernetes secrets to use when launching pod in Kubernetes. These
349
- secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
350
- in Metaflow configuration.
351
- node_selector: Union[Dict[str,str], str], optional, default None
352
- Kubernetes node selector(s) to apply to the pod running the task.
353
- Can be passed in as a comma separated string of values e.g.
354
- 'kubernetes.io/os=linux,kubernetes.io/arch=amd64' or as a dictionary
355
- {'kubernetes.io/os': 'linux', 'kubernetes.io/arch': 'amd64'}
356
- namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
357
- Kubernetes namespace to use when launching pod in Kubernetes.
358
- gpu : int, optional, default None
359
- Number of GPUs required for this step. A value of zero implies that
360
- the scheduled node should not have GPUs.
361
- gpu_vendor : str, default KUBERNETES_GPU_VENDOR
362
- The vendor of the GPUs to be used for this step.
363
- tolerations : List[str], default []
364
- The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
365
- Kubernetes tolerations to use when launching pod in Kubernetes.
366
- labels: Dict[str, str], default: METAFLOW_KUBERNETES_LABELS
367
- Kubernetes labels to use when launching pod in Kubernetes.
368
- annotations: Dict[str, str], default: METAFLOW_KUBERNETES_ANNOTATIONS
369
- Kubernetes annotations to use when launching pod in Kubernetes.
370
- use_tmpfs : bool, default False
371
- This enables an explicit tmpfs mount for this step.
372
- tmpfs_tempdir : bool, default True
373
- sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
374
- tmpfs_size : int, optional, default: None
375
- The value for the size (in MiB) of the tmpfs mount for this step.
376
- This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
377
- memory allocated for this step.
378
- tmpfs_path : str, optional, default /metaflow_temp
379
- Path to tmpfs mount for this step.
380
- persistent_volume_claims : Dict[str, str], optional, default None
381
- A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
382
- volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
383
- shared_memory: int, optional
384
- Shared memory size (in MiB) required for this step
385
- port: int, optional
386
- Port number to specify in the Kubernetes job object
387
- compute_pool : str, optional, default None
388
- Compute pool to be used for for this step.
389
- If not specified, any accessible compute pool within the perimeter is used.
390
- hostname_resolution_timeout: int, default 10 * 60
391
- Timeout in seconds for the workers tasks in the gang scheduled cluster to resolve the hostname of control task.
392
- Only applicable when @parallel is used.
393
- qos: str, default: Burstable
394
- Quality of Service class to assign to the pod. Supported values are: Guaranteed, Burstable, BestEffort
395
-
396
- security_context: Dict[str, Any], optional, default None
397
- Container security context. Applies to the task container. Allows the following keys:
398
- - privileged: bool, optional, default None
399
- - allow_privilege_escalation: bool, optional, default None
400
- - run_as_user: int, optional, default None
401
- - run_as_group: int, optional, default None
402
- - run_as_non_root: bool, optional, default None
403
- """
404
- ...
405
-
406
208
  @typing.overload
407
209
  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]]]:
408
210
  """
@@ -459,169 +261,464 @@ def retry(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
459
261
  ...
460
262
 
461
263
  @typing.overload
462
- 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]]]:
264
+ 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]]]:
463
265
  """
464
- Specifies a timeout for your step.
465
-
466
- This decorator is useful if this step may hang indefinitely.
467
-
468
- This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
469
- A timeout is considered to be an exception thrown by the step. It will cause the step to be
470
- retried if needed and the exception will be caught by the `@catch` decorator, if present.
471
-
472
- Note that all the values specified in parameters are added together so if you specify
473
- 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
266
+ Specifies environment variables to be set prior to the execution of a step.
474
267
 
475
268
 
476
269
  Parameters
477
270
  ----------
478
- seconds : int, default 0
479
- Number of seconds to wait prior to timing out.
480
- minutes : int, default 0
481
- Number of minutes to wait prior to timing out.
482
- hours : int, default 0
483
- Number of hours to wait prior to timing out.
271
+ vars : Dict[str, str], default {}
272
+ Dictionary of environment variables to set.
484
273
  """
485
274
  ...
486
275
 
487
276
  @typing.overload
488
- def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
277
+ def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
489
278
  ...
490
279
 
491
280
  @typing.overload
492
- def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
281
+ def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
493
282
  ...
494
283
 
495
- 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):
284
+ def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
496
285
  """
497
- Specifies a timeout for your step.
498
-
499
- This decorator is useful if this step may hang indefinitely.
500
-
501
- This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
502
- A timeout is considered to be an exception thrown by the step. It will cause the step to be
503
- retried if needed and the exception will be caught by the `@catch` decorator, if present.
504
-
505
- Note that all the values specified in parameters are added together so if you specify
506
- 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
286
+ Specifies environment variables to be set prior to the execution of a step.
507
287
 
508
288
 
509
289
  Parameters
510
290
  ----------
511
- seconds : int, default 0
512
- Number of seconds to wait prior to timing out.
513
- minutes : int, default 0
514
- Number of minutes to wait prior to timing out.
515
- hours : int, default 0
516
- Number of hours to wait prior to timing out.
291
+ vars : Dict[str, str], default {}
292
+ Dictionary of environment variables to set.
517
293
  """
518
294
  ...
519
295
 
520
- @typing.overload
521
- 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]]]:
296
+ def vllm(*, model: str, backend: str, debug: bool, kwargs: typing.Any) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
522
297
  """
523
- Specifies the Conda environment for the step.
298
+ This decorator is used to run vllm APIs as Metaflow task sidecars.
524
299
 
525
- Information in this decorator will augment any
526
- attributes set in the `@conda_base` flow-level decorator. Hence,
527
- you can use `@conda_base` to set packages required by all
528
- steps and use `@conda` to specify step-specific overrides.
300
+ User code call
301
+ --------------
302
+ @vllm(
303
+ model="...",
304
+ ...
305
+ )
306
+
307
+ Valid backend options
308
+ ---------------------
309
+ - 'local': Run as a separate process on the local task machine.
310
+
311
+ Valid model options
312
+ -------------------
313
+ Any HuggingFace model identifier, e.g. 'meta-llama/Llama-3.2-1B'
314
+
315
+ NOTE: vLLM's OpenAI-compatible server serves ONE model per server instance.
316
+ If you need multiple models, you must create multiple @vllm decorators.
529
317
 
530
318
 
531
319
  Parameters
532
320
  ----------
533
- packages : Dict[str, str], default {}
534
- Packages to use for this step. The key is the name of the package
535
- and the value is the version to use.
536
- libraries : Dict[str, str], default {}
537
- Supported for backward compatibility. When used with packages, packages will take precedence.
538
- python : str, optional, default None
539
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
540
- that the version used will correspond to the version of the Python interpreter used to start the run.
541
- disabled : bool, default False
542
- If set to True, disables @conda.
321
+ model: str
322
+ HuggingFace model identifier to be served by vLLM.
323
+ backend: str
324
+ Determines where and how to run the vLLM process.
325
+ debug: bool
326
+ Whether to turn on verbose debugging logs.
327
+ kwargs : Any
328
+ Any other keyword arguments are passed directly to the vLLM engine.
329
+ This allows for flexible configuration of vLLM server settings.
330
+ For example, `tensor_parallel_size=2`.
331
+ """
332
+ ...
333
+
334
+ def huggingface_hub(*, temp_dir_root: typing.Optional[str] = None, load: typing.Union[typing.List[str], typing.List[typing.Tuple[typing.Dict, str]], typing.List[typing.Tuple[str, str]], typing.List[typing.Dict], None]) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
335
+ """
336
+ Decorator that helps cache, version and store models/datasets from huggingface hub.
337
+
338
+
339
+ Parameters
340
+ ----------
341
+ temp_dir_root : str, optional
342
+ The root directory that will hold the temporary directory where objects will be downloaded.
343
+
344
+ load: Union[List[str], List[Tuple[Dict, str]], List[Tuple[str, str]], List[Dict], None]
345
+ The list of repos (models/datasets) to load.
346
+
347
+ Loaded repos can be accessed via `current.huggingface_hub.loaded`. If load is set, then the following happens:
348
+
349
+ - If repo (model/dataset) is not found in the datastore:
350
+ - Downloads the repo from Hugging Face Hub to a temporary directory (or uses specified path) for local access
351
+ - Stores it in Metaflow's datastore (s3/gcs/azure etc.) with a unique name based on repo_type/repo_id
352
+ - All HF models loaded for a `@step` will be cached separately under flow/step/namespace.
353
+
354
+ - If repo is found in the datastore:
355
+ - Loads it directly from datastore to local path (can be temporary directory or specified path)
543
356
  """
544
357
  ...
545
358
 
546
359
  @typing.overload
547
- def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
360
+ 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]]]:
361
+ """
362
+ Enables checkpointing for a step.
363
+
364
+
365
+
366
+ Parameters
367
+ ----------
368
+ load_policy : str, default: "fresh"
369
+ The policy for loading the checkpoint. The following policies are supported:
370
+ - "eager": Loads the the latest available checkpoint within the namespace.
371
+ With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
372
+ will be loaded at the start of the task.
373
+ - "none": Do not load any checkpoint
374
+ - "fresh": Loads the lastest checkpoint created within the running Task.
375
+ This mode helps loading checkpoints across various retry attempts of the same task.
376
+ With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
377
+ created within the task will be loaded when the task is retries execution on failure.
378
+
379
+ temp_dir_root : str, default: None
380
+ The root directory under which `current.checkpoint.directory` will be created.
381
+ """
548
382
  ...
549
383
 
550
384
  @typing.overload
551
- def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
385
+ def checkpoint(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
552
386
  ...
553
387
 
554
- 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):
388
+ @typing.overload
389
+ def checkpoint(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
390
+ ...
391
+
392
+ 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):
555
393
  """
556
- Specifies the Conda environment for the step.
394
+ Enables checkpointing for a step.
557
395
 
558
- Information in this decorator will augment any
559
- attributes set in the `@conda_base` flow-level decorator. Hence,
560
- you can use `@conda_base` to set packages required by all
561
- steps and use `@conda` to specify step-specific overrides.
562
396
 
563
397
 
564
398
  Parameters
565
399
  ----------
566
- packages : Dict[str, str], default {}
567
- Packages to use for this step. The key is the name of the package
568
- and the value is the version to use.
569
- libraries : Dict[str, str], default {}
570
- Supported for backward compatibility. When used with packages, packages will take precedence.
571
- python : str, optional, default None
572
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
573
- that the version used will correspond to the version of the Python interpreter used to start the run.
574
- disabled : bool, default False
575
- If set to True, disables @conda.
400
+ load_policy : str, default: "fresh"
401
+ The policy for loading the checkpoint. The following policies are supported:
402
+ - "eager": Loads the the latest available checkpoint within the namespace.
403
+ With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
404
+ will be loaded at the start of the task.
405
+ - "none": Do not load any checkpoint
406
+ - "fresh": Loads the lastest checkpoint created within the running Task.
407
+ This mode helps loading checkpoints across various retry attempts of the same task.
408
+ With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
409
+ created within the task will be loaded when the task is retries execution on failure.
410
+
411
+ temp_dir_root : str, default: None
412
+ The root directory under which `current.checkpoint.directory` will be created.
413
+ """
414
+ ...
415
+
416
+ 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]]]:
417
+ """
418
+ This decorator is used to run Ollama APIs as Metaflow task sidecars.
419
+
420
+ User code call
421
+ --------------
422
+ @ollama(
423
+ models=[...],
424
+ ...
425
+ )
426
+
427
+ Valid backend options
428
+ ---------------------
429
+ - 'local': Run as a separate process on the local task machine.
430
+ - (TODO) 'managed': Outerbounds hosts and selects compute provider.
431
+ - (TODO) 'remote': Spin up separate instance to serve Ollama models.
432
+
433
+ Valid model options
434
+ -------------------
435
+ Any model here https://ollama.com/search, e.g. 'llama3.2', 'llama3.3'
436
+
437
+
438
+ Parameters
439
+ ----------
440
+ models: list[str]
441
+ List of Ollama containers running models in sidecars.
442
+ backend: str
443
+ Determines where and how to run the Ollama process.
444
+ force_pull: bool
445
+ Whether to run `ollama pull` no matter what, or first check the remote cache in Metaflow datastore for this model key.
446
+ cache_update_policy: str
447
+ Cache update policy: "auto", "force", or "never".
448
+ force_cache_update: bool
449
+ Simple override for "force" cache update policy.
450
+ debug: bool
451
+ Whether to turn on verbose debugging logs.
452
+ circuit_breaker_config: dict
453
+ Configuration for circuit breaker protection. Keys: failure_threshold, recovery_timeout, reset_timeout.
454
+ timeout_config: dict
455
+ Configuration for various operation timeouts. Keys: pull, stop, health_check, install, server_startup.
456
+ """
457
+ ...
458
+
459
+ def app_deploy(*, app_port: int, app_name: str) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
460
+ """
461
+ Specifies that this step is used to deploy an instance of the app.
462
+ Requires that self.app_name, self.app_port, self.entrypoint and self.deployDir is set.
463
+
464
+
465
+ Parameters
466
+ ----------
467
+ app_port : int
468
+ Number of GPUs to use.
469
+ app_name : str
470
+ Name of the app to deploy.
576
471
  """
577
472
  ...
578
473
 
579
474
  @typing.overload
580
- 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]]]:
475
+ def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
581
476
  """
582
- Creates a human-readable report, a Metaflow Card, after this step completes.
477
+ Decorator prototype for all step decorators. This function gets specialized
478
+ and imported for all decorators types by _import_plugin_decorators().
479
+ """
480
+ ...
481
+
482
+ @typing.overload
483
+ def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
484
+ ...
485
+
486
+ def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
487
+ """
488
+ Decorator prototype for all step decorators. This function gets specialized
489
+ and imported for all decorators types by _import_plugin_decorators().
490
+ """
491
+ ...
492
+
493
+ @typing.overload
494
+ 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]]]:
495
+ """
496
+ Enables loading / saving of models within a step.
583
497
 
584
- Note that you may add multiple `@card` decorators in a step with different parameters.
585
498
 
586
499
 
587
500
  Parameters
588
501
  ----------
589
- type : str, default 'default'
590
- Card type.
591
- id : str, optional, default None
592
- If multiple cards are present, use this id to identify this card.
593
- options : Dict[str, Any], default {}
594
- Options passed to the card. The contents depend on the card type.
595
- timeout : int, default 45
596
- Interrupt reporting if it takes more than this many seconds.
502
+ load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
503
+ Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
504
+ These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
505
+ - `current.checkpoint`
506
+ - `current.model`
507
+ - `current.huggingface_hub`
508
+
509
+ 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
510
+ the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
511
+ If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
512
+
513
+ temp_dir_root : str, default: None
514
+ The root directory under which `current.model.loaded` will store loaded models
597
515
  """
598
516
  ...
599
517
 
600
518
  @typing.overload
601
- def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
519
+ def model(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
602
520
  ...
603
521
 
604
522
  @typing.overload
605
- def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
523
+ def model(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
606
524
  ...
607
525
 
608
- 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):
526
+ 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):
609
527
  """
610
- Creates a human-readable report, a Metaflow Card, after this step completes.
528
+ Enables loading / saving of models within a step.
611
529
 
612
- Note that you may add multiple `@card` decorators in a step with different parameters.
613
530
 
614
531
 
615
- Parameters
616
- ----------
617
- type : str, default 'default'
618
- Card type.
619
- id : str, optional, default None
620
- If multiple cards are present, use this id to identify this card.
621
- options : Dict[str, Any], default {}
622
- Options passed to the card. The contents depend on the card type.
623
- timeout : int, default 45
624
- Interrupt reporting if it takes more than this many seconds.
532
+ Parameters
533
+ ----------
534
+ load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
535
+ Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
536
+ These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
537
+ - `current.checkpoint`
538
+ - `current.model`
539
+ - `current.huggingface_hub`
540
+
541
+ 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
542
+ the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
543
+ If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
544
+
545
+ temp_dir_root : str, default: None
546
+ The root directory under which `current.model.loaded` will store loaded models
547
+ """
548
+ ...
549
+
550
+ @typing.overload
551
+ 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]]]:
552
+ """
553
+ Specifies secrets to be retrieved and injected as environment variables prior to
554
+ the execution of a step.
555
+
556
+
557
+ Parameters
558
+ ----------
559
+ sources : List[Union[str, Dict[str, Any]]], default: []
560
+ List of secret specs, defining how the secrets are to be retrieved
561
+ """
562
+ ...
563
+
564
+ @typing.overload
565
+ def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
566
+ ...
567
+
568
+ @typing.overload
569
+ def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
570
+ ...
571
+
572
+ 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]]] = []):
573
+ """
574
+ Specifies secrets to be retrieved and injected as environment variables prior to
575
+ the execution of a step.
576
+
577
+
578
+ Parameters
579
+ ----------
580
+ sources : List[Union[str, Dict[str, Any]]], default: []
581
+ List of secret specs, defining how the secrets are to be retrieved
582
+ """
583
+ ...
584
+
585
+ @typing.overload
586
+ 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]]]:
587
+ """
588
+ Specifies the PyPI packages for the step.
589
+
590
+ Information in this decorator will augment any
591
+ attributes set in the `@pyi_base` flow-level decorator. Hence,
592
+ you can use `@pypi_base` to set packages required by all
593
+ steps and use `@pypi` to specify step-specific overrides.
594
+
595
+
596
+ Parameters
597
+ ----------
598
+ packages : Dict[str, str], default: {}
599
+ Packages to use for this step. The key is the name of the package
600
+ and the value is the version to use.
601
+ python : str, optional, default: None
602
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
603
+ that the version used will correspond to the version of the Python interpreter used to start the run.
604
+ """
605
+ ...
606
+
607
+ @typing.overload
608
+ def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
609
+ ...
610
+
611
+ @typing.overload
612
+ def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
613
+ ...
614
+
615
+ 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):
616
+ """
617
+ Specifies the PyPI packages for the step.
618
+
619
+ Information in this decorator will augment any
620
+ attributes set in the `@pyi_base` flow-level decorator. Hence,
621
+ you can use `@pypi_base` to set packages required by all
622
+ steps and use `@pypi` to specify step-specific overrides.
623
+
624
+
625
+ Parameters
626
+ ----------
627
+ packages : Dict[str, str], default: {}
628
+ Packages to use for this step. The key is the name of the package
629
+ and the value is the version to use.
630
+ python : str, optional, default: None
631
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
632
+ that the version used will correspond to the version of the Python interpreter used to start the run.
633
+ """
634
+ ...
635
+
636
+ def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: typing.Optional[str] = None, image_pull_policy: str = 'KUBERNETES_IMAGE_PULL_POLICY', image_pull_secrets: typing.List[str] = [], service_account: str = 'METAFLOW_KUBERNETES_SERVICE_ACCOUNT', secrets: typing.Optional[typing.List[str]] = None, node_selector: typing.Union[typing.Dict[str, str], str, None] = None, namespace: str = 'METAFLOW_KUBERNETES_NAMESPACE', gpu: typing.Optional[int] = None, gpu_vendor: str = 'KUBERNETES_GPU_VENDOR', tolerations: typing.List[str] = [], labels: typing.Dict[str, str] = 'METAFLOW_KUBERNETES_LABELS', annotations: typing.Dict[str, str] = 'METAFLOW_KUBERNETES_ANNOTATIONS', use_tmpfs: bool = False, tmpfs_tempdir: bool = True, tmpfs_size: typing.Optional[int] = None, tmpfs_path: typing.Optional[str] = '/metaflow_temp', persistent_volume_claims: typing.Optional[typing.Dict[str, str]] = None, shared_memory: typing.Optional[int] = None, port: typing.Optional[int] = None, compute_pool: typing.Optional[str] = None, hostname_resolution_timeout: int = 600, qos: str = 'Burstable', security_context: typing.Optional[typing.Dict[str, typing.Any]] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
637
+ """
638
+ Specifies that this step should execute on Kubernetes.
639
+
640
+
641
+ Parameters
642
+ ----------
643
+ cpu : int, default 1
644
+ Number of CPUs required for this step. If `@resources` is
645
+ also present, the maximum value from all decorators is used.
646
+ memory : int, default 4096
647
+ Memory size (in MB) required for this step. If
648
+ `@resources` is also present, the maximum value from all decorators is
649
+ used.
650
+ disk : int, default 10240
651
+ Disk size (in MB) required for this step. If
652
+ `@resources` is also present, the maximum value from all decorators is
653
+ used.
654
+ image : str, optional, default None
655
+ Docker image to use when launching on Kubernetes. If not specified, and
656
+ METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
657
+ not, a default Docker image mapping to the current version of Python is used.
658
+ image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
659
+ If given, the imagePullPolicy to be applied to the Docker image of the step.
660
+ image_pull_secrets: List[str], default []
661
+ The default is extracted from METAFLOW_KUBERNETES_IMAGE_PULL_SECRETS.
662
+ Kubernetes image pull secrets to use when pulling container images
663
+ in Kubernetes.
664
+ service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
665
+ Kubernetes service account to use when launching pod in Kubernetes.
666
+ secrets : List[str], optional, default None
667
+ Kubernetes secrets to use when launching pod in Kubernetes. These
668
+ secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
669
+ in Metaflow configuration.
670
+ node_selector: Union[Dict[str,str], str], optional, default None
671
+ Kubernetes node selector(s) to apply to the pod running the task.
672
+ Can be passed in as a comma separated string of values e.g.
673
+ 'kubernetes.io/os=linux,kubernetes.io/arch=amd64' or as a dictionary
674
+ {'kubernetes.io/os': 'linux', 'kubernetes.io/arch': 'amd64'}
675
+ namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
676
+ Kubernetes namespace to use when launching pod in Kubernetes.
677
+ gpu : int, optional, default None
678
+ Number of GPUs required for this step. A value of zero implies that
679
+ the scheduled node should not have GPUs.
680
+ gpu_vendor : str, default KUBERNETES_GPU_VENDOR
681
+ The vendor of the GPUs to be used for this step.
682
+ tolerations : List[str], default []
683
+ The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
684
+ Kubernetes tolerations to use when launching pod in Kubernetes.
685
+ labels: Dict[str, str], default: METAFLOW_KUBERNETES_LABELS
686
+ Kubernetes labels to use when launching pod in Kubernetes.
687
+ annotations: Dict[str, str], default: METAFLOW_KUBERNETES_ANNOTATIONS
688
+ Kubernetes annotations to use when launching pod in Kubernetes.
689
+ use_tmpfs : bool, default False
690
+ This enables an explicit tmpfs mount for this step.
691
+ tmpfs_tempdir : bool, default True
692
+ sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
693
+ tmpfs_size : int, optional, default: None
694
+ The value for the size (in MiB) of the tmpfs mount for this step.
695
+ This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
696
+ memory allocated for this step.
697
+ tmpfs_path : str, optional, default /metaflow_temp
698
+ Path to tmpfs mount for this step.
699
+ persistent_volume_claims : Dict[str, str], optional, default None
700
+ A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
701
+ volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
702
+ shared_memory: int, optional
703
+ Shared memory size (in MiB) required for this step
704
+ port: int, optional
705
+ Port number to specify in the Kubernetes job object
706
+ compute_pool : str, optional, default None
707
+ Compute pool to be used for for this step.
708
+ If not specified, any accessible compute pool within the perimeter is used.
709
+ hostname_resolution_timeout: int, default 10 * 60
710
+ Timeout in seconds for the workers tasks in the gang scheduled cluster to resolve the hostname of control task.
711
+ Only applicable when @parallel is used.
712
+ qos: str, default: Burstable
713
+ Quality of Service class to assign to the pod. Supported values are: Guaranteed, Burstable, BestEffort
714
+
715
+ security_context: Dict[str, Any], optional, default None
716
+ Container security context. Applies to the task container. Allows the following keys:
717
+ - privileged: bool, optional, default None
718
+ - allow_privilege_escalation: bool, optional, default None
719
+ - run_as_user: int, optional, default None
720
+ - run_as_group: int, optional, default None
721
+ - run_as_non_root: bool, optional, default None
625
722
  """
626
723
  ...
627
724
 
@@ -640,35 +737,61 @@ def nvct(*, gpu: int, gpu_type: str) -> typing.Callable[[typing.Union[typing.Cal
640
737
  ...
641
738
 
642
739
  @typing.overload
643
- 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]]]:
740
+ 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]]]:
644
741
  """
645
- Specifies environment variables to be set prior to the execution of a step.
742
+ Specifies the Conda environment for the step.
743
+
744
+ Information in this decorator will augment any
745
+ attributes set in the `@conda_base` flow-level decorator. Hence,
746
+ you can use `@conda_base` to set packages required by all
747
+ steps and use `@conda` to specify step-specific overrides.
646
748
 
647
749
 
648
750
  Parameters
649
751
  ----------
650
- vars : Dict[str, str], default {}
651
- Dictionary of environment variables to set.
752
+ packages : Dict[str, str], default {}
753
+ Packages to use for this step. The key is the name of the package
754
+ and the value is the version to use.
755
+ libraries : Dict[str, str], default {}
756
+ Supported for backward compatibility. When used with packages, packages will take precedence.
757
+ python : str, optional, default None
758
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
759
+ that the version used will correspond to the version of the Python interpreter used to start the run.
760
+ disabled : bool, default False
761
+ If set to True, disables @conda.
652
762
  """
653
763
  ...
654
764
 
655
765
  @typing.overload
656
- def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
766
+ def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
657
767
  ...
658
768
 
659
769
  @typing.overload
660
- def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
770
+ def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
661
771
  ...
662
772
 
663
- def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
773
+ 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):
664
774
  """
665
- Specifies environment variables to be set prior to the execution of a step.
775
+ Specifies the Conda environment for the step.
776
+
777
+ Information in this decorator will augment any
778
+ attributes set in the `@conda_base` flow-level decorator. Hence,
779
+ you can use `@conda_base` to set packages required by all
780
+ steps and use `@conda` to specify step-specific overrides.
666
781
 
667
782
 
668
783
  Parameters
669
784
  ----------
670
- vars : Dict[str, str], default {}
671
- Dictionary of environment variables to set.
785
+ packages : Dict[str, str], default {}
786
+ Packages to use for this step. The key is the name of the package
787
+ and the value is the version to use.
788
+ libraries : Dict[str, str], default {}
789
+ Supported for backward compatibility. When used with packages, packages will take precedence.
790
+ python : str, optional, default None
791
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
792
+ that the version used will correspond to the version of the Python interpreter used to start the run.
793
+ disabled : bool, default False
794
+ If set to True, disables @conda.
672
795
  """
673
796
  ...
674
797
 
@@ -726,276 +849,87 @@ def resources(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None]
726
849
  You can choose the compute layer on the command line by executing e.g.
727
850
  ```
728
851
  python myflow.py run --with batch
729
- ```
730
- or
731
- ```
732
- python myflow.py run --with kubernetes
733
- ```
734
- which executes the flow on the desired system using the
735
- requirements specified in `@resources`.
736
-
737
-
738
- Parameters
739
- ----------
740
- cpu : int, default 1
741
- Number of CPUs required for this step.
742
- gpu : int, optional, default None
743
- Number of GPUs required for this step.
744
- disk : int, optional, default None
745
- Disk size (in MB) required for this step. Only applies on Kubernetes.
746
- memory : int, default 4096
747
- Memory size (in MB) required for this step.
748
- shared_memory : int, optional, default None
749
- The value for the size (in MiB) of the /dev/shm volume for this step.
750
- This parameter maps to the `--shm-size` option in Docker.
751
- """
752
- ...
753
-
754
- def app_deploy(*, app_port: int, app_name: str) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
755
- """
756
- Specifies that this step is used to deploy an instance of the app.
757
- Requires that self.app_name, self.app_port, self.entrypoint and self.deployDir is set.
758
-
759
-
760
- Parameters
761
- ----------
762
- app_port : int
763
- Number of GPUs to use.
764
- app_name : str
765
- Name of the app to deploy.
766
- """
767
- ...
768
-
769
- @typing.overload
770
- def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
771
- """
772
- Decorator prototype for all step decorators. This function gets specialized
773
- and imported for all decorators types by _import_plugin_decorators().
774
- """
775
- ...
776
-
777
- @typing.overload
778
- def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
779
- ...
780
-
781
- def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
782
- """
783
- Decorator prototype for all step decorators. This function gets specialized
784
- and imported for all decorators types by _import_plugin_decorators().
785
- """
786
- ...
787
-
788
- 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]]]:
789
- """
790
- This decorator is used to run Ollama APIs as Metaflow task sidecars.
791
-
792
- User code call
793
- --------------
794
- @ollama(
795
- models=[...],
796
- ...
797
- )
798
-
799
- Valid backend options
800
- ---------------------
801
- - 'local': Run as a separate process on the local task machine.
802
- - (TODO) 'managed': Outerbounds hosts and selects compute provider.
803
- - (TODO) 'remote': Spin up separate instance to serve Ollama models.
804
-
805
- Valid model options
806
- -------------------
807
- Any model here https://ollama.com/search, e.g. 'llama3.2', 'llama3.3'
808
-
809
-
810
- Parameters
811
- ----------
812
- models: list[str]
813
- List of Ollama containers running models in sidecars.
814
- backend: str
815
- Determines where and how to run the Ollama process.
816
- force_pull: bool
817
- Whether to run `ollama pull` no matter what, or first check the remote cache in Metaflow datastore for this model key.
818
- cache_update_policy: str
819
- Cache update policy: "auto", "force", or "never".
820
- force_cache_update: bool
821
- Simple override for "force" cache update policy.
822
- debug: bool
823
- Whether to turn on verbose debugging logs.
824
- circuit_breaker_config: dict
825
- Configuration for circuit breaker protection. Keys: failure_threshold, recovery_timeout, reset_timeout.
826
- timeout_config: dict
827
- Configuration for various operation timeouts. Keys: pull, stop, health_check, install, server_startup.
828
- """
829
- ...
830
-
831
- def huggingface_hub(*, temp_dir_root: typing.Optional[str] = None, load: typing.Union[typing.List[str], typing.List[typing.Tuple[typing.Dict, str]], typing.List[typing.Tuple[str, str]], typing.List[typing.Dict], None]) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
832
- """
833
- Decorator that helps cache, version and store models/datasets from huggingface hub.
834
-
835
-
836
- Parameters
837
- ----------
838
- temp_dir_root : str, optional
839
- The root directory that will hold the temporary directory where objects will be downloaded.
840
-
841
- load: Union[List[str], List[Tuple[Dict, str]], List[Tuple[str, str]], List[Dict], None]
842
- The list of repos (models/datasets) to load.
843
-
844
- Loaded repos can be accessed via `current.huggingface_hub.loaded`. If load is set, then the following happens:
845
-
846
- - If repo (model/dataset) is not found in the datastore:
847
- - Downloads the repo from Hugging Face Hub to a temporary directory (or uses specified path) for local access
848
- - Stores it in Metaflow's datastore (s3/gcs/azure etc.) with a unique name based on repo_type/repo_id
849
- - All HF models loaded for a `@step` will be cached separately under flow/step/namespace.
850
-
851
- - If repo is found in the datastore:
852
- - Loads it directly from datastore to local path (can be temporary directory or specified path)
853
- """
854
- ...
855
-
856
- @typing.overload
857
- 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]]]:
858
- """
859
- Enables checkpointing for a step.
860
-
861
-
862
-
863
- Parameters
864
- ----------
865
- load_policy : str, default: "fresh"
866
- The policy for loading the checkpoint. The following policies are supported:
867
- - "eager": Loads the the latest available checkpoint within the namespace.
868
- With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
869
- will be loaded at the start of the task.
870
- - "none": Do not load any checkpoint
871
- - "fresh": Loads the lastest checkpoint created within the running Task.
872
- This mode helps loading checkpoints across various retry attempts of the same task.
873
- With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
874
- created within the task will be loaded when the task is retries execution on failure.
875
-
876
- temp_dir_root : str, default: None
877
- The root directory under which `current.checkpoint.directory` will be created.
878
- """
879
- ...
880
-
881
- @typing.overload
882
- def checkpoint(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
883
- ...
884
-
885
- @typing.overload
886
- def checkpoint(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
887
- ...
888
-
889
- 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):
890
- """
891
- Enables checkpointing for a step.
892
-
852
+ ```
853
+ or
854
+ ```
855
+ python myflow.py run --with kubernetes
856
+ ```
857
+ which executes the flow on the desired system using the
858
+ requirements specified in `@resources`.
893
859
 
894
860
 
895
861
  Parameters
896
862
  ----------
897
- load_policy : str, default: "fresh"
898
- The policy for loading the checkpoint. The following policies are supported:
899
- - "eager": Loads the the latest available checkpoint within the namespace.
900
- With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
901
- will be loaded at the start of the task.
902
- - "none": Do not load any checkpoint
903
- - "fresh": Loads the lastest checkpoint created within the running Task.
904
- This mode helps loading checkpoints across various retry attempts of the same task.
905
- With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
906
- created within the task will be loaded when the task is retries execution on failure.
907
-
908
- temp_dir_root : str, default: None
909
- The root directory under which `current.checkpoint.directory` will be created.
863
+ cpu : int, default 1
864
+ Number of CPUs required for this step.
865
+ gpu : int, optional, default None
866
+ Number of GPUs required for this step.
867
+ disk : int, optional, default None
868
+ Disk size (in MB) required for this step. Only applies on Kubernetes.
869
+ memory : int, default 4096
870
+ Memory size (in MB) required for this step.
871
+ shared_memory : int, optional, default None
872
+ The value for the size (in MiB) of the /dev/shm volume for this step.
873
+ This parameter maps to the `--shm-size` option in Docker.
910
874
  """
911
875
  ...
912
876
 
913
877
  @typing.overload
914
- 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]]]:
878
+ 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]]]:
915
879
  """
916
- Specifies the PyPI packages for the step.
880
+ Specifies a timeout for your step.
917
881
 
918
- Information in this decorator will augment any
919
- attributes set in the `@pyi_base` flow-level decorator. Hence,
920
- you can use `@pypi_base` to set packages required by all
921
- steps and use `@pypi` to specify step-specific overrides.
882
+ This decorator is useful if this step may hang indefinitely.
883
+
884
+ This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
885
+ A timeout is considered to be an exception thrown by the step. It will cause the step to be
886
+ retried if needed and the exception will be caught by the `@catch` decorator, if present.
887
+
888
+ Note that all the values specified in parameters are added together so if you specify
889
+ 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
922
890
 
923
891
 
924
892
  Parameters
925
893
  ----------
926
- packages : Dict[str, str], default: {}
927
- Packages to use for this step. The key is the name of the package
928
- and the value is the version to use.
929
- python : str, optional, default: None
930
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
931
- that the version used will correspond to the version of the Python interpreter used to start the run.
894
+ seconds : int, default 0
895
+ Number of seconds to wait prior to timing out.
896
+ minutes : int, default 0
897
+ Number of minutes to wait prior to timing out.
898
+ hours : int, default 0
899
+ Number of hours to wait prior to timing out.
932
900
  """
933
901
  ...
934
902
 
935
903
  @typing.overload
936
- def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
904
+ def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
937
905
  ...
938
906
 
939
907
  @typing.overload
940
- def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
941
- ...
942
-
943
- 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):
944
- """
945
- Specifies the PyPI packages for the step.
946
-
947
- Information in this decorator will augment any
948
- attributes set in the `@pyi_base` flow-level decorator. Hence,
949
- you can use `@pypi_base` to set packages required by all
950
- steps and use `@pypi` to specify step-specific overrides.
951
-
952
-
953
- Parameters
954
- ----------
955
- packages : Dict[str, str], default: {}
956
- Packages to use for this step. The key is the name of the package
957
- and the value is the version to use.
958
- python : str, optional, default: None
959
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
960
- that the version used will correspond to the version of the Python interpreter used to start the run.
961
- """
908
+ def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
962
909
  ...
963
910
 
964
- def vllm(*, model: str, backend: str, debug: bool, kwargs: typing.Any) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
911
+ 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):
965
912
  """
966
- This decorator is used to run vllm APIs as Metaflow task sidecars.
967
-
968
- User code call
969
- --------------
970
- @vllm(
971
- model="...",
972
- ...
973
- )
913
+ Specifies a timeout for your step.
974
914
 
975
- Valid backend options
976
- ---------------------
977
- - 'local': Run as a separate process on the local task machine.
915
+ This decorator is useful if this step may hang indefinitely.
978
916
 
979
- Valid model options
980
- -------------------
981
- Any HuggingFace model identifier, e.g. 'meta-llama/Llama-3.2-1B'
917
+ This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
918
+ A timeout is considered to be an exception thrown by the step. It will cause the step to be
919
+ retried if needed and the exception will be caught by the `@catch` decorator, if present.
982
920
 
983
- NOTE: vLLM's OpenAI-compatible server serves ONE model per server instance.
984
- If you need multiple models, you must create multiple @vllm decorators.
921
+ Note that all the values specified in parameters are added together so if you specify
922
+ 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
985
923
 
986
924
 
987
925
  Parameters
988
926
  ----------
989
- model: str
990
- HuggingFace model identifier to be served by vLLM.
991
- backend: str
992
- Determines where and how to run the vLLM process.
993
- debug: bool
994
- Whether to turn on verbose debugging logs.
995
- kwargs : Any
996
- Any other keyword arguments are passed directly to the vLLM engine.
997
- This allows for flexible configuration of vLLM server settings.
998
- For example, `tensor_parallel_size=2`.
927
+ seconds : int, default 0
928
+ Number of seconds to wait prior to timing out.
929
+ minutes : int, default 0
930
+ Number of minutes to wait prior to timing out.
931
+ hours : int, default 0
932
+ Number of hours to wait prior to timing out.
999
933
  """
1000
934
  ...
1001
935
 
@@ -1016,87 +950,68 @@ def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepF
1016
950
  """
1017
951
  ...
1018
952
 
1019
- @typing.overload
1020
- def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
953
+ 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]]]:
1021
954
  """
1022
- Specifies the PyPI packages for all steps of the flow.
955
+ Specifies that this step should execute on DGX cloud.
1023
956
 
1024
- Use `@pypi_base` to set common packages required by all
1025
- steps and use `@pypi` to specify step-specific overrides.
1026
957
 
1027
958
  Parameters
1028
959
  ----------
1029
- packages : Dict[str, str], default: {}
1030
- Packages to use for this flow. The key is the name of the package
1031
- and the value is the version to use.
1032
- python : str, optional, default: None
1033
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1034
- that the version used will correspond to the version of the Python interpreter used to start the run.
960
+ gpu : int
961
+ Number of GPUs to use.
962
+ gpu_type : str
963
+ Type of Nvidia GPU to use.
964
+ queue_timeout : int
965
+ Time to keep the job in NVCF's queue.
1035
966
  """
1036
967
  ...
1037
968
 
1038
969
  @typing.overload
1039
- def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1040
- ...
1041
-
1042
- def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
970
+ 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]]]:
1043
971
  """
1044
- Specifies the PyPI packages for all steps of the flow.
972
+ Creates a human-readable report, a Metaflow Card, after this step completes.
973
+
974
+ Note that you may add multiple `@card` decorators in a step with different parameters.
1045
975
 
1046
- Use `@pypi_base` to set common packages required by all
1047
- steps and use `@pypi` to specify step-specific overrides.
1048
976
 
1049
977
  Parameters
1050
978
  ----------
1051
- packages : Dict[str, str], default: {}
1052
- Packages to use for this flow. The key is the name of the package
1053
- and the value is the version to use.
1054
- python : str, optional, default: None
1055
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1056
- that the version used will correspond to the version of the Python interpreter used to start the run.
979
+ type : str, default 'default'
980
+ Card type.
981
+ id : str, optional, default None
982
+ If multiple cards are present, use this id to identify this card.
983
+ options : Dict[str, Any], default {}
984
+ Options passed to the card. The contents depend on the card type.
985
+ timeout : int, default 45
986
+ Interrupt reporting if it takes more than this many seconds.
1057
987
  """
1058
988
  ...
1059
989
 
1060
- def airflow_external_task_sensor(*, timeout: int, poke_interval: int, mode: str, exponential_backoff: bool, pool: str, soft_fail: bool, name: str, description: str, external_dag_id: str, external_task_ids: typing.List[str], allowed_states: typing.List[str], failed_states: typing.List[str], execution_delta: "datetime.timedelta", check_existence: bool) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
990
+ @typing.overload
991
+ def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
992
+ ...
993
+
994
+ @typing.overload
995
+ def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
996
+ ...
997
+
998
+ 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):
1061
999
  """
1062
- The `@airflow_external_task_sensor` decorator attaches a Airflow [ExternalTaskSensor](https://airflow.apache.org/docs/apache-airflow/stable/_api/airflow/sensors/external_task/index.html#airflow.sensors.external_task.ExternalTaskSensor) before the start step of the flow.
1063
- This decorator only works when a flow is scheduled on Airflow and is compiled using `airflow create`. More than one `@airflow_external_task_sensor` can be added as a flow decorators. Adding more than one decorator will ensure that `start` step starts only after all sensors finish.
1000
+ Creates a human-readable report, a Metaflow Card, after this step completes.
1001
+
1002
+ Note that you may add multiple `@card` decorators in a step with different parameters.
1064
1003
 
1065
1004
 
1066
1005
  Parameters
1067
1006
  ----------
1068
- timeout : int
1069
- Time, in seconds before the task times out and fails. (Default: 3600)
1070
- poke_interval : int
1071
- Time in seconds that the job should wait in between each try. (Default: 60)
1072
- mode : str
1073
- How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1074
- exponential_backoff : bool
1075
- allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1076
- pool : str
1077
- the slot pool this task should run in,
1078
- slot pools are a way to limit concurrency for certain tasks. (Default:None)
1079
- soft_fail : bool
1080
- Set to true to mark the task as SKIPPED on failure. (Default: False)
1081
- name : str
1082
- Name of the sensor on Airflow
1083
- description : str
1084
- Description of sensor in the Airflow UI
1085
- external_dag_id : str
1086
- The dag_id that contains the task you want to wait for.
1087
- external_task_ids : List[str]
1088
- The list of task_ids that you want to wait for.
1089
- If None (default value) the sensor waits for the DAG. (Default: None)
1090
- allowed_states : List[str]
1091
- Iterable of allowed states, (Default: ['success'])
1092
- failed_states : List[str]
1093
- Iterable of failed or dis-allowed states. (Default: None)
1094
- execution_delta : datetime.timedelta
1095
- time difference with the previous execution to look at,
1096
- the default is the same logical date as the current task or DAG. (Default: None)
1097
- check_existence: bool
1098
- Set to True to check if the external task exists or check if
1099
- the DAG to wait for exists. (Default: True)
1007
+ type : str, default 'default'
1008
+ Card type.
1009
+ id : str, optional, default None
1010
+ If multiple cards are present, use this id to identify this card.
1011
+ options : Dict[str, Any], default {}
1012
+ Options passed to the card. The contents depend on the card type.
1013
+ timeout : int, default 45
1014
+ Interrupt reporting if it takes more than this many seconds.
1100
1015
  """
1101
1016
  ...
1102
1017
 
@@ -1135,104 +1050,97 @@ def project(*, name: str, branch: typing.Optional[str] = None, production: bool
1135
1050
  """
1136
1051
  ...
1137
1052
 
1053
+ def airflow_external_task_sensor(*, timeout: int, poke_interval: int, mode: str, exponential_backoff: bool, pool: str, soft_fail: bool, name: str, description: str, external_dag_id: str, external_task_ids: typing.List[str], allowed_states: typing.List[str], failed_states: typing.List[str], execution_delta: "datetime.timedelta", check_existence: bool) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1054
+ """
1055
+ The `@airflow_external_task_sensor` decorator attaches a Airflow [ExternalTaskSensor](https://airflow.apache.org/docs/apache-airflow/stable/_api/airflow/sensors/external_task/index.html#airflow.sensors.external_task.ExternalTaskSensor) before the start step of the flow.
1056
+ This decorator only works when a flow is scheduled on Airflow and is compiled using `airflow create`. More than one `@airflow_external_task_sensor` can be added as a flow decorators. Adding more than one decorator will ensure that `start` step starts only after all sensors finish.
1057
+
1058
+
1059
+ Parameters
1060
+ ----------
1061
+ timeout : int
1062
+ Time, in seconds before the task times out and fails. (Default: 3600)
1063
+ poke_interval : int
1064
+ Time in seconds that the job should wait in between each try. (Default: 60)
1065
+ mode : str
1066
+ How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1067
+ exponential_backoff : bool
1068
+ allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1069
+ pool : str
1070
+ the slot pool this task should run in,
1071
+ slot pools are a way to limit concurrency for certain tasks. (Default:None)
1072
+ soft_fail : bool
1073
+ Set to true to mark the task as SKIPPED on failure. (Default: False)
1074
+ name : str
1075
+ Name of the sensor on Airflow
1076
+ description : str
1077
+ Description of sensor in the Airflow UI
1078
+ external_dag_id : str
1079
+ The dag_id that contains the task you want to wait for.
1080
+ external_task_ids : List[str]
1081
+ The list of task_ids that you want to wait for.
1082
+ If None (default value) the sensor waits for the DAG. (Default: None)
1083
+ allowed_states : List[str]
1084
+ Iterable of allowed states, (Default: ['success'])
1085
+ failed_states : List[str]
1086
+ Iterable of failed or dis-allowed states. (Default: None)
1087
+ execution_delta : datetime.timedelta
1088
+ time difference with the previous execution to look at,
1089
+ the default is the same logical date as the current task or DAG. (Default: None)
1090
+ check_existence: bool
1091
+ Set to True to check if the external task exists or check if
1092
+ the DAG to wait for exists. (Default: True)
1093
+ """
1094
+ ...
1095
+
1138
1096
  @typing.overload
1139
- 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]]:
1097
+ 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]]:
1140
1098
  """
1141
- Specifies the flow(s) that this flow depends on.
1142
-
1143
- ```
1144
- @trigger_on_finish(flow='FooFlow')
1145
- ```
1146
- or
1147
- ```
1148
- @trigger_on_finish(flows=['FooFlow', 'BarFlow'])
1149
- ```
1150
- This decorator respects the @project decorator and triggers the flow
1151
- when upstream runs within the same namespace complete successfully
1152
-
1153
- Additionally, you can specify project aware upstream flow dependencies
1154
- by specifying the fully qualified project_flow_name.
1155
- ```
1156
- @trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
1157
- ```
1158
- or
1159
- ```
1160
- @trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
1161
- ```
1162
-
1163
- You can also specify just the project or project branch (other values will be
1164
- inferred from the current project or project branch):
1165
- ```
1166
- @trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
1167
- ```
1099
+ Specifies the Conda environment for all steps of the flow.
1168
1100
 
1169
- Note that `branch` is typically one of:
1170
- - `prod`
1171
- - `user.bob`
1172
- - `test.my_experiment`
1173
- - `prod.staging`
1101
+ Use `@conda_base` to set common libraries required by all
1102
+ steps and use `@conda` to specify step-specific additions.
1174
1103
 
1175
1104
 
1176
1105
  Parameters
1177
1106
  ----------
1178
- flow : Union[str, Dict[str, str]], optional, default None
1179
- Upstream flow dependency for this flow.
1180
- flows : List[Union[str, Dict[str, str]]], default []
1181
- Upstream flow dependencies for this flow.
1182
- options : Dict[str, Any], default {}
1183
- Backend-specific configuration for tuning eventing behavior.
1107
+ packages : Dict[str, str], default {}
1108
+ Packages to use for this flow. The key is the name of the package
1109
+ and the value is the version to use.
1110
+ libraries : Dict[str, str], default {}
1111
+ Supported for backward compatibility. When used with packages, packages will take precedence.
1112
+ python : str, optional, default None
1113
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1114
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1115
+ disabled : bool, default False
1116
+ If set to True, disables Conda.
1184
1117
  """
1185
1118
  ...
1186
1119
 
1187
1120
  @typing.overload
1188
- def trigger_on_finish(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1121
+ def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1189
1122
  ...
1190
1123
 
1191
- 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] = {}):
1124
+ 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):
1192
1125
  """
1193
- Specifies the flow(s) that this flow depends on.
1194
-
1195
- ```
1196
- @trigger_on_finish(flow='FooFlow')
1197
- ```
1198
- or
1199
- ```
1200
- @trigger_on_finish(flows=['FooFlow', 'BarFlow'])
1201
- ```
1202
- This decorator respects the @project decorator and triggers the flow
1203
- when upstream runs within the same namespace complete successfully
1204
-
1205
- Additionally, you can specify project aware upstream flow dependencies
1206
- by specifying the fully qualified project_flow_name.
1207
- ```
1208
- @trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
1209
- ```
1210
- or
1211
- ```
1212
- @trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
1213
- ```
1214
-
1215
- You can also specify just the project or project branch (other values will be
1216
- inferred from the current project or project branch):
1217
- ```
1218
- @trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
1219
- ```
1126
+ Specifies the Conda environment for all steps of the flow.
1220
1127
 
1221
- Note that `branch` is typically one of:
1222
- - `prod`
1223
- - `user.bob`
1224
- - `test.my_experiment`
1225
- - `prod.staging`
1128
+ Use `@conda_base` to set common libraries required by all
1129
+ steps and use `@conda` to specify step-specific additions.
1226
1130
 
1227
1131
 
1228
1132
  Parameters
1229
1133
  ----------
1230
- flow : Union[str, Dict[str, str]], optional, default None
1231
- Upstream flow dependency for this flow.
1232
- flows : List[Union[str, Dict[str, str]]], default []
1233
- Upstream flow dependencies for this flow.
1234
- options : Dict[str, Any], default {}
1235
- Backend-specific configuration for tuning eventing behavior.
1134
+ packages : Dict[str, str], default {}
1135
+ Packages to use for this flow. The key is the name of the package
1136
+ and the value is the version to use.
1137
+ libraries : Dict[str, str], default {}
1138
+ Supported for backward compatibility. When used with packages, packages will take precedence.
1139
+ python : str, optional, default None
1140
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1141
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1142
+ disabled : bool, default False
1143
+ If set to True, disables Conda.
1236
1144
  """
1237
1145
  ...
1238
1146
 
@@ -1538,53 +1446,144 @@ def airflow_s3_key_sensor(*, timeout: int, poke_interval: int, mode: str, expone
1538
1446
  ...
1539
1447
 
1540
1448
  @typing.overload
1541
- 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]]:
1449
+ def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1542
1450
  """
1543
- Specifies the Conda environment for all steps of the flow.
1544
-
1545
- Use `@conda_base` to set common libraries required by all
1546
- steps and use `@conda` to specify step-specific additions.
1451
+ Specifies the PyPI packages for all steps of the flow.
1547
1452
 
1453
+ Use `@pypi_base` to set common packages required by all
1454
+ steps and use `@pypi` to specify step-specific overrides.
1548
1455
 
1549
1456
  Parameters
1550
1457
  ----------
1551
- packages : Dict[str, str], default {}
1458
+ packages : Dict[str, str], default: {}
1552
1459
  Packages to use for this flow. The key is the name of the package
1553
1460
  and the value is the version to use.
1554
- libraries : Dict[str, str], default {}
1555
- Supported for backward compatibility. When used with packages, packages will take precedence.
1556
- python : str, optional, default None
1461
+ python : str, optional, default: None
1557
1462
  Version of Python to use, e.g. '3.7.4'. A default value of None implies
1558
1463
  that the version used will correspond to the version of the Python interpreter used to start the run.
1559
- disabled : bool, default False
1560
- If set to True, disables Conda.
1561
1464
  """
1562
1465
  ...
1563
1466
 
1564
1467
  @typing.overload
1565
- def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1468
+ def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1566
1469
  ...
1567
1470
 
1568
- 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):
1471
+ def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
1569
1472
  """
1570
- Specifies the Conda environment for all steps of the flow.
1571
-
1572
- Use `@conda_base` to set common libraries required by all
1573
- steps and use `@conda` to specify step-specific additions.
1473
+ Specifies the PyPI packages for all steps of the flow.
1574
1474
 
1475
+ Use `@pypi_base` to set common packages required by all
1476
+ steps and use `@pypi` to specify step-specific overrides.
1575
1477
 
1576
1478
  Parameters
1577
1479
  ----------
1578
- packages : Dict[str, str], default {}
1480
+ packages : Dict[str, str], default: {}
1579
1481
  Packages to use for this flow. The key is the name of the package
1580
1482
  and the value is the version to use.
1581
- libraries : Dict[str, str], default {}
1582
- Supported for backward compatibility. When used with packages, packages will take precedence.
1583
- python : str, optional, default None
1483
+ python : str, optional, default: None
1584
1484
  Version of Python to use, e.g. '3.7.4'. A default value of None implies
1585
1485
  that the version used will correspond to the version of the Python interpreter used to start the run.
1586
- disabled : bool, default False
1587
- If set to True, disables Conda.
1486
+ """
1487
+ ...
1488
+
1489
+ @typing.overload
1490
+ 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]]:
1491
+ """
1492
+ Specifies the flow(s) that this flow depends on.
1493
+
1494
+ ```
1495
+ @trigger_on_finish(flow='FooFlow')
1496
+ ```
1497
+ or
1498
+ ```
1499
+ @trigger_on_finish(flows=['FooFlow', 'BarFlow'])
1500
+ ```
1501
+ This decorator respects the @project decorator and triggers the flow
1502
+ when upstream runs within the same namespace complete successfully
1503
+
1504
+ Additionally, you can specify project aware upstream flow dependencies
1505
+ by specifying the fully qualified project_flow_name.
1506
+ ```
1507
+ @trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
1508
+ ```
1509
+ or
1510
+ ```
1511
+ @trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
1512
+ ```
1513
+
1514
+ You can also specify just the project or project branch (other values will be
1515
+ inferred from the current project or project branch):
1516
+ ```
1517
+ @trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
1518
+ ```
1519
+
1520
+ Note that `branch` is typically one of:
1521
+ - `prod`
1522
+ - `user.bob`
1523
+ - `test.my_experiment`
1524
+ - `prod.staging`
1525
+
1526
+
1527
+ Parameters
1528
+ ----------
1529
+ flow : Union[str, Dict[str, str]], optional, default None
1530
+ Upstream flow dependency for this flow.
1531
+ flows : List[Union[str, Dict[str, str]]], default []
1532
+ Upstream flow dependencies for this flow.
1533
+ options : Dict[str, Any], default {}
1534
+ Backend-specific configuration for tuning eventing behavior.
1535
+ """
1536
+ ...
1537
+
1538
+ @typing.overload
1539
+ def trigger_on_finish(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1540
+ ...
1541
+
1542
+ 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] = {}):
1543
+ """
1544
+ Specifies the flow(s) that this flow depends on.
1545
+
1546
+ ```
1547
+ @trigger_on_finish(flow='FooFlow')
1548
+ ```
1549
+ or
1550
+ ```
1551
+ @trigger_on_finish(flows=['FooFlow', 'BarFlow'])
1552
+ ```
1553
+ This decorator respects the @project decorator and triggers the flow
1554
+ when upstream runs within the same namespace complete successfully
1555
+
1556
+ Additionally, you can specify project aware upstream flow dependencies
1557
+ by specifying the fully qualified project_flow_name.
1558
+ ```
1559
+ @trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
1560
+ ```
1561
+ or
1562
+ ```
1563
+ @trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
1564
+ ```
1565
+
1566
+ You can also specify just the project or project branch (other values will be
1567
+ inferred from the current project or project branch):
1568
+ ```
1569
+ @trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
1570
+ ```
1571
+
1572
+ Note that `branch` is typically one of:
1573
+ - `prod`
1574
+ - `user.bob`
1575
+ - `test.my_experiment`
1576
+ - `prod.staging`
1577
+
1578
+
1579
+ Parameters
1580
+ ----------
1581
+ flow : Union[str, Dict[str, str]], optional, default None
1582
+ Upstream flow dependency for this flow.
1583
+ flows : List[Union[str, Dict[str, str]]], default []
1584
+ Upstream flow dependencies for this flow.
1585
+ options : Dict[str, Any], default {}
1586
+ Backend-specific configuration for tuning eventing behavior.
1588
1587
  """
1589
1588
  ...
1590
1589