ob-metaflow-stubs 6.0.3.167__py2.py3-none-any.whl → 6.0.3.168__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 +583 -583
  2. metaflow-stubs/cards.pyi +2 -2
  3. metaflow-stubs/cli.pyi +2 -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 +2 -2
  9. metaflow-stubs/events.pyi +3 -3
  10. metaflow-stubs/exception.pyi +2 -2
  11. metaflow-stubs/flowspec.pyi +6 -6
  12. metaflow-stubs/generated_for.txt +1 -1
  13. metaflow-stubs/includefile.pyi +4 -4
  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 +2 -4
  20. metaflow-stubs/metaflow_current.pyi +86 -86
  21. metaflow-stubs/metaflow_git.pyi +2 -2
  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 +3 -3
  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 +5 -5
  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 +5 -5
  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 +5 -5
  37. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/decorator.pyi +5 -5
  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 +4 -4
  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 +5 -5
  82. metaflow-stubs/plugins/__init__.pyi +10 -10
  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 +4 -4
  95. metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +4 -4
  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 +4 -4
  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 +3 -3
  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 +4 -4
  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 +6 -6
  121. metaflow-stubs/plugins/cards/card_client.pyi +3 -3
  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 +4 -4
  127. metaflow-stubs/plugins/cards/card_modules/card.pyi +2 -2
  128. metaflow-stubs/plugins/cards/card_modules/components.pyi +4 -4
  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 +2 -2
  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 +4 -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 +4 -4
  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 +2 -2
  157. metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +2 -2
  158. metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +2 -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 +3 -3
  166. metaflow-stubs/plugins/pypi/conda_decorator.pyi +2 -2
  167. metaflow-stubs/plugins/pypi/conda_environment.pyi +5 -5
  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 +3 -3
  175. metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +3 -3
  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 +2 -2
  181. metaflow-stubs/plugins/uv/__init__.pyi +2 -2
  182. metaflow-stubs/plugins/uv/uv_environment.pyi +2 -2
  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 +30 -30
  187. metaflow-stubs/runner/deployer_impl.pyi +3 -3
  188. metaflow-stubs/runner/metaflow_runner.pyi +3 -3
  189. metaflow-stubs/runner/nbdeploy.pyi +2 -2
  190. metaflow-stubs/runner/nbrun.pyi +2 -2
  191. metaflow-stubs/runner/subprocess_manager.pyi +3 -3
  192. metaflow-stubs/runner/utils.pyi +3 -3
  193. metaflow-stubs/system/__init__.pyi +2 -2
  194. metaflow-stubs/system/system_logger.pyi +2 -2
  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 +6 -6
  200. metaflow-stubs/user_configs/config_options.pyi +4 -4
  201. metaflow-stubs/user_configs/config_parameters.pyi +6 -6
  202. {ob_metaflow_stubs-6.0.3.167.dist-info → ob_metaflow_stubs-6.0.3.168.dist-info}/METADATA +1 -1
  203. ob_metaflow_stubs-6.0.3.168.dist-info/RECORD +206 -0
  204. ob_metaflow_stubs-6.0.3.167.dist-info/RECORD +0 -206
  205. {ob_metaflow_stubs-6.0.3.167.dist-info → ob_metaflow_stubs-6.0.3.168.dist-info}/WHEEL +0 -0
  206. {ob_metaflow_stubs-6.0.3.167.dist-info → ob_metaflow_stubs-6.0.3.168.dist-info}/top_level.txt +0 -0
@@ -1,15 +1,15 @@
1
1
  ######################################################################################################
2
2
  # Auto-generated Metaflow stub file #
3
- # MF version: 2.15.11.2+obcheckpoint(0.2.1);ob(v1) #
4
- # Generated on 2025-05-13T17:00:07.187688 #
3
+ # MF version: 2.15.13.1+obcheckpoint(0.2.1);ob(v1) #
4
+ # Generated on 2025-05-20T18:21:15.778004 #
5
5
  ######################################################################################################
6
6
 
7
7
  from __future__ import annotations
8
8
 
9
9
  import typing
10
10
  if typing.TYPE_CHECKING:
11
- import datetime
12
11
  import typing
12
+ import datetime
13
13
  FlowSpecDerived = typing.TypeVar("FlowSpecDerived", bound="FlowSpec", contravariant=False, covariant=False)
14
14
  StepFlag = typing.NewType("StepFlag", bool)
15
15
 
@@ -44,9 +44,9 @@ from . import plugins as plugins
44
44
  from .mf_extensions.outerbounds.toplevel.global_aliases_for_metaflow_package import S3 as S3
45
45
  from . import includefile as includefile
46
46
  from .includefile import IncludeFile as IncludeFile
47
+ from .plugins.pypi.parsers import pyproject_toml_parser as pyproject_toml_parser
47
48
  from .plugins.pypi.parsers import requirements_txt_parser as requirements_txt_parser
48
49
  from .plugins.pypi.parsers import conda_environment_yml_parser as conda_environment_yml_parser
49
- from .plugins.pypi.parsers import pyproject_toml_parser as pyproject_toml_parser
50
50
  from . import client as client
51
51
  from .client.core import namespace as namespace
52
52
  from .client.core import get_namespace as get_namespace
@@ -154,283 +154,311 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
154
154
  ...
155
155
 
156
156
  @typing.overload
