ob-metaflow-stubs 6.0.3.167__py2.py3-none-any.whl → 6.0.3.168rc0__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 (206) hide show
  1. metaflow-stubs/__init__.pyi +719 -719
  2. metaflow-stubs/cards.pyi +1 -1
  3. metaflow-stubs/cli.pyi +1 -1
  4. metaflow-stubs/cli_components/__init__.pyi +1 -1
  5. metaflow-stubs/cli_components/utils.pyi +1 -1
  6. metaflow-stubs/client/__init__.pyi +1 -1
  7. metaflow-stubs/client/core.pyi +4 -4
  8. metaflow-stubs/client/filecache.pyi +1 -1
  9. metaflow-stubs/events.pyi +2 -2
  10. metaflow-stubs/exception.pyi +1 -1
  11. metaflow-stubs/flowspec.pyi +4 -4
  12. metaflow-stubs/generated_for.txt +1 -1
  13. metaflow-stubs/includefile.pyi +4 -4
  14. metaflow-stubs/info_file.pyi +1 -1
  15. metaflow-stubs/metadata_provider/__init__.pyi +1 -1
  16. metaflow-stubs/metadata_provider/heartbeat.pyi +1 -1
  17. metaflow-stubs/metadata_provider/metadata.pyi +2 -2
  18. metaflow-stubs/metadata_provider/util.pyi +1 -1
  19. metaflow-stubs/metaflow_config.pyi +1 -1
  20. metaflow-stubs/metaflow_current.pyi +128 -128
  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 +4 -4
  33. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/lineage_card.pyi +1 -1
  34. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/checkpoint_storage.pyi +4 -4
  35. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/constructors.pyi +1 -1
  36. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/core.pyi +3 -3
  37. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/decorator.pyi +4 -4
  38. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/exceptions.pyi +1 -1
  39. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/final_api.pyi +1 -1
  40. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/lineage.pyi +1 -1
  41. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/__init__.pyi +1 -1
  42. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/context.pyi +2 -2
  43. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/core.pyi +1 -1
  44. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/decorator.pyi +1 -1
  45. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/exceptions.pyi +1 -1
  46. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/task_utils.pyi +2 -2
  47. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/utils.pyi +1 -1
  48. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastructures.pyi +2 -2
  49. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/exceptions.pyi +1 -1
  50. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/hf_hub/__init__.pyi +1 -1
  51. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/hf_hub/decorator.pyi +1 -1
  52. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/__init__.pyi +1 -1
  53. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/core.pyi +2 -2
  54. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/exceptions.pyi +1 -1
  55. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/model_storage.pyi +3 -3
  56. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/__init__.pyi +1 -1
  57. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/flowspec_utils.pyi +1 -1
  58. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/general.pyi +1 -1
  59. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/identity_utils.pyi +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 +2 -2
  63. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/tar_utils.pyi +2 -2
  64. metaflow-stubs/mf_extensions/outerbounds/__init__.pyi +1 -1
  65. metaflow-stubs/mf_extensions/outerbounds/plugins/__init__.pyi +1 -1
  66. metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/__init__.pyi +1 -1
  67. metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/injector.pyi +1 -1
  68. metaflow-stubs/mf_extensions/outerbounds/plugins/checkpoint_datastores/__init__.pyi +1 -1
  69. metaflow-stubs/mf_extensions/outerbounds/plugins/checkpoint_datastores/coreweave.pyi +1 -1
  70. metaflow-stubs/mf_extensions/outerbounds/plugins/checkpoint_datastores/nebius.pyi +1 -1
  71. metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/__init__.pyi +1 -1
  72. metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/ollama.pyi +1 -1
  73. metaflow-stubs/mf_extensions/outerbounds/plugins/snowflake/__init__.pyi +1 -1
  74. metaflow-stubs/mf_extensions/outerbounds/plugins/snowflake/snowflake.pyi +1 -1
  75. metaflow-stubs/mf_extensions/outerbounds/profilers/__init__.pyi +1 -1
  76. metaflow-stubs/mf_extensions/outerbounds/profilers/gpu.pyi +1 -1
  77. metaflow-stubs/mf_extensions/outerbounds/remote_config.pyi +1 -1
  78. metaflow-stubs/mf_extensions/outerbounds/toplevel/__init__.pyi +1 -1
  79. metaflow-stubs/mf_extensions/outerbounds/toplevel/global_aliases_for_metaflow_package.pyi +1 -1
  80. metaflow-stubs/multicore_utils.pyi +1 -1
  81. metaflow-stubs/parameters.pyi +3 -3
  82. metaflow-stubs/plugins/__init__.pyi +11 -11
  83. metaflow-stubs/plugins/airflow/__init__.pyi +1 -1
  84. metaflow-stubs/plugins/airflow/airflow_utils.pyi +1 -1
  85. metaflow-stubs/plugins/airflow/exception.pyi +1 -1
  86. metaflow-stubs/plugins/airflow/sensors/__init__.pyi +1 -1
  87. metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +1 -1
  88. metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +1 -1
  89. metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +1 -1
  90. metaflow-stubs/plugins/argo/__init__.pyi +1 -1
  91. metaflow-stubs/plugins/argo/argo_client.pyi +1 -1
  92. metaflow-stubs/plugins/argo/argo_events.pyi +1 -1
  93. metaflow-stubs/plugins/argo/argo_workflows.pyi +2 -2
  94. metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +3 -3
  95. metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +2 -2
  96. metaflow-stubs/plugins/argo/argo_workflows_deployer_objects.pyi +2 -2
  97. metaflow-stubs/plugins/aws/__init__.pyi +1 -1
  98. metaflow-stubs/plugins/aws/aws_client.pyi +1 -1
  99. metaflow-stubs/plugins/aws/aws_utils.pyi +1 -1
  100. metaflow-stubs/plugins/aws/batch/__init__.pyi +1 -1
  101. metaflow-stubs/plugins/aws/batch/batch.pyi +1 -1
  102. metaflow-stubs/plugins/aws/batch/batch_client.pyi +1 -1
  103. metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +1 -1
  104. metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +1 -1
  105. metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +3 -3
  106. metaflow-stubs/plugins/aws/step_functions/__init__.pyi +1 -1
  107. metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +1 -1
  108. metaflow-stubs/plugins/aws/step_functions/schedule_decorator.pyi +1 -1
  109. metaflow-stubs/plugins/aws/step_functions/step_functions.pyi +1 -1
  110. metaflow-stubs/plugins/aws/step_functions/step_functions_client.pyi +1 -1
  111. metaflow-stubs/plugins/aws/step_functions/step_functions_deployer.pyi +2 -2
  112. metaflow-stubs/plugins/aws/step_functions/step_functions_deployer_objects.pyi +2 -2
  113. metaflow-stubs/plugins/azure/__init__.pyi +1 -1
  114. metaflow-stubs/plugins/azure/azure_credential.pyi +1 -1
  115. metaflow-stubs/plugins/azure/azure_exceptions.pyi +1 -1
  116. metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +3 -3
  117. metaflow-stubs/plugins/azure/azure_utils.pyi +1 -1
  118. metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +1 -1
  119. metaflow-stubs/plugins/azure/includefile_support.pyi +1 -1
  120. metaflow-stubs/plugins/cards/__init__.pyi +5 -5
  121. metaflow-stubs/plugins/cards/card_client.pyi +2 -2
  122. metaflow-stubs/plugins/cards/card_creator.pyi +1 -1
  123. metaflow-stubs/plugins/cards/card_datastore.pyi +1 -1
  124. metaflow-stubs/plugins/cards/card_decorator.pyi +1 -1
  125. metaflow-stubs/plugins/cards/card_modules/__init__.pyi +1 -1
  126. metaflow-stubs/plugins/cards/card_modules/basic.pyi +1 -1
  127. metaflow-stubs/plugins/cards/card_modules/card.pyi +1 -1
  128. metaflow-stubs/plugins/cards/card_modules/components.pyi +2 -2
  129. metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +1 -1
  130. metaflow-stubs/plugins/cards/card_modules/renderer_tools.pyi +1 -1
  131. metaflow-stubs/plugins/cards/card_modules/test_cards.pyi +1 -1
  132. metaflow-stubs/plugins/cards/card_resolver.pyi +1 -1
  133. metaflow-stubs/plugins/cards/component_serializer.pyi +1 -1
  134. metaflow-stubs/plugins/cards/exception.pyi +1 -1
  135. metaflow-stubs/plugins/catch_decorator.pyi +2 -2
  136. metaflow-stubs/plugins/datatools/__init__.pyi +1 -1
  137. metaflow-stubs/plugins/datatools/local.pyi +1 -1
  138. metaflow-stubs/plugins/datatools/s3/__init__.pyi +1 -1
  139. metaflow-stubs/plugins/datatools/s3/s3.pyi +3 -3
  140. metaflow-stubs/plugins/datatools/s3/s3tail.pyi +1 -1
  141. metaflow-stubs/plugins/datatools/s3/s3util.pyi +1 -1
  142. metaflow-stubs/plugins/debug_logger.pyi +1 -1
  143. metaflow-stubs/plugins/debug_monitor.pyi +1 -1
  144. metaflow-stubs/plugins/environment_decorator.pyi +1 -1
  145. metaflow-stubs/plugins/events_decorator.pyi +1 -1
  146. metaflow-stubs/plugins/frameworks/__init__.pyi +1 -1
  147. metaflow-stubs/plugins/frameworks/pytorch.pyi +1 -1
  148. metaflow-stubs/plugins/gcp/__init__.pyi +1 -1
  149. metaflow-stubs/plugins/gcp/gcp_secret_manager_secrets_provider.pyi +3 -3
  150. metaflow-stubs/plugins/gcp/gs_exceptions.pyi +1 -1
  151. metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +1 -1
  152. metaflow-stubs/plugins/gcp/gs_utils.pyi +1 -1
  153. metaflow-stubs/plugins/gcp/includefile_support.pyi +1 -1
  154. metaflow-stubs/plugins/kubernetes/__init__.pyi +1 -1
  155. metaflow-stubs/plugins/kubernetes/kube_utils.pyi +2 -2
  156. metaflow-stubs/plugins/kubernetes/kubernetes.pyi +1 -1
  157. metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +1 -1
  158. metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +1 -1
  159. metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +1 -1
  160. metaflow-stubs/plugins/kubernetes/spot_monitor_sidecar.pyi +1 -1
  161. metaflow-stubs/plugins/ollama/__init__.pyi +2 -2
  162. metaflow-stubs/plugins/parallel_decorator.pyi +1 -1
  163. metaflow-stubs/plugins/perimeters.pyi +1 -1
  164. metaflow-stubs/plugins/project_decorator.pyi +1 -1
  165. metaflow-stubs/plugins/pypi/__init__.pyi +1 -1
  166. metaflow-stubs/plugins/pypi/conda_decorator.pyi +1 -1
  167. metaflow-stubs/plugins/pypi/conda_environment.pyi +4 -4
  168. metaflow-stubs/plugins/pypi/parsers.pyi +1 -1
  169. metaflow-stubs/plugins/pypi/pypi_decorator.pyi +1 -1
  170. metaflow-stubs/plugins/pypi/pypi_environment.pyi +1 -1
  171. metaflow-stubs/plugins/pypi/utils.pyi +1 -1
  172. metaflow-stubs/plugins/resources_decorator.pyi +1 -1
  173. metaflow-stubs/plugins/retry_decorator.pyi +1 -1
  174. metaflow-stubs/plugins/secrets/__init__.pyi +2 -2
  175. metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +2 -2
  176. metaflow-stubs/plugins/secrets/secrets_decorator.pyi +1 -1
  177. metaflow-stubs/plugins/snowflake/__init__.pyi +1 -1
  178. metaflow-stubs/plugins/storage_executor.pyi +1 -1
  179. metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +1 -1
  180. metaflow-stubs/plugins/timeout_decorator.pyi +2 -2
  181. metaflow-stubs/plugins/uv/__init__.pyi +1 -1
  182. metaflow-stubs/plugins/uv/uv_environment.pyi +2 -2
  183. metaflow-stubs/profilers/__init__.pyi +1 -1
  184. metaflow-stubs/pylint_wrapper.pyi +1 -1
  185. metaflow-stubs/runner/__init__.pyi +1 -1
  186. metaflow-stubs/runner/deployer.pyi +29 -29
  187. metaflow-stubs/runner/deployer_impl.pyi +2 -2
  188. metaflow-stubs/runner/metaflow_runner.pyi +3 -3
  189. metaflow-stubs/runner/nbdeploy.pyi +1 -1
  190. metaflow-stubs/runner/nbrun.pyi +1 -1
  191. metaflow-stubs/runner/subprocess_manager.pyi +1 -1
  192. metaflow-stubs/runner/utils.pyi +2 -2
  193. metaflow-stubs/system/__init__.pyi +1 -1
  194. metaflow-stubs/system/system_logger.pyi +1 -1
  195. metaflow-stubs/system/system_monitor.pyi +1 -1
  196. metaflow-stubs/tagging_util.pyi +1 -1
  197. metaflow-stubs/tuple_util.pyi +1 -1
  198. metaflow-stubs/user_configs/__init__.pyi +1 -1
  199. metaflow-stubs/user_configs/config_decorators.pyi +4 -4
  200. metaflow-stubs/user_configs/config_options.pyi +3 -3
  201. metaflow-stubs/user_configs/config_parameters.pyi +5 -5
  202. {ob_metaflow_stubs-6.0.3.167.dist-info → ob_metaflow_stubs-6.0.3.168rc0.dist-info}/METADATA +1 -1
  203. ob_metaflow_stubs-6.0.3.168rc0.dist-info/RECORD +206 -0
  204. ob_metaflow_stubs-6.0.3.167.dist-info/RECORD +0 -206
  205. {ob_metaflow_stubs-6.0.3.167.dist-info → ob_metaflow_stubs-6.0.3.168rc0.dist-info}/WHEEL +0 -0
  206. {ob_metaflow_stubs-6.0.3.167.dist-info → ob_metaflow_stubs-6.0.3.168rc0.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.11.2+obcheckpoint(0.2.1);ob(v1) #
4
- # Generated on 2025-05-13T17:00:07.187688 #
4
+ # Generated on 2025-05-19T23:34:02.941331 #
5
5
  ######################################################################################################
6
6
 
7
7
  from __future__ import annotations
8
8
 
9
9
  import typing
10
10
  if typing.TYPE_CHECKING:
11
- import datetime
12
11
  import typing
12
+ import datetime
13
13
  FlowSpecDerived = typing.TypeVar("FlowSpecDerived", bound="FlowSpec", contravariant=False, covariant=False)
14
14
  StepFlag = typing.NewType("StepFlag", bool)
15
15
 
@@ -35,18 +35,18 @@ from .user_configs.config_parameters import ConfigValue as ConfigValue
35
35
  from .user_configs.config_parameters import config_expr as config_expr
36
36
  from .user_configs.config_decorators import CustomFlowDecorator as CustomFlowDecorator
37
37
  from .user_configs.config_decorators import CustomStepDecorator as CustomStepDecorator
38
- from . import events as events
39
- from . import metaflow_git as metaflow_git
40
38
  from . import tuple_util as tuple_util
41
39
  from . import cards as cards
40
+ from . import metaflow_git as metaflow_git
41
+ from . import events as events
42
42
  from . import runner as runner
43
43
  from . import plugins as plugins
44
44
  from .mf_extensions.outerbounds.toplevel.global_aliases_for_metaflow_package import S3 as S3
45
45
  from . import includefile as includefile
46
46
  from .includefile import IncludeFile as IncludeFile
47
- from .plugins.pypi.parsers import requirements_txt_parser as requirements_txt_parser
48
47
  from .plugins.pypi.parsers import conda_environment_yml_parser as conda_environment_yml_parser
49
48
  from .plugins.pypi.parsers import pyproject_toml_parser as pyproject_toml_parser
49
+ from .plugins.pypi.parsers import requirements_txt_parser as requirements_txt_parser
50
50
  from . import client as client
51
51
  from .client.core import namespace as namespace
52
52
  from .client.core import get_namespace as get_namespace
@@ -154,160 +154,108 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
154
154
  ...
155
155
 
156
156
  @typing.overload
157
- 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]]]:
157
+ def checkpoint(*, load_policy: str = 'fresh', temp_dir_root: str = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
158
158
  """
159
- Specifies a timeout for your step.
160
-
161
- This decorator is useful if this step may hang indefinitely.
162
-
163
- This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
164
- A timeout is considered to be an exception thrown by the step. It will cause the step to be
165
- retried if needed and the exception will be caught by the `@catch` decorator, if present.
159
+ Enables checkpointing for a step.
166
160
 
167
- Note that all the values specified in parameters are added together so if you specify
168
- 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
169
161
 
170
162
 
171
163
  Parameters
172
164
  ----------
173
- seconds : int, default 0
174
- Number of seconds to wait prior to timing out.
175
- minutes : int, default 0
176
- Number of minutes to wait prior to timing out.
177
- hours : int, default 0
178
- Number of hours to wait prior to timing out.
165
+ load_policy : str, default: "fresh"
166
+ The policy for loading the checkpoint. The following policies are supported:
167
+ - "eager": Loads the the latest available checkpoint within the namespace.
168
+ With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
169
+ will be loaded at the start of the task.
170
+ - "none": Do not load any checkpoint
171
+ - "fresh": Loads the lastest checkpoint created within the running Task.
172
+ This mode helps loading checkpoints across various retry attempts of the same task.
173
+ With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
174
+ created within the task will be loaded when the task is retries execution on failure.
175
+
176
+ temp_dir_root : str, default: None
177
+ The root directory under which `current.checkpoint.directory` will be created.
179
178
  """
180
179
  ...
181
180
 
182
181
  @typing.overload
183
- def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
182
+ def checkpoint(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
184
183
  ...
185
184
 
186
185
  @typing.overload
187
- def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
186
+ def checkpoint(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
188
187
  ...
189
188
 
190
- 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):
189
+ 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):
191
190
  """
192
- Specifies a timeout for your step.
193
-
194
- This decorator is useful if this step may hang indefinitely.
195
-
196
- This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
197
- A timeout is considered to be an exception thrown by the step. It will cause the step to be
198
- retried if needed and the exception will be caught by the `@catch` decorator, if present.
199
-
200
- Note that all the values specified in parameters are added together so if you specify
201
- 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
202
-
191
+ Enables checkpointing for a step.
203
192
 
204
- Parameters
205
- ----------
206
- seconds : int, default 0
207
- Number of seconds to wait prior to timing out.
208
- minutes : int, default 0
209
- Number of minutes to wait prior to timing out.
210
- hours : int, default 0
211
- Number of hours to wait prior to timing out.
212
- """
213
- ...
214
-
215
- @typing.overload
216
- 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]]]:
217
- """
218
- Specifies environment variables to be set prior to the execution of a step.
219
193
 
220
194
 
221
195
  Parameters
222
196
  ----------
223
- vars : Dict[str, str], default {}
224
- Dictionary of environment variables to set.
225
- """
226
- ...
227
-
228
- @typing.overload
229
- def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
230
- ...
231
-
232
- @typing.overload
233
- def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
234
- ...
235
-
236
- def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
237
- """
238
- Specifies environment variables to be set prior to the execution of a step.
239
-
197
+ load_policy : str, default: "fresh"
198
+ The policy for loading the checkpoint. The following policies are supported:
199
+ - "eager": Loads the the latest available checkpoint within the namespace.
200
+ With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
201
+ will be loaded at the start of the task.
202
+ - "none": Do not load any checkpoint
203
+ - "fresh": Loads the lastest checkpoint created within the running Task.
204
+ This mode helps loading checkpoints across various retry attempts of the same task.
205
+ With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
206
+ created within the task will be loaded when the task is retries execution on failure.
240
207
 
241
- Parameters
242
- ----------
243
- vars : Dict[str, str], default {}
244
- Dictionary of environment variables to set.
208
+ temp_dir_root : str, default: None
209
+ The root directory under which `current.checkpoint.directory` will be created.
245
210
  """
