ob-metaflow-stubs 6.0.3.155rc0__py2.py3-none-any.whl → 6.0.3.156__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 (200) hide show
  1. metaflow-stubs/__init__.pyi +550 -665
  2. metaflow-stubs/cards.pyi +2 -2
  3. metaflow-stubs/cli.pyi +2 -2
  4. metaflow-stubs/cli_components/__init__.pyi +2 -2
  5. metaflow-stubs/cli_components/utils.pyi +2 -2
  6. metaflow-stubs/client/__init__.pyi +2 -2
  7. metaflow-stubs/client/core.pyi +4 -4
  8. metaflow-stubs/client/filecache.pyi +2 -2
  9. metaflow-stubs/events.pyi +3 -3
  10. metaflow-stubs/exception.pyi +2 -2
  11. metaflow-stubs/flowspec.pyi +3 -3
  12. metaflow-stubs/generated_for.txt +1 -1
  13. metaflow-stubs/includefile.pyi +3 -3
  14. metaflow-stubs/info_file.pyi +2 -2
  15. metaflow-stubs/metadata_provider/__init__.pyi +2 -2
  16. metaflow-stubs/metadata_provider/heartbeat.pyi +2 -2
  17. metaflow-stubs/metadata_provider/metadata.pyi +2 -2
  18. metaflow-stubs/metadata_provider/util.pyi +2 -2
  19. metaflow-stubs/metaflow_config.pyi +2 -2
  20. metaflow-stubs/metaflow_current.pyi +98 -98
  21. metaflow-stubs/mf_extensions/__init__.pyi +2 -2
  22. metaflow-stubs/mf_extensions/obcheckpoint/__init__.pyi +2 -2
  23. metaflow-stubs/mf_extensions/obcheckpoint/plugins/__init__.pyi +2 -2
  24. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/__init__.pyi +2 -2
  25. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/__init__.pyi +2 -2
  26. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/async_cards.pyi +2 -2
  27. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/deco_injection_mixin.pyi +2 -2
  28. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/extra_components.pyi +3 -3
  29. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/__init__.pyi +2 -2
  30. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/__init__.pyi +2 -2
  31. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/checkpoint_lister.pyi +3 -3
  32. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/lineage_card.pyi +2 -2
  33. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/checkpoint_storage.pyi +3 -5
  34. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/constructors.pyi +2 -2
  35. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/core.pyi +4 -10
  36. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/decorator.pyi +4 -5
  37. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/exceptions.pyi +2 -2
  38. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/final_api.pyi +2 -4
  39. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/lineage.pyi +2 -2
  40. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/__init__.pyi +2 -2
  41. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/core.pyi +8 -4
  42. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/exceptions.pyi +2 -2
  43. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/task_utils.pyi +4 -32
  44. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/utils.pyi +2 -2
  45. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastructures.pyi +2 -2
  46. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/exceptions.pyi +2 -2
  47. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/hf_hub/__init__.pyi +2 -2
  48. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/hf_hub/decorator.pyi +2 -2
  49. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/__init__.pyi +2 -2
  50. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/core.pyi +3 -3
  51. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/exceptions.pyi +2 -2
  52. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/model_storage.pyi +3 -3
  53. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/__init__.pyi +2 -2
  54. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/flowspec_utils.pyi +2 -2
  55. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/general.pyi +2 -2
  56. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/identity_utils.pyi +3 -3
  57. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/__init__.pyi +2 -2
  58. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/base.pyi +2 -2
  59. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/tar.pyi +2 -2
  60. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/tar_utils.pyi +2 -2
  61. metaflow-stubs/mf_extensions/outerbounds/__init__.pyi +2 -2
  62. metaflow-stubs/mf_extensions/outerbounds/plugins/__init__.pyi +2 -2
  63. metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/__init__.pyi +2 -2
  64. metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/injector.pyi +2 -2
  65. metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/__init__.pyi +2 -2
  66. metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/ollama.pyi +2 -2
  67. metaflow-stubs/mf_extensions/outerbounds/plugins/snowflake/__init__.pyi +2 -2
  68. metaflow-stubs/mf_extensions/outerbounds/plugins/snowflake/snowflake.pyi +2 -2
  69. metaflow-stubs/mf_extensions/outerbounds/profilers/__init__.pyi +2 -2
  70. metaflow-stubs/mf_extensions/outerbounds/profilers/gpu.pyi +2 -2
  71. metaflow-stubs/mf_extensions/outerbounds/remote_config.pyi +2 -2
  72. metaflow-stubs/mf_extensions/outerbounds/toplevel/__init__.pyi +2 -2
  73. metaflow-stubs/mf_extensions/outerbounds/toplevel/global_aliases_for_metaflow_package.pyi +2 -2
  74. metaflow-stubs/multicore_utils.pyi +2 -2
  75. metaflow-stubs/parameters.pyi +3 -3
  76. metaflow-stubs/plugins/__init__.pyi +12 -12
  77. metaflow-stubs/plugins/airflow/__init__.pyi +2 -2
  78. metaflow-stubs/plugins/airflow/airflow_utils.pyi +2 -2
  79. metaflow-stubs/plugins/airflow/exception.pyi +2 -2
  80. metaflow-stubs/plugins/airflow/sensors/__init__.pyi +2 -2
  81. metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +2 -2
  82. metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +2 -2
  83. metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +2 -2
  84. metaflow-stubs/plugins/argo/__init__.pyi +2 -2
  85. metaflow-stubs/plugins/argo/argo_client.pyi +2 -2
  86. metaflow-stubs/plugins/argo/argo_events.pyi +2 -2
  87. metaflow-stubs/plugins/argo/argo_workflows.pyi +3 -3
  88. metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +3 -3
  89. metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +3 -3
  90. metaflow-stubs/plugins/argo/argo_workflows_deployer_objects.pyi +2 -2
  91. metaflow-stubs/plugins/aws/__init__.pyi +2 -2
  92. metaflow-stubs/plugins/aws/aws_client.pyi +2 -2
  93. metaflow-stubs/plugins/aws/aws_utils.pyi +2 -2
  94. metaflow-stubs/plugins/aws/batch/__init__.pyi +2 -2
  95. metaflow-stubs/plugins/aws/batch/batch.pyi +2 -2
  96. metaflow-stubs/plugins/aws/batch/batch_client.pyi +2 -2
  97. metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +2 -2
  98. metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +2 -2
  99. metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +4 -4
  100. metaflow-stubs/plugins/aws/step_functions/__init__.pyi +2 -2
  101. metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +2 -2
  102. metaflow-stubs/plugins/aws/step_functions/schedule_decorator.pyi +2 -2
  103. metaflow-stubs/plugins/aws/step_functions/step_functions.pyi +2 -2
  104. metaflow-stubs/plugins/aws/step_functions/step_functions_client.pyi +2 -2
  105. metaflow-stubs/plugins/aws/step_functions/step_functions_deployer.pyi +3 -3
  106. metaflow-stubs/plugins/aws/step_functions/step_functions_deployer_objects.pyi +2 -2
  107. metaflow-stubs/plugins/azure/__init__.pyi +2 -2
  108. metaflow-stubs/plugins/azure/azure_credential.pyi +2 -2
  109. metaflow-stubs/plugins/azure/azure_exceptions.pyi +2 -2
  110. metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +4 -4
  111. metaflow-stubs/plugins/azure/azure_utils.pyi +2 -2
  112. metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +2 -2
  113. metaflow-stubs/plugins/azure/includefile_support.pyi +2 -2
  114. metaflow-stubs/plugins/cards/__init__.pyi +2 -2
  115. metaflow-stubs/plugins/cards/card_client.pyi +2 -2
  116. metaflow-stubs/plugins/cards/card_creator.pyi +2 -2
  117. metaflow-stubs/plugins/cards/card_datastore.pyi +2 -2
  118. metaflow-stubs/plugins/cards/card_decorator.pyi +2 -2
  119. metaflow-stubs/plugins/cards/card_modules/__init__.pyi +2 -2
  120. metaflow-stubs/plugins/cards/card_modules/basic.pyi +3 -3
  121. metaflow-stubs/plugins/cards/card_modules/card.pyi +2 -2
  122. metaflow-stubs/plugins/cards/card_modules/components.pyi +3 -3
  123. metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +2 -2
  124. metaflow-stubs/plugins/cards/card_modules/renderer_tools.pyi +2 -2
  125. metaflow-stubs/plugins/cards/card_modules/test_cards.pyi +2 -2
  126. metaflow-stubs/plugins/cards/card_resolver.pyi +2 -2
  127. metaflow-stubs/plugins/cards/component_serializer.pyi +2 -2
  128. metaflow-stubs/plugins/cards/exception.pyi +2 -2
  129. metaflow-stubs/plugins/catch_decorator.pyi +2 -2
  130. metaflow-stubs/plugins/datatools/__init__.pyi +2 -2
  131. metaflow-stubs/plugins/datatools/local.pyi +2 -2
  132. metaflow-stubs/plugins/datatools/s3/__init__.pyi +2 -2
  133. metaflow-stubs/plugins/datatools/s3/s3.pyi +3 -3
  134. metaflow-stubs/plugins/datatools/s3/s3tail.pyi +2 -2
  135. metaflow-stubs/plugins/datatools/s3/s3util.pyi +2 -2
  136. metaflow-stubs/plugins/debug_logger.pyi +2 -2
  137. metaflow-stubs/plugins/debug_monitor.pyi +2 -2
  138. metaflow-stubs/plugins/environment_decorator.pyi +2 -2
  139. metaflow-stubs/plugins/events_decorator.pyi +2 -2
  140. metaflow-stubs/plugins/frameworks/__init__.pyi +2 -2
  141. metaflow-stubs/plugins/frameworks/pytorch.pyi +2 -2
  142. metaflow-stubs/plugins/gcp/__init__.pyi +2 -2
  143. metaflow-stubs/plugins/gcp/gcp_secret_manager_secrets_provider.pyi +4 -4
  144. metaflow-stubs/plugins/gcp/gs_exceptions.pyi +2 -2
  145. metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +2 -2
  146. metaflow-stubs/plugins/gcp/gs_utils.pyi +2 -2
  147. metaflow-stubs/plugins/gcp/includefile_support.pyi +2 -2
  148. metaflow-stubs/plugins/kubernetes/__init__.pyi +2 -2
  149. metaflow-stubs/plugins/kubernetes/kube_utils.pyi +2 -2
  150. metaflow-stubs/plugins/kubernetes/kubernetes.pyi +2 -2
  151. metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +2 -2
  152. metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +2 -2
  153. metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +2 -2
  154. metaflow-stubs/plugins/kubernetes/spot_monitor_sidecar.pyi +2 -2
  155. metaflow-stubs/plugins/ollama/__init__.pyi +2 -2
  156. metaflow-stubs/plugins/parallel_decorator.pyi +2 -2
  157. metaflow-stubs/plugins/perimeters.pyi +2 -2
  158. metaflow-stubs/plugins/project_decorator.pyi +2 -2
  159. metaflow-stubs/plugins/pypi/__init__.pyi +3 -3
  160. metaflow-stubs/plugins/pypi/conda_decorator.pyi +2 -2
  161. metaflow-stubs/plugins/pypi/conda_environment.pyi +4 -4
  162. metaflow-stubs/plugins/pypi/parsers.pyi +2 -2
  163. metaflow-stubs/plugins/pypi/pypi_decorator.pyi +2 -2
  164. metaflow-stubs/plugins/pypi/pypi_environment.pyi +2 -2
  165. metaflow-stubs/plugins/pypi/utils.pyi +2 -2
  166. metaflow-stubs/plugins/resources_decorator.pyi +2 -2
  167. metaflow-stubs/plugins/retry_decorator.pyi +2 -2
  168. metaflow-stubs/plugins/secrets/__init__.pyi +3 -3
  169. metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +4 -4
  170. metaflow-stubs/plugins/secrets/secrets_decorator.pyi +2 -2
  171. metaflow-stubs/plugins/snowflake/__init__.pyi +2 -2
  172. metaflow-stubs/plugins/storage_executor.pyi +2 -2
  173. metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +2 -2
  174. metaflow-stubs/plugins/timeout_decorator.pyi +2 -2
  175. metaflow-stubs/profilers/__init__.pyi +2 -2
  176. metaflow-stubs/pylint_wrapper.pyi +2 -2
  177. metaflow-stubs/runner/__init__.pyi +2 -2
  178. metaflow-stubs/runner/deployer.pyi +5 -5
  179. metaflow-stubs/runner/deployer_impl.pyi +2 -2
  180. metaflow-stubs/runner/metaflow_runner.pyi +2 -2
  181. metaflow-stubs/runner/nbdeploy.pyi +2 -2
  182. metaflow-stubs/runner/nbrun.pyi +2 -2
  183. metaflow-stubs/runner/subprocess_manager.pyi +2 -2
  184. metaflow-stubs/runner/utils.pyi +3 -3
  185. metaflow-stubs/system/__init__.pyi +2 -2
  186. metaflow-stubs/system/system_logger.pyi +2 -2
  187. metaflow-stubs/system/system_monitor.pyi +2 -2
  188. metaflow-stubs/tagging_util.pyi +2 -2
  189. metaflow-stubs/tuple_util.pyi +2 -2
  190. metaflow-stubs/user_configs/__init__.pyi +2 -2
  191. metaflow-stubs/user_configs/config_decorators.pyi +6 -6
  192. metaflow-stubs/user_configs/config_options.pyi +2 -2
  193. metaflow-stubs/user_configs/config_parameters.pyi +5 -5
  194. {ob_metaflow_stubs-6.0.3.155rc0.dist-info → ob_metaflow_stubs-6.0.3.156.dist-info}/METADATA +1 -1
  195. ob_metaflow_stubs-6.0.3.156.dist-info/RECORD +198 -0
  196. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/context.pyi +0 -95
  197. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/decorator.pyi +0 -135
  198. ob_metaflow_stubs-6.0.3.155rc0.dist-info/RECORD +0 -200
  199. {ob_metaflow_stubs-6.0.3.155rc0.dist-info → ob_metaflow_stubs-6.0.3.156.dist-info}/WHEEL +0 -0
  200. {ob_metaflow_stubs-6.0.3.155rc0.dist-info → ob_metaflow_stubs-6.0.3.156.dist-info}/top_level.txt +0 -0