157
- def timeout(*, seconds: int = 0, minutes: int = 0, hours: int = 0) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
157
+ def resources(*, cpu: int = 1, gpu: typing.Optional[int] = None, disk: typing.Optional[int] = None, memory: int = 4096, shared_memory: typing.Optional[int] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
158
158
  """
159
- Specifies a timeout for your step.
160
-
161
- This decorator is useful if this step may hang indefinitely.
159
+ Specifies the resources needed when executing this step.
162
160
 
163
- This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
164
- A timeout is considered to be an exception thrown by the step. It will cause the step to be
165
- retried if needed and the exception will be caught by the `@catch` decorator, if present.
161
+ Use `@resources` to specify the resource requirements
162
+ independently of the specific compute layer (`@batch`, `@kubernetes`).
166
163
 
167
- Note that all the values specified in parameters are added together so if you specify
168
- 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
164
+ You can choose the compute layer on the command line by executing e.g.
165
+ ```
166
+ python myflow.py run --with batch
167
+ ```
168
+ or
169
+ ```
170
+ python myflow.py run --with kubernetes
171
+ ```
172
+ which executes the flow on the desired system using the
173
+ requirements specified in `@resources`.
169
174
 
170
175
 
171
176
  Parameters
172
177
  ----------
173
- seconds : int, default 0
174
- Number of seconds to wait prior to timing out.
175
- minutes : int, default 0
176
- Number of minutes to wait prior to timing out.
177
- hours : int, default 0
178
- Number of hours to wait prior to timing out.
178
+ cpu : int, default 1
179
+ Number of CPUs required for this step.
180
+ gpu : int, optional, default None
181
+ Number of GPUs required for this step.
182
+ disk : int, optional, default None
183
+ Disk size (in MB) required for this step. Only applies on Kubernetes.
184
+ memory : int, default 4096
185
+ Memory size (in MB) required for this step.
186
+ shared_memory : int, optional, default None
187
+ The value for the size (in MiB) of the /dev/shm volume for this step.
188
+ This parameter maps to the `--shm-size` option in Docker.
179
189
  """
180
190
  ...
181
191
 
182
192
  @typing.overload
183
- def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
193
+ def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
184
194
  ...
185
195
 
186
196
  @typing.overload
187
- def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
197
+ def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
188
198
  ...
189
199
 
190
- def timeout(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, seconds: int = 0, minutes: int = 0, hours: int = 0):
200
+ def resources(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, cpu: int = 1, gpu: typing.Optional[int] = None, disk: typing.Optional[int] = None, memory: int = 4096, shared_memory: typing.Optional[int] = None):
191
201
  """
192
- Specifies a timeout for your step.
193
-
194
- This decorator is useful if this step may hang indefinitely.
202
+ Specifies the resources needed when executing this step.
195
203
 
196
- This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
197
- A timeout is considered to be an exception thrown by the step. It will cause the step to be
198
- retried if needed and the exception will be caught by the `@catch` decorator, if present.
204
+ Use `@resources` to specify the resource requirements
205
+ independently of the specific compute layer (`@batch`, `@kubernetes`).
199
206
 
200
- Note that all the values specified in parameters are added together so if you specify
201
- 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
207
+ You can choose the compute layer on the command line by executing e.g.
208
+ ```
209
+ python myflow.py run --with batch
210
+ ```
211
+ or
212
+ ```
213
+ python myflow.py run --with kubernetes
214
+ ```
215
+ which executes the flow on the desired system using the
216
+ requirements specified in `@resources`.
202
217
 
203
218
 
204
219
  Parameters
205
220
  ----------
206
- seconds : int, default 0
207
- Number of seconds to wait prior to timing out.
208
- minutes : int, default 0
209
- Number of minutes to wait prior to timing out.
210
- hours : int, default 0
211
- Number of hours to wait prior to timing out.
221
+ cpu : int, default 1
222
+ Number of CPUs required for this step.
223
+ gpu : int, optional, default None
224
+ Number of GPUs required for this step.
225
+ disk : int, optional, default None
226
+ Disk size (in MB) required for this step. Only applies on Kubernetes.
227
+ memory : int, default 4096
228
+ Memory size (in MB) required for this step.
229
+ shared_memory : int, optional, default None
230
+ The value for the size (in MiB) of the /dev/shm volume for this step.
231
+ This parameter maps to the `--shm-size` option in Docker.
212
232
  """
213
233
  ...
214
234
 
215
235
  @typing.overload
216
- def environment(*, vars: typing.Dict[str, str] = {}) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
236
+ def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
217
237
  """
218
- Specifies environment variables to be set prior to the execution of a step.
219
-
220
-
221
- Parameters
222
- ----------
223
- vars : Dict[str, str], default {}
224
- Dictionary of environment variables to set.
238
+ Decorator prototype for all step decorators. This function gets specialized
239
+ and imported for all decorators types by _import_plugin_decorators().
225
240
  """
226
241
  ...
227
242
 
228
243
  @typing.overload
229
- def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
230
- ...
231
-
232
- @typing.overload
233
- def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
244
+ def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
234
245
  ...
235
246
 
236
- def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
247
+ def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
237
248
  """
238
- Specifies environment variables to be set prior to the execution of a step.
239
-
240
-
241
- Parameters
242
- ----------
243
- vars : Dict[str, str], default {}
244
- Dictionary of environment variables to set.
249
+ Decorator prototype for all step decorators. This function gets specialized
250
+ and imported for all decorators types by _import_plugin_decorators().
245
251
  """
246
252
  ...
247
253
 
248
254
  @typing.overload
249
- def pypi(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
255
+ 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]]]:
250
256
  """
251
- Specifies the PyPI packages for the step.
257
+ Specifies the Conda environment for the step.
252
258
 
253
259
  Information in this decorator will augment any
254
- attributes set in the `@pyi_base` flow-level decorator. Hence,
255
- you can use `@pypi_base` to set packages required by all
256
- steps and use `@pypi` to specify step-specific overrides.
260
+ attributes set in the `@conda_base` flow-level decorator. Hence,
261
+ you can use `@conda_base` to set packages required by all
262
+ steps and use `@conda` to specify step-specific overrides.
257
263
 
258
264
 
259
265
  Parameters
260
266
  ----------
261
- packages : Dict[str, str], default: {}
267
+ packages : Dict[str, str], default {}
262
268
  Packages to use for this step. The key is the name of the package
263
269
  and the value is the version to use.
264
- python : str, optional, default: None
270
+ libraries : Dict[str, str], default {}
271
+ Supported for backward compatibility. When used with packages, packages will take precedence.
272
+ python : str, optional, default None
265
273
  Version of Python to use, e.g. '3.7.4'. A default value of None implies
266
274
  that the version used will correspond to the version of the Python interpreter used to start the run.
275
+ disabled : bool, default False
276
+ If set to True, disables @conda.
267
277
  """
268
278
  ...
269
279
 
270
280
  @typing.overload
271
- def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
281
+ def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
272
282
  ...
273
283
 
274
284
  @typing.overload
275
- def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
285
+ def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
276
286
  ...
277
287
 
278
- def pypi(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
288
+ 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):
279
289
  """
280
- Specifies the PyPI packages for the step.
290
+ Specifies the Conda environment for the step.
281
291
 
282
292
  Information in this decorator will augment any
283
- attributes set in the `@pyi_base` flow-level decorator. Hence,
284
- you can use `@pypi_base` to set packages required by all
285
- steps and use `@pypi` to specify step-specific overrides.
293
+ attributes set in the `@conda_base` flow-level decorator. Hence,
294
+ you can use `@conda_base` to set packages required by all
295
+ steps and use `@conda` to specify step-specific overrides.
286
296
 
287
297
 
288
298
  Parameters
289
299
  ----------
290
- packages : Dict[str, str], default: {}
300
+ packages : Dict[str, str], default {}
291
301
  Packages to use for this step. The key is the name of the package
292
302
  and the value is the version to use.
293
- python : str, optional, default: None
303
+ libraries : Dict[str, str], default {}
304
+ Supported for backward compatibility. When used with packages, packages will take precedence.
305
+ python : str, optional, default None
294
306
  Version of Python to use, e.g. '3.7.4'. A default value of None implies
295
307
  that the version used will correspond to the version of the Python interpreter used to start the run.
308
+ disabled : bool, default False
309
+ If set to True, disables @conda.
296
310
  """
297
311
  ...
298
312
 
299
- def app_deploy(*, app_port: int, app_name: str) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
313
+ def huggingface_hub(*, temp_dir_root: typing.Optional[str] = None, load: typing.Union[typing.List[str], typing.List[typing.Tuple[typing.Dict, str]], typing.List[typing.Tuple[str, str]], typing.List[typing.Dict], None]) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
300
314
  """
301
- Specifies that this step is used to deploy an instance of the app.
302
- Requires that self.app_name, self.app_port, self.entrypoint and self.deployDir is set.
315
+ Decorator that helps cache, version and store models/datasets from huggingface hub.
303
316
 
304
317
 
305
318
  Parameters
306
319
  ----------
307
- app_port : int
308
- Number of GPUs to use.
309
- app_name : str
310
- Name of the app to deploy.
311
- """
312
- ...
313
-
314
- @typing.overload
315
- 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]]]:
316
- """
317
- Creates a human-readable report, a Metaflow Card, after this step completes.
320
+ temp_dir_root : str, optional
321
+ The root directory that will hold the temporary directory where objects will be downloaded.
318
322
 
319
- Note that you may add multiple `@card` decorators in a step with different parameters.
323
+ load: Union[List[str], List[Tuple[Dict, str]], List[Tuple[str, str]], List[Dict], None]
324
+ The list of repos (models/datasets) to load.
320
325
 
326
+ Loaded repos can be accessed via `current.huggingface_hub.loaded`. If load is set, then the following happens:
321
327
 
322
- Parameters
323
- ----------
324
- type : str, default 'default'
325
- Card type.
326
- id : str, optional, default None
327
- If multiple cards are present, use this id to identify this card.
328
- options : Dict[str, Any], default {}
329
- Options passed to the card. The contents depend on the card type.
330
- timeout : int, default 45
331
- Interrupt reporting if it takes more than this many seconds.
328
+ - If repo (model/dataset) is not found in the datastore:
329
+ - Downloads the repo from Hugging Face Hub to a temporary directory (or uses specified path) for local access
330
+ - Stores it in Metaflow's datastore (s3/gcs/azure etc.) with a unique name based on repo_type/repo_id
331
+ - All HF models loaded for a `@step` will be cached separately under flow/step/namespace.
332
+
333
+ - If repo is found in the datastore:
334
+ - Loads it directly from datastore to local path (can be temporary directory or specified path)
332
335
  """