246
211
  ...
247
212
 
248
- @typing.overload
249
- 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]]]:
213
+ 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]]]:
250
214
  """
251
- Specifies the PyPI packages for the step.
252
-
253
- Information in this decorator will augment any
254
- attributes set in the `@pyi_base` flow-level decorator. Hence,
255
- you can use `@pypi_base` to set packages required by all
256
- steps and use `@pypi` to specify step-specific overrides.
215
+ Specifies that this step should execute on DGX cloud.
257
216
 
258
217
 
259
218
  Parameters
260
219
  ----------
261
- packages : Dict[str, str], default: {}
262
- Packages to use for this step. The key is the name of the package
263
- and the value is the version to use.
264
- python : str, optional, default: None
265
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
266
- that the version used will correspond to the version of the Python interpreter used to start the run.
220
+ gpu : int
221
+ Number of GPUs to use.
222
+ gpu_type : str
223
+ Type of Nvidia GPU to use.
224
+ queue_timeout : int
225
+ Time to keep the job in NVCF's queue.
267
226
  """
268
227
  ...
269
228
 
270
- @typing.overload
271
- def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
272
- ...
273
-
274
- @typing.overload
275
- def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
276
- ...
277
-
278
- 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):
229
+ def ollama(*, models: "list[Ollama]", backend: 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]]]:
279
230
  """
280
- Specifies the PyPI packages for the step.
231
+ This decorator is used to run Ollama APIs as Metaflow task sidecars.
281
232
 
282
- Information in this decorator will augment any
283
- attributes set in the `@pyi_base` flow-level decorator. Hence,
284
- you can use `@pypi_base` to set packages required by all
285
- steps and use `@pypi` to specify step-specific overrides.
233
+ User code call
234
+ -----------
235
+ @ollama(
236
+ models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
237
+ backend='local'
238
+ )
286
239
 
240
+ Valid backend options
241
+ ---------------------
242
+ - 'local': Run as a separate process on the local task machine.
243
+ - (TODO) 'managed': Outerbounds hosts and selects compute provider.
244
+ - (TODO) 'remote': Spin up separate instance to serve Ollama models.
287
245
 
288
- Parameters
289
- ----------
290
- packages : Dict[str, str], default: {}
291
- Packages to use for this step. The key is the name of the package
292
- and the value is the version to use.
293
- python : str, optional, default: None
294
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
295
- that the version used will correspond to the version of the Python interpreter used to start the run.
296
- """
297
- ...
298
-
299
- 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]]]:
300
- """
301
- Specifies that this step is used to deploy an instance of the app.
302
- Requires that self.app_name, self.app_port, self.entrypoint and self.deployDir is set.
246
+ Valid model options
247
+ ----------------
248
+ - 'llama3.2'
249
+ - 'llama3.3'
250
+ - any model here https://ollama.com/search
303
251
 
304
252
 
305
253
  Parameters
306
254
  ----------
307
- app_port : int
308
- Number of GPUs to use.
309
- app_name : str
310
- Name of the app to deploy.
255
+ models: list[Ollama]
256
+ List of Ollama containers running models in sidecars.
257
+ backend: str
258
+ Determines where and how to run the Ollama process.
311
259
  """
