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