333
336
  ...
334
337
 
335
338
  @typing.overload
336
- def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
339
+ def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
340
+ """
341
+ Internal decorator to support Fast bakery
342
+ """
337
343
  ...
338
344
 
339
345
  @typing.overload
340
- def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
346
+ def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
341
347
  ...
342
348
 
343
- 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):
349
+ def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
344
350
  """
345
- Creates a human-readable report, a Metaflow Card, after this step completes.
346
-
347
- Note that you may add multiple `@card` decorators in a step with different parameters.
348
-
349
-
350
- Parameters
351
- ----------
352
- type : str, default 'default'
353
- Card type.
354
- id : str, optional, default None
355
- If multiple cards are present, use this id to identify this card.
356
- options : Dict[str, Any], default {}
357
- Options passed to the card. The contents depend on the card type.
358
- timeout : int, default 45
359
- Interrupt reporting if it takes more than this many seconds.
351
+ Internal decorator to support Fast bakery
360
352
  """
361
353
  ...
362
354
 
363
355
  @typing.overload
364
- def model(*, load: typing.Union[typing.List[str], str, typing.List[typing.Tuple[str, typing.Optional[str]]]] = None, temp_dir_root: str = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
356
+ def catch(*, var: typing.Optional[str] = None, print_exception: bool = True) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
365
357
  """
366
- Enables loading / saving of models within a step.
358
+ Specifies that the step will success under all circumstances.
367
359
 
360
+ The decorator will create an optional artifact, specified by `var`, which
361
+ contains the exception raised. You can use it to detect the presence
362
+ of errors, indicating that all happy-path artifacts produced by the step
363
+ are missing.
368
364
 
369
365
 
370
366
  Parameters
371
367
  ----------
372
- load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
373
- Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
374
- These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
375
- - `current.checkpoint`
376
- - `current.model`
377
- - `current.huggingface_hub`
378
-
379
- If a list of tuples is provided, the first element is the artifact name and the second element is the path the artifact needs be unpacked on
380
- the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
381
- If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
382
-
383
- temp_dir_root : str, default: None
384
- The root directory under which `current.model.loaded` will store loaded models
368
+ var : str, optional, default None
369
+ Name of the artifact in which to store the caught exception.
370
+ If not specified, the exception is not stored.
371
+ print_exception : bool, default True
372
+ Determines whether or not the exception is printed to
373
+ stdout when caught.
385
374
  """
386
375
  ...
387
376
 
388
377
  @typing.overload
389
- def model(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
378
+ def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
390
379
  ...
391
380
 
392
381
  @typing.overload
393
- def model(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
382
+ def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
394
383
  ...
395
384
 
396
- def model(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, load: typing.Union[typing.List[str], str, typing.List[typing.Tuple[str, typing.Optional[str]]]] = None, temp_dir_root: str = None):
385
+ def catch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, var: typing.Optional[str] = None, print_exception: bool = True):
397
386
  """
398
- Enables loading / saving of models within a step.
399
-
387
+ Specifies that the step will success under all circumstances.
388
+
389
+ The decorator will create an optional artifact, specified by `var`, which
390
+ contains the exception raised. You can use it to detect the presence
391
+ of errors, indicating that all happy-path artifacts produced by the step
392
+ are missing.
400
393
 
401
394
 
402
395
  Parameters
403
396
  ----------
404
- load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
405
- Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
406
- These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
407
- - `current.checkpoint`
408
- - `current.model`
409
- - `current.huggingface_hub`
410
-
411
- If a list of tuples is provided, the first element is the artifact name and the second element is the path the artifact needs be unpacked on
412
- the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
413
- If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
414
-
415
- temp_dir_root : str, default: None
416
- The root directory under which `current.model.loaded` will store loaded models
397
+ var : str, optional, default None
398
+ Name of the artifact in which to store the caught exception.
399
+ If not specified, the exception is not stored.
400
+ print_exception : bool, default True
401
+ Determines whether or not the exception is printed to
402
+ stdout when caught.
417
403
  """
418
404
  ...
419
405
 
420
406
  @typing.overload
421
- def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
407
+ 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]]]:
422
408
  """
423
- Internal decorator to support Fast bakery
409
+ Specifies a timeout for your step.
410
+
411
+ This decorator is useful if this step may hang indefinitely.
412
+
413
+ This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
414
+ A timeout is considered to be an exception thrown by the step. It will cause the step to be
415
+ retried if needed and the exception will be caught by the `@catch` decorator, if present.
416
+
417
+ Note that all the values specified in parameters are added together so if you specify
418
+ 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
419
+
420
+
421
+ Parameters
422
+ ----------
423
+ seconds : int, default 0
424
+ Number of seconds to wait prior to timing out.
425
+ minutes : int, default 0
426
+ Number of minutes to wait prior to timing out.
427
+ hours : int, default 0
428
+ Number of hours to wait prior to timing out.
424
429
  """
425
430
  ...
426
431
 
427
432
  @typing.overload
428
- def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
433
+ def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
429
434
  ...
430
435
 
431
- def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
436
+ @typing.overload
437
+ def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
438
+ ...
439
+
440
+ 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):
432
441
  """
433
- Internal decorator to support Fast bakery
442
+ Specifies a timeout for your step.
443
+
444
+ This decorator is useful if this step may hang indefinitely.
445
+
446
+ This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
447
+ A timeout is considered to be an exception thrown by the step. It will cause the step to be
448
+ retried if needed and the exception will be caught by the `@catch` decorator, if present.
449
+
450
+ Note that all the values specified in parameters are added together so if you specify
451
+ 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
452
+
453
+
454
+ Parameters
455
+ ----------
456
+ seconds : int, default 0
457
+ Number of seconds to wait prior to timing out.
458
+ minutes : int, default 0
459
+ Number of minutes to wait prior to timing out.
460
+ hours : int, default 0
461
+ Number of hours to wait prior to timing out.
434
462
  """
435
463
  ...
436
464
 