312
260
  ...
313
261
 
@@ -361,293 +309,196 @@ def card(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typ
361
309
  ...
362
310
 
363
311
  @typing.overload
364
- 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]]]:
312
+ 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]]]:
365
313
  """
366
- Enables loading / saving of models within a step.
314
+ Specifies that the step will success under all circumstances.
367
315
 
316
+ The decorator will create an optional artifact, specified by `var`, which
317
+ contains the exception raised. You can use it to detect the presence
318
+ of errors, indicating that all happy-path artifacts produced by the step
319
+ are missing.
368
320
 
369
321
 
370
322
  Parameters
371
323
  ----------
372
- load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
373
- Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
374
- These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
375
- - `current.checkpoint`
376
- - `current.model`
377
- - `current.huggingface_hub`
378
-
379
- 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
380
- the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
381
- If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
382
-
383
- temp_dir_root : str, default: None
384
- The root directory under which `current.model.loaded` will store loaded models
324
+ var : str, optional, default None
325
+ Name of the artifact in which to store the caught exception.
326
+ If not specified, the exception is not stored.
327
+ print_exception : bool, default True
328
+ Determines whether or not the exception is printed to
329
+ stdout when caught.
385
330
  """
386
331
  ...
387
332
 
388
333
  @typing.overload
389
- def model(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
334
+ def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
390
335
  ...
391
336
 
392
337
  @typing.overload
393
- def model(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
338
+ def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
394
339
  ...
395
340
 
396
- 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):
341
+ def catch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, var: typing.Optional[str] = None, print_exception: bool = True):
397
342
  """
398
- Enables loading / saving of models within a step.
343
+ Specifies that the step will success under all circumstances.
399
344
 
345
+ The decorator will create an optional artifact, specified by `var`, which
346
+ contains the exception raised. You can use it to detect the presence
347
+ of errors, indicating that all happy-path artifacts produced by the step
348
+ are missing.
400
349
 
401
350
 
402
351
  Parameters
403
352
  ----------
404
- load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
405
- Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
406
- These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
407
- - `current.checkpoint`
408
- - `current.model`
409
- - `current.huggingface_hub`
410
-
411
- 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
412
- the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
413
- If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
414
-
415
- temp_dir_root : str, default: None
416
- The root directory under which `current.model.loaded` will store loaded models
417
- """
418
- ...
419
-
420
- @typing.overload
421
- def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
422
- """
423
- Internal decorator to support Fast bakery
353
+ var : str, optional, default None
354
+ Name of the artifact in which to store the caught exception.
355
+ If not specified, the exception is not stored.
356
+ print_exception : bool, default True
357
+ Determines whether or not the exception is printed to
358
+ stdout when caught.
424
359
  """
425
360
  ...
426
361
 
427
362
  @typing.overload
428
- def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
429
- ...
430
-
431
- def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
432
- """
433
- Internal decorator to support Fast bakery
363
+ 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]]]:
434
364
  """