@@ -1,7 +1,7 @@
1
1
  ######################################################################################################
2
2
  # Auto-generated Metaflow stub file #
3
- # MF version: 2.15.7.2+obcheckpoint(0.2.0);ob(v1) #
4
- # Generated on 2025-04-14T19:55:43.556579 #
3
+ # MF version: 2.15.7.2+obcheckpoint(0.1.9);ob(v1) #
4
+ # Generated on 2025-04-16T21:50:24.175279 #
5
5
  ######################################################################################################
6
6
 
7
7
  from __future__ import annotations
@@ -35,17 +35,17 @@ from .user_configs.config_parameters import ConfigValue as ConfigValue
35
35
  from .user_configs.config_parameters import config_expr as config_expr
36
36
  from .user_configs.config_decorators import CustomFlowDecorator as CustomFlowDecorator
37
37
  from .user_configs.config_decorators import CustomStepDecorator as CustomStepDecorator
38
- from . import events as events
39
38
  from . import tuple_util as tuple_util
40
39
  from . import cards as cards
40
+ from . import events as events
41
41
  from . import runner as runner
42
42
  from . import plugins as plugins
43
43
  from .mf_extensions.outerbounds.toplevel.global_aliases_for_metaflow_package import S3 as S3
44
44
  from . import includefile as includefile
45
45
  from .includefile import IncludeFile as IncludeFile
46
46
  from .plugins.pypi.parsers import requirements_txt_parser as requirements_txt_parser
47
- from .plugins.pypi.parsers import pyproject_toml_parser as pyproject_toml_parser
48
47
  from .plugins.pypi.parsers import conda_environment_yml_parser as conda_environment_yml_parser
48
+ from .plugins.pypi.parsers import pyproject_toml_parser as pyproject_toml_parser
49
49
  from . import client as client
50
50
  from .client.core import namespace as namespace
51
51
  from .client.core import get_namespace as get_namespace
@@ -66,7 +66,6 @@ from .runner.deployer import DeployedFlow as DeployedFlow
66
66
  from .runner.nbdeploy import NBDeployer as NBDeployer
