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