435
- ...
436
-
437
- def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: typing.Optional[str] = None, image_pull_policy: str = 'KUBERNETES_IMAGE_PULL_POLICY', 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]]]:
438
- """
439
- Specifies that this step should execute on Kubernetes.
440
-
441
-
442
- Parameters
443
- ----------
444
- cpu : int, default 1
445
- Number of CPUs required for this step. If `@resources` is
446
- also present, the maximum value from all decorators is used.
447
- memory : int, default 4096
448
- Memory size (in MB) required for this step. If
449
- `@resources` is also present, the maximum value from all decorators is
450
- used.
451
- disk : int, default 10240
452
- Disk size (in MB) required for this step. If
453
- `@resources` is also present, the maximum value from all decorators is
454
- used.
455
- image : str, optional, default None
456
- Docker image to use when launching on Kubernetes. If not specified, and
457
- METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
458
- not, a default Docker image mapping to the current version of Python is used.
459
- image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
460
- If given, the imagePullPolicy to be applied to the Docker image of the step.
461
- service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
462
- Kubernetes service account to use when launching pod in Kubernetes.
463
- secrets : List[str], optional, default None
464
- Kubernetes secrets to use when launching pod in Kubernetes. These
465
- secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
466
- in Metaflow configuration.
467
- node_selector: Union[Dict[str,str], str], optional, default None
468
- Kubernetes node selector(s) to apply to the pod running the task.
469
- Can be passed in as a comma separated string of values e.g.
470
- 'kubernetes.io/os=linux,kubernetes.io/arch=amd64' or as a dictionary
471
- {'kubernetes.io/os': 'linux', 'kubernetes.io/arch': 'amd64'}
472
- namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
473
- Kubernetes namespace to use when launching pod in Kubernetes.
474
- gpu : int, optional, default None
475
- Number of GPUs required for this step. A value of zero implies that
476
- the scheduled node should not have GPUs.
477
- gpu_vendor : str, default KUBERNETES_GPU_VENDOR
478
- The vendor of the GPUs to be used for this step.
479
- tolerations : List[str], default []
480
- The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
481
- Kubernetes tolerations to use when launching pod in Kubernetes.
482
- labels: Dict[str, str], default: METAFLOW_KUBERNETES_LABELS
483
- Kubernetes labels to use when launching pod in Kubernetes.
484
- annotations: Dict[str, str], default: METAFLOW_KUBERNETES_ANNOTATIONS
485
- Kubernetes annotations to use when launching pod in Kubernetes.
486
- use_tmpfs : bool, default False
487
- This enables an explicit tmpfs mount for this step.
488
- tmpfs_tempdir : bool, default True
489
- sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
490
- tmpfs_size : int, optional, default: None
491
- The value for the size (in MiB) of the tmpfs mount for this step.
492
- This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
493
- memory allocated for this step.
494
- tmpfs_path : str, optional, default /metaflow_temp
495
- Path to tmpfs mount for this step.
496
- persistent_volume_claims : Dict[str, str], optional, default None
497
- A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
498
- volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
499
- shared_memory: int, optional
500
- Shared memory size (in MiB) required for this step
501
- port: int, optional
502
- Port number to specify in the Kubernetes job object
503
- compute_pool : str, optional, default None
504
- Compute pool to be used for for this step.
505
- If not specified, any accessible compute pool within the perimeter is used.
506
- hostname_resolution_timeout: int, default 10 * 60
507
- Timeout in seconds for the workers tasks in the gang scheduled cluster to resolve the hostname of control task.
508
- Only applicable when @parallel is used.
509
- qos: str, default: Burstable
510
- Quality of Service class to assign to the pod. Supported values are: Guaranteed, Burstable, BestEffort
365
+ Specifies a timeout for your step.
511
366
 
512
- security_context: Dict[str, Any], optional, default None
513
- Container security context. Applies to the task container. Allows the following keys:
514
- - privileged: bool, optional, default None
515
- - allow_privilege_escalation: bool, optional, default None
516
- - run_as_user: int, optional, default None
517
- - run_as_group: int, optional, default None
518
- - run_as_non_root: bool, optional, default None
519
- """
520
- ...
521
-
522
- @typing.overload
523
- 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]]]:
524
- """
525
- Specifies the number of times the task corresponding
526
- to a step needs to be retried.
367
+ This decorator is useful if this step may hang indefinitely.
527
368
 
528
- This decorator is useful for handling transient errors, such as networking issues.
529
- If your task contains operations that can't be retried safely, e.g. database updates,
530
- it is advisable to annotate it with `@retry(times=0)`.
369
+ This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
370
+ A timeout is considered to be an exception thrown by the step. It will cause the step to be
371
+ retried if needed and the exception will be caught by the `@catch` decorator, if present.
531
372
 
532
- This can be used in conjunction with the `@catch` decorator. The `@catch`
533
- decorator will execute a no-op task after all retries have been exhausted,
534
- ensuring that the flow execution can continue.
373
+ Note that all the values specified in parameters are added together so if you specify
374
+ 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
535
375
 
536
376
 
537
377
  Parameters
538
378
  ----------
539
- times : int, default 3
540
- Number of times to retry this task.
541
- minutes_between_retries : int, default 2
542
- Number of minutes between retries.
379
+ seconds : int, default 0
380
+ Number of seconds to wait prior to timing out.
381
+ minutes : int, default 0
382
+ Number of minutes to wait prior to timing out.
383
+ hours : int, default 0
384
+ Number of hours to wait prior to timing out.
543
385
  """
544
386
  ...
545
387
 
546
388
  @typing.overload
547
- def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
389
+ def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
548
390
  ...
549
391
 
550
392
  @typing.overload
551
- def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
393
+ def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
552
394
  ...
553
395
 
554
- def retry(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, times: int = 3, minutes_between_retries: int = 2):
396
+ 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):
555
397
  """
556
- Specifies the number of times the task corresponding
557
- to a step needs to be retried.
398
+ Specifies a timeout for your step.
558
399
 
559
- This decorator is useful for handling transient errors, such as networking issues.
560
- If your task contains operations that can't be retried safely, e.g. database updates,
561
- it is advisable to annotate it with `@retry(times=0)`.
400
+ This decorator is useful if this step may hang indefinitely.
562
401
 
563
- This can be used in conjunction with the `@catch` decorator. The `@catch`
564
- decorator will execute a no-op task after all retries have been exhausted,
565
- ensuring that the flow execution can continue.
402
+ This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
403
+ A timeout is considered to be an exception thrown by the step. It will cause the step to be
404
+ retried if needed and the exception will be caught by the `@catch` decorator, if present.
405
+
406
+ Note that all the values specified in parameters are added together so if you specify
407
+ 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
566
408
 
567
409
 
568
410
  Parameters
569
411
  ----------
570
- times : int, default 3
571
- Number of times to retry this task.
572
- minutes_between_retries : int, default 2
573
- Number of minutes between retries.
412
+ seconds : int, default 0
413
+ Number of seconds to wait prior to timing out.
414
+ minutes : int, default 0
415
+ Number of minutes to wait prior to timing out.
416
+ hours : int, default 0
417
+ Number of hours to wait prior to timing out.
574
418
  """
575
419
  ...
576
420
 
577
421
  @typing.overload
578
- def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
422
+ 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]]]:
579
423
  """
580
- Decorator prototype for all step decorators. This function gets specialized
581
- and imported for all decorators types by _import_plugin_decorators().
424
+ Specifies the PyPI packages for the step.
425
+
426
+ Information in this decorator will augment any
427
+ attributes set in the `@pyi_base` flow-level decorator. Hence,
428
+ you can use `@pypi_base` to set packages required by all
429
+ steps and use `@pypi` to specify step-specific overrides.
430
+
431
+
432
+ Parameters
433
+ ----------
434
+ packages : Dict[str, str], default: {}
435
+ Packages to use for this step. The key is the name of the package
436
+ and the value is the version to use.
437
+ python : str, optional, default: None
438
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
439
+ that the version used will correspond to the version of the Python interpreter used to start the run.
582
440
  """
583
441
  ...
584
442
 
585
443
  @typing.overload
586
- def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
444
+ def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
587
445
  ...
588
446
 
589
- def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
447
+ @typing.overload
448
+ def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
449
+ ...
450
+
451
+ 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):
590
452
  """
591
- Decorator prototype for all step decorators. This function gets specialized
592
- and imported for all decorators types by _import_plugin_decorators().
453
+ Specifies the PyPI packages for the step.
454
+
455
+ Information in this decorator will augment any
456
+ attributes set in the `@pyi_base` flow-level decorator. Hence,
457
+ you can use `@pypi_base` to set packages required by all
458
+ steps and use `@pypi` to specify step-specific overrides.
459
+
460
+
461
+ Parameters
462
+ ----------
463
+ packages : Dict[str, str], default: {}
464
+ Packages to use for this step. The key is the name of the package
465
+ and the value is the version to use.
466
+ python : str, optional, default: None
467
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
468
+ that the version used will correspond to the version of the Python interpreter used to start the run.
593
469
  """
594
470
  ...
595
471
 
596
- def ollama(*, models: "list[Ollama]", backend: 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]]]:
472
+ def nim(*, models: "list[NIM]", backend: 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]]]:
597
473
  """
598
- This decorator is used to run Ollama APIs as Metaflow task sidecars.
474
+ This decorator is used to run NIM containers in Metaflow tasks as sidecars.
599
475
 
600
476
  User code call
601
477
  -----------
602
- @ollama(
478
+ @nim(
603
479
  models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
604
- backend='local'
480
+ backend='managed'
605
481
  )
606
482
 
607
483
  Valid backend options
608
484
  ---------------------
609
- - 'local': Run as a separate process on the local task machine.
610
- - (TODO) 'managed': Outerbounds hosts and selects compute provider.
611
- - (TODO) 'remote': Spin up separate instance to serve Ollama models.
485
+ - 'managed': Outerbounds selects a compute provider based on the model.
612
486
 
613
487
  Valid model options
614
488
  ----------------
615
- - 'llama3.2'
616
- - 'llama3.3'
617
- - any model here https://ollama.com/search
489
+ - 'meta/llama3-8b-instruct': 8B parameter model
490
+ - 'meta/llama3-70b-instruct': 70B parameter model
491
+ - any model here: https://nvcf.ngc.nvidia.com/functions?filter=nvidia-functions
618
492
 
619
493
 
620
494
  Parameters
621
495
  ----------
622
- models: list[Ollama]
623
- List of Ollama containers running models in sidecars.
496
+ models: list[NIM]
497
+ List of NIM containers running models in sidecars.
624
498
  backend: str
625
- Determines where and how to run the Ollama process.
626
- """
627
- ...
628
-
629
- 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]]]:
630
- """
631
- Decorator that helps cache, version and store models/datasets from huggingface hub.
632
-
633
-
634
- Parameters
635
- ----------
636
- temp_dir_root : str, optional
637
- The root directory that will hold the temporary directory where objects will be downloaded.
638
-
639
- load: Union[List[str], List[Tuple[Dict, str]], List[Tuple[str, str]], List[Dict], None]
640
- The list of repos (models/datasets) to load.
641
-
642
- Loaded repos can be accessed via `current.huggingface_hub.loaded`. If load is set, then the following happens:
643
-
644
- - If repo (model/dataset) is not found in the datastore:
645
- - Downloads the repo from Hugging Face Hub to a temporary directory (or uses specified path) for local access
646
- - Stores it in Metaflow's datastore (s3/gcs/azure etc.) with a unique name based on repo_type/repo_id
647
- - All HF models loaded for a `@step` will be cached separately under flow/step/namespace.
648
-
649
- - If repo is found in the datastore:
650
- - Loads it directly from datastore to local path (can be temporary directory or specified path)
499
+ Compute provider to run the NIM container.
500
+ queue_timeout : int
501
+ Time to keep the job in NVCF's queue.
651
502
  """
652
503
  ...
653
504
 
@@ -731,112 +582,67 @@ def resources(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None]
731
582
  ...
732
583
 
733
584
  @typing.overload