67
67
  from .mf_extensions.obcheckpoint.plugins.machine_learning_utilities.checkpoints.final_api import Checkpoint as Checkpoint
68
68
  from .mf_extensions.obcheckpoint.plugins.machine_learning_utilities.datastructures import load_model as load_model
69
- from .mf_extensions.obcheckpoint.plugins.machine_learning_utilities.datastore.context import artifact_store_from as artifact_store_from
70
69
  from .mf_extensions.outerbounds.toplevel.global_aliases_for_metaflow_package import get_aws_client as get_aws_client
71
70
  from .mf_extensions.outerbounds.plugins.snowflake.snowflake import Snowflake as Snowflake
72
71
  from . import cli_components as cli_components
@@ -150,159 +149,206 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
150
149
  """
151
150
  ...
152
151
 
152
+ 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]]]:
153
+ """
154
+ Specifies that this step should execute on DGX cloud.
155
+
156
+
157
+ Parameters
158
+ ----------
159
+ gpu : int
160
+ Number of GPUs to use.
161
+ gpu_type : str
162
+ Type of Nvidia GPU to use.
163
+ queue_timeout : int
164
+ Time to keep the job in NVCF's queue.
165
+ """
166
+ ...
167
+
153
168
  @typing.overload
154
- 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]]]:
169
+ 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]]]:
155
170
  """
156
- Specifies the PyPI packages for the step.
171
+ Specifies that the step will success under all circumstances.
157
172
 
158
- Information in this decorator will augment any
159
- attributes set in the `@pyi_base` flow-level decorator. Hence,
160
- you can use `@pypi_base` to set packages required by all
161
- steps and use `@pypi` to specify step-specific overrides.
173
+ The decorator will create an optional artifact, specified by `var`, which
174
+ contains the exception raised. You can use it to detect the presence
175
+ of errors, indicating that all happy-path artifacts produced by the step
176
+ are missing.
162
177
 
163
178
 
164
179
  Parameters
165
180
  ----------
166
- packages : Dict[str, str], default: {}
167
- Packages to use for this step. The key is the name of the package
168
- and the value is the version to use.
169
- python : str, optional, default: None
170
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
171
- that the version used will correspond to the version of the Python interpreter used to start the run.
181
+ var : str, optional, default None
182
+ Name of the artifact in which to store the caught exception.
183
+ If not specified, the exception is not stored.
184
+ print_exception : bool, default True
185
+ Determines whether or not the exception is printed to
186
+ stdout when caught.
172
187
  """
173
188
  ...
174
189
 
175
190
  @typing.overload
176
- def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
191
+ def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
177
192
  ...
178
193
 
179
194
  @typing.overload
180
- def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
195
+ def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
181
196
  ...
182
197
 
183
- def pypi(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
198
+ 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):
184
199
  """
185
- Specifies the PyPI packages for the step.
200
+ Specifies that the step will success under all circumstances.
186
201
 
187
- Information in this decorator will augment any
188
- attributes set in the `@pyi_base` flow-level decorator. Hence,
189
- you can use `@pypi_base` to set packages required by all
190
- steps and use `@pypi` to specify step-specific overrides.
202
+ The decorator will create an optional artifact, specified by `var`, which
203
+ contains the exception raised. You can use it to detect the presence
204
+ of errors, indicating that all happy-path artifacts produced by the step
205
+ are missing.
191
206
 
192
207
 
193
208
  Parameters
194
209
  ----------
195
- packages : Dict[str, str], default: {}
196
- Packages to use for this step. The key is the name of the package
197
- and the value is the version to use.
198
- python : str, optional, default: None
199
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
200
- that the version used will correspond to the version of the Python interpreter used to start the run.
210
+ var : str, optional, default None
211
+ Name of the artifact in which to store the caught exception.
212
+ If not specified, the exception is not stored.
213
+ print_exception : bool, default True
214
+ Determines whether or not the exception is printed to
215
+ stdout when caught.
201
216
  """
202
217
  ...
203
218
 
204
219
  @typing.overload
205
- 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]]]:
220
+ 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]]]:
206
221
  """
207
- Specifies secrets to be retrieved and injected as environment variables prior to
208
- the execution of a step.
222
+ Specifies the resources needed when executing this step.
223
+
224
+ Use `@resources` to specify the resource requirements
225
+ independently of the specific compute layer (`@batch`, `@kubernetes`).
226
+
227
+ You can choose the compute layer on the command line by executing e.g.
228
+ ```
229
+ python myflow.py run --with batch
230
+ ```
231
+ or
232
+ ```
233
+ python myflow.py run --with kubernetes
234
+ ```
235
+ which executes the flow on the desired system using the
236
+ requirements specified in `@resources`.
209
237
 
210
238
 
211
239
  Parameters
212
240
  ----------
213
- sources : List[Union[str, Dict[str, Any]]], default: []
214
- List of secret specs, defining how the secrets are to be retrieved
241
+ cpu : int, default 1
242
+ Number of CPUs required for this step.
243
+ gpu : int, optional, default None
244
+ Number of GPUs required for this step.
245
+ disk : int, optional, default None
246
+ Disk size (in MB) required for this step. Only applies on Kubernetes.
247
+ memory : int, default 4096
248
+ Memory size (in MB) required for this step.
249
+ shared_memory : int, optional, default None
250
+ The value for the size (in MiB) of the /dev/shm volume for this step.
251
+ This parameter maps to the `--shm-size` option in Docker.
215
252
  """
216
253
  ...
217
254
 
218
255
  @typing.overload
219
- def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
256
+ def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
220
257
  ...
221
258
 
222
259
  @typing.overload
223
- def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
260
+ def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
224
261
  ...
225
262
 
226
- def secrets(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, sources: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = []):
263
+ 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):
227
264
  """
228
- Specifies secrets to be retrieved and injected as environment variables prior to
229
- the execution of a step.
265
+ Specifies the resources needed when executing this step.
266
+
267
+ Use `@resources` to specify the resource requirements
268
+ independently of the specific compute layer (`@batch`, `@kubernetes`).
269
+
270
+ You can choose the compute layer on the command line by executing e.g.
271
+ ```
272
+ python myflow.py run --with batch
273
+ ```
274
+ or
275
+ ```
276
+ python myflow.py run --with kubernetes
277
+ ```
278
+ which executes the flow on the desired system using the
279
+ requirements specified in `@resources`.
230
280
 
231
281
 
232
282
  Parameters
233
283
  ----------
234
- sources : List[Union[str, Dict[str, Any]]], default: []
235
- List of secret specs, defining how the secrets are to be retrieved
284
+ cpu : int, default 1
285
+ Number of CPUs required for this step.
286
+ gpu : int, optional, default None
287
+ Number of GPUs required for this step.
288
+ disk : int, optional, default None
289
+ Disk size (in MB) required for this step. Only applies on Kubernetes.
290
+ memory : int, default 4096
291
+ Memory size (in MB) required for this step.
292
+ shared_memory : int, optional, default None
293
+ The value for the size (in MiB) of the /dev/shm volume for this step.
294
+ This parameter maps to the `--shm-size` option in Docker.
236
295
  """
237
296
  ...
238
297
 
239
298
  @typing.overload
240
- 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]]]:
299
+ 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]]]:
241
300
  """
242
- Specifies the number of times the task corresponding
243
- to a step needs to be retried.
244
-
245
- This decorator is useful for handling transient errors, such as networking issues.
246
- If your task contains operations that can't be retried safely, e.g. database updates,
247
- it is advisable to annotate it with `@retry(times=0)`.
301
+ Enables checkpointing for a step.
248
302
 
249
- This can be used in conjunction with the `@catch` decorator. The `@catch`
250
- decorator will execute a no-op task after all retries have been exhausted,
251
- ensuring that the flow execution can continue.
252
303
 
253
304
 
254
305
  Parameters
255
306
  ----------