@@ -574,273 +602,247 @@ def retry(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
574
602
  """
575
603
  ...
576
604
 
577
- @typing.overload
578
- def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
579
- """
580
- Decorator prototype for all step decorators. This function gets specialized
581
- and imported for all decorators types by _import_plugin_decorators().
582
- """
583
- ...
584
-
585
- @typing.overload
586
- def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
587
- ...
588
-
589
- def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
590
- """
591
- Decorator prototype for all step decorators. This function gets specialized
592
- and imported for all decorators types by _import_plugin_decorators().
593
- """
594
- ...
595
-
596
- def ollama(*, models: "list[Ollama]", backend: str) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
597
- """
598
- This decorator is used to run Ollama APIs as Metaflow task sidecars.
599
-
600
- User code call
601
- -----------
602
- @ollama(
603
- models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
604
- backend='local'
605
- )
606
-
607
- Valid backend options
608
- ---------------------
609
- - 'local': Run as a separate process on the local task machine.
610
- - (TODO) 'managed': Outerbounds hosts and selects compute provider.
611
- - (TODO) 'remote': Spin up separate instance to serve Ollama models.
612
-
613
- Valid model options
614
- ----------------
615
- - 'llama3.2'
616
- - 'llama3.3'
617
- - any model here https://ollama.com/search
618
-
619
-
620
- Parameters
621
- ----------
622
- models: list[Ollama]
623
- List of Ollama containers running models in sidecars.
624
- backend: str
625
- Determines where and how to run the Ollama process.
626
- """
627
- ...
628
-
629
- def huggingface_hub(*, temp_dir_root: typing.Optional[str] = None, load: typing.Union[typing.List[str], typing.List[typing.Tuple[typing.Dict, str]], typing.List[typing.Tuple[str, str]], typing.List[typing.Dict], None]) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
605
+ 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]]]:
630
606
  """
631
- Decorator that helps cache, version and store models/datasets from huggingface hub.
607
+ Specifies that this step is used to deploy an instance of the app.
608
+ Requires that self.app_name, self.app_port, self.entrypoint and self.deployDir is set.
632
609
 
633
610
 
634
611
  Parameters
635
612
  ----------
636
- temp_dir_root : str, optional
637
- The root directory that will hold the temporary directory where objects will be downloaded.
638
-
639
- load: Union[List[str], List[Tuple[Dict, str]], List[Tuple[str, str]], List[Dict], None]
640
- The list of repos (models/datasets) to load.
641
-
642
- Loaded repos can be accessed via `current.huggingface_hub.loaded`. If load is set, then the following happens:
643
-
644
- - If repo (model/dataset) is not found in the datastore:
645
- - Downloads the repo from Hugging Face Hub to a temporary directory (or uses specified path) for local access
646
- - Stores it in Metaflow's datastore (s3/gcs/azure etc.) with a unique name based on repo_type/repo_id
647
- - All HF models loaded for a `@step` will be cached separately under flow/step/namespace.
648
-
649
- - If repo is found in the datastore:
650
- - Loads it directly from datastore to local path (can be temporary directory or specified path)
613
+ app_port : int
614
+ Number of GPUs to use.
615
+ app_name : str
616
+ Name of the app to deploy.
651
617
  """
652
618
  ...
653
619
 
654
620
  @typing.overload
655
- def resources(*, cpu: int = 1, gpu: typing.Optional[int] = None, disk: typing.Optional[int] = None, memory: int = 4096, shared_memory: typing.Optional[int] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
621
+ 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]]]:
656
622
  """
657
- Specifies the resources needed when executing this step.
658
-
659
- Use `@resources` to specify the resource requirements
660
- independently of the specific compute layer (`@batch`, `@kubernetes`).
661
-
662
- You can choose the compute layer on the command line by executing e.g.
663
- ```
664
- python myflow.py run --with batch
665
- ```
666
- or
667
- ```
668
- python myflow.py run --with kubernetes
669
- ```
670
- which executes the flow on the desired system using the
671
- requirements specified in `@resources`.
623
+ Specifies secrets to be retrieved and injected as environment variables prior to
624
+ the execution of a step.
672
625
 
673
626
 
674
627
  Parameters
675
628
  ----------
676
- cpu : int, default 1
677
- Number of CPUs required for this step.
678
- gpu : int, optional, default None
679
- Number of GPUs required for this step.
680
- disk : int, optional, default None
681
- Disk size (in MB) required for this step. Only applies on Kubernetes.
682
- memory : int, default 4096
683
- Memory size (in MB) required for this step.
684
- shared_memory : int, optional, default None
685
- The value for the size (in MiB) of the /dev/shm volume for this step.
686
- This parameter maps to the `--shm-size` option in Docker.
629
+ sources : List[Union[str, Dict[str, Any]]], default: []
630
+ List of secret specs, defining how the secrets are to be retrieved
687
631
  """
688
632
  ...
689
633
 
690
634
  @typing.overload
691
- def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
635
+ def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
692
636
  ...
693
637
 
694
638
  @typing.overload
695
- def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
639
+ def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
696
640
  ...
697
641
 
698
- def resources(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, cpu: int = 1, gpu: typing.Optional[int] = None, disk: typing.Optional[int] = None, memory: int = 4096, shared_memory: typing.Optional[int] = None):
642
+ 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]]] = []):
699
643
  """
700
- Specifies the resources needed when executing this step.
701
-
702
- Use `@resources` to specify the resource requirements
703
- independently of the specific compute layer (`@batch`, `@kubernetes`).
704
-
705
- You can choose the compute layer on the command line by executing e.g.
706
- ```
707
- python myflow.py run --with batch
708
- ```
709
- or
710
- ```
711
- python myflow.py run --with kubernetes
712
- ```
713
- which executes the flow on the desired system using the
714
- requirements specified in `@resources`.
644
+ Specifies secrets to be retrieved and injected as environment variables prior to
645
+ the execution of a step.
715
646
 
716
647
 
717
648
  Parameters
718
649
  ----------
719
- cpu : int, default 1
720
- Number of CPUs required for this step.
721
- gpu : int, optional, default None
722
- Number of GPUs required for this step.
723
- disk : int, optional, default None
724
- Disk size (in MB) required for this step. Only applies on Kubernetes.
725
- memory : int, default 4096
726
- Memory size (in MB) required for this step.
727
- shared_memory : int, optional, default None
728
- The value for the size (in MiB) of the /dev/shm volume for this step.
729
- This parameter maps to the `--shm-size` option in Docker.
650
+ sources : List[Union[str, Dict[str, Any]]], default: []
651
+ List of secret specs, defining how the secrets are to be retrieved
730
652
  """
731
653
  ...
732
654
 
733
655
  @typing.overload
734
- def conda(*, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
656
+ 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]]]:
735
657
  """
736
- Specifies the Conda environment for the step.
658
+ Specifies the PyPI packages for the step.
737
659
 
738
660
  Information in this decorator will augment any
739
- attributes set in the `@conda_base` flow-level decorator. Hence,
740
- you can use `@conda_base` to set packages required by all
741
- steps and use `@conda` to specify step-specific overrides.
661
+ attributes set in the `@pyi_base` flow-level decorator. Hence,
662
+ you can use `@pypi_base` to set packages required by all
663
+ steps and use `@pypi` to specify step-specific overrides.
742
664
 
743
665
 
744
666
  Parameters
745
667
  ----------
746
- packages : Dict[str, str], default {}
668
+ packages : Dict[str, str], default: {}
747
669
  Packages to use for this step. The key is the name of the package
748
670
  and the value is the version to use.
749
- libraries : Dict[str, str], default {}
750
- Supported for backward compatibility. When used with packages, packages will take precedence.
751
- python : str, optional, default None
671
+ python : str, optional, default: None
752
672
  Version of Python to use, e.g. '3.7.4'. A default value of None implies
753
673
  that the version used will correspond to the version of the Python interpreter used to start the run.
754
- disabled : bool, default False
755
- If set to True, disables @conda.
756
674
  """
757
675
  ...
758
676
 
759
677
  @typing.overload
760
- def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
678
+ def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
761
679
  ...
762
680
 
763
681
  @typing.overload
764
- def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
682
+ def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
765
683
  ...
766
684
 
767
- def conda(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False):
685
+ 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):
768
686
  """
769
- Specifies the Conda environment for the step.
687
+ Specifies the PyPI packages for the step.
770
688
 
771
689
  Information in this decorator will augment any
772
- attributes set in the `@conda_base` flow-level decorator. Hence,
773
- you can use `@conda_base` to set packages required by all
774
- steps and use `@conda` to specify step-specific overrides.
690
+ attributes set in the `@pyi_base` flow-level decorator. Hence,
691
+ you can use `@pypi_base` to set packages required by all
692
+ steps and use `@pypi` to specify step-specific overrides.
775
693
 
776
694
 
777
695
  Parameters
778
696
  ----------
779
- packages : Dict[str, str], default {}
697
+ packages : Dict[str, str], default: {}
780
698
  Packages to use for this step. The key is the name of the package
781
699
  and the value is the version to use.
782
- libraries : Dict[str, str], default {}
783
- Supported for backward compatibility. When used with packages, packages will take precedence.
784
- python : str, optional, default None
700
+ python : str, optional, default: None
785
701
  Version of Python to use, e.g. '3.7.4'. A default value of None implies
786
702
  that the version used will correspond to the version of the Python interpreter used to start the run.
787
- disabled : bool, default False
788
- If set to True, disables @conda.
789
703
  """
790
704
  ...
791
705
 
792
706
  @typing.overload
793
- def secrets(*, sources: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = []) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
707
+ 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]]]:
794
708
  """
795
- Specifies secrets to be retrieved and injected as environment variables prior to
796
- the execution of a step.
709
+ Creates a human-readable report, a Metaflow Card, after this step completes.
710
+
711
+ Note that you may add multiple `@card` decorators in a step with different parameters.
797
712
 
798
713
 
799
714
  Parameters
800
715
  ----------
801
- sources : List[Union[str, Dict[str, Any]]], default: []
802
- List of secret specs, defining how the secrets are to be retrieved
716
+ type : str, default 'default'
717
+ Card type.
718
+ id : str, optional, default None
719
+ If multiple cards are present, use this id to identify this card.
720
+ options : Dict[str, Any], default {}
721
+ Options passed to the card. The contents depend on the card type.
722
+ timeout : int, default 45
723
+ Interrupt reporting if it takes more than this many seconds.
803
724
  """
804
725
  ...
805
726
 
806
727
  @typing.overload
807
- def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
728
+ def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
808
729
  ...
809
730
 
810
731
  @typing.overload
811
- def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
732
+ def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
812
733
  ...
813
734
 
814
- def secrets(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, sources: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = []):
735
+ 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):
815
736
  """
816
- Specifies secrets to be retrieved and injected as environment variables prior to
817
- the execution of a step.
737
+ Creates a human-readable report, a Metaflow Card, after this step completes.
738
+
739
+ Note that you may add multiple `@card` decorators in a step with different parameters.
818
740
 
819
741
 
820
742
  Parameters
821
743
  ----------
822
- sources : List[Union[str, Dict[str, Any]]], default: []
823
- List of secret specs, defining how the secrets are to be retrieved
744
+ type : str, default 'default'
745
+ Card type.
746
+ id : str, optional, default None
747
+ If multiple cards are present, use this id to identify this card.
748
+ options : Dict[str, Any], default {}
749
+ Options passed to the card. The contents depend on the card type.
750
+ timeout : int, default 45
751
+ Interrupt reporting if it takes more than this many seconds.
824
752
  """
825
753
  ...
826
754
 
827
- def nvidia(*, gpu: int, gpu_type: str, queue_timeout: int) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
755
+ @typing.overload
756
+ def checkpoint(*, load_policy: str = 'fresh', temp_dir_root: str = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
828
757
  """
829
- Specifies that this step should execute on DGX cloud.
758
+ Enables checkpointing for a step.
759
+
830
760
 
831
761
 
832
762
  Parameters
833
763
  ----------
834
- gpu : int
835
- Number of GPUs to use.
836
- gpu_type : str
837
- Type of Nvidia GPU to use.
764
+ load_policy : str, default: "fresh"
765
+ The policy for loading the checkpoint. The following policies are supported:
766
+ - "eager": Loads the the latest available checkpoint within the namespace.
767
+ With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
768
+ will be loaded at the start of the task.
769
+ - "none": Do not load any checkpoint
770
+ - "fresh": Loads the lastest checkpoint created within the running Task.
771
+ This mode helps loading checkpoints across various retry attempts of the same task.
772
+ With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
773
+ created within the task will be loaded when the task is retries execution on failure.
774
+
775
+ temp_dir_root : str, default: None
776
+ The root directory under which `current.checkpoint.directory` will be created.
777
+ """
778
+ ...
779
+
780
+ @typing.overload
781
+ def checkpoint(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
782
+ ...
783
+
784
+ @typing.overload
785
+ def checkpoint(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
786
+ ...
787
+
788
+ def checkpoint(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, load_policy: str = 'fresh', temp_dir_root: str = None):
789
+ """
790
+ Enables checkpointing for a step.
791
+
792
+
793
+
794
+ Parameters
795
+ ----------
796
+ load_policy : str, default: "fresh"
797
+ The policy for loading the checkpoint. The following policies are supported:
798
+ - "eager": Loads the the latest available checkpoint within the namespace.
799
+ With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
800
+ will be loaded at the start of the task.
801
+ - "none": Do not load any checkpoint
802
+ - "fresh": Loads the lastest checkpoint created within the running Task.
803
+ This mode helps loading checkpoints across various retry attempts of the same task.
804
+ With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
805
+ created within the task will be loaded when the task is retries execution on failure.
806
+
807
+ temp_dir_root : str, default: None
808
+ The root directory under which `current.checkpoint.directory` will be created.
809
+ """
810
+ ...
811
+
812
+ 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]]]:
813
+ """
814
+ This decorator is used to run NIM containers in Metaflow tasks as sidecars.
815
+
816
+ User code call
817
+ -----------
818
+ @nim(
819
+ models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
820
+ backend='managed'
821
+ )
822
+
823
+ Valid backend options
824
+ ---------------------
825
+ - 'managed': Outerbounds selects a compute provider based on the model.
826
+
827
+ Valid model options
828
+ ----------------
829
+ - 'meta/llama3-8b-instruct': 8B parameter model
830
+ - 'meta/llama3-70b-instruct': 70B parameter model
831
+ - any model here: https://nvcf.ngc.nvidia.com/functions?filter=nvidia-functions
832
+
833
+
834
+ Parameters
835
+ ----------
836
+ models: list[NIM]
837
+ List of NIM containers running models in sidecars.
838
+ backend: str
839
+ Compute provider to run the NIM container.
838
840
  queue_timeout : int
839
841
  Time to keep the job in NVCF's queue.
840
842
  """
841
843
  ...
842
844
 
843
- def nvct(*, gpu: int, gpu_type: str) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
845
+ 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]]]:
844
846
  """
845
847
  Specifies that this step should execute on DGX cloud.
846
848
 
@@ -851,147 +853,145 @@ def nvct(*, gpu: int, gpu_type: str) -> typing.Callable[[typing.Union[typing.Cal
851
853
  Number of GPUs to use.
852
854
  gpu_type : str
853
855
  Type of Nvidia GPU to use.
856
+ queue_timeout : int
857
+ Time to keep the job in NVCF's queue.
854
858
  """
855
859
  ...
856
860
 
857
861
  @typing.overload
858
- def catch(*, var: typing.Optional[str] = None, print_exception: bool = True) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
862
+ def model(*, load: typing.Union[typing.List[str], str, typing.List[typing.Tuple[str, typing.Optional[str]]]] = None, temp_dir_root: str = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
859
863
  """
860
- Specifies that the step will success under all circumstances.
864
+ Enables loading / saving of models within a step.
861
865
 
862
- The decorator will create an optional artifact, specified by `var`, which
863
- contains the exception raised. You can use it to detect the presence
864
- of errors, indicating that all happy-path artifacts produced by the step
865
- are missing.
866
866
 
867
867
 
868
868
  Parameters
869
869
  ----------
870
- var : str, optional, default None
871
- Name of the artifact in which to store the caught exception.
872
- If not specified, the exception is not stored.
873
- print_exception : bool, default True
874
- Determines whether or not the exception is printed to
875
- stdout when caught.
870
+ load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
871
+ Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
872
+ These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
873
+ - `current.checkpoint`
874
+ - `current.model`
875
+ - `current.huggingface_hub`
876
+
877
+ 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
878
+ the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
879
+ If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
880
+
881
+ temp_dir_root : str, default: None
882
+ The root directory under which `current.model.loaded` will store loaded models
876
883
  """
877
884
  ...
878
885
 
879
886
  @typing.overload
880
- def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
887
+ def model(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
881
888
  ...
882
889
 
883
890
  @typing.overload
884
- def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
891
+ def model(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
885
892
  ...
886
893
 
887
- def catch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, var: typing.Optional[str] = None, print_exception: bool = True):
894
+ def model(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, load: typing.Union[typing.List[str], str, typing.List[typing.Tuple[str, typing.Optional[str]]]] = None, temp_dir_root: str = None):
888
895
  """
889
- Specifies that the step will success under all circumstances.
896
+ Enables loading / saving of models within a step.
890
897
 
891
- The decorator will create an optional artifact, specified by `var`, which
892
- contains the exception raised. You can use it to detect the presence
893
- of errors, indicating that all happy-path artifacts produced by the step
894
- are missing.
895
898
 
896
899
 
897
900
  Parameters
898
901
  ----------
899
- var : str, optional, default None
900
- Name of the artifact in which to store the caught exception.
901
- If not specified, the exception is not stored.
902
- print_exception : bool, default True
903
- Determines whether or not the exception is printed to
904
- stdout when caught.
902
+ load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
903
+ Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
904
+ These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
905
+ - `current.checkpoint`
906
+ - `current.model`
907
+ - `current.huggingface_hub`
908
+
909
+ 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
910
+ the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
911
+ If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
912
+
913
+ temp_dir_root : str, default: None
914
+ The root directory under which `current.model.loaded` will store loaded models
905
915
  """
906
916
  ...
907
917
 
908
- def nim(*, models: "list[NIM]", backend: str, queue_timeout: int) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
918
+ def ollama(*, models: "list[Ollama]", backend: str) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
909
919
  """
910
- This decorator is used to run NIM containers in Metaflow tasks as sidecars.
920
+ This decorator is used to run Ollama APIs as Metaflow task sidecars.
911
921
 
912
922
  User code call
913
923
  -----------
914
- @nim(
924
+ @ollama(
915
925
  models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
916
- backend='managed'
926
+ backend='local'
917
927
  )
918
928
 
919
929
  Valid backend options
920
930
  ---------------------
921
- - 'managed': Outerbounds selects a compute provider based on the model.
931
+ - 'local': Run as a separate process on the local task machine.
932
+ - (TODO) 'managed': Outerbounds hosts and selects compute provider.
933
+ - (TODO) 'remote': Spin up separate instance to serve Ollama models.
922
934
 
923
935
  Valid model options
924
936
  ----------------
925
- - 'meta/llama3-8b-instruct': 8B parameter model
926
- - 'meta/llama3-70b-instruct': 70B parameter model
927
- - any model here: https://nvcf.ngc.nvidia.com/functions?filter=nvidia-functions
937
+ - 'llama3.2'
938
+ - 'llama3.3'
939
+ - any model here https://ollama.com/search
928
940
 
929
941
 
930
942
  Parameters
931
943
  ----------
932
- models: list[NIM]
933
- List of NIM containers running models in sidecars.
944
+ models: list[Ollama]
945
+ List of Ollama containers running models in sidecars.
934
946
  backend: str
935
- Compute provider to run the NIM container.
936
- queue_timeout : int
937
- Time to keep the job in NVCF's queue.
947
+ Determines where and how to run the Ollama process.
938
948
  """
939
949
  ...
940
950
 
941
951
  @typing.overload
942
- def checkpoint(*, load_policy: str = 'fresh', temp_dir_root: str = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
952
+ 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]]]:
943
953
  """
944
- Enables checkpointing for a step.
945
-
954
+ Specifies environment variables to be set prior to the execution of a step.
946
955
 
947
956
 
948
957
  Parameters
949
958
  ----------
950
- load_policy : str, default: "fresh"
951
- The policy for loading the checkpoint. The following policies are supported:
952
- - "eager": Loads the the latest available checkpoint within the namespace.
953
- With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
954
- will be loaded at the start of the task.
955
- - "none": Do not load any checkpoint
956
- - "fresh": Loads the lastest checkpoint created within the running Task.
957
- This mode helps loading checkpoints across various retry attempts of the same task.
958
- With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
959
- created within the task will be loaded when the task is retries execution on failure.
960
-
961
- temp_dir_root : str, default: None
962
- The root directory under which `current.checkpoint.directory` will be created.
959
+ vars : Dict[str, str], default {}
960
+ Dictionary of environment variables to set.
963
961
  """
964
962
  ...
965
963
 
966
964
  @typing.overload
967
- def checkpoint(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
965
+ def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
968
966
  ...
969
967
 
970
968
  @typing.overload
971
- def checkpoint(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
969
+ def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
972
970
  ...
973
971
 
974
- def checkpoint(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, load_policy: str = 'fresh', temp_dir_root: str = None):
972
+ def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
975
973
  """
976
- Enables checkpointing for a step.
977
-
974
+ Specifies environment variables to be set prior to the execution of a step.
978
975
 
979
976
 
980
977
  Parameters
981
978
  ----------
982
- load_policy : str, default: "fresh"
983
- The policy for loading the checkpoint. The following policies are supported:
984
- - "eager": Loads the the latest available checkpoint within the namespace.
985
- With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
986
- will be loaded at the start of the task.
987
- - "none": Do not load any checkpoint
988
- - "fresh": Loads the lastest checkpoint created within the running Task.
989
- This mode helps loading checkpoints across various retry attempts of the same task.
990
- With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
991
- created within the task will be loaded when the task is retries execution on failure.
979
+ vars : Dict[str, str], default {}
980
+ Dictionary of environment variables to set.
981
+ """
982
+ ...
983
+
984
+ def nvct(*, gpu: int, gpu_type: str) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
985
+ """
986
+ Specifies that this step should execute on DGX cloud.
992
987
 
993
- temp_dir_root : str, default: None
994
- The root directory under which `current.checkpoint.directory` will be created.
988
+
989
+ Parameters
990
+ ----------
991
+ gpu : int
992
+ Number of GPUs to use.
993
+ gpu_type : str
994
+ Type of Nvidia GPU to use.
995
995
  """
996
996
  ...
997
997
 
@@ -1089,53 +1089,144 @@ def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, event: t
1089
1089
  ...
1090
1090
 
1091
1091
  @typing.overload
1092
- 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]]:
1092
+ 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]]:
1093
1093
  """
1094
- Specifies the times when the flow should be run when running on a
1095
- production scheduler.
1094
+ Specifies the flow(s) that this flow depends on.
1095
+
1096
+ ```
1097
+ @trigger_on_finish(flow='FooFlow')
1098
+ ```
1099
+ or
1100
+ ```
1101
+ @trigger_on_finish(flows=['FooFlow', 'BarFlow'])
1102
+ ```
1103
+ This decorator respects the @project decorator and triggers the flow
1104
+ when upstream runs within the same namespace complete successfully
1105
+
1106
+ Additionally, you can specify project aware upstream flow dependencies
1107
+ by specifying the fully qualified project_flow_name.
1108
+ ```
1109
+ @trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
1110
+ ```
1111
+ or
1112
+ ```
1113
+ @trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
1114
+ ```
1115
+
1116
+ You can also specify just the project or project branch (other values will be
1117
+ inferred from the current project or project branch):
1118
+ ```
1119
+ @trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
1120
+ ```
1121
+
1122
+ Note that `branch` is typically one of:
1123
+ - `prod`
1124
+ - `user.bob`
1125
+ - `test.my_experiment`
1126
+ - `prod.staging`
1096
1127
 
1097
1128
 
1098
1129
  Parameters
1099
1130
  ----------
1100
- hourly : bool, default False
1101
- Run the workflow hourly.
1102
- daily : bool, default True
1103
- Run the workflow daily.
1104
- weekly : bool, default False
1105
- Run the workflow weekly.
1106
- cron : str, optional, default None
1107
- Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1108
- specified by this expression.
1109
- timezone : str, optional, default None
1110
- Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1111
- which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1131
+ flow : Union[str, Dict[str, str]], optional, default None
1132
+ Upstream flow dependency for this flow.
1133
+ flows : List[Union[str, Dict[str, str]]], default []
1134
+ Upstream flow dependencies for this flow.
1135
+ options : Dict[str, Any], default {}
1136
+ Backend-specific configuration for tuning eventing behavior.
1137
+ """
1138
+ ...
1139
+
1140
+ @typing.overload
1141
+ def trigger_on_finish(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1142
+ ...
1143
+
1144
+ 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] = {}):
1145
+ """
1146
+ Specifies the flow(s) that this flow depends on.
1147
+
1148
+ ```
1149
+ @trigger_on_finish(flow='FooFlow')
1150
+ ```
1151
+ or
1152
+ ```
1153
+ @trigger_on_finish(flows=['FooFlow', 'BarFlow'])
1154
+ ```
1155
+ This decorator respects the @project decorator and triggers the flow
1156
+ when upstream runs within the same namespace complete successfully
1157
+
1158
+ Additionally, you can specify project aware upstream flow dependencies
1159
+ by specifying the fully qualified project_flow_name.
1160
+ ```
1161
+ @trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
1162
+ ```
1163
+ or
1164
+ ```
1165
+ @trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
1166
+ ```
1167
+
1168
+ You can also specify just the project or project branch (other values will be
1169
+ inferred from the current project or project branch):
1170
+ ```
1171
+ @trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
1172
+ ```
1173
+
1174
+ Note that `branch` is typically one of:
1175
+ - `prod`
1176
+ - `user.bob`
1177
+ - `test.my_experiment`
1178
+ - `prod.staging`
1179
+
1180
+
1181
+ Parameters
1182
+ ----------
1183
+ flow : Union[str, Dict[str, str]], optional, default None
1184
+ Upstream flow dependency for this flow.
1185
+ flows : List[Union[str, Dict[str, str]]], default []
1186
+ Upstream flow dependencies for this flow.
1187
+ options : Dict[str, Any], default {}
1188
+ Backend-specific configuration for tuning eventing behavior.
1189
+ """
1190
+ ...
1191
+
1192
+ @typing.overload
1193
+ def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1194
+ """
1195
+ Specifies the PyPI packages for all steps of the flow.
1196
+
1197
+ Use `@pypi_base` to set common packages required by all
1198
+ steps and use `@pypi` to specify step-specific overrides.
1199
+
1200
+ Parameters
1201
+ ----------
1202
+ packages : Dict[str, str], default: {}
1203
+ Packages to use for this flow. The key is the name of the package
1204
+ and the value is the version to use.
1205
+ python : str, optional, default: None
1206
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1207
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1112
1208
  """
1113
1209
  ...
1114
1210
 
1115
1211
  @typing.overload
1116
- def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1212
+ def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1117
1213
  ...
1118
1214
 
1119
- 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):
1215
+ def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
1120
1216
  """
1121
- Specifies the times when the flow should be run when running on a
1122
- production scheduler.
1217
+ Specifies the PyPI packages for all steps of the flow.
1123
1218
 
1219
+ Use `@pypi_base` to set common packages required by all
1220
+ steps and use `@pypi` to specify step-specific overrides.
1124
1221
 
1125
1222
  Parameters
1126
1223
  ----------
1127
- hourly : bool, default False
1128
- Run the workflow hourly.
1129
- daily : bool, default True
1130
- Run the workflow daily.
1131
- weekly : bool, default False
1132
- Run the workflow weekly.
1133
- cron : str, optional, default None
1134
- Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1135
- specified by this expression.
1136
- timezone : str, optional, default None
1137
- Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1138
- which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1224
+ packages : Dict[str, str], default: {}
1225
+ Packages to use for this flow. The key is the name of the package
1226
+ and the value is the version to use.
1227
+ python : str, optional, default: None
1228
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1229
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1139
1230
  """
1140
1231
  ...
1141
1232
 
@@ -1254,103 +1345,53 @@ def with_artifact_store(f: typing.Optional[typing.Type[FlowSpecDerived]] = None)
1254
1345
  ...
1255
1346
 
1256
1347
  @typing.overload
1257
- def trigger_on_finish(*, flow: typing.Union[typing.Dict[str, str], str, None] = None, flows: typing.List[typing.Union[str, typing.Dict[str, str]]] = [], options: typing.Dict[str, typing.Any] = {}) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1348
+ 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]]:
1258
1349
  """
1259
- Specifies the flow(s) that this flow depends on.
1260
-
1261
- ```
1262
- @trigger_on_finish(flow='FooFlow')
1263
- ```
1264
- or
1265
- ```
1266
- @trigger_on_finish(flows=['FooFlow', 'BarFlow'])
1267
- ```
1268
- This decorator respects the @project decorator and triggers the flow
1269
- when upstream runs within the same namespace complete successfully
1270
-
1271
- Additionally, you can specify project aware upstream flow dependencies
1272
- by specifying the fully qualified project_flow_name.
1273
- ```
1274
- @trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
1275
- ```
1276
- or
1277
- ```
1278
- @trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
1279
- ```
1280
-
1281
- You can also specify just the project or project branch (other values will be
1282
- inferred from the current project or project branch):
1283
- ```
1284
- @trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
1285
- ```
1286
-
1287
- Note that `branch` is typically one of:
1288
- - `prod`
1289
- - `user.bob`
1290
- - `test.my_experiment`
1291
- - `prod.staging`
1350
+ Specifies the times when the flow should be run when running on a
1351
+ production scheduler.
1292
1352
 
1293
1353
 
1294
1354
  Parameters
1295
1355
  ----------
1296
- flow : Union[str, Dict[str, str]], optional, default None
1297
- Upstream flow dependency for this flow.
1298
- flows : List[Union[str, Dict[str, str]]], default []
1299
- Upstream flow dependencies for this flow.
1300
- options : Dict[str, Any], default {}
1301
- Backend-specific configuration for tuning eventing behavior.
1356
+ hourly : bool, default False
1357
+ Run the workflow hourly.
1358
+ daily : bool, default True
1359
+ Run the workflow daily.
1360
+ weekly : bool, default False
1361
+ Run the workflow weekly.
1362
+ cron : str, optional, default None
1363
+ Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1364
+ specified by this expression.
1365
+ timezone : str, optional, default None
1366
+ Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1367
+ which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1302
1368
  """
1303
1369
  ...
1304
1370
 
1305
1371
  @typing.overload
1306
- def trigger_on_finish(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1372
+ def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1307
1373
  ...
1308
1374
 
1309
- def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, flow: typing.Union[typing.Dict[str, str], str, None] = None, flows: typing.List[typing.Union[str, typing.Dict[str, str]]] = [], options: typing.Dict[str, typing.Any] = {}):
1375
+ 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):
1310
1376
  """
1311
- Specifies the flow(s) that this flow depends on.
1312
-
1313
- ```
1314
- @trigger_on_finish(flow='FooFlow')
1315
- ```
1316
- or
1317
- ```
1318
- @trigger_on_finish(flows=['FooFlow', 'BarFlow'])
1319
- ```
1320
- This decorator respects the @project decorator and triggers the flow
1321
- when upstream runs within the same namespace complete successfully
1322
-
1323
- Additionally, you can specify project aware upstream flow dependencies
1324
- by specifying the fully qualified project_flow_name.
1325
- ```
1326
- @trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
1327
- ```
1328
- or
1329
- ```
1330
- @trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
1331
- ```
1332
-
1333
- You can also specify just the project or project branch (other values will be
1334
- inferred from the current project or project branch):
1335
- ```
1336
- @trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
1337
- ```
1338
-
1339
- Note that `branch` is typically one of:
1340
- - `prod`
1341
- - `user.bob`
1342
- - `test.my_experiment`
1343
- - `prod.staging`
1377
+ Specifies the times when the flow should be run when running on a
1378
+ production scheduler.
1344
1379
 
1345
1380
 
1346
1381
  Parameters
1347
1382
  ----------
1348
- flow : Union[str, Dict[str, str]], optional, default None
1349
- Upstream flow dependency for this flow.
1350
- flows : List[Union[str, Dict[str, str]]], default []
1351
- Upstream flow dependencies for this flow.
1352
- options : Dict[str, Any], default {}
1353
- Backend-specific configuration for tuning eventing behavior.
1383
+ hourly : bool, default False
1384
+ Run the workflow hourly.
1385
+ daily : bool, default True
1386
+ Run the workflow daily.
1387
+ weekly : bool, default False
1388
+ Run the workflow weekly.
1389
+ cron : str, optional, default None
1390
+ Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1391
+ specified by this expression.
1392
+ timezone : str, optional, default None
1393
+ Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1394
+ which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1354
1395
  """
1355
1396
  ...
1356
1397
 
@@ -1405,10 +1446,13 @@ def conda_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packa
1405
1446
  """
1406
1447
  ...
1407
1448
 
1408
- def airflow_external_task_sensor(*, timeout: int, poke_interval: int, mode: str, exponential_backoff: bool, pool: str, soft_fail: bool, name: str, description: str, external_dag_id: str, external_task_ids: typing.List[str], allowed_states: typing.List[str], failed_states: typing.List[str], execution_delta: "datetime.timedelta", check_existence: bool) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1449
+ def airflow_s3_key_sensor(*, timeout: int, poke_interval: int, mode: str, exponential_backoff: bool, pool: str, soft_fail: bool, name: str, description: str, bucket_key: typing.Union[str, typing.List[str]], bucket_name: str, wildcard_match: bool, aws_conn_id: str, verify: bool) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1409
1450
  """
1410
- The `@airflow_external_task_sensor` decorator attaches a Airflow [ExternalTaskSensor](https://airflow.apache.org/docs/apache-airflow/stable/_api/airflow/sensors/external_task/index.html#airflow.sensors.external_task.ExternalTaskSensor) before the start step of the flow.
1411
- This decorator only works when a flow is scheduled on Airflow and is compiled using `airflow create`. More than one `@airflow_external_task_sensor` can be added as a flow decorators. Adding more than one decorator will ensure that `start` step starts only after all sensors finish.
1451
+ The `@airflow_s3_key_sensor` decorator attaches a Airflow [S3KeySensor](https://airflow.apache.org/docs/apache-airflow-providers-amazon/stable/_api/airflow/providers/amazon/aws/sensors/s3/index.html#airflow.providers.amazon.aws.sensors.s3.S3KeySensor)
1452
+ before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
1453
+ and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
1454
+ added as a flow decorators. Adding more than one decorator will ensure that `start` step
1455
+ starts only after all sensors finish.
1412
1456
 
1413
1457
 
1414
1458
  Parameters
@@ -1430,62 +1474,18 @@ def airflow_external_task_sensor(*, timeout: int, poke_interval: int, mode: str,
1430
1474
  Name of the sensor on Airflow
1431
1475
  description : str
1432
1476
  Description of sensor in the Airflow UI
1433
- external_dag_id : str
1434
- The dag_id that contains the task you want to wait for.
1435
- external_task_ids : List[str]
1436
- The list of task_ids that you want to wait for.
1437
- If None (default value) the sensor waits for the DAG. (Default: None)
1438
- allowed_states : List[str]
1439
- Iterable of allowed states, (Default: ['success'])
1440
- failed_states : List[str]
1441
- Iterable of failed or dis-allowed states. (Default: None)
1442
- execution_delta : datetime.timedelta
1443
- time difference with the previous execution to look at,
1444
- the default is the same logical date as the current task or DAG. (Default: None)
1445
- check_existence: bool
1446
- Set to True to check if the external task exists or check if
1447
- the DAG to wait for exists. (Default: True)
1448
- """
1449
- ...
1450
-
1451
- @typing.overload
1452
- def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1453
- """
1454
- Specifies the PyPI packages for all steps of the flow.
1455
-
1456
- Use `@pypi_base` to set common packages required by all
1457
- steps and use `@pypi` to specify step-specific overrides.
1458
-
1459
- Parameters
1460
- ----------
1461
- packages : Dict[str, str], default: {}
1462
- Packages to use for this flow. The key is the name of the package
1463
- and the value is the version to use.
1464
- python : str, optional, default: None
1465
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1466
- that the version used will correspond to the version of the Python interpreter used to start the run.
1467
- """
1468
- ...
1469
-
1470
- @typing.overload
1471
- def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1472
- ...
1473
-
1474
- def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
1475
- """
1476
- Specifies the PyPI packages for all steps of the flow.
1477
-
1478
- Use `@pypi_base` to set common packages required by all
1479
- steps and use `@pypi` to specify step-specific overrides.
1480
-
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
- python : str, optional, default: None
1487
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1488
- that the version used will correspond to the version of the Python interpreter used to start the run.
1477
+ bucket_key : Union[str, List[str]]
1478
+ The key(s) being waited on. Supports full s3:// style url or relative path from root level.
1479
+ When it's specified as a full s3:// url, please leave `bucket_name` as None
1480
+ bucket_name : str
1481
+ Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
1482
+ When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
1483
+ wildcard_match : bool
1484
+ whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
1485
+ aws_conn_id : str
1486
+ a reference to the s3 connection on Airflow. (Default: None)
1487
+ verify : bool
1488
+ Whether or not to verify SSL certificates for S3 connection. (Default: None)
1489
1489
  """
1490
1490
  ...
1491
1491
 
@@ -1524,13 +1524,10 @@ def project(*, name: str, branch: typing.Optional[str] = None, production: bool
1524
1524
  """
1525
1525
  ...
1526
1526
 
1527
- def airflow_s3_key_sensor(*, timeout: int, poke_interval: int, mode: str, exponential_backoff: bool, pool: str, soft_fail: bool, name: str, description: str, bucket_key: typing.Union[str, typing.List[str]], bucket_name: str, wildcard_match: bool, aws_conn_id: str, verify: bool) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1527
+ 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]]:
1528
1528
  """
1529
- The `@airflow_s3_key_sensor` decorator attaches a Airflow [S3KeySensor](https://airflow.apache.org/docs/apache-airflow-providers-amazon/stable/_api/airflow/providers/amazon/aws/sensors/s3/index.html#airflow.providers.amazon.aws.sensors.s3.S3KeySensor)
1530
- before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
1531
- and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
1532
- added as a flow decorators. Adding more than one decorator will ensure that `start` step
1533
- starts only after all sensors finish.
1529
+ 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.
1530
+ 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.
1534
1531
 
1535
1532
 
1536
1533
  Parameters
@@ -1552,18 +1549,21 @@ def airflow_s3_key_sensor(*, timeout: int, poke_interval: int, mode: str, expone
1552
1549
  Name of the sensor on Airflow
1553
1550
  description : str
1554
1551
  Description of sensor in the Airflow UI
1555
- bucket_key : Union[str, List[str]]
1556
- The key(s) being waited on. Supports full s3:// style url or relative path from root level.
1557
- When it's specified as a full s3:// url, please leave `bucket_name` as None
1558
- bucket_name : str
1559
- Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
1560
- When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
1561
- wildcard_match : bool
1562
- whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
1563
- aws_conn_id : str
1564
- a reference to the s3 connection on Airflow. (Default: None)
1565
- verify : bool
1566
- Whether or not to verify SSL certificates for S3 connection. (Default: None)
1552
+ external_dag_id : str
1553
+ The dag_id that contains the task you want to wait for.
1554
+ external_task_ids : List[str]
1555
+ The list of task_ids that you want to wait for.
1556
+ If None (default value) the sensor waits for the DAG. (Default: None)
1557
+ allowed_states : List[str]
1558
+ Iterable of allowed states, (Default: ['success'])
1559
+ failed_states : List[str]
1560
+ Iterable of failed or dis-allowed states. (Default: None)
1561
+ execution_delta : datetime.timedelta
1562
+ time difference with the previous execution to look at,
1563
+ the default is the same logical date as the current task or DAG. (Default: None)
1564
+ check_existence: bool
1565
+ Set to True to check if the external task exists or check if
1566
+ the DAG to wait for exists. (Default: True)
1567
1567
  """
1568
1568
  ...
1569
1569