734
- 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]]]:
585
+ def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
735
586
  """
736
- Specifies the Conda environment for the step.
737
-
738
- Information in this decorator will augment any
739
- attributes set in the `@conda_base` flow-level decorator. Hence,
740
- you can use `@conda_base` to set packages required by all
741
- steps and use `@conda` to specify step-specific overrides.
742
-
743
-
744
- Parameters
745
- ----------
746
- packages : Dict[str, str], default {}
747
- Packages to use for this step. The key is the name of the package
748
- and the value is the version to use.
749
- libraries : Dict[str, str], default {}
750
- Supported for backward compatibility. When used with packages, packages will take precedence.
751
- python : str, optional, default None
752
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
753
- that the version used will correspond to the version of the Python interpreter used to start the run.
754
- disabled : bool, default False
755
- If set to True, disables @conda.
587
+ Internal decorator to support Fast bakery
756
588
  """
757
589
  ...
758
590
 
759
591
  @typing.overload
760
- def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
761
- ...
762
-
763
- @typing.overload
764
- def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
592
+ def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
765
593
  ...
766
594
 
767
- 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):
595
+ def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
768
596
  """
769
- Specifies the Conda environment for the step.
770
-
771
- Information in this decorator will augment any
772
- attributes set in the `@conda_base` flow-level decorator. Hence,
773
- you can use `@conda_base` to set packages required by all
774
- steps and use `@conda` to specify step-specific overrides.
775
-
776
-
777
- Parameters
778
- ----------
779
- packages : Dict[str, str], default {}
780
- Packages to use for this step. The key is the name of the package
781
- and the value is the version to use.
782
- libraries : Dict[str, str], default {}
783
- Supported for backward compatibility. When used with packages, packages will take precedence.
784
- python : str, optional, default None
785
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
786
- that the version used will correspond to the version of the Python interpreter used to start the run.
787
- disabled : bool, default False
788
- If set to True, disables @conda.
597
+ Internal decorator to support Fast bakery
789
598
  """
790
599
  ...
791
600
 
792
601
  @typing.overload
793
- 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]]]:
602
+ 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]]]:
794
603
  """
795
- Specifies secrets to be retrieved and injected as environment variables prior to
796
- the execution of a step.
604
+ Specifies environment variables to be set prior to the execution of a step.
797
605
 
798
606
 
799
607
  Parameters
800
608
  ----------
801
- sources : List[Union[str, Dict[str, Any]]], default: []
802
- List of secret specs, defining how the secrets are to be retrieved
609
+ vars : Dict[str, str], default {}
610
+ Dictionary of environment variables to set.
803
611
  """
804
612
  ...
805
613
 
806
614
  @typing.overload
807
- def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
615
+ def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
808
616
  ...
809
617
 
810
618
  @typing.overload
811
- def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
619
+ def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
812
620
  ...
813
621
 
814
- 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]]] = []):
622
+ def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
815
623
  """
816
- Specifies secrets to be retrieved and injected as environment variables prior to
817
- the execution of a step.
624
+ Specifies environment variables to be set prior to the execution of a step.
818
625
 
819
626
 
820
627
  Parameters
821
628
  ----------
822
- sources : List[Union[str, Dict[str, Any]]], default: []
823
- List of secret specs, defining how the secrets are to be retrieved
629
+ vars : Dict[str, str], default {}
630
+ Dictionary of environment variables to set.
824
631
  """
825
632
  ...
826
633
 
827
- 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]]]:
634
+ 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]]]:
828
635
  """
829
- Specifies that this step should execute on DGX cloud.
636
+ Specifies that this step is used to deploy an instance of the app.
637
+ Requires that self.app_name, self.app_port, self.entrypoint and self.deployDir is set.
830
638
 
831
639
 
832
640
  Parameters
833
641
  ----------
834
- gpu : int
642
+ app_port : int
835
643
  Number of GPUs to use.
836
- gpu_type : str
837
- Type of Nvidia GPU to use.
838
- queue_timeout : int
839
- Time to keep the job in NVCF's queue.
644
+ app_name : str
645
+ Name of the app to deploy.
840
646
  """
841
647
  ...
842
648
 