256
- times : int, default 3
257
- Number of times to retry this task.
258
- minutes_between_retries : int, default 2
259
- Number of minutes between retries.
307
+ load_policy : str, default: "fresh"
308
+ The policy for loading the checkpoint. The following policies are supported:
309
+ - "eager": Loads the the latest available checkpoint within the namespace.
310
+ With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
311
+ will be loaded at the start of the task.
312
+ - "none": Do not load any checkpoint
313
+ - "fresh": Loads the lastest checkpoint created within the running Task.
314
+ This mode helps loading checkpoints across various retry attempts of the same task.
315
+ With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
316
+ created within the task will be loaded when the task is retries execution on failure.
317
+
318
+ temp_dir_root : str, default: None
319
+ The root directory under which `current.checkpoint.directory` will be created.
260
320
  """
261
321
  ...
262
322
 
263
323
  @typing.overload
264
- def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
324
+ def checkpoint(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
265
325
  ...
266
326
 
267
327
  @typing.overload
268
- def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
328
+ def checkpoint(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
269
329
  ...
270
330
 
271
- 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):
331
+ 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):
272
332
  """
273
- Specifies the number of times the task corresponding
274
- to a step needs to be retried.
275
-
276
- This decorator is useful for handling transient errors, such as networking issues.
277
- If your task contains operations that can't be retried safely, e.g. database updates,
278
- it is advisable to annotate it with `@retry(times=0)`.
333
+ Enables checkpointing for a step.
279
334
 
280
- This can be used in conjunction with the `@catch` decorator. The `@catch`
281
- decorator will execute a no-op task after all retries have been exhausted,
282
- ensuring that the flow execution can continue.
283
335
 
284
336
 
285
337
  Parameters
286
338
  ----------
287
- times : int, default 3
288
- Number of times to retry this task.
289
- minutes_between_retries : int, default 2
290
- Number of minutes between retries.
291
- """
292
- ...
293
-
294
- 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]]]:
295
- """
296
- Specifies that this step is used to deploy an instance of the app.
297
- Requires that self.app_name, self.app_port, self.entrypoint and self.deployDir is set.
298
-
339
+ load_policy : str, default: "fresh"
340
+ The policy for loading the checkpoint. The following policies are supported:
341
+ - "eager": Loads the the latest available checkpoint within the namespace.
342
+ With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
343
+ will be loaded at the start of the task.
344
+ - "none": Do not load any checkpoint
345
+ - "fresh": Loads the lastest checkpoint created within the running Task.
346
+ This mode helps loading checkpoints across various retry attempts of the same task.
347
+ With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
348
+ created within the task will be loaded when the task is retries execution on failure.
299
349
 
300
- Parameters
301
- ----------
302
- app_port : int
303
- Number of GPUs to use.
304
- app_name : str
305
- Name of the app to deploy.
350
+ temp_dir_root : str, default: None
351
+ The root directory under which `current.checkpoint.directory` will be created.
306
352
  """
307
353
  ...
308
354
 
@@ -365,6 +411,23 @@ def timeout(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None],
365
411
  """
366
412
  ...
367
413
 
414
+ @typing.overload
415
+ def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
416
+ """
417
+ Internal decorator to support Fast bakery
418
+ """
419
+ ...
420
+
421
+ @typing.overload
422
+ def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
423
+ ...
424
+
425
+ def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
426
+ """
427
+ Internal decorator to support Fast bakery
428
+ """
429
+ ...
430
+
368
431
  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]]]:
369
432
  """
370
433
  Decorator that helps cache, version and store models/datasets from huggingface hub.
@@ -390,36 +453,124 @@ def huggingface_hub(*, temp_dir_root: typing.Optional[str] = None, load: typing.
390
453
  """
391
454
  ...
392
455
 
393
- 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]]]:
456
+ @typing.overload
457
+ 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]]]:
394
458
  """
395
- Specifies that this step should execute on DGX cloud.
459
+ Creates a human-readable report, a Metaflow Card, after this step completes.
460
+
461
+ Note that you may add multiple `@card` decorators in a step with different parameters.
396
462
 
397
463
 
398
464
  Parameters
399
465
  ----------
400
- gpu : int
401
- Number of GPUs to use.
402
- gpu_type : str
403
- Type of Nvidia GPU to use.
404
- queue_timeout : int
405
- Time to keep the job in NVCF's queue.
466
+ type : str, default 'default'
467
+ Card type.
468
+ id : str, optional, default None
469
+ If multiple cards are present, use this id to identify this card.
470
+ options : Dict[str, Any], default {}
471
+ Options passed to the card. The contents depend on the card type.
472
+ timeout : int, default 45
473
+ Interrupt reporting if it takes more than this many seconds.
406
474
  """
407
475
  ...
408
476
 
409
477
  @typing.overload
410
- def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
411
- """
412
- Internal decorator to support Fast bakery
478
+ def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
479
+ ...
480
+
481
+ @typing.overload
482
+ def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
483
+ ...
484
+
485
+ 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):
486
+ """
487
+ Creates a human-readable report, a Metaflow Card, after this step completes.
488
+
489
+ Note that you may add multiple `@card` decorators in a step with different parameters.
490
+
491
+
492
+ Parameters
493
+ ----------
494
+ type : str, default 'default'
495
+ Card type.
496
+ id : str, optional, default None
497
+ If multiple cards are present, use this id to identify this card.
498
+ options : Dict[str, Any], default {}
499
+ Options passed to the card. The contents depend on the card type.
500
+ timeout : int, default 45
501
+ Interrupt reporting if it takes more than this many seconds.
413
502
  """
414
503
  ...
415
504
 
416
505
  @typing.overload
417
- def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
506
+ 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]]]:
507
+ """
508
+ Enables loading / saving of models within a step.
509
+
510
+
511
+
512
+ Parameters
513
+ ----------
514
+ load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
515
+ Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
516
+ These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
517
+ - `current.checkpoint`
518
+ - `current.model`
519
+ - `current.huggingface_hub`
520
+
521
+ 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
522
+ the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
523
+ If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
524
+
525
+ temp_dir_root : str, default: None
526
+ The root directory under which `current.model.loaded` will store loaded models
527
+ """
418
528
  ...
419
529
 
420
- def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
530
+ @typing.overload
531
+ def model(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
532
+ ...
533
+
534
+ @typing.overload
535
+ def model(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
536
+ ...
537
+
538
+ 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):
421
539
  """
422
- Internal decorator to support Fast bakery
540
+ Enables loading / saving of models within a step.
541
+
542
+
543
+
544
+ Parameters
545
+ ----------
546
+ load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
547
+ Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
548
+ These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
549
+ - `current.checkpoint`
550
+ - `current.model`
551
+ - `current.huggingface_hub`
552
+
553
+ 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
554
+ the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
555
+ If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
556
+
557
+ temp_dir_root : str, default: None
558
+ The root directory under which `current.model.loaded` will store loaded models
559
+ """
560
+ ...
561
+
562
+ 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]]]:
563
+ """
564
+ Specifies that this step is used to deploy an instance of the app.
565
+ Requires that self.app_name, self.app_port, self.entrypoint and self.deployDir is set.
566
+
567
+
568
+ Parameters
569
+ ----------
570
+ app_port : int
571
+ Number of GPUs to use.
572
+ app_name : str
573
+ Name of the app to deploy.
423
574
  """
424
575
  ...
425
576
 
@@ -456,6 +607,74 @@ def ollama(*, models: "list[Ollama]", backend: str) -> typing.Callable[[typing.U
456
607
  """
457
608
  ...
458
609
 
610
+ def nim(*, models: "list[NIM]", backend: str, queue_timeout: int) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
611
+ """
612
+ This decorator is used to run NIM containers in Metaflow tasks as sidecars.
613
+
614
+ User code call
615
+ -----------
616
+ @nim(
617
+ models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
618
+ backend='managed'
619
+ )
620
+
621
+ Valid backend options
622
+ ---------------------
623
+ - 'managed': Outerbounds selects a compute provider based on the model.
624
+
625
+ Valid model options
626
+ ----------------
627
+ - 'meta/llama3-8b-instruct': 8B parameter model
628
+ - 'meta/llama3-70b-instruct': 70B parameter model
629
+ - any model here: https://nvcf.ngc.nvidia.com/functions?filter=nvidia-functions
630
+
631
+
632
+ Parameters
633
+ ----------
634
+ models: list[NIM]
635
+ List of NIM containers running models in sidecars.
636
+ backend: str
637
+ Compute provider to run the NIM container.
638
+ queue_timeout : int
639
+ Time to keep the job in NVCF's queue.
640
+ """
641
+ ...
642
+
643
+ @typing.overload
644
+ 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]]]:
645
+ """
646
+ Specifies secrets to be retrieved and injected as environment variables prior to
647
+ the execution of a step.
648
+
649
+
650
+ Parameters
651
+ ----------
652
+ sources : List[Union[str, Dict[str, Any]]], default: []
653
+ List of secret specs, defining how the secrets are to be retrieved
654
+ """
655
+ ...
656
+
657
+ @typing.overload
658
+ def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
659
+ ...
660
+
661
+ @typing.overload
662
+ def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
663
+ ...
664
+
665
+ def secrets(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, sources: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = []):
666
+ """
667
+ Specifies secrets to be retrieved and injected as environment variables prior to
668
+ the execution of a step.
669
+
670
+
671
+ Parameters
672
+ ----------
673
+ sources : List[Union[str, Dict[str, Any]]], default: []
674
+ List of secret specs, defining how the secrets are to be retrieved
675
+ """
676
+ ...
677
+
459
678
  @typing.overload
460
679
  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]]]:
461
680
  """
@@ -516,59 +735,53 @@ def conda(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
516
735
  ...
517
736
 
518
737
  @typing.overload
519
- 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]]]:
738
+ 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]]]:
520
739
  """
521
- Enables loading / saving of models within a step.
740
+ Specifies the PyPI packages for the step.
522
741
 
742
+ Information in this decorator will augment any
743
+ attributes set in the `@pyi_base` flow-level decorator. Hence,
744
+ you can use `@pypi_base` to set packages required by all
745
+ steps and use `@pypi` to specify step-specific overrides.
523
746
 
524
747
 
525
748
  Parameters
526
749
  ----------
527
- load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
528
- Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
529
- These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
530
- - `current.checkpoint`
531
- - `current.model`
532
- - `current.huggingface_hub`
533
-
534
- 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
535
- the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
536
- If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
537
-
538
- temp_dir_root : str, default: None
539
- The root directory under which `current.model.loaded` will store loaded models
750
+ packages : Dict[str, str], default: {}
751
+ Packages to use for this step. The key is the name of the package
752
+ and the value is the version to use.
753
+ python : str, optional, default: None
754
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
755
+ that the version used will correspond to the version of the Python interpreter used to start the run.
540
756
  """
541
757
  ...
542
758
 
543
759
  @typing.overload
544
- def model(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
760
+ def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
545
761
  ...
546
762
 
547
763
  @typing.overload
548
- def model(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
764
+ def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
549
765
  ...
550
766
 
551
- 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):
767
+ def pypi(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
552
768
  """
553
- Enables loading / saving of models within a step.
769
+ Specifies the PyPI packages for the step.
554
770
 
771
+ Information in this decorator will augment any
772
+ attributes set in the `@pyi_base` flow-level decorator. Hence,
773
+ you can use `@pypi_base` to set packages required by all
774
+ steps and use `@pypi` to specify step-specific overrides.
555
775
 
556
776
 
557
777
  Parameters
558
778
  ----------
559
- load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
560
- Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
561
- These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
562
- - `current.checkpoint`
563
- - `current.model`
564
- - `current.huggingface_hub`
565
-
566
- 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
567
- the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
568
- If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
569
-
570
- temp_dir_root : str, default: None
571
- The root directory under which `current.model.loaded` will store loaded models
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
+ python : str, optional, default: None
783
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
784
+ that the version used will correspond to the version of the Python interpreter used to start the run.
572
785
  """
573
786
  ...
574
787
 
@@ -582,138 +795,26 @@ def environment(*, vars: typing.Dict[str, str] = {}) -> typing.Callable[[typing.
582
795
  ----------
583
796
  vars : Dict[str, str], default {}
584
797
  Dictionary of environment variables to set.
585
- """
586
- ...
587
-
588
- @typing.overload
589
- def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
590
- ...
591
-
592
- @typing.overload
593
- def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
594
- ...
595
-
596
- def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
597
- """
598
- Specifies environment variables to be set prior to the execution of a step.
599
-
600
-
601
- Parameters
602
- ----------
603
- vars : Dict[str, str], default {}
604
- Dictionary of environment variables to set.
605
- """
606
- ...
607
-
608
- @typing.overload
609
- 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]]]:
610
- """
611
- Specifies the resources needed when executing this step.
612
-
613
- Use `@resources` to specify the resource requirements
614
- independently of the specific compute layer (`@batch`, `@kubernetes`).
615
-
616
- You can choose the compute layer on the command line by executing e.g.
617
- ```
618
- python myflow.py run --with batch
619
- ```
620
- or
621
- ```
622
- python myflow.py run --with kubernetes
623
- ```
624
- which executes the flow on the desired system using the
625
- requirements specified in `@resources`.
626
-
627
-
628
- Parameters
629
- ----------
630
- cpu : int, default 1
631
- Number of CPUs required for this step.
632
- gpu : int, optional, default None
633
- Number of GPUs required for this step.
634
- disk : int, optional, default None
635
- Disk size (in MB) required for this step. Only applies on Kubernetes.
636
- memory : int, default 4096
637
- Memory size (in MB) required for this step.
638
- shared_memory : int, optional, default None
639
- The value for the size (in MiB) of the /dev/shm volume for this step.
640
- This parameter maps to the `--shm-size` option in Docker.
641
- """
642
- ...
643
-
644
- @typing.overload
645
- def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
646
- ...
647
-
648
- @typing.overload
649
- def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
650
- ...
651
-
652
- 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):
653
- """
654
- Specifies the resources needed when executing this step.
655
-
656
- Use `@resources` to specify the resource requirements
657
- independently of the specific compute layer (`@batch`, `@kubernetes`).
658
-
659
- You can choose the compute layer on the command line by executing e.g.
660
- ```
661
- python myflow.py run --with batch
662
- ```
663
- or
664
- ```
665
- python myflow.py run --with kubernetes
666
- ```
667
- which executes the flow on the desired system using the
668
- requirements specified in `@resources`.
669
-
670
-
671
- Parameters
672
- ----------
673
- cpu : int, default 1
674
- Number of CPUs required for this step.
675
- gpu : int, optional, default None
676
- Number of GPUs required for this step.
677
- disk : int, optional, default None
678
- Disk size (in MB) required for this step. Only applies on Kubernetes.
679
- memory : int, default 4096
680
- Memory size (in MB) required for this step.
681
- shared_memory : int, optional, default None
682
- The value for the size (in MiB) of the /dev/shm volume for this step.
683
- This parameter maps to the `--shm-size` option in Docker.
684
- """
685
- ...
686
-
687
- def nim(*, models: "list[NIM]", backend: str, queue_timeout: int) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
688
- """
689
- This decorator is used to run NIM containers in Metaflow tasks as sidecars.
690
-
691
- User code call
692
- -----------
693
- @nim(
694
- models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
695
- backend='managed'
696
- )
697
-
698
- Valid backend options
699
- ---------------------
700
- - 'managed': Outerbounds selects a compute provider based on the model.
701
-
702
- Valid model options
703
- ----------------
704
- - 'meta/llama3-8b-instruct': 8B parameter model
705
- - 'meta/llama3-70b-instruct': 70B parameter model
706
- - any model here: https://nvcf.ngc.nvidia.com/functions?filter=nvidia-functions
798
+ """
799
+ ...
800
+
801
+ @typing.overload
802
+ def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
803
+ ...
804
+
805
+ @typing.overload
806
+ def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
807
+ ...
808
+
809
+ def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
810
+ """
811
+ Specifies environment variables to be set prior to the execution of a step.
707
812
 
708
813
 
709
814
  Parameters
710
815
  ----------
711
- models: list[NIM]
712
- List of NIM containers running models in sidecars.
713
- backend: str
714
- Compute provider to run the NIM container.
715
- queue_timeout : int
716
- Time to keep the job in NVCF's queue.
816
+ vars : Dict[str, str], default {}
817
+ Dictionary of environment variables to set.
717
818
  """
718
819
  ...
719
820
 