@@ -854,144 +660,338 @@ def nvct(*, gpu: int, gpu_type: str) -> typing.Callable[[typing.Union[typing.Cal
854
660
  """
855
661
  ...
856
662
 
663
+ 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]]]:
664
+ """
665
+ Decorator that helps cache, version and store models/datasets from huggingface hub.
666
+
667
+
668
+ Parameters
669
+ ----------
670
+ temp_dir_root : str, optional
671
+ The root directory that will hold the temporary directory where objects will be downloaded.
672
+
673
+ load: Union[List[str], List[Tuple[Dict, str]], List[Tuple[str, str]], List[Dict], None]
674
+ The list of repos (models/datasets) to load.
675
+
676
+ Loaded repos can be accessed via `current.huggingface_hub.loaded`. If load is set, then the following happens:
677
+
678
+ - If repo (model/dataset) is not found in the datastore:
679
+ - Downloads the repo from Hugging Face Hub to a temporary directory (or uses specified path) for local access
680
+ - Stores it in Metaflow's datastore (s3/gcs/azure etc.) with a unique name based on repo_type/repo_id
681
+ - All HF models loaded for a `@step` will be cached separately under flow/step/namespace.
682
+
683
+ - If repo is found in the datastore:
684
+ - Loads it directly from datastore to local path (can be temporary directory or specified path)
685
+ """
686
+ ...
687
+
857
688
  @typing.overload
858
- 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]]]:
689
+ 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]]]:
859
690
  """
860
- Specifies that the step will success under all circumstances.
691
+ Enables loading / saving of models within a step.
861
692
 
862
- The decorator will create an optional artifact, specified by `var`, which
863
- contains the exception raised. You can use it to detect the presence
864
- of errors, indicating that all happy-path artifacts produced by the step
865
- are missing.
866
693
 
867
694
 
868
695
  Parameters
869
696
  ----------
870
- var : str, optional, default None
871
- Name of the artifact in which to store the caught exception.
872
- If not specified, the exception is not stored.
873
- print_exception : bool, default True
874
- Determines whether or not the exception is printed to
875
- stdout when caught.
697
+ load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
698
+ Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
699
+ These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
700
+ - `current.checkpoint`
701
+ - `current.model`
702
+ - `current.huggingface_hub`
703
+
704
+ 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
705
+ the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
706
+ If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
707
+
708
+ temp_dir_root : str, default: None
709
+ The root directory under which `current.model.loaded` will store loaded models
876
710
  """
877
711
  ...
878
712
 
879
713
  @typing.overload
880
- def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
714
+ def model(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
881
715
  ...
882
716
 
883
717
  @typing.overload
884
- def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
718
+ def model(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
885
719
  ...
886
720
 
887
- def catch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, var: typing.Optional[str] = None, print_exception: bool = True):
721
+ 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):
888
722
  """
889
- Specifies that the step will success under all circumstances.
723
+ Enables loading / saving of models within a step.
890
724
 
891
- The decorator will create an optional artifact, specified by `var`, which
892
- contains the exception raised. You can use it to detect the presence
893
- of errors, indicating that all happy-path artifacts produced by the step
894
- are missing.
895
725
 
896
726
 
897
727
  Parameters
898
728
  ----------
899
- var : str, optional, default None
900
- Name of the artifact in which to store the caught exception.
901
- If not specified, the exception is not stored.
902
- print_exception : bool, default True
903
- Determines whether or not the exception is printed to
904
- stdout when caught.
729
+ load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
730
+ Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
731
+ These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
732
+ - `current.checkpoint`
733
+ - `current.model`
734
+ - `current.huggingface_hub`
735
+
736
+ 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
737
+ the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
738
+ If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
739
+
740
+ temp_dir_root : str, default: None
741
+ The root directory under which `current.model.loaded` will store loaded models
905
742
  """
906
743
  ...
907
744
 
908
- def nim(*, models: "list[NIM]", backend: 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]]]:
745
+ @typing.overload
746
+ 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]]]:
909
747
  """
910
- This decorator is used to run NIM containers in Metaflow tasks as sidecars.
748
+ Specifies secrets to be retrieved and injected as environment variables prior to
749
+ the execution of a step.
911
750
 
912
- User code call
913
- -----------
914
- @nim(
915
- models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
916
- backend='managed'
917
- )
918
751
 
919
- Valid backend options
920
- ---------------------
921
- - 'managed': Outerbounds selects a compute provider based on the model.
752
+ Parameters
753
+ ----------
754
+ sources : List[Union[str, Dict[str, Any]]], default: []
755
+ List of secret specs, defining how the secrets are to be retrieved
756
+ """
757
+ ...
758
+
759
+ @typing.overload
760
+ def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
761
+ ...
762
+
763
+ @typing.overload
764
+ def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
765
+ ...
766
+
767
+ 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]]] = []):
768
+ """
769
+ Specifies secrets to be retrieved and injected as environment variables prior to
770
+ the execution of a step.
922
771
 
923
- Valid model options
924
- ----------------
925
- - 'meta/llama3-8b-instruct': 8B parameter model
926
- - 'meta/llama3-70b-instruct': 70B parameter model
927
- - any model here: https://nvcf.ngc.nvidia.com/functions?filter=nvidia-functions
772
+
773
+ Parameters
774
+ ----------
775
+ sources : List[Union[str, Dict[str, Any]]], default: []
776
+ List of secret specs, defining how the secrets are to be retrieved
777
+ """
778
+ ...
779
+
780
+ def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: typing.Optional[str] = None, image_pull_policy: str = 'KUBERNETES_IMAGE_PULL_POLICY', 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]]]:
781
+ """
782
+ Specifies that this step should execute on Kubernetes.
928
783
 
929
784
 
930
785
  Parameters
931
786
  ----------
932
- models: list[NIM]
933
- List of NIM containers running models in sidecars.
934
- backend: str
935
- Compute provider to run the NIM container.
936
- queue_timeout : int
937
- Time to keep the job in NVCF's queue.
787
+ cpu : int, default 1
788
+ Number of CPUs required for this step. If `@resources` is
789
+ also present, the maximum value from all decorators is used.
790
+ memory : int, default 4096
791
+ Memory size (in MB) required for this step. If
792
+ `@resources` is also present, the maximum value from all decorators is
793
+ used.
794
+ disk : int, default 10240
795
+ Disk size (in MB) required for this step. If
796
+ `@resources` is also present, the maximum value from all decorators is
797
+ used.
798
+ image : str, optional, default None
799
+ Docker image to use when launching on Kubernetes. If not specified, and
800
+ METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
801
+ not, a default Docker image mapping to the current version of Python is used.
802
+ image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
803
+ If given, the imagePullPolicy to be applied to the Docker image of the step.
804
+ service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
805
+ Kubernetes service account to use when launching pod in Kubernetes.
806
+ secrets : List[str], optional, default None
807
+ Kubernetes secrets to use when launching pod in Kubernetes. These
808
+ secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
809
+ in Metaflow configuration.
810
+ node_selector: Union[Dict[str,str], str], optional, default None
811
+ Kubernetes node selector(s) to apply to the pod running the task.
812
+ Can be passed in as a comma separated string of values e.g.
813
+ 'kubernetes.io/os=linux,kubernetes.io/arch=amd64' or as a dictionary
814
+ {'kubernetes.io/os': 'linux', 'kubernetes.io/arch': 'amd64'}
815
+ namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
816
+ Kubernetes namespace to use when launching pod in Kubernetes.
817
+ gpu : int, optional, default None
818
+ Number of GPUs required for this step. A value of zero implies that
819
+ the scheduled node should not have GPUs.
820
+ gpu_vendor : str, default KUBERNETES_GPU_VENDOR
821
+ The vendor of the GPUs to be used for this step.
822
+ tolerations : List[str], default []
823
+ The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
824
+ Kubernetes tolerations to use when launching pod in Kubernetes.
825
+ labels: Dict[str, str], default: METAFLOW_KUBERNETES_LABELS
826
+ Kubernetes labels to use when launching pod in Kubernetes.
827
+ annotations: Dict[str, str], default: METAFLOW_KUBERNETES_ANNOTATIONS
828
+ Kubernetes annotations to use when launching pod in Kubernetes.
829
+ use_tmpfs : bool, default False
830
+ This enables an explicit tmpfs mount for this step.
831
+ tmpfs_tempdir : bool, default True
832
+ sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
833
+ tmpfs_size : int, optional, default: None
834
+ The value for the size (in MiB) of the tmpfs mount for this step.
835
+ This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
836
+ memory allocated for this step.
837
+ tmpfs_path : str, optional, default /metaflow_temp
838
+ Path to tmpfs mount for this step.
839
+ persistent_volume_claims : Dict[str, str], optional, default None
840
+ A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
841
+ volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
842
+ shared_memory: int, optional
843
+ Shared memory size (in MiB) required for this step
844
+ port: int, optional
845
+ Port number to specify in the Kubernetes job object
846
+ compute_pool : str, optional, default None
847
+ Compute pool to be used for for this step.
848
+ If not specified, any accessible compute pool within the perimeter is used.
849
+ hostname_resolution_timeout: int, default 10 * 60
850
+ Timeout in seconds for the workers tasks in the gang scheduled cluster to resolve the hostname of control task.
851
+ Only applicable when @parallel is used.
852
+ qos: str, default: Burstable
853
+ Quality of Service class to assign to the pod. Supported values are: Guaranteed, Burstable, BestEffort
854
+
855
+ security_context: Dict[str, Any], optional, default None
856
+ Container security context. Applies to the task container. Allows the following keys:
857
+ - privileged: bool, optional, default None
858
+ - allow_privilege_escalation: bool, optional, default None
859
+ - run_as_user: int, optional, default None
860
+ - run_as_group: int, optional, default None
861
+ - run_as_non_root: bool, optional, default None
938
862
  """
939
863
  ...
940
864
 
941
865
  @typing.overload
942
- 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]]]:
866
+ def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
943
867
  """
944
- Enables checkpointing for a step.
868
+ Decorator prototype for all step decorators. This function gets specialized
869
+ and imported for all decorators types by _import_plugin_decorators().
870
+ """
871
+ ...
872
+
873
+ @typing.overload
874
+ def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
875
+ ...
876
+
877
+ def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
878
+ """
879
+ Decorator prototype for all step decorators. This function gets specialized
880
+ and imported for all decorators types by _import_plugin_decorators().
881
+ """
882
+ ...
883
+
884
+ @typing.overload
885
+ 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]]]:
886
+ """
887
+ Specifies the number of times the task corresponding
888
+ to a step needs to be retried.
945
889
 
890
+ This decorator is useful for handling transient errors, such as networking issues.
891
+ If your task contains operations that can't be retried safely, e.g. database updates,
892
+ it is advisable to annotate it with `@retry(times=0)`.
893
+
894
+ This can be used in conjunction with the `@catch` decorator. The `@catch`
895
+ decorator will execute a no-op task after all retries have been exhausted,
896
+ ensuring that the flow execution can continue.
946
897
 
947
898
 
948
899
  Parameters
949
900
  ----------
950
- load_policy : str, default: "fresh"
951
- The policy for loading the checkpoint. The following policies are supported:
952
- - "eager": Loads the the latest available checkpoint within the namespace.
953
- With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
954
- will be loaded at the start of the task.
955
- - "none": Do not load any checkpoint
956
- - "fresh": Loads the lastest checkpoint created within the running Task.
957
- This mode helps loading checkpoints across various retry attempts of the same task.
958
- With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
959
- created within the task will be loaded when the task is retries execution on failure.
960
-
961
- temp_dir_root : str, default: None
962
- The root directory under which `current.checkpoint.directory` will be created.
901
+ times : int, default 3
902
+ Number of times to retry this task.
903
+ minutes_between_retries : int, default 2
904
+ Number of minutes between retries.
963
905
  """
964
906
  ...
965
907
 
966
908
  @typing.overload
967
- def checkpoint(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
909
+ def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
968
910
  ...
969
911
 
970
912
  @typing.overload
971
- def checkpoint(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
913
+ def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
972
914
  ...
973
915
 
974
- 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):
916
+ def retry(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, times: int = 3, minutes_between_retries: int = 2):
975
917
  """
976
- Enables checkpointing for a step.
918
+ Specifies the number of times the task corresponding
919
+ to a step needs to be retried.
920
+
921
+ This decorator is useful for handling transient errors, such as networking issues.
922
+ If your task contains operations that can't be retried safely, e.g. database updates,
923
+ it is advisable to annotate it with `@retry(times=0)`.
977
924
 
925
+ This can be used in conjunction with the `@catch` decorator. The `@catch`
926
+ decorator will execute a no-op task after all retries have been exhausted,
927
+ ensuring that the flow execution can continue.
978
928
 
979
929
 
980
930
  Parameters
981
931
  ----------
982
- load_policy : str, default: "fresh"
983
- The policy for loading the checkpoint. The following policies are supported:
984
- - "eager": Loads the the latest available checkpoint within the namespace.
985
- With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
986
- will be loaded at the start of the task.
987
- - "none": Do not load any checkpoint
988
- - "fresh": Loads the lastest checkpoint created within the running Task.
989
- This mode helps loading checkpoints across various retry attempts of the same task.
990
- With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
991
- created within the task will be loaded when the task is retries execution on failure.
932
+ times : int, default 3
933
+ Number of times to retry this task.
934
+ minutes_between_retries : int, default 2
935
+ Number of minutes between retries.
936
+ """
937
+ ...
938
+
939
+ @typing.overload
940
+ 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]]]:
941
+ """
942
+ Specifies the Conda environment for the step.
992
943
 
993
- temp_dir_root : str, default: None
994
- The root directory under which `current.checkpoint.directory` will be created.
944
+ Information in this decorator will augment any
945
+ attributes set in the `@conda_base` flow-level decorator. Hence,
946
+ you can use `@conda_base` to set packages required by all
947
+ steps and use `@conda` to specify step-specific overrides.
948
+
949
+
950
+ Parameters
951
+ ----------
952
+ packages : Dict[str, str], default {}
953
+ Packages to use for this step. The key is the name of the package
954
+ and the value is the version to use.
955
+ libraries : Dict[str, str], default {}
956
+ Supported for backward compatibility. When used with packages, packages will take precedence.
957
+ python : str, optional, default None
958
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
959
+ that the version used will correspond to the version of the Python interpreter used to start the run.
960
+ disabled : bool, default False
961
+ If set to True, disables @conda.
962
+ """
963
+ ...
964
+
965
+ @typing.overload
966
+ def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
967
+ ...
968
+
969
+ @typing.overload
970
+ def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
971
+ ...
972
+
973
+ 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):
974
+ """
975
+ Specifies the Conda environment for the step.
976
+
977
+ Information in this decorator will augment any
978
+ attributes set in the `@conda_base` flow-level decorator. Hence,
979
+ you can use `@conda_base` to set packages required by all
980
+ steps and use `@conda` to specify step-specific overrides.
981
+
982
+
983
+ Parameters
984
+ ----------
985
+ packages : Dict[str, str], default {}
986
+ Packages to use for this step. The key is the name of the package
987
+ and the value is the version to use.
988
+ libraries : Dict[str, str], default {}
989
+ Supported for backward compatibility. When used with packages, packages will take precedence.
990
+ python : str, optional, default None
991
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
992
+ that the version used will correspond to the version of the Python interpreter used to start the run.
993
+ disabled : bool, default False
994
+ If set to True, disables @conda.
995
995
  """
996
996
  ...
997
997
 
@@ -1088,6 +1088,49 @@ def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, event: t
1088
1088
  """
1089
1089
  ...
1090
1090
 
1091
+ 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]]:
1092
+ """
1093
+ 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.
1094
+ 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.
1095
+
1096
+
1097
+ Parameters
1098
+ ----------
1099
+ timeout : int
1100
+ Time, in seconds before the task times out and fails. (Default: 3600)
1101
+ poke_interval : int
1102
+ Time in seconds that the job should wait in between each try. (Default: 60)
1103
+ mode : str
1104
+ How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1105
+ exponential_backoff : bool
1106
+ allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1107
+ pool : str
1108
+ the slot pool this task should run in,
1109
+ slot pools are a way to limit concurrency for certain tasks. (Default:None)
1110
+ soft_fail : bool
1111
+ Set to true to mark the task as SKIPPED on failure. (Default: False)
1112
+ name : str
1113
+ Name of the sensor on Airflow
1114
+ description : str
1115
+ Description of sensor in the Airflow UI
1116
+ external_dag_id : str
1117
+ The dag_id that contains the task you want to wait for.
1118
+ external_task_ids : List[str]
1119
+ The list of task_ids that you want to wait for.
1120
+ If None (default value) the sensor waits for the DAG. (Default: None)
1121
+ allowed_states : List[str]
1122
+ Iterable of allowed states, (Default: ['success'])
1123
+ failed_states : List[str]
1124
+ Iterable of failed or dis-allowed states. (Default: None)
1125
+ execution_delta : datetime.timedelta
1126
+ time difference with the previous execution to look at,
1127
+ the default is the same logical date as the current task or DAG. (Default: None)
1128
+ check_existence: bool
1129
+ Set to True to check if the external task exists or check if
1130
+ the DAG to wait for exists. (Default: True)
1131
+ """
1132
+ ...
1133
+
1091
1134
  @typing.overload
1092
1135
  def schedule(*, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: typing.Optional[str] = None, timezone: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1093
1136
  """
@@ -1124,18 +1167,213 @@ def schedule(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, hourly:
1124
1167
 
1125
1168
  Parameters
1126
1169
  ----------
1127
- hourly : bool, default False
1128
- Run the workflow hourly.
1129
- daily : bool, default True
1130
- Run the workflow daily.
1131
- weekly : bool, default False
1132
- Run the workflow weekly.
1133
- cron : str, optional, default None
1134
- Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1135
- specified by this expression.
1136
- timezone : str, optional, default None
1137
- Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1138
- which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1170
+ hourly : bool, default False
1171
+ Run the workflow hourly.
1172
+ daily : bool, default True
1173
+ Run the workflow daily.
1174
+ weekly : bool, default False
1175
+ Run the workflow weekly.
1176
+ cron : str, optional, default None
1177
+ Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1178
+ specified by this expression.
1179
+ timezone : str, optional, default None
1180
+ Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1181
+ which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1182
+ """
1183
+ ...
1184
+
1185
+ def airflow_s3_key_sensor(*, timeout: int, poke_interval: int, mode: str, exponential_backoff: bool, pool: str, soft_fail: bool, name: str, description: str, bucket_key: typing.Union[str, typing.List[str]], bucket_name: str, wildcard_match: bool, aws_conn_id: str, verify: bool) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1186
+ """
1187
+ The `@airflow_s3_key_sensor` decorator attaches a Airflow [S3KeySensor](https://airflow.apache.org/docs/apache-airflow-providers-amazon/stable/_api/airflow/providers/amazon/aws/sensors/s3/index.html#airflow.providers.amazon.aws.sensors.s3.S3KeySensor)
1188
+ before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
1189
+ and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
1190
+ added as a flow decorators. Adding more than one decorator will ensure that `start` step
1191
+ starts only after all sensors finish.
1192
+
1193
+
1194
+ Parameters
1195
+ ----------
1196
+ timeout : int
1197
+ Time, in seconds before the task times out and fails. (Default: 3600)
1198
+ poke_interval : int
1199
+ Time in seconds that the job should wait in between each try. (Default: 60)
1200
+ mode : str
1201
+ How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1202
+ exponential_backoff : bool
1203
+ allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1204
+ pool : str
1205
+ the slot pool this task should run in,
1206
+ slot pools are a way to limit concurrency for certain tasks. (Default:None)
1207
+ soft_fail : bool
1208
+ Set to true to mark the task as SKIPPED on failure. (Default: False)
1209
+ name : str
1210
+ Name of the sensor on Airflow
1211
+ description : str
1212
+ Description of sensor in the Airflow UI
1213
+ bucket_key : Union[str, List[str]]
1214
+ The key(s) being waited on. Supports full s3:// style url or relative path from root level.
1215
+ When it's specified as a full s3:// url, please leave `bucket_name` as None
1216
+ bucket_name : str
1217
+ Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
1218
+ When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
1219
+ wildcard_match : bool
1220
+ whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
1221
+ aws_conn_id : str
1222
+ a reference to the s3 connection on Airflow. (Default: None)
1223
+ verify : bool
1224
+ Whether or not to verify SSL certificates for S3 connection. (Default: None)
1225
+ """
1226
+ ...
1227
+
1228
+ @typing.overload
1229
+ 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]]:
1230
+ """
1231
+ Specifies the Conda environment for all steps of the flow.
1232
+
1233
+ Use `@conda_base` to set common libraries required by all
1234
+ steps and use `@conda` to specify step-specific additions.
1235
+
1236
+
1237
+ Parameters
1238
+ ----------
1239
+ packages : Dict[str, str], default {}
1240
+ Packages to use for this flow. The key is the name of the package
1241
+ and the value is the version to use.
1242
+ libraries : Dict[str, str], default {}
1243
+ Supported for backward compatibility. When used with packages, packages will take precedence.
1244
+ python : str, optional, default None
1245
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1246
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1247
+ disabled : bool, default False
1248
+ If set to True, disables Conda.
1249
+ """
1250
+ ...
1251
+
1252
+ @typing.overload
1253
+ def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1254
+ ...
1255
+
1256
+ 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):
1257
+ """
1258
+ Specifies the Conda environment for all steps of the flow.
1259
+
1260
+ Use `@conda_base` to set common libraries required by all
1261
+ steps and use `@conda` to specify step-specific additions.
1262
+
1263
+
1264
+ Parameters
1265
+ ----------
1266
+ packages : Dict[str, str], default {}
1267
+ Packages to use for this flow. The key is the name of the package
1268
+ and the value is the version to use.
1269
+ libraries : Dict[str, str], default {}
1270
+ Supported for backward compatibility. When used with packages, packages will take precedence.
1271
+ python : str, optional, default None
1272
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1273
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1274
+ disabled : bool, default False
1275
+ If set to True, disables Conda.
1276
+ """
1277
+ ...
1278
+
1279
+ @typing.overload
1280
+ 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]]:
1281
+ """
1282
+ Specifies the flow(s) that this flow depends on.
1283
+
1284
+ ```
1285
+ @trigger_on_finish(flow='FooFlow')
1286
+ ```
1287
+ or
1288
+ ```
1289
+ @trigger_on_finish(flows=['FooFlow', 'BarFlow'])
1290
+ ```
1291
+ This decorator respects the @project decorator and triggers the flow
1292
+ when upstream runs within the same namespace complete successfully
1293
+
1294
+ Additionally, you can specify project aware upstream flow dependencies
1295
+ by specifying the fully qualified project_flow_name.
1296
+ ```
1297
+ @trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
1298
+ ```
1299
+ or
1300
+ ```
1301
+ @trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
1302
+ ```
1303
+
1304
+ You can also specify just the project or project branch (other values will be
1305
+ inferred from the current project or project branch):
1306
+ ```
1307
+ @trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
1308
+ ```
1309
+
1310
+ Note that `branch` is typically one of:
1311
+ - `prod`
1312
+ - `user.bob`
1313
+ - `test.my_experiment`
1314
+ - `prod.staging`
1315
+
1316
+
1317
+ Parameters
1318
+ ----------
1319
+ flow : Union[str, Dict[str, str]], optional, default None
1320
+ Upstream flow dependency for this flow.
1321
+ flows : List[Union[str, Dict[str, str]]], default []
1322
+ Upstream flow dependencies for this flow.
1323
+ options : Dict[str, Any], default {}
1324
+ Backend-specific configuration for tuning eventing behavior.
1325
+ """
1326
+ ...
1327
+
1328
+ @typing.overload
1329
+ def trigger_on_finish(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1330
+ ...
1331
+
1332
+ 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] = {}):
1333
+ """
1334
+ Specifies the flow(s) that this flow depends on.
1335
+
1336
+ ```
1337
+ @trigger_on_finish(flow='FooFlow')
1338
+ ```
1339
+ or
1340
+ ```
1341
+ @trigger_on_finish(flows=['FooFlow', 'BarFlow'])
1342
+ ```
1343
+ This decorator respects the @project decorator and triggers the flow
1344
+ when upstream runs within the same namespace complete successfully
1345
+
1346
+ Additionally, you can specify project aware upstream flow dependencies
1347
+ by specifying the fully qualified project_flow_name.
1348
+ ```
1349
+ @trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
1350
+ ```
1351
+ or
1352
+ ```
1353
+ @trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
1354
+ ```
1355
+
1356
+ You can also specify just the project or project branch (other values will be
1357
+ inferred from the current project or project branch):
1358
+ ```
1359
+ @trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
1360
+ ```
1361
+
1362
+ Note that `branch` is typically one of:
1363
+ - `prod`
1364
+ - `user.bob`
1365
+ - `test.my_experiment`
1366
+ - `prod.staging`
1367
+
1368
+
1369
+ Parameters
1370
+ ----------
1371
+ flow : Union[str, Dict[str, str]], optional, default None
1372
+ Upstream flow dependency for this flow.
1373
+ flows : List[Union[str, Dict[str, str]]], default []
1374
+ Upstream flow dependencies for this flow.
1375
+ options : Dict[str, Any], default {}
1376
+ Backend-specific configuration for tuning eventing behavior.
1139
1377
  """
1140
1378
  ...
1141
1379
 
@@ -1253,201 +1491,6 @@ def with_artifact_store(f: typing.Optional[typing.Type[FlowSpecDerived]] = None)
1253
1491
  """
1254
1492
  ...
1255
1493
 
1256
- @typing.overload
1257
- 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]]:
1258
- """
1259
- Specifies the flow(s) that this flow depends on.
1260
-
1261
- ```
1262
- @trigger_on_finish(flow='FooFlow')
1263
- ```
1264
- or
1265
- ```
1266
- @trigger_on_finish(flows=['FooFlow', 'BarFlow'])
1267
- ```
1268
- This decorator respects the @project decorator and triggers the flow
1269
- when upstream runs within the same namespace complete successfully
1270
-
1271
- Additionally, you can specify project aware upstream flow dependencies
1272
- by specifying the fully qualified project_flow_name.
1273
- ```
1274
- @trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
1275
- ```
1276
- or
1277
- ```
1278
- @trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
1279
- ```
1280
-
1281
- You can also specify just the project or project branch (other values will be
1282
- inferred from the current project or project branch):
1283
- ```
1284
- @trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
1285
- ```
1286
-
1287
- Note that `branch` is typically one of:
1288
- - `prod`
1289
- - `user.bob`
1290
- - `test.my_experiment`
1291
- - `prod.staging`
1292
-
1293
-
1294
- Parameters
1295
- ----------
1296
- flow : Union[str, Dict[str, str]], optional, default None
1297
- Upstream flow dependency for this flow.
1298
- flows : List[Union[str, Dict[str, str]]], default []
1299
- Upstream flow dependencies for this flow.
1300
- options : Dict[str, Any], default {}
1301
- Backend-specific configuration for tuning eventing behavior.
1302
- """
1303
- ...
1304
-
1305
- @typing.overload
1306
- def trigger_on_finish(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1307
- ...
1308
-
1309
- 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] = {}):
1310
- """
1311
- Specifies the flow(s) that this flow depends on.
1312
-
1313
- ```
1314
- @trigger_on_finish(flow='FooFlow')
1315
- ```
1316
- or
1317
- ```
1318
- @trigger_on_finish(flows=['FooFlow', 'BarFlow'])
1319
- ```
1320
- This decorator respects the @project decorator and triggers the flow
1321
- when upstream runs within the same namespace complete successfully
1322
-
1323
- Additionally, you can specify project aware upstream flow dependencies
1324
- by specifying the fully qualified project_flow_name.
1325
- ```
1326
- @trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
1327
- ```
1328
- or
1329
- ```
1330
- @trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
1331
- ```
1332
-
1333
- You can also specify just the project or project branch (other values will be
1334
- inferred from the current project or project branch):
1335
- ```
1336
- @trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
1337
- ```
1338
-
1339
- Note that `branch` is typically one of:
1340
- - `prod`
1341
- - `user.bob`
1342
- - `test.my_experiment`
1343
- - `prod.staging`
1344
-
1345
-
1346
- Parameters
1347
- ----------
1348
- flow : Union[str, Dict[str, str]], optional, default None
1349
- Upstream flow dependency for this flow.
1350
- flows : List[Union[str, Dict[str, str]]], default []
1351
- Upstream flow dependencies for this flow.
1352
- options : Dict[str, Any], default {}
1353
- Backend-specific configuration for tuning eventing behavior.
1354
- """
1355
- ...
1356
-
1357
- @typing.overload
1358
- 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]]:
1359
- """
1360
- Specifies the Conda environment for all steps of the flow.
1361
-
1362
- Use `@conda_base` to set common libraries required by all
1363
- steps and use `@conda` to specify step-specific additions.
1364
-
1365
-
1366
- Parameters
1367
- ----------
1368
- packages : Dict[str, str], default {}
1369
- Packages to use for this flow. The key is the name of the package
1370
- and the value is the version to use.
1371
- libraries : Dict[str, str], default {}
1372
- Supported for backward compatibility. When used with packages, packages will take precedence.
1373
- python : str, optional, default None
1374
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1375
- that the version used will correspond to the version of the Python interpreter used to start the run.
1376
- disabled : bool, default False
1377
- If set to True, disables Conda.
1378
- """
1379
- ...
1380
-
1381
- @typing.overload
1382
- def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1383
- ...
1384
-
1385
- 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):
1386
- """
1387
- Specifies the Conda environment for all steps of the flow.
1388
-
1389
- Use `@conda_base` to set common libraries required by all
1390
- steps and use `@conda` to specify step-specific additions.
1391
-
1392
-
1393
- Parameters
1394
- ----------
1395
- packages : Dict[str, str], default {}
1396
- Packages to use for this flow. The key is the name of the package
1397
- and the value is the version to use.
1398
- libraries : Dict[str, str], default {}
1399
- Supported for backward compatibility. When used with packages, packages will take precedence.
1400
- python : str, optional, default None
1401
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1402
- that the version used will correspond to the version of the Python interpreter used to start the run.
1403
- disabled : bool, default False
1404
- If set to True, disables Conda.
1405
- """
1406
- ...
1407
-
1408
- 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]]:
1409
- """
1410
- 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.
1411
- 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.
1412
-
1413
-
1414
- Parameters
1415
- ----------
1416
- timeout : int
1417
- Time, in seconds before the task times out and fails. (Default: 3600)
1418
- poke_interval : int
1419
- Time in seconds that the job should wait in between each try. (Default: 60)
1420
- mode : str
1421
- How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1422
- exponential_backoff : bool
1423
- allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1424
- pool : str
1425
- the slot pool this task should run in,
1426
- slot pools are a way to limit concurrency for certain tasks. (Default:None)
1427
- soft_fail : bool
1428
- Set to true to mark the task as SKIPPED on failure. (Default: False)
1429
- name : str
1430
- Name of the sensor on Airflow
1431
- description : str
1432
- Description of sensor in the Airflow UI
1433
- external_dag_id : str
1434
- The dag_id that contains the task you want to wait for.
1435
- external_task_ids : List[str]
1436
- The list of task_ids that you want to wait for.
1437
- If None (default value) the sensor waits for the DAG. (Default: None)
1438
- allowed_states : List[str]
1439
- Iterable of allowed states, (Default: ['success'])
1440
- failed_states : List[str]
1441
- Iterable of failed or dis-allowed states. (Default: None)
1442
- execution_delta : datetime.timedelta
1443
- time difference with the previous execution to look at,
1444
- the default is the same logical date as the current task or DAG. (Default: None)
1445
- check_existence: bool
1446
- Set to True to check if the external task exists or check if
1447
- the DAG to wait for exists. (Default: True)
1448
- """
1449
- ...
1450
-
1451
1494
  @typing.overload
1452
1495
  def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1453
1496
  """
@@ -1524,48 +1567,5 @@ def project(*, name: str, branch: typing.Optional[str] = None, production: bool
1524
1567
  """
1525
1568
  ...
1526
1569
 
1527
- def airflow_s3_key_sensor(*, timeout: int, poke_interval: int, mode: str, exponential_backoff: bool, pool: str, soft_fail: bool, name: str, description: str, bucket_key: typing.Union[str, typing.List[str]], bucket_name: str, wildcard_match: bool, aws_conn_id: str, verify: bool) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1528
- """
1529
- The `@airflow_s3_key_sensor` decorator attaches a Airflow [S3KeySensor](https://airflow.apache.org/docs/apache-airflow-providers-amazon/stable/_api/airflow/providers/amazon/aws/sensors/s3/index.html#airflow.providers.amazon.aws.sensors.s3.S3KeySensor)
1530
- before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
1531
- and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
1532
- added as a flow decorators. Adding more than one decorator will ensure that `start` step
1533
- starts only after all sensors finish.
1534
-
1535
-
1536
- Parameters
1537
- ----------
1538
- timeout : int
1539
- Time, in seconds before the task times out and fails. (Default: 3600)
1540
- poke_interval : int
1541
- Time in seconds that the job should wait in between each try. (Default: 60)
1542
- mode : str
1543
- How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1544
- exponential_backoff : bool
1545
- allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1546
- pool : str
1547
- the slot pool this task should run in,
1548
- slot pools are a way to limit concurrency for certain tasks. (Default:None)
1549
- soft_fail : bool
1550
- Set to true to mark the task as SKIPPED on failure. (Default: False)
1551
- name : str
1552
- Name of the sensor on Airflow
1553
- description : str
1554
- Description of sensor in the Airflow UI
1555
- bucket_key : Union[str, List[str]]
1556
- The key(s) being waited on. Supports full s3:// style url or relative path from root level.
1557
- When it's specified as a full s3:// url, please leave `bucket_name` as None
1558
- bucket_name : str
1559
- Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
1560
- When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
1561
- wildcard_match : bool
1562
- whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
1563
- aws_conn_id : str
1564
- a reference to the s3 connection on Airflow. (Default: None)
1565
- verify : bool
1566
- Whether or not to verify SSL certificates for S3 connection. (Default: None)
1567
- """
1568
- ...
1569
-
1570
1570
  pkg_name: str
1571
1571