@@ -736,6 +837,61 @@ def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None],
736
837
  """
737
838
  ...
738
839
 
840
+ @typing.overload
841
+ 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]]]:
842
+ """
843
+ Specifies the number of times the task corresponding
844
+ to a step needs to be retried.
845
+
846
+ This decorator is useful for handling transient errors, such as networking issues.
847
+ If your task contains operations that can't be retried safely, e.g. database updates,
848
+ it is advisable to annotate it with `@retry(times=0)`.
849
+
850
+ This can be used in conjunction with the `@catch` decorator. The `@catch`
851
+ decorator will execute a no-op task after all retries have been exhausted,
852
+ ensuring that the flow execution can continue.
853
+
854
+
855
+ Parameters
856
+ ----------
857
+ times : int, default 3
858
+ Number of times to retry this task.
859
+ minutes_between_retries : int, default 2
860
+ Number of minutes between retries.
861
+ """
862
+ ...
863
+
864
+ @typing.overload
865
+ def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
866
+ ...
867
+
868
+ @typing.overload
869
+ def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
870
+ ...
871
+
872
+ 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):
873
+ """
874
+ Specifies the number of times the task corresponding
875
+ to a step needs to be retried.
876
+
877
+ This decorator is useful for handling transient errors, such as networking issues.
878
+ If your task contains operations that can't be retried safely, e.g. database updates,
879
+ it is advisable to annotate it with `@retry(times=0)`.
880
+
881
+ This can be used in conjunction with the `@catch` decorator. The `@catch`
882
+ decorator will execute a no-op task after all retries have been exhausted,
883
+ ensuring that the flow execution can continue.
884
+
885
+
886
+ Parameters
887
+ ----------
888
+ times : int, default 3
889
+ Number of times to retry this task.
890
+ minutes_between_retries : int, default 2
891
+ Number of minutes between retries.
892
+ """
893
+ ...
894
+
739
895
  def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: typing.Optional[str] = None, image_pull_policy: str = 'KUBERNETES_IMAGE_PULL_POLICY', service_account: str = 'METAFLOW_KUBERNETES_SERVICE_ACCOUNT', secrets: typing.Optional[typing.List[str]] = None, node_selector: typing.Union[typing.Dict[str, str], str, None] = None, namespace: str = 'METAFLOW_KUBERNETES_NAMESPACE', gpu: typing.Optional[int] = None, gpu_vendor: str = 'KUBERNETES_GPU_VENDOR', tolerations: typing.List[str] = [], labels: typing.Dict[str, str] = 'METAFLOW_KUBERNETES_LABELS', annotations: typing.Dict[str, str] = 'METAFLOW_KUBERNETES_ANNOTATIONS', use_tmpfs: bool = False, tmpfs_tempdir: bool = True, tmpfs_size: typing.Optional[int] = None, tmpfs_path: typing.Optional[str] = '/metaflow_temp', persistent_volume_claims: typing.Optional[typing.Dict[str, str]] = None, shared_memory: typing.Optional[int] = None, port: typing.Optional[int] = None, compute_pool: typing.Optional[str] = None, hostname_resolution_timeout: int = 600, qos: str = 'Burstable') -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
740
896
  """
741
897
  Specifies that this step should execute on Kubernetes.
@@ -814,159 +970,43 @@ def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: ty
814
970
  ...
815
971
 
816
972
  @typing.overload
817
- 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]]]:
818
- """
819
- Creates a human-readable report, a Metaflow Card, after this step completes.
820
-
821
- Note that you may add multiple `@card` decorators in a step with different parameters.
822
-
823
-
824
- Parameters
825
- ----------
826
- type : str, default 'default'
827
- Card type.
828
- id : str, optional, default None
829
- If multiple cards are present, use this id to identify this card.
830
- options : Dict[str, Any], default {}
831
- Options passed to the card. The contents depend on the card type.
832
- timeout : int, default 45
833
- Interrupt reporting if it takes more than this many seconds.
834
- """
835
- ...
836
-
837
- @typing.overload
838
- def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
839
- ...
840
-
841
- @typing.overload
842
- def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
843
- ...
844
-
845
- 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):
846
- """
847
- Creates a human-readable report, a Metaflow Card, after this step completes.
848
-
849
- Note that you may add multiple `@card` decorators in a step with different parameters.
850
-
851
-
852
- Parameters
853
- ----------
854
- type : str, default 'default'
855
- Card type.
856
- id : str, optional, default None
857
- If multiple cards are present, use this id to identify this card.
858
- options : Dict[str, Any], default {}
859
- Options passed to the card. The contents depend on the card type.
860
- timeout : int, default 45
861
- Interrupt reporting if it takes more than this many seconds.
862
- """
863
- ...
864
-
865
- @typing.overload
866
- 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]]]:
867
- """
868
- Enables checkpointing for a step.
869
-
870
-
871
-
872
- Parameters
873
- ----------
874
- load_policy : str, default: "fresh"
875
- The policy for loading the checkpoint. The following policies are supported:
876
- - "eager": Loads the the latest available checkpoint within the namespace.
877
- With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
878
- will be loaded at the start of the task.
879
- - "none": Do not load any checkpoint
880
- - "fresh": Loads the lastest checkpoint created within the running Task.
881
- This mode helps loading checkpoints across various retry attempts of the same task.
882
- With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
883
- created within the task will be loaded when the task is retries execution on failure.
884
-
885
- temp_dir_root : str, default: None
886
- The root directory under which `current.checkpoint.directory` will be created.
887
- """
888
- ...
889
-
890
- @typing.overload
891
- def checkpoint(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
892
- ...
893
-
894
- @typing.overload
895
- def checkpoint(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
896
- ...
897
-
898
- 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):
899
- """
900
- Enables checkpointing for a step.
901
-
902
-
903
-
904
- Parameters
905
- ----------
906
- load_policy : str, default: "fresh"
907
- The policy for loading the checkpoint. The following policies are supported:
908
- - "eager": Loads the the latest available checkpoint within the namespace.
909
- With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
910
- will be loaded at the start of the task.
911
- - "none": Do not load any checkpoint
912
- - "fresh": Loads the lastest checkpoint created within the running Task.
913
- This mode helps loading checkpoints across various retry attempts of the same task.
914
- With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
915
- created within the task will be loaded when the task is retries execution on failure.
916
-
917
- temp_dir_root : str, default: None
918
- The root directory under which `current.checkpoint.directory` will be created.
919
- """
920
- ...
921
-
922
- @typing.overload
923
- 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]]]:
973
+ def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
924
974
  """
925
- Specifies that the step will success under all circumstances.
926
-
927
- The decorator will create an optional artifact, specified by `var`, which
928
- contains the exception raised. You can use it to detect the presence
929
- of errors, indicating that all happy-path artifacts produced by the step
930
- are missing.
975
+ Specifies the PyPI packages for all steps of the flow.
931
976
 
977
+ Use `@pypi_base` to set common packages required by all
978
+ steps and use `@pypi` to specify step-specific overrides.
932
979
 
933
980
  Parameters
934
981
  ----------
935
- var : str, optional, default None
936
- Name of the artifact in which to store the caught exception.
937
- If not specified, the exception is not stored.
938
- print_exception : bool, default True
939
- Determines whether or not the exception is printed to
940
- stdout when caught.
982
+ packages : Dict[str, str], default: {}
983
+ Packages to use for this flow. The key is the name of the package
984
+ and the value is the version to use.
985
+ python : str, optional, default: None
986
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
987
+ that the version used will correspond to the version of the Python interpreter used to start the run.
941
988
  """
942
989
  ...
943
990
 
944
991
  @typing.overload
945
- def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
946
- ...
947
-
948
- @typing.overload
949
- def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
992
+ def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
950
993
  ...
951
994
 
952
- 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):
995
+ def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
953
996
  """
954
- Specifies that the step will success under all circumstances.
955
-
956
- The decorator will create an optional artifact, specified by `var`, which
957
- contains the exception raised. You can use it to detect the presence
958
- of errors, indicating that all happy-path artifacts produced by the step
959
- are missing.
997
+ Specifies the PyPI packages for all steps of the flow.
960
998
 
999
+ Use `@pypi_base` to set common packages required by all
1000
+ steps and use `@pypi` to specify step-specific overrides.
961
1001
 
962
1002
  Parameters
963
1003
  ----------
964
- var : str, optional, default None
965
- Name of the artifact in which to store the caught exception.
966
- If not specified, the exception is not stored.
967
- print_exception : bool, default True
968
- Determines whether or not the exception is printed to
969
- stdout when caught.
1004
+ packages : Dict[str, str], default: {}
1005
+ Packages to use for this flow. The key is the name of the package
1006
+ and the value is the version to use.
1007
+ python : str, optional, default: None
1008
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1009
+ that the version used will correspond to the version of the Python interpreter used to start the run.
970
1010
  """
971
1011
  ...
972
1012
 
@@ -1021,6 +1061,41 @@ def conda_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packa
1021
1061
  """
1022
1062
  ...
1023
1063
 
1064
+ def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1065
+ """
1066
+ Specifies what flows belong to the same project.
1067
+
1068
+ A project-specific namespace is created for all flows that
1069
+ use the same `@project(name)`.
1070
+
1071
+
1072
+ Parameters
1073
+ ----------
1074
+ name : str
1075
+ Project name. Make sure that the name is unique amongst all
1076
+ projects that use the same production scheduler. The name may
1077
+ contain only lowercase alphanumeric characters and underscores.
1078
+
1079
+ branch : Optional[str], default None
1080
+ The branch to use. If not specified, the branch is set to
1081
+ `user.<username>` unless `production` is set to `True`. This can
1082
+ also be set on the command line using `--branch` as a top-level option.
1083
+ It is an error to specify `branch` in the decorator and on the command line.
1084
+
1085
+ production : bool, default False
1086
+ Whether or not the branch is the production branch. This can also be set on the
1087
+ command line using `--production` as a top-level option. It is an error to specify
1088
+ `production` in the decorator and on the command line.
1089
+ The project branch name will be:
1090
+ - if `branch` is specified:
1091
+ - if `production` is True: `prod.<branch>`
1092
+ - if `production` is False: `test.<branch>`
1093
+ - if `branch` is not specified:
1094
+ - if `production` is True: `prod`
1095
+ - if `production` is False: `user.<username>`
1096
+ """
1097
+ ...
1098
+
1024
1099
  @typing.overload
1025
1100
  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]]:
1026
1101
  """
@@ -1114,6 +1189,49 @@ def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, event: t
1114
1189
  """
1115
1190
  ...
1116
1191
 
1192
+ 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]]:
1193
+ """
1194
+ 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.
1195
+ 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.
1196
+
1197
+
1198
+ Parameters
1199
+ ----------
1200
+ timeout : int
1201
+ Time, in seconds before the task times out and fails. (Default: 3600)
1202
+ poke_interval : int
1203
+ Time in seconds that the job should wait in between each try. (Default: 60)
1204
+ mode : str
1205
+ How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1206
+ exponential_backoff : bool
1207
+ allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1208
+ pool : str
1209
+ the slot pool this task should run in,
1210
+ slot pools are a way to limit concurrency for certain tasks. (Default:None)
1211
+ soft_fail : bool
1212
+ Set to true to mark the task as SKIPPED on failure. (Default: False)
1213
+ name : str
1214
+ Name of the sensor on Airflow
1215
+ description : str
1216
+ Description of sensor in the Airflow UI
1217
+ external_dag_id : str
1218
+ The dag_id that contains the task you want to wait for.
1219
+ external_task_ids : List[str]
1220
+ The list of task_ids that you want to wait for.
1221
+ If None (default value) the sensor waits for the DAG. (Default: None)
1222
+ allowed_states : List[str]
1223
+ Iterable of allowed states, (Default: ['success'])
1224
+ failed_states : List[str]
1225
+ Iterable of failed or dis-allowed states. (Default: None)
1226
+ execution_delta : datetime.timedelta
1227
+ time difference with the previous execution to look at,
1228
+ the default is the same logical date as the current task or DAG. (Default: None)
1229
+ check_existence: bool
1230
+ Set to True to check if the external task exists or check if
1231
+ the DAG to wait for exists. (Default: True)
1232
+ """
1233
+ ...
1234
+
1117
1235
  @typing.overload
1118
1236
  def trigger_on_finish(*, flow: typing.Union[typing.Dict[str, str], str, None] = None, flows: typing.List[typing.Union[str, typing.Dict[str, str]]] = [], options: typing.Dict[str, typing.Any] = {}) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1119
1237
  """
@@ -1215,152 +1333,46 @@ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *
1215
1333
  """
1216
1334
  ...
1217
1335
 
1218
- def with_artifact_store(f: typing.Optional[typing.Type[FlowSpecDerived]] = None):
1219
- """
1220
- Allows setting external datastores to save data for the
1221
- `@checkpoint`/`@model`/`@huggingface_hub` decorators.
1222
-
1223
- This decorator is useful when users wish to save data to a different datastore
1224
- than what is configured in Metaflow. This can be for variety of reasons:
1225
-
1226
- 1. Data security: The objects needs to be stored in a bucket (object storage) that is not accessible by other flows.
1227
- 2. Data Locality: The location where the task is executing is not located in the same region as the datastore.
1228
- - Example: Metaflow datastore lives in US East, but the task is executing in Finland datacenters.
1229
- 3. Data Lifecycle Policies: The objects need to be archived / managed separately from the Metaflow managed objects.
1230
- - Example: Flow is training very large models that need to be stored separately and will be deleted more aggressively than the Metaflow managed objects.
1231
-
1232
- Usage:
1233
- ----------
1234
-
1235
- - Using a custom IAM role to access the datastore.
1236
-
1237
- ```python
1238
- @with_artifact_store(
1239
- type="s3",
1240
- config=lambda: {
1241
- "root": "s3://my-bucket-foo/path/to/root",
1242
- "role_arn": ROLE,
1243
- },
1244
- )
1245
- class MyFlow(FlowSpec):
1246
-
1247
- @checkpoint
1248
- @step
1249
- def start(self):
1250
- with open("my_file.txt", "w") as f:
1251
- f.write("Hello, World!")
1252
- self.external_bucket_checkpoint = current.checkpoint.save("my_file.txt")
1253
- self.next(self.end)
1254
-
1255
- ```
1256
-
1257
- - Using credentials to access the s3-compatible datastore.
1258
-
1259
- ```python
1260
- @with_artifact_store(
1261
- type="s3",
1262
- config=lambda: {
1263
- "root": "s3://my-bucket-foo/path/to/root",
1264
- "client_params": {
1265
- "aws_access_key_id": os.environ.get("MY_CUSTOM_ACCESS_KEY"),
1266
- "aws_secret_access_key": os.environ.get("MY_CUSTOM_SECRET_KEY"),
1267
- },
1268
- },
1269
- )
1270
- class MyFlow(FlowSpec):
1271
-
1272
- @checkpoint
1273
- @step
1274
- def start(self):
1275
- with open("my_file.txt", "w") as f:
1276
- f.write("Hello, World!")
1277
- self.external_bucket_checkpoint = current.checkpoint.save("my_file.txt")
1278
- self.next(self.end)
1279
-
1280
- ```
1281
-
1282
- - Accessing objects stored in external datastores after task execution.
1283
-
1284
- ```python
1285
- run = Run("CheckpointsTestsFlow/8992")
1286
- with artifact_store_from(run=run, config={
1287
- "client_params": {
1288
- "aws_access_key_id": os.environ.get("MY_CUSTOM_ACCESS_KEY"),
1289
- "aws_secret_access_key": os.environ.get("MY_CUSTOM_SECRET_KEY"),
1290
- },
1291
- }):
1292
- with Checkpoint() as cp:
1293
- latest = cp.list(
1294
- task=run["start"].task
1295
- )[0]
1296
- print(latest)
1297
- cp.load(
1298
- latest,
1299
- "test-checkpoints"
1300
- )
1301
-
1302
- task = Task("TorchTuneFlow/8484/train/53673")
1303
- with artifact_store_from(run=run, config={
1304
- "client_params": {
1305
- "aws_access_key_id": os.environ.get("MY_CUSTOM_ACCESS_KEY"),
1306
- "aws_secret_access_key": os.environ.get("MY_CUSTOM_SECRET_KEY"),
1307
- },
1308
- }):
1309
- load_model(
1310
- task.data.model_ref,
1311
- "test-models"
1312
- )
1313
- ```
1314
- Parameters:
1315
- ----------
1316
-
1317
- type: str
1318
- The type of the datastore. Can be one of 's3', 'gcs', 'azure' or any other supported metaflow Datastore.
1319
-
1320
- config: dict or Callable
1321
- Dictionary of configuration options for the datastore. The following keys are required:
1322
- - root: The root path in the datastore where the data will be saved. (needs to be in the format expected by the datastore)
1323
- - example: 's3://bucket-name/path/to/root'
1324
- - example: 'gs://bucket-name/path/to/root'
1325
- - example: 'https://myblockacc.blob.core.windows.net/metaflow/'
1326
- - role_arn (optional): AWS IAM role to access s3 bucket (only when `type` is 's3')
1327
- - session_vars (optional): AWS session variables to access s3 bucket (only when `type` is 's3')
1328
- - client_params (optional): AWS client parameters to access s3 bucket (only when `type` is 's3')
1329
- """
1330
- ...
1331
-
1332
- def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1336
+ 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]]:
1333
1337
  """
1334
- Specifies what flows belong to the same project.
1335
-
1336
- A project-specific namespace is created for all flows that
1337
- use the same `@project(name)`.
1338
+ 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)
1339
+ before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
1340
+ and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
1341
+ added as a flow decorators. Adding more than one decorator will ensure that `start` step
1342
+ starts only after all sensors finish.
1338
1343
 
1339
1344
 
1340
1345
  Parameters
1341
1346
  ----------
1347
+ timeout : int
1348
+ Time, in seconds before the task times out and fails. (Default: 3600)
1349
+ poke_interval : int
1350
+ Time in seconds that the job should wait in between each try. (Default: 60)
1351
+ mode : str
1352
+ How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1353
+ exponential_backoff : bool
1354
+ allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1355
+ pool : str
1356
+ the slot pool this task should run in,
1357
+ slot pools are a way to limit concurrency for certain tasks. (Default:None)
1358
+ soft_fail : bool
1359
+ Set to true to mark the task as SKIPPED on failure. (Default: False)
1342
1360
  name : str
1343
- Project name. Make sure that the name is unique amongst all
1344
- projects that use the same production scheduler. The name may
1345
- contain only lowercase alphanumeric characters and underscores.
1346
-
1347
- branch : Optional[str], default None
1348
- The branch to use. If not specified, the branch is set to
1349
- `user.<username>` unless `production` is set to `True`. This can
1350
- also be set on the command line using `--branch` as a top-level option.
1351
- It is an error to specify `branch` in the decorator and on the command line.
1352
-
1353
- production : bool, default False
1354
- Whether or not the branch is the production branch. This can also be set on the
1355
- command line using `--production` as a top-level option. It is an error to specify
1356
- `production` in the decorator and on the command line.
1357
- The project branch name will be:
1358
- - if `branch` is specified:
1359
- - if `production` is True: `prod.<branch>`
1360
- - if `production` is False: `test.<branch>`
1361
- - if `branch` is not specified:
1362
- - if `production` is True: `prod`
1363
- - if `production` is False: `user.<username>`
1361
+ Name of the sensor on Airflow
1362
+ description : str
1363
+ Description of sensor in the Airflow UI
1364
+ bucket_key : Union[str, List[str]]
1365
+ The key(s) being waited on. Supports full s3:// style url or relative path from root level.
1366
+ When it's specified as a full s3:// url, please leave `bucket_name` as None
1367
+ bucket_name : str
1368
+ Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
1369
+ When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
1370
+ wildcard_match : bool
1371
+ whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
1372
+ aws_conn_id : str
1373
+ a reference to the s3 connection on Airflow. (Default: None)
1374
+ verify : bool
1375
+ Whether or not to verify SSL certificates for S3 connection. (Default: None)
1364
1376
  """
1365
1377
  ...
1366
1378
 
@@ -1415,132 +1427,5 @@ def schedule(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, hourly:
1415
1427
  """
1416
1428
  ...
1417
1429
 
1418
- @typing.overload
1419
- def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1420
- """
1421
- Specifies the PyPI packages for all steps of the flow.
1422
-
1423
- Use `@pypi_base` to set common packages required by all
1424
- steps and use `@pypi` to specify step-specific overrides.
1425
-
1426
- Parameters
1427
- ----------
1428
- packages : Dict[str, str], default: {}
1429
- Packages to use for this flow. The key is the name of the package
1430
- and the value is the version to use.
1431
- python : str, optional, default: None
1432
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1433
- that the version used will correspond to the version of the Python interpreter used to start the run.
1434
- """
1435
- ...
1436
-
1437
- @typing.overload
1438
- def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1439
- ...
1440
-
1441
- def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
1442
- """
1443
- Specifies the PyPI packages for all steps of the flow.
1444
-
1445
- Use `@pypi_base` to set common packages required by all
1446
- steps and use `@pypi` to specify step-specific overrides.
1447
-
1448
- Parameters
1449
- ----------
1450
- packages : Dict[str, str], default: {}
1451
- Packages to use for this flow. The key is the name of the package
1452
- and the value is the version to use.
1453
- python : str, optional, default: None
1454
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1455
- that the version used will correspond to the version of the Python interpreter used to start the run.
1456
- """
1457
- ...
1458
-
1459
- 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]]:
1460
- """
1461
- 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.
1462
- 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.
1463
-
1464
-
1465
- Parameters
1466
- ----------
1467
- timeout : int
1468
- Time, in seconds before the task times out and fails. (Default: 3600)
1469
- poke_interval : int
1470
- Time in seconds that the job should wait in between each try. (Default: 60)
1471
- mode : str
1472
- How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1473
- exponential_backoff : bool
1474
- allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1475
- pool : str
1476
- the slot pool this task should run in,
1477
- slot pools are a way to limit concurrency for certain tasks. (Default:None)
1478
- soft_fail : bool
1479
- Set to true to mark the task as SKIPPED on failure. (Default: False)
1480
- name : str
1481
- Name of the sensor on Airflow
1482
- description : str
1483
- Description of sensor in the Airflow UI
1484
- external_dag_id : str
1485
- The dag_id that contains the task you want to wait for.
1486
- external_task_ids : List[str]
1487
- The list of task_ids that you want to wait for.
1488
- If None (default value) the sensor waits for the DAG. (Default: None)
1489
- allowed_states : List[str]
1490
- Iterable of allowed states, (Default: ['success'])
1491
- failed_states : List[str]
1492
- Iterable of failed or dis-allowed states. (Default: None)
1493
- execution_delta : datetime.timedelta
1494
- time difference with the previous execution to look at,
1495
- the default is the same logical date as the current task or DAG. (Default: None)
1496
- check_existence: bool
1497
- Set to True to check if the external task exists or check if
1498
- the DAG to wait for exists. (Default: True)
1499
- """
1500
- ...
1501
-
1502
- 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]]:
1503
- """
1504
- 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)
1505
- before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
1506
- and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
1507
- added as a flow decorators. Adding more than one decorator will ensure that `start` step
1508
- starts only after all sensors finish.
1509
-
1510
-
1511
- Parameters
1512
- ----------
1513
- timeout : int
1514
- Time, in seconds before the task times out and fails. (Default: 3600)
1515
- poke_interval : int
1516
- Time in seconds that the job should wait in between each try. (Default: 60)
1517
- mode : str
1518
- How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1519
- exponential_backoff : bool
1520
- allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1521
- pool : str
1522
- the slot pool this task should run in,
1523
- slot pools are a way to limit concurrency for certain tasks. (Default:None)
1524
- soft_fail : bool
1525
- Set to true to mark the task as SKIPPED on failure. (Default: False)
1526
- name : str
1527
- Name of the sensor on Airflow
1528
- description : str
1529
- Description of sensor in the Airflow UI
1530
- bucket_key : Union[str, List[str]]
1531
- The key(s) being waited on. Supports full s3:// style url or relative path from root level.
1532
- When it's specified as a full s3:// url, please leave `bucket_name` as None
1533
- bucket_name : str
1534
- Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
1535
- When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
1536
- wildcard_match : bool
1537
- whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
1538
- aws_conn_id : str
1539
- a reference to the s3 connection on Airflow. (Default: None)
1540
- verify : bool
1541
- Whether or not to verify SSL certificates for S3 connection. (Default: None)
1542
- """
1543
- ...
1544
-
1545
1430
  pkg_name: str
1546
1431