ob-metaflow-stubs 6.0.3.166__py2.py3-none-any.whl → 6.0.3.168__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (206) hide show
  1. metaflow-stubs/__init__.pyi +742 -742
  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 +5 -5
  8. metaflow-stubs/client/filecache.pyi +3 -3
  9. metaflow-stubs/events.pyi +2 -2
  10. metaflow-stubs/exception.pyi +2 -2
  11. metaflow-stubs/flowspec.pyi +5 -5
  12. metaflow-stubs/generated_for.txt +1 -1
  13. metaflow-stubs/includefile.pyi +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 -4
  20. metaflow-stubs/metaflow_current.pyi +126 -126
  21. metaflow-stubs/metaflow_git.pyi +2 -2
  22. metaflow-stubs/mf_extensions/__init__.pyi +2 -2
  23. metaflow-stubs/mf_extensions/obcheckpoint/__init__.pyi +2 -2
  24. metaflow-stubs/mf_extensions/obcheckpoint/plugins/__init__.pyi +2 -2
  25. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/__init__.pyi +2 -2
  26. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/__init__.pyi +2 -2
  27. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/async_cards.pyi +2 -2
  28. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/deco_injection_mixin.pyi +2 -2
  29. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/extra_components.pyi +3 -3
  30. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/__init__.pyi +2 -2
  31. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/__init__.pyi +2 -2
  32. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/checkpoint_lister.pyi +3 -3
  33. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/lineage_card.pyi +2 -2
  34. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/checkpoint_storage.pyi +4 -4
  35. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/constructors.pyi +2 -2
  36. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/core.pyi +3 -3
  37. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/decorator.pyi +4 -4
  38. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/exceptions.pyi +2 -2
  39. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/final_api.pyi +2 -2
  40. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/lineage.pyi +2 -2
  41. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/__init__.pyi +2 -2
  42. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/context.pyi +2 -2
  43. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/core.pyi +3 -3
  44. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/decorator.pyi +2 -2
  45. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/exceptions.pyi +2 -2
  46. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/task_utils.pyi +2 -2
  47. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/utils.pyi +2 -2
  48. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastructures.pyi +2 -2
  49. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/exceptions.pyi +2 -2
  50. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/hf_hub/__init__.pyi +2 -2
  51. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/hf_hub/decorator.pyi +3 -3
  52. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/__init__.pyi +2 -2
  53. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/core.pyi +3 -3
  54. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/exceptions.pyi +2 -2
  55. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/model_storage.pyi +3 -3
  56. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/__init__.pyi +2 -2
  57. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/flowspec_utils.pyi +2 -2
  58. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/general.pyi +2 -2
  59. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/identity_utils.pyi +2 -2
  60. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/__init__.pyi +2 -2
  61. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/base.pyi +2 -2
  62. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/tar.pyi +2 -2
  63. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/tar_utils.pyi +2 -2
  64. metaflow-stubs/mf_extensions/outerbounds/__init__.pyi +2 -2
  65. metaflow-stubs/mf_extensions/outerbounds/plugins/__init__.pyi +2 -2
  66. metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/__init__.pyi +2 -2
  67. metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/injector.pyi +2 -2
  68. metaflow-stubs/mf_extensions/outerbounds/plugins/checkpoint_datastores/__init__.pyi +2 -2
  69. metaflow-stubs/mf_extensions/outerbounds/plugins/checkpoint_datastores/coreweave.pyi +2 -2
  70. metaflow-stubs/mf_extensions/outerbounds/plugins/checkpoint_datastores/nebius.pyi +2 -2
  71. metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/__init__.pyi +2 -2
  72. metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/ollama.pyi +2 -2
  73. metaflow-stubs/mf_extensions/outerbounds/plugins/snowflake/__init__.pyi +2 -2
  74. metaflow-stubs/mf_extensions/outerbounds/plugins/snowflake/snowflake.pyi +2 -2
  75. metaflow-stubs/mf_extensions/outerbounds/profilers/__init__.pyi +2 -2
  76. metaflow-stubs/mf_extensions/outerbounds/profilers/gpu.pyi +2 -2
  77. metaflow-stubs/mf_extensions/outerbounds/remote_config.pyi +9 -2
  78. metaflow-stubs/mf_extensions/outerbounds/toplevel/__init__.pyi +2 -2
  79. metaflow-stubs/mf_extensions/outerbounds/toplevel/global_aliases_for_metaflow_package.pyi +2 -2
  80. metaflow-stubs/multicore_utils.pyi +2 -2
  81. metaflow-stubs/parameters.pyi +3 -3
  82. metaflow-stubs/plugins/__init__.pyi +13 -13
  83. metaflow-stubs/plugins/airflow/__init__.pyi +2 -2
  84. metaflow-stubs/plugins/airflow/airflow_utils.pyi +2 -2
  85. metaflow-stubs/plugins/airflow/exception.pyi +2 -2
  86. metaflow-stubs/plugins/airflow/sensors/__init__.pyi +2 -2
  87. metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +2 -2
  88. metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +2 -2
  89. metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +2 -2
  90. metaflow-stubs/plugins/argo/__init__.pyi +2 -2
  91. metaflow-stubs/plugins/argo/argo_client.pyi +2 -2
  92. metaflow-stubs/plugins/argo/argo_events.pyi +2 -2
  93. metaflow-stubs/plugins/argo/argo_workflows.pyi +2 -2
  94. metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +3 -3
  95. metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +3 -3
  96. metaflow-stubs/plugins/argo/argo_workflows_deployer_objects.pyi +2 -2
  97. metaflow-stubs/plugins/aws/__init__.pyi +2 -2
  98. metaflow-stubs/plugins/aws/aws_client.pyi +2 -2
  99. metaflow-stubs/plugins/aws/aws_utils.pyi +2 -2
  100. metaflow-stubs/plugins/aws/batch/__init__.pyi +2 -2
  101. metaflow-stubs/plugins/aws/batch/batch.pyi +2 -2
  102. metaflow-stubs/plugins/aws/batch/batch_client.pyi +2 -2
  103. metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +2 -2
  104. metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +2 -2
  105. metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +5 -5
  106. metaflow-stubs/plugins/aws/step_functions/__init__.pyi +2 -2
  107. metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +2 -2
  108. metaflow-stubs/plugins/aws/step_functions/schedule_decorator.pyi +2 -2
  109. metaflow-stubs/plugins/aws/step_functions/step_functions.pyi +2 -2
  110. metaflow-stubs/plugins/aws/step_functions/step_functions_client.pyi +2 -2
  111. metaflow-stubs/plugins/aws/step_functions/step_functions_deployer.pyi +3 -3
  112. metaflow-stubs/plugins/aws/step_functions/step_functions_deployer_objects.pyi +2 -2
  113. metaflow-stubs/plugins/azure/__init__.pyi +2 -2
  114. metaflow-stubs/plugins/azure/azure_credential.pyi +2 -2
  115. metaflow-stubs/plugins/azure/azure_exceptions.pyi +2 -2
  116. metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +5 -5
  117. metaflow-stubs/plugins/azure/azure_utils.pyi +2 -2
  118. metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +2 -2
  119. metaflow-stubs/plugins/azure/includefile_support.pyi +2 -2
  120. metaflow-stubs/plugins/cards/__init__.pyi +2 -2
  121. metaflow-stubs/plugins/cards/card_client.pyi +2 -2
  122. metaflow-stubs/plugins/cards/card_creator.pyi +2 -2
  123. metaflow-stubs/plugins/cards/card_datastore.pyi +2 -2
  124. metaflow-stubs/plugins/cards/card_decorator.pyi +2 -2
  125. metaflow-stubs/plugins/cards/card_modules/__init__.pyi +2 -2
  126. metaflow-stubs/plugins/cards/card_modules/basic.pyi +3 -3
  127. metaflow-stubs/plugins/cards/card_modules/card.pyi +2 -2
  128. metaflow-stubs/plugins/cards/card_modules/components.pyi +3 -3
  129. metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +2 -2
  130. metaflow-stubs/plugins/cards/card_modules/renderer_tools.pyi +2 -2
  131. metaflow-stubs/plugins/cards/card_modules/test_cards.pyi +2 -2
  132. metaflow-stubs/plugins/cards/card_resolver.pyi +2 -2
  133. metaflow-stubs/plugins/cards/component_serializer.pyi +2 -2
  134. metaflow-stubs/plugins/cards/exception.pyi +2 -2
  135. metaflow-stubs/plugins/catch_decorator.pyi +3 -3
  136. metaflow-stubs/plugins/datatools/__init__.pyi +2 -2
  137. metaflow-stubs/plugins/datatools/local.pyi +2 -2
  138. metaflow-stubs/plugins/datatools/s3/__init__.pyi +2 -2
  139. metaflow-stubs/plugins/datatools/s3/s3.pyi +3 -3
  140. metaflow-stubs/plugins/datatools/s3/s3tail.pyi +2 -2
  141. metaflow-stubs/plugins/datatools/s3/s3util.pyi +2 -2
  142. metaflow-stubs/plugins/debug_logger.pyi +2 -2
  143. metaflow-stubs/plugins/debug_monitor.pyi +2 -2
  144. metaflow-stubs/plugins/environment_decorator.pyi +2 -2
  145. metaflow-stubs/plugins/events_decorator.pyi +2 -2
  146. metaflow-stubs/plugins/frameworks/__init__.pyi +2 -2
  147. metaflow-stubs/plugins/frameworks/pytorch.pyi +2 -2
  148. metaflow-stubs/plugins/gcp/__init__.pyi +2 -2
  149. metaflow-stubs/plugins/gcp/gcp_secret_manager_secrets_provider.pyi +5 -5
  150. metaflow-stubs/plugins/gcp/gs_exceptions.pyi +2 -2
  151. metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +2 -2
  152. metaflow-stubs/plugins/gcp/gs_utils.pyi +2 -2
  153. metaflow-stubs/plugins/gcp/includefile_support.pyi +2 -2
  154. metaflow-stubs/plugins/kubernetes/__init__.pyi +2 -2
  155. metaflow-stubs/plugins/kubernetes/kube_utils.pyi +2 -2
  156. metaflow-stubs/plugins/kubernetes/kubernetes.pyi +2 -2
  157. metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +2 -2
  158. metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +2 -2
  159. metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +2 -2
  160. metaflow-stubs/plugins/kubernetes/spot_monitor_sidecar.pyi +2 -2
  161. metaflow-stubs/plugins/ollama/__init__.pyi +2 -2
  162. metaflow-stubs/plugins/parallel_decorator.pyi +2 -2
  163. metaflow-stubs/plugins/perimeters.pyi +2 -2
  164. metaflow-stubs/plugins/project_decorator.pyi +2 -2
  165. metaflow-stubs/plugins/pypi/__init__.pyi +3 -3
  166. metaflow-stubs/plugins/pypi/conda_decorator.pyi +2 -2
  167. metaflow-stubs/plugins/pypi/conda_environment.pyi +5 -5
  168. metaflow-stubs/plugins/pypi/parsers.pyi +2 -2
  169. metaflow-stubs/plugins/pypi/pypi_decorator.pyi +2 -2
  170. metaflow-stubs/plugins/pypi/pypi_environment.pyi +2 -2
  171. metaflow-stubs/plugins/pypi/utils.pyi +2 -2
  172. metaflow-stubs/plugins/resources_decorator.pyi +2 -2
  173. metaflow-stubs/plugins/retry_decorator.pyi +2 -2
  174. metaflow-stubs/plugins/secrets/__init__.pyi +3 -3
  175. metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +4 -4
  176. metaflow-stubs/plugins/secrets/secrets_decorator.pyi +2 -2
  177. metaflow-stubs/plugins/snowflake/__init__.pyi +2 -2
  178. metaflow-stubs/plugins/storage_executor.pyi +2 -2
  179. metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +3 -3
  180. metaflow-stubs/plugins/timeout_decorator.pyi +3 -3
  181. metaflow-stubs/plugins/uv/__init__.pyi +2 -2
  182. metaflow-stubs/plugins/uv/uv_environment.pyi +3 -3
  183. metaflow-stubs/profilers/__init__.pyi +2 -2
  184. metaflow-stubs/pylint_wrapper.pyi +2 -2
  185. metaflow-stubs/runner/__init__.pyi +2 -2
  186. metaflow-stubs/runner/deployer.pyi +4 -4
  187. metaflow-stubs/runner/deployer_impl.pyi +3 -3
  188. metaflow-stubs/runner/metaflow_runner.pyi +4 -4
  189. metaflow-stubs/runner/nbdeploy.pyi +2 -2
  190. metaflow-stubs/runner/nbrun.pyi +2 -2
  191. metaflow-stubs/runner/subprocess_manager.pyi +3 -3
  192. metaflow-stubs/runner/utils.pyi +3 -3
  193. metaflow-stubs/system/__init__.pyi +2 -2
  194. metaflow-stubs/system/system_logger.pyi +3 -3
  195. metaflow-stubs/system/system_monitor.pyi +2 -2
  196. metaflow-stubs/tagging_util.pyi +2 -2
  197. metaflow-stubs/tuple_util.pyi +2 -2
  198. metaflow-stubs/user_configs/__init__.pyi +2 -2
  199. metaflow-stubs/user_configs/config_decorators.pyi +6 -6
  200. metaflow-stubs/user_configs/config_options.pyi +3 -3
  201. metaflow-stubs/user_configs/config_parameters.pyi +5 -5
  202. {ob_metaflow_stubs-6.0.3.166.dist-info → ob_metaflow_stubs-6.0.3.168.dist-info}/METADATA +1 -1
  203. ob_metaflow_stubs-6.0.3.168.dist-info/RECORD +206 -0
  204. ob_metaflow_stubs-6.0.3.166.dist-info/RECORD +0 -206
  205. {ob_metaflow_stubs-6.0.3.166.dist-info → ob_metaflow_stubs-6.0.3.168.dist-info}/WHEEL +0 -0
  206. {ob_metaflow_stubs-6.0.3.166.dist-info → ob_metaflow_stubs-6.0.3.168.dist-info}/top_level.txt +0 -0
@@ -1,15 +1,15 @@
1
1
  ######################################################################################################
2
2
  # Auto-generated Metaflow stub file #
3
- # MF version: 2.15.11.2+obcheckpoint(0.2.1);ob(v1) #
4
- # Generated on 2025-05-09T17:10:54.121807 #
3
+ # MF version: 2.15.13.1+obcheckpoint(0.2.1);ob(v1) #
4
+ # Generated on 2025-05-20T18:21:15.778004 #
5
5
  ######################################################################################################
6
6
 
7
7
  from __future__ import annotations
8
8
 
9
9
  import typing
10
10
  if typing.TYPE_CHECKING:
11
- import datetime
12
11
  import typing
12
+ import datetime
13
13
  FlowSpecDerived = typing.TypeVar("FlowSpecDerived", bound="FlowSpec", contravariant=False, covariant=False)
14
14
  StepFlag = typing.NewType("StepFlag", bool)
15
15
 
@@ -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 cards as cards
39
- from . import tuple_util as tuple_util
40
- from . import metaflow_git as metaflow_git
41
38
  from . import events as events
39
+ from . import metaflow_git as metaflow_git
40
+ from . import tuple_util as tuple_util
41
+ from . import cards as cards
42
42
  from . import runner as runner
43
43
  from . import plugins as plugins
44
44
  from .mf_extensions.outerbounds.toplevel.global_aliases_for_metaflow_package import S3 as S3
45
45
  from . import includefile as includefile
46
46
  from .includefile import IncludeFile as IncludeFile
47
- from .plugins.pypi.parsers import requirements_txt_parser as requirements_txt_parser
48
47
  from .plugins.pypi.parsers import pyproject_toml_parser as pyproject_toml_parser
48
+ from .plugins.pypi.parsers import requirements_txt_parser as requirements_txt_parser
49
49
  from .plugins.pypi.parsers import conda_environment_yml_parser as conda_environment_yml_parser
50
50
  from . import client as client
51
51
  from .client.core import namespace as namespace
@@ -154,171 +154,324 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
154
154
  ...
155
155
 
156
156
  @typing.overload
157
- def environment(*, vars: typing.Dict[str, str] = {}) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
157
+ def resources(*, cpu: int = 1, gpu: typing.Optional[int] = None, disk: typing.Optional[int] = None, memory: int = 4096, shared_memory: typing.Optional[int] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
158
158
  """
159
- Specifies environment variables to be set prior to the execution of a step.
159
+ Specifies the resources needed when executing this step.
160
+
161
+ Use `@resources` to specify the resource requirements
162
+ independently of the specific compute layer (`@batch`, `@kubernetes`).
163
+
164
+ You can choose the compute layer on the command line by executing e.g.
165
+ ```
166
+ python myflow.py run --with batch
167
+ ```
168
+ or
169
+ ```
170
+ python myflow.py run --with kubernetes
171
+ ```
172
+ which executes the flow on the desired system using the
173
+ requirements specified in `@resources`.
160
174
 
161
175
 
162
176
  Parameters
163
177
  ----------
164
- vars : Dict[str, str], default {}
165
- Dictionary of environment variables to set.
178
+ cpu : int, default 1
179
+ Number of CPUs required for this step.
180
+ gpu : int, optional, default None
181
+ Number of GPUs required for this step.
182
+ disk : int, optional, default None
183
+ Disk size (in MB) required for this step. Only applies on Kubernetes.
184
+ memory : int, default 4096
185
+ Memory size (in MB) required for this step.
186
+ shared_memory : int, optional, default None
187
+ The value for the size (in MiB) of the /dev/shm volume for this step.
188
+ This parameter maps to the `--shm-size` option in Docker.
166
189
  """
167
190
  ...
168
191
 
169
192
  @typing.overload
170
- def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
193
+ def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
171
194
  ...
172
195
 
173
196
  @typing.overload
174
- def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
197
+ def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
175
198
  ...
176
199
 
177
- def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
200
+ def resources(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, cpu: int = 1, gpu: typing.Optional[int] = None, disk: typing.Optional[int] = None, memory: int = 4096, shared_memory: typing.Optional[int] = None):
178
201
  """
179
- Specifies environment variables to be set prior to the execution of a step.
202
+ Specifies the resources needed when executing this step.
203
+
204
+ Use `@resources` to specify the resource requirements
205
+ independently of the specific compute layer (`@batch`, `@kubernetes`).
206
+
207
+ You can choose the compute layer on the command line by executing e.g.
208
+ ```
209
+ python myflow.py run --with batch
210
+ ```
211
+ or
212
+ ```
213
+ python myflow.py run --with kubernetes
214
+ ```
215
+ which executes the flow on the desired system using the
216
+ requirements specified in `@resources`.
180
217
 
181
218
 
182
219
  Parameters
183
220
  ----------
184
- vars : Dict[str, str], default {}
185
- Dictionary of environment variables to set.
221
+ cpu : int, default 1
222
+ Number of CPUs required for this step.
223
+ gpu : int, optional, default None
224
+ Number of GPUs required for this step.
225
+ disk : int, optional, default None
226
+ Disk size (in MB) required for this step. Only applies on Kubernetes.
227
+ memory : int, default 4096
228
+ Memory size (in MB) required for this step.
229
+ shared_memory : int, optional, default None
230
+ The value for the size (in MiB) of the /dev/shm volume for this step.
231
+ This parameter maps to the `--shm-size` option in Docker.
186
232
  """
187
233
  ...
188
234
 
189
- 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]]]:
235
+ @typing.overload
236
+ def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
190
237
  """
191
- This decorator is used to run NIM containers in Metaflow tasks as sidecars.
192
-
193
- User code call
194
- -----------
195
- @nim(
196
- models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
197
- backend='managed'
198
- )
199
-
200
- Valid backend options
201
- ---------------------
202
- - 'managed': Outerbounds selects a compute provider based on the model.
203
-
204
- Valid model options
205
- ----------------
206
- - 'meta/llama3-8b-instruct': 8B parameter model
207
- - 'meta/llama3-70b-instruct': 70B parameter model
208
- - any model here: https://nvcf.ngc.nvidia.com/functions?filter=nvidia-functions
209
-
210
-
211
- Parameters
212
- ----------
213
- models: list[NIM]
214
- List of NIM containers running models in sidecars.
215
- backend: str
216
- Compute provider to run the NIM container.
217
- queue_timeout : int
218
- Time to keep the job in NVCF's queue.
238
+ Decorator prototype for all step decorators. This function gets specialized
239
+ and imported for all decorators types by _import_plugin_decorators().
219
240
  """
220
241
  ...
221
242
 
222
243
  @typing.overload
223
- 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]]]:
244
+ def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
245
+ ...
246
+
247
+ def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
224
248
  """
225
- Enables checkpointing for a step.
249
+ Decorator prototype for all step decorators. This function gets specialized
250
+ and imported for all decorators types by _import_plugin_decorators().
251
+ """
252
+ ...
253
+
254
+ @typing.overload
255
+ def conda(*, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
256
+ """
257
+ Specifies the Conda environment for the step.
226
258
 
259
+ Information in this decorator will augment any
260
+ attributes set in the `@conda_base` flow-level decorator. Hence,
261
+ you can use `@conda_base` to set packages required by all
262
+ steps and use `@conda` to specify step-specific overrides.
227
263
 
228
264
 
229
265
  Parameters
230
266
  ----------
231
- load_policy : str, default: "fresh"
232
- The policy for loading the checkpoint. The following policies are supported:
233
- - "eager": Loads the the latest available checkpoint within the namespace.
234
- With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
235
- will be loaded at the start of the task.
236
- - "none": Do not load any checkpoint
237
- - "fresh": Loads the lastest checkpoint created within the running Task.
238
- This mode helps loading checkpoints across various retry attempts of the same task.
239
- With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
240
- created within the task will be loaded when the task is retries execution on failure.
241
-
242
- temp_dir_root : str, default: None
243
- The root directory under which `current.checkpoint.directory` will be created.
267
+ packages : Dict[str, str], default {}
268
+ Packages to use for this step. The key is the name of the package
269
+ and the value is the version to use.
270
+ libraries : Dict[str, str], default {}
271
+ Supported for backward compatibility. When used with packages, packages will take precedence.
272
+ python : str, optional, default None
273
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
274
+ that the version used will correspond to the version of the Python interpreter used to start the run.
275
+ disabled : bool, default False
276
+ If set to True, disables @conda.
244
277
  """
245
278
  ...
246
279
 
247
280
  @typing.overload
248
- def checkpoint(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
281
+ def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
249
282
  ...
250
283
 
251
284
  @typing.overload
252
- def checkpoint(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
285
+ def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
253
286
  ...
254
287
 
255
- 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):
288
+ def conda(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False):
256
289
  """
257
- Enables checkpointing for a step.
290
+ Specifies the Conda environment for the step.
258
291
 
292
+ Information in this decorator will augment any
293
+ attributes set in the `@conda_base` flow-level decorator. Hence,
294
+ you can use `@conda_base` to set packages required by all
295
+ steps and use `@conda` to specify step-specific overrides.
259
296
 
260
297
 
261
298
  Parameters
262
299
  ----------
263
- load_policy : str, default: "fresh"
264
- The policy for loading the checkpoint. The following policies are supported:
265
- - "eager": Loads the the latest available checkpoint within the namespace.
266
- With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
267
- will be loaded at the start of the task.
268
- - "none": Do not load any checkpoint
269
- - "fresh": Loads the lastest checkpoint created within the running Task.
270
- This mode helps loading checkpoints across various retry attempts of the same task.
271
- With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
272
- created within the task will be loaded when the task is retries execution on failure.
273
-
274
- temp_dir_root : str, default: None
275
- The root directory under which `current.checkpoint.directory` will be created.
300
+ packages : Dict[str, str], default {}
301
+ Packages to use for this step. The key is the name of the package
302
+ and the value is the version to use.
303
+ libraries : Dict[str, str], default {}
304
+ Supported for backward compatibility. When used with packages, packages will take precedence.
305
+ python : str, optional, default None
306
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
307
+ that the version used will correspond to the version of the Python interpreter used to start the run.
308
+ disabled : bool, default False
309
+ If set to True, disables @conda.
276
310
  """
277
311
  ...
278
312
 
279
- def ollama(*, models: "list[Ollama]", backend: str) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
313
+ def huggingface_hub(*, temp_dir_root: typing.Optional[str] = None, load: typing.Union[typing.List[str], typing.List[typing.Tuple[typing.Dict, str]], typing.List[typing.Tuple[str, str]], typing.List[typing.Dict], None]) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
280
314
  """
281
- This decorator is used to run Ollama APIs as Metaflow task sidecars.
315
+ Decorator that helps cache, version and store models/datasets from huggingface hub.
282
316
 
283
- User code call
284
- -----------
285
- @ollama(
286
- models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
287
- backend='local'
288
- )
289
317
 
290
- Valid backend options
291
- ---------------------
292
- - 'local': Run as a separate process on the local task machine.
293
- - (TODO) 'managed': Outerbounds hosts and selects compute provider.
294
- - (TODO) 'remote': Spin up separate instance to serve Ollama models.
318
+ Parameters
319
+ ----------
320
+ temp_dir_root : str, optional
321
+ The root directory that will hold the temporary directory where objects will be downloaded.
295
322
 
296
- Valid model options
297
- ----------------
298
- - 'llama3.2'
299
- - 'llama3.3'
300
- - any model here https://ollama.com/search
323
+ load: Union[List[str], List[Tuple[Dict, str]], List[Tuple[str, str]], List[Dict], None]
324
+ The list of repos (models/datasets) to load.
301
325
 
326
+ Loaded repos can be accessed via `current.huggingface_hub.loaded`. If load is set, then the following happens:
302
327
 
303
- Parameters
304
- ----------
305
- models: list[Ollama]
306
- List of Ollama containers running models in sidecars.
307
- backend: str
308
- Determines where and how to run the Ollama process.
328
+ - If repo (model/dataset) is not found in the datastore:
329
+ - Downloads the repo from Hugging Face Hub to a temporary directory (or uses specified path) for local access
330
+ - Stores it in Metaflow's datastore (s3/gcs/azure etc.) with a unique name based on repo_type/repo_id
331
+ - All HF models loaded for a `@step` will be cached separately under flow/step/namespace.
332
+
333
+ - If repo is found in the datastore:
334
+ - Loads it directly from datastore to local path (can be temporary directory or specified path)
309
335
  """
310
336
  ...
311
337
 
312
- def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: typing.Optional[str] = None, image_pull_policy: str = 'KUBERNETES_IMAGE_PULL_POLICY', service_account: str = 'METAFLOW_KUBERNETES_SERVICE_ACCOUNT', secrets: typing.Optional[typing.List[str]] = None, node_selector: typing.Union[typing.Dict[str, str], str, None] = None, namespace: str = 'METAFLOW_KUBERNETES_NAMESPACE', gpu: typing.Optional[int] = None, gpu_vendor: str = 'KUBERNETES_GPU_VENDOR', tolerations: typing.List[str] = [], labels: typing.Dict[str, str] = 'METAFLOW_KUBERNETES_LABELS', annotations: typing.Dict[str, str] = 'METAFLOW_KUBERNETES_ANNOTATIONS', use_tmpfs: bool = False, tmpfs_tempdir: bool = True, tmpfs_size: typing.Optional[int] = None, tmpfs_path: typing.Optional[str] = '/metaflow_temp', persistent_volume_claims: typing.Optional[typing.Dict[str, str]] = None, shared_memory: typing.Optional[int] = None, port: typing.Optional[int] = None, compute_pool: typing.Optional[str] = None, hostname_resolution_timeout: int = 600, qos: str = 'Burstable', security_context: typing.Optional[typing.Dict[str, typing.Any]] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
338
+ @typing.overload
339
+ def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
313
340
  """
314
- Specifies that this step should execute on Kubernetes.
341
+ Internal decorator to support Fast bakery
342
+ """
343
+ ...
344
+
345
+ @typing.overload
346
+ def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
347
+ ...
348
+
349
+ def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
350
+ """
351
+ Internal decorator to support Fast bakery
352
+ """
353
+ ...
354
+
355
+ @typing.overload
356
+ def catch(*, var: typing.Optional[str] = None, print_exception: bool = True) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
357
+ """
358
+ Specifies that the step will success under all circumstances.
359
+
360
+ The decorator will create an optional artifact, specified by `var`, which
361
+ contains the exception raised. You can use it to detect the presence
362
+ of errors, indicating that all happy-path artifacts produced by the step
363
+ are missing.
315
364
 
316
365
 
317
366
  Parameters
318
367
  ----------
319
- cpu : int, default 1
320
- Number of CPUs required for this step. If `@resources` is
321
- also present, the maximum value from all decorators is used.
368
+ var : str, optional, default None
369
+ Name of the artifact in which to store the caught exception.
370
+ If not specified, the exception is not stored.
371
+ print_exception : bool, default True
372
+ Determines whether or not the exception is printed to
373
+ stdout when caught.
374
+ """
375
+ ...
376
+
377
+ @typing.overload
378
+ def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
379
+ ...
380
+
381
+ @typing.overload
382
+ def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
383
+ ...
384
+
385
+ def catch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, var: typing.Optional[str] = None, print_exception: bool = True):
386
+ """
387
+ Specifies that the step will success under all circumstances.
388
+
389
+ The decorator will create an optional artifact, specified by `var`, which
390
+ contains the exception raised. You can use it to detect the presence
391
+ of errors, indicating that all happy-path artifacts produced by the step
392
+ are missing.
393
+
394
+
395
+ Parameters
396
+ ----------
397
+ var : str, optional, default None
398
+ Name of the artifact in which to store the caught exception.
399
+ If not specified, the exception is not stored.
400
+ print_exception : bool, default True
401
+ Determines whether or not the exception is printed to
402
+ stdout when caught.
403
+ """
404
+ ...
405
+
406
+ @typing.overload
407
+ def timeout(*, seconds: int = 0, minutes: int = 0, hours: int = 0) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
408
+ """
409
+ Specifies a timeout for your step.
410
+
411
+ This decorator is useful if this step may hang indefinitely.
412
+
413
+ This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
414
+ A timeout is considered to be an exception thrown by the step. It will cause the step to be
415
+ retried if needed and the exception will be caught by the `@catch` decorator, if present.
416
+
417
+ Note that all the values specified in parameters are added together so if you specify
418
+ 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
419
+
420
+
421
+ Parameters
422
+ ----------
423
+ seconds : int, default 0
424
+ Number of seconds to wait prior to timing out.
425
+ minutes : int, default 0
426
+ Number of minutes to wait prior to timing out.
427
+ hours : int, default 0
428
+ Number of hours to wait prior to timing out.
429
+ """
430
+ ...
431
+
432
+ @typing.overload
433
+ def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
434
+ ...
435
+
436
+ @typing.overload
437
+ def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
438
+ ...
439
+
440
+ def timeout(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, seconds: int = 0, minutes: int = 0, hours: int = 0):
441
+ """
442
+ Specifies a timeout for your step.
443
+
444
+ This decorator is useful if this step may hang indefinitely.
445
+
446
+ This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
447
+ A timeout is considered to be an exception thrown by the step. It will cause the step to be
448
+ retried if needed and the exception will be caught by the `@catch` decorator, if present.
449
+
450
+ Note that all the values specified in parameters are added together so if you specify
451
+ 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
452
+
453
+
454
+ Parameters
455
+ ----------
456
+ seconds : int, default 0
457
+ Number of seconds to wait prior to timing out.
458
+ minutes : int, default 0
459
+ Number of minutes to wait prior to timing out.
460
+ hours : int, default 0
461
+ Number of hours to wait prior to timing out.
462
+ """
463
+ ...
464
+
465
+ def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: typing.Optional[str] = None, image_pull_policy: str = 'KUBERNETES_IMAGE_PULL_POLICY', service_account: str = 'METAFLOW_KUBERNETES_SERVICE_ACCOUNT', secrets: typing.Optional[typing.List[str]] = None, node_selector: typing.Union[typing.Dict[str, str], str, None] = None, namespace: str = 'METAFLOW_KUBERNETES_NAMESPACE', gpu: typing.Optional[int] = None, gpu_vendor: str = 'KUBERNETES_GPU_VENDOR', tolerations: typing.List[str] = [], labels: typing.Dict[str, str] = 'METAFLOW_KUBERNETES_LABELS', annotations: typing.Dict[str, str] = 'METAFLOW_KUBERNETES_ANNOTATIONS', use_tmpfs: bool = False, tmpfs_tempdir: bool = True, tmpfs_size: typing.Optional[int] = None, tmpfs_path: typing.Optional[str] = '/metaflow_temp', persistent_volume_claims: typing.Optional[typing.Dict[str, str]] = None, shared_memory: typing.Optional[int] = None, port: typing.Optional[int] = None, compute_pool: typing.Optional[str] = None, hostname_resolution_timeout: int = 600, qos: str = 'Burstable', security_context: typing.Optional[typing.Dict[str, typing.Any]] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
466
+ """
467
+ Specifies that this step should execute on Kubernetes.
468
+
469
+
470
+ Parameters
471
+ ----------
472
+ cpu : int, default 1
473
+ Number of CPUs required for this step. If `@resources` is
474
+ also present, the maximum value from all decorators is used.
322
475
  memory : int, default 4096
323
476
  Memory size (in MB) required for this step. If
324
477
  `@resources` is also present, the maximum value from all decorators is
@@ -395,781 +548,543 @@ def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: ty
395
548
  ...
396
549
 
397
550
  @typing.overload
398
- 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]]]:
551
+ 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]]]:
399
552
  """
400
- Enables loading / saving of models within a step.
553
+ Specifies the number of times the task corresponding
554
+ to a step needs to be retried.
401
555
 
556
+ This decorator is useful for handling transient errors, such as networking issues.
557
+ If your task contains operations that can't be retried safely, e.g. database updates,
558
+ it is advisable to annotate it with `@retry(times=0)`.
559
+
560
+ This can be used in conjunction with the `@catch` decorator. The `@catch`
561
+ decorator will execute a no-op task after all retries have been exhausted,
562
+ ensuring that the flow execution can continue.
402
563
 
403
564
 
404
565
  Parameters
405
566
  ----------
406
- load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
407
- Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
408
- These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
409
- - `current.checkpoint`
410
- - `current.model`
411
- - `current.huggingface_hub`
412
-
413
- 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
414
- the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
415
- If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
416
-
417
- temp_dir_root : str, default: None
418
- The root directory under which `current.model.loaded` will store loaded models
567
+ times : int, default 3
568
+ Number of times to retry this task.
569
+ minutes_between_retries : int, default 2
570
+ Number of minutes between retries.
419
571
  """
420
572
  ...
421
573
 
422
574
  @typing.overload
423
- def model(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
575
+ def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
424
576
  ...
425
577
 
426
578
  @typing.overload
427
- def model(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
579
+ def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
428
580
  ...
429
581
 
430
- 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):
582
+ 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):
431
583
  """
432
- Enables loading / saving of models within a step.
584
+ Specifies the number of times the task corresponding
585
+ to a step needs to be retried.
586
+
587
+ This decorator is useful for handling transient errors, such as networking issues.
588
+ If your task contains operations that can't be retried safely, e.g. database updates,
589
+ it is advisable to annotate it with `@retry(times=0)`.
433
590
 
591
+ This can be used in conjunction with the `@catch` decorator. The `@catch`
592
+ decorator will execute a no-op task after all retries have been exhausted,
593
+ ensuring that the flow execution can continue.
434
594
 
435
595
 
436
596
  Parameters
437
597
  ----------
438
- load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
439
- Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
440
- These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
441
- - `current.checkpoint`
442
- - `current.model`
443
- - `current.huggingface_hub`
444
-
445
- 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
446
- the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
447
- If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
448
-
449
- temp_dir_root : str, default: None
450
- The root directory under which `current.model.loaded` will store loaded models
598
+ times : int, default 3
599
+ Number of times to retry this task.
600
+ minutes_between_retries : int, default 2
601
+ Number of minutes between retries.
451
602
  """
452
603
  ...
453
604
 
454
- 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]]]:
605
+ def app_deploy(*, app_port: int, app_name: str) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
455
606
  """
456
- Specifies that this step should execute on DGX cloud.
607
+ Specifies that this step is used to deploy an instance of the app.
608
+ Requires that self.app_name, self.app_port, self.entrypoint and self.deployDir is set.
457
609
 
458
610
 
459
611
  Parameters
460
612
  ----------
461
- gpu : int
613
+ app_port : int
462
614
  Number of GPUs to use.
463
- gpu_type : str
464
- Type of Nvidia GPU to use.
465
- queue_timeout : int
466
- Time to keep the job in NVCF's queue.
615
+ app_name : str
616
+ Name of the app to deploy.
467
617
  """
468
618
  ...
469
619
 
470
- def nvct(*, gpu: int, gpu_type: str) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
620
+ @typing.overload
621
+ def secrets(*, sources: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = []) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
471
622
  """
472
- Specifies that this step should execute on DGX cloud.
623
+ Specifies secrets to be retrieved and injected as environment variables prior to
624
+ the execution of a step.
473
625
 
474
626
 
475
627
  Parameters
476
628
  ----------
477
- gpu : int
478
- Number of GPUs to use.
479
- gpu_type : str
480
- Type of Nvidia GPU to use.
629
+ sources : List[Union[str, Dict[str, Any]]], default: []
630
+ List of secret specs, defining how the secrets are to be retrieved
481
631
  """
482
632
  ...
483
633
 
484
634
  @typing.overload
485
- 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]]]:
635
+ def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
636
+ ...
637
+
638
+ @typing.overload
639
+ def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
640
+ ...
641
+
642
+ def secrets(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, sources: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = []):
486
643
  """
487
- Specifies the resources needed when executing this step.
644
+ Specifies secrets to be retrieved and injected as environment variables prior to
645
+ the execution of a step.
488
646
 
489
- Use `@resources` to specify the resource requirements
490
- independently of the specific compute layer (`@batch`, `@kubernetes`).
491
647
 
492
- You can choose the compute layer on the command line by executing e.g.
493
- ```
494
- python myflow.py run --with batch
495
- ```
496
- or
497
- ```
498
- python myflow.py run --with kubernetes
499
- ```
500
- which executes the flow on the desired system using the
501
- requirements specified in `@resources`.
648
+ Parameters
649
+ ----------
650
+ sources : List[Union[str, Dict[str, Any]]], default: []
651
+ List of secret specs, defining how the secrets are to be retrieved
652
+ """
653
+ ...
654
+
655
+ @typing.overload
656
+ def pypi(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
657
+ """
658
+ Specifies the PyPI packages for the step.
659
+
660
+ Information in this decorator will augment any
661
+ attributes set in the `@pyi_base` flow-level decorator. Hence,
662
+ you can use `@pypi_base` to set packages required by all
663
+ steps and use `@pypi` to specify step-specific overrides.
502
664
 
503
665
 
504
666
  Parameters
505
667
  ----------
506
- cpu : int, default 1
507
- Number of CPUs required for this step.
508
- gpu : int, optional, default None
509
- Number of GPUs required for this step.
510
- disk : int, optional, default None
511
- Disk size (in MB) required for this step. Only applies on Kubernetes.
512
- memory : int, default 4096
513
- Memory size (in MB) required for this step.
514
- shared_memory : int, optional, default None
515
- The value for the size (in MiB) of the /dev/shm volume for this step.
516
- This parameter maps to the `--shm-size` option in Docker.
668
+ packages : Dict[str, str], default: {}
669
+ Packages to use for this step. The key is the name of the package
670
+ and the value is the version to use.
671
+ python : str, optional, default: None
672
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
673
+ that the version used will correspond to the version of the Python interpreter used to start the run.
517
674
  """
518
675
  ...
519
676
 
520
677
  @typing.overload
521
- def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
678
+ def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
522
679
  ...
523
680
 
524
681
  @typing.overload
525
- def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
682
+ def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
526
683
  ...
527
684
 
528
- 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):
685
+ def pypi(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
529
686
  """
530
- Specifies the resources needed when executing this step.
531
-
532
- Use `@resources` to specify the resource requirements
533
- independently of the specific compute layer (`@batch`, `@kubernetes`).
687
+ Specifies the PyPI packages for the step.
534
688
 
535
- You can choose the compute layer on the command line by executing e.g.
536
- ```
537
- python myflow.py run --with batch
538
- ```
539
- or
540
- ```
541
- python myflow.py run --with kubernetes
542
- ```
543
- which executes the flow on the desired system using the
544
- requirements specified in `@resources`.
689
+ Information in this decorator will augment any
690
+ attributes set in the `@pyi_base` flow-level decorator. Hence,
691
+ you can use `@pypi_base` to set packages required by all
692
+ steps and use `@pypi` to specify step-specific overrides.
545
693
 
546
694
 
547
695
  Parameters
548
696
  ----------
549
- cpu : int, default 1
550
- Number of CPUs required for this step.
551
- gpu : int, optional, default None
552
- Number of GPUs required for this step.
553
- disk : int, optional, default None
554
- Disk size (in MB) required for this step. Only applies on Kubernetes.
555
- memory : int, default 4096
556
- Memory size (in MB) required for this step.
557
- shared_memory : int, optional, default None
558
- The value for the size (in MiB) of the /dev/shm volume for this step.
559
- This parameter maps to the `--shm-size` option in Docker.
697
+ packages : Dict[str, str], default: {}
698
+ Packages to use for this step. The key is the name of the package
699
+ and the value is the version to use.
700
+ python : str, optional, default: None
701
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
702
+ that the version used will correspond to the version of the Python interpreter used to start the run.
560
703
  """
561
704
  ...
562
705
 
563
706
  @typing.overload
564
- def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
707
+ def card(*, type: str = 'default', id: typing.Optional[str] = None, options: typing.Dict[str, typing.Any] = {}, timeout: int = 45) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
565
708
  """
566
- Decorator prototype for all step decorators. This function gets specialized
567
- and imported for all decorators types by _import_plugin_decorators().
709
+ Creates a human-readable report, a Metaflow Card, after this step completes.
710
+
711
+ Note that you may add multiple `@card` decorators in a step with different parameters.
712
+
713
+
714
+ Parameters
715
+ ----------
716
+ type : str, default 'default'
717
+ Card type.
718
+ id : str, optional, default None
719
+ If multiple cards are present, use this id to identify this card.
720
+ options : Dict[str, Any], default {}
721
+ Options passed to the card. The contents depend on the card type.
722
+ timeout : int, default 45
723
+ Interrupt reporting if it takes more than this many seconds.
568
724
  """
569
725
  ...
570
726
 
571
727
  @typing.overload
572
- def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
728
+ def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
573
729
  ...
574
730
 
575
- def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
731
+ @typing.overload
732
+ def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
733
+ ...
734
+
735
+ def card(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, type: str = 'default', id: typing.Optional[str] = None, options: typing.Dict[str, typing.Any] = {}, timeout: int = 45):
576
736
  """
577
- Decorator prototype for all step decorators. This function gets specialized
578
- and imported for all decorators types by _import_plugin_decorators().
737
+ Creates a human-readable report, a Metaflow Card, after this step completes.
738
+
739
+ Note that you may add multiple `@card` decorators in a step with different parameters.
740
+
741
+
742
+ Parameters
743
+ ----------
744
+ type : str, default 'default'
745
+ Card type.
746
+ id : str, optional, default None
747
+ If multiple cards are present, use this id to identify this card.
748
+ options : Dict[str, Any], default {}
749
+ Options passed to the card. The contents depend on the card type.
750
+ timeout : int, default 45
751
+ Interrupt reporting if it takes more than this many seconds.
579
752
  """
580
753
  ...
581
754
 
582
755
  @typing.overload
583
- 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]]]:
756
+ def checkpoint(*, load_policy: str = 'fresh', temp_dir_root: str = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
584
757
  """
585
- Specifies the number of times the task corresponding
586
- to a step needs to be retried.
587
-
588
- This decorator is useful for handling transient errors, such as networking issues.
589
- If your task contains operations that can't be retried safely, e.g. database updates,
590
- it is advisable to annotate it with `@retry(times=0)`.
758
+ Enables checkpointing for a step.
591
759
 
592
- This can be used in conjunction with the `@catch` decorator. The `@catch`
593
- decorator will execute a no-op task after all retries have been exhausted,
594
- ensuring that the flow execution can continue.
595
760
 
596
761
 
597
762
  Parameters
598
763
  ----------
599
- times : int, default 3
600
- Number of times to retry this task.
601
- minutes_between_retries : int, default 2
602
- Number of minutes between retries.
764
+ load_policy : str, default: "fresh"
765
+ The policy for loading the checkpoint. The following policies are supported:
766
+ - "eager": Loads the the latest available checkpoint within the namespace.
767
+ With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
768
+ will be loaded at the start of the task.
769
+ - "none": Do not load any checkpoint
770
+ - "fresh": Loads the lastest checkpoint created within the running Task.
771
+ This mode helps loading checkpoints across various retry attempts of the same task.
772
+ With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
773
+ created within the task will be loaded when the task is retries execution on failure.
774
+
775
+ temp_dir_root : str, default: None
776
+ The root directory under which `current.checkpoint.directory` will be created.
603
777
  """
604
778
  ...
605
779
 
606
780
  @typing.overload
607
- def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
781
+ def checkpoint(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
608
782
  ...
609
783
 
610
784
  @typing.overload
611
- def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
785
+ def checkpoint(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
612
786
  ...
613
787
 
614
- 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):
788
+ def checkpoint(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, load_policy: str = 'fresh', temp_dir_root: str = None):
615
789
  """
616
- Specifies the number of times the task corresponding
617
- to a step needs to be retried.
618
-
619
- This decorator is useful for handling transient errors, such as networking issues.
620
- If your task contains operations that can't be retried safely, e.g. database updates,
621
- it is advisable to annotate it with `@retry(times=0)`.
790
+ Enables checkpointing for a step.
622
791
 
623
- This can be used in conjunction with the `@catch` decorator. The `@catch`
624
- decorator will execute a no-op task after all retries have been exhausted,
625
- ensuring that the flow execution can continue.
626
792
 
627
793
 
628
794
  Parameters
629
795
  ----------
630
- times : int, default 3
631
- Number of times to retry this task.
632
- minutes_between_retries : int, default 2
633
- Number of minutes between retries.
796
+ load_policy : str, default: "fresh"
797
+ The policy for loading the checkpoint. The following policies are supported:
798
+ - "eager": Loads the the latest available checkpoint within the namespace.
799
+ With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
800
+ will be loaded at the start of the task.
801
+ - "none": Do not load any checkpoint
802
+ - "fresh": Loads the lastest checkpoint created within the running Task.
803
+ This mode helps loading checkpoints across various retry attempts of the same task.
804
+ With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
805
+ created within the task will be loaded when the task is retries execution on failure.
806
+
807
+ temp_dir_root : str, default: None
808
+ The root directory under which `current.checkpoint.directory` will be created.
634
809
  """
635
810
  ...
636
811
 
637
- @typing.overload
638
- 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]]]:
812
+ def nim(*, models: "list[NIM]", backend: str, queue_timeout: int) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
639
813
  """
640
- Specifies the PyPI packages for the step.
814
+ This decorator is used to run NIM containers in Metaflow tasks as sidecars.
641
815
 
642
- Information in this decorator will augment any
643
- attributes set in the `@pyi_base` flow-level decorator. Hence,
644
- you can use `@pypi_base` to set packages required by all
645
- steps and use `@pypi` to specify step-specific overrides.
816
+ User code call
817
+ -----------
818
+ @nim(
819
+ models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
820
+ backend='managed'
821
+ )
822
+
823
+ Valid backend options
824
+ ---------------------
825
+ - 'managed': Outerbounds selects a compute provider based on the model.
826
+
827
+ Valid model options
828
+ ----------------
829
+ - 'meta/llama3-8b-instruct': 8B parameter model
830
+ - 'meta/llama3-70b-instruct': 70B parameter model
831
+ - any model here: https://nvcf.ngc.nvidia.com/functions?filter=nvidia-functions
646
832
 
647
833
 
648
834
  Parameters
649
835
  ----------
650
- packages : Dict[str, str], default: {}
651
- Packages to use for this step. The key is the name of the package
652
- and the value is the version to use.
653
- python : str, optional, default: None
654
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
655
- that the version used will correspond to the version of the Python interpreter used to start the run.
836
+ models: list[NIM]
837
+ List of NIM containers running models in sidecars.
838
+ backend: str
839
+ Compute provider to run the NIM container.
840
+ queue_timeout : int
841
+ Time to keep the job in NVCF's queue.
656
842
  """
657
843
  ...
658
844
 
659
- @typing.overload
660
- def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
661
- ...
662
-
663
- @typing.overload
664
- def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
665
- ...
666
-
667
- 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):
845
+ def nvidia(*, gpu: int, gpu_type: str, queue_timeout: int) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
668
846
  """
669
- Specifies the PyPI packages for the step.
670
-
671
- Information in this decorator will augment any
672
- attributes set in the `@pyi_base` flow-level decorator. Hence,
673
- you can use `@pypi_base` to set packages required by all
674
- steps and use `@pypi` to specify step-specific overrides.
847
+ Specifies that this step should execute on DGX cloud.
675
848
 
676
849
 
677
850
  Parameters
678
851
  ----------
679
- packages : Dict[str, str], default: {}
680
- Packages to use for this step. The key is the name of the package
681
- and the value is the version to use.
682
- python : str, optional, default: None
683
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
684
- that the version used will correspond to the version of the Python interpreter used to start the run.
852
+ gpu : int
853
+ Number of GPUs to use.
854
+ gpu_type : str
855
+ Type of Nvidia GPU to use.
856
+ queue_timeout : int
857
+ Time to keep the job in NVCF's queue.
685
858
  """
686
859
  ...
687
860
 
688
861
  @typing.overload
689
- def catch(*, var: typing.Optional[str] = None, print_exception: bool = True) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
862
+ def model(*, load: typing.Union[typing.List[str], str, typing.List[typing.Tuple[str, typing.Optional[str]]]] = None, temp_dir_root: str = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
690
863
  """
691
- Specifies that the step will success under all circumstances.
864
+ Enables loading / saving of models within a step.
692
865
 
693
- The decorator will create an optional artifact, specified by `var`, which
694
- contains the exception raised. You can use it to detect the presence
695
- of errors, indicating that all happy-path artifacts produced by the step
696
- are missing.
697
866
 
698
867
 
699
868
  Parameters
700
869
  ----------
701
- var : str, optional, default None
702
- Name of the artifact in which to store the caught exception.
703
- If not specified, the exception is not stored.
704
- print_exception : bool, default True
705
- Determines whether or not the exception is printed to
706
- stdout when caught.
870
+ load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
871
+ Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
872
+ These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
873
+ - `current.checkpoint`
874
+ - `current.model`
875
+ - `current.huggingface_hub`
876
+
877
+ If a list of tuples is provided, the first element is the artifact name and the second element is the path the artifact needs be unpacked on
878
+ the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
879
+ If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
880
+
881
+ temp_dir_root : str, default: None
882
+ The root directory under which `current.model.loaded` will store loaded models
707
883
  """
708
884
  ...
709
885
 
710
886
  @typing.overload
711
- def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
887
+ def model(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
712
888
  ...
713
889
 
714
890
  @typing.overload
715
- def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
891
+ def model(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
716
892
  ...
717
893
 
718
- def catch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, var: typing.Optional[str] = None, print_exception: bool = True):
894
+ def model(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, load: typing.Union[typing.List[str], str, typing.List[typing.Tuple[str, typing.Optional[str]]]] = None, temp_dir_root: str = None):
719
895
  """
720
- Specifies that the step will success under all circumstances.
896
+ Enables loading / saving of models within a step.
721
897
 
722
- The decorator will create an optional artifact, specified by `var`, which
723
- contains the exception raised. You can use it to detect the presence
724
- of errors, indicating that all happy-path artifacts produced by the step
725
- are missing.
726
898
 
727
899
 
728
900
  Parameters
729
901
  ----------
730
- var : str, optional, default None
731
- Name of the artifact in which to store the caught exception.
732
- If not specified, the exception is not stored.
733
- print_exception : bool, default True
734
- Determines whether or not the exception is printed to
735
- stdout when caught.
736
- """
737
- ...
738
-
739
- 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]]]:
740
- """
741
- Decorator that helps cache, version and store models/datasets from huggingface hub.
742
-
743
-
744
- Parameters
745
- ----------
746
- temp_dir_root : str, optional
747
- The root directory that will hold the temporary directory where objects will be downloaded.
748
-
749
- load: Union[List[str], List[Tuple[Dict, str]], List[Tuple[str, str]], List[Dict], None]
750
- The list of repos (models/datasets) to load.
751
-
752
- Loaded repos can be accessed via `current.huggingface_hub.loaded`. If load is set, then the following happens:
753
-
754
- - If repo (model/dataset) is not found in the datastore:
755
- - Downloads the repo from Hugging Face Hub to a temporary directory (or uses specified path) for local access
756
- - Stores it in Metaflow's datastore (s3/gcs/azure etc.) with a unique name based on repo_type/repo_id
757
- - All HF models loaded for a `@step` will be cached separately under flow/step/namespace.
758
-
759
- - If repo is found in the datastore:
760
- - Loads it directly from datastore to local path (can be temporary directory or specified path)
761
- """
762
- ...
763
-
764
- @typing.overload
765
- def timeout(*, seconds: int = 0, minutes: int = 0, hours: int = 0) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
766
- """
767
- Specifies a timeout for your step.
768
-
769
- This decorator is useful if this step may hang indefinitely.
770
-
771
- This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
772
- A timeout is considered to be an exception thrown by the step. It will cause the step to be
773
- retried if needed and the exception will be caught by the `@catch` decorator, if present.
774
-
775
- Note that all the values specified in parameters are added together so if you specify
776
- 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
902
+ load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
903
+ Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
904
+ These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
905
+ - `current.checkpoint`
906
+ - `current.model`
907
+ - `current.huggingface_hub`
777
908
 
909
+ If a list of tuples is provided, the first element is the artifact name and the second element is the path the artifact needs be unpacked on
910
+ the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
911
+ If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
778
912
 
779
- Parameters
780
- ----------
781
- seconds : int, default 0
782
- Number of seconds to wait prior to timing out.
783
- minutes : int, default 0
784
- Number of minutes to wait prior to timing out.
785
- hours : int, default 0
786
- Number of hours to wait prior to timing out.
913
+ temp_dir_root : str, default: None
914
+ The root directory under which `current.model.loaded` will store loaded models
787
915
  """
788
916
  ...
789
917
 
790
- @typing.overload
791
- def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
792
- ...
793
-
794
- @typing.overload
795
- def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
796
- ...
797
-
798
- def timeout(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, seconds: int = 0, minutes: int = 0, hours: int = 0):
918
+ def ollama(*, models: "list[Ollama]", backend: str) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
799
919
  """
800
- Specifies a timeout for your step.
801
-
802
- This decorator is useful if this step may hang indefinitely.
803
-
804
- This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
805
- A timeout is considered to be an exception thrown by the step. It will cause the step to be
806
- retried if needed and the exception will be caught by the `@catch` decorator, if present.
920
+ This decorator is used to run Ollama APIs as Metaflow task sidecars.
807
921
 
808
- Note that all the values specified in parameters are added together so if you specify
809
- 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
922
+ User code call
923
+ -----------
924
+ @ollama(
925
+ models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
926
+ backend='local'
927
+ )
810
928
 
929
+ Valid backend options
930
+ ---------------------
931
+ - 'local': Run as a separate process on the local task machine.
932
+ - (TODO) 'managed': Outerbounds hosts and selects compute provider.
933
+ - (TODO) 'remote': Spin up separate instance to serve Ollama models.
811
934
 
812
- Parameters
813
- ----------
814
- seconds : int, default 0
815
- Number of seconds to wait prior to timing out.
816
- minutes : int, default 0
817
- Number of minutes to wait prior to timing out.
818
- hours : int, default 0
819
- Number of hours to wait prior to timing out.
820
- """
821
- ...
822
-
823
- 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]]]:
824
- """
825
- Specifies that this step is used to deploy an instance of the app.
826
- Requires that self.app_name, self.app_port, self.entrypoint and self.deployDir is set.
935
+ Valid model options
936
+ ----------------
937
+ - 'llama3.2'
938
+ - 'llama3.3'
939
+ - any model here https://ollama.com/search
827
940
 
828
941
 
829
942
  Parameters
830
943
  ----------
831
- app_port : int
832
- Number of GPUs to use.
833
- app_name : str
834
- Name of the app to deploy.
835
- """
836
- ...
837
-
838
- @typing.overload
839
- def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
840
- """
841
- Internal decorator to support Fast bakery
842
- """
843
- ...
844
-
845
- @typing.overload
846
- def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
847
- ...
848
-
849
- def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
850
- """
851
- Internal decorator to support Fast bakery
944
+ models: list[Ollama]
945
+ List of Ollama containers running models in sidecars.
946
+ backend: str
947
+ Determines where and how to run the Ollama process.
852
948
  """
853
949
  ...
854
950
 
855
951
  @typing.overload
856
- 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]]]:
952
+ def environment(*, vars: typing.Dict[str, str] = {}) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
857
953
  """
858
- Specifies secrets to be retrieved and injected as environment variables prior to
859
- the execution of a step.
954
+ Specifies environment variables to be set prior to the execution of a step.
860
955
 
861
956
 
862
957
  Parameters
863
958
  ----------
864
- sources : List[Union[str, Dict[str, Any]]], default: []
865
- List of secret specs, defining how the secrets are to be retrieved
959
+ vars : Dict[str, str], default {}
960
+ Dictionary of environment variables to set.
866
961
  """
867
962
  ...
868
963
 
869
964
  @typing.overload
870
- def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
965
+ def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
871
966
  ...
872
967
 
873
968
  @typing.overload
874
- def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
875
- ...
876
-
877
- 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]]] = []):
878
- """
879
- Specifies secrets to be retrieved and injected as environment variables prior to
880
- the execution of a step.
881
-
882
-
883
- Parameters
884
- ----------
885
- sources : List[Union[str, Dict[str, Any]]], default: []
886
- List of secret specs, defining how the secrets are to be retrieved
887
- """
969
+ def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
888
970
  ...
889
971
 
890
- @typing.overload
891
- 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]]]:
972
+ def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
892
973
  """
893
- Specifies the Conda environment for the step.
894
-
895
- Information in this decorator will augment any
896
- attributes set in the `@conda_base` flow-level decorator. Hence,
897
- you can use `@conda_base` to set packages required by all
898
- steps and use `@conda` to specify step-specific overrides.
974
+ Specifies environment variables to be set prior to the execution of a step.
899
975
 
900
976
 
901
977
  Parameters
902
978
  ----------
903
- packages : Dict[str, str], default {}
904
- Packages to use for this step. The key is the name of the package
905
- and the value is the version to use.
906
- libraries : Dict[str, str], default {}
907
- Supported for backward compatibility. When used with packages, packages will take precedence.
908
- python : str, optional, default None
909
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
910
- that the version used will correspond to the version of the Python interpreter used to start the run.
911
- disabled : bool, default False
912
- If set to True, disables @conda.
979
+ vars : Dict[str, str], default {}
980
+ Dictionary of environment variables to set.
913
981
  """
914
982
  ...
915
983
 
916
- @typing.overload
917
- def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
918
- ...
919
-
920
- @typing.overload
921
- def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
922
- ...
923
-
924
- def conda(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False):
984
+ def nvct(*, gpu: int, gpu_type: str) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
925
985
  """
926
- Specifies the Conda environment for the step.
927
-
928
- Information in this decorator will augment any
929
- attributes set in the `@conda_base` flow-level decorator. Hence,
930
- you can use `@conda_base` to set packages required by all
931
- steps and use `@conda` to specify step-specific overrides.
986
+ Specifies that this step should execute on DGX cloud.
932
987
 
933
988
 
934
989
  Parameters
935
990
  ----------
936
- packages : Dict[str, str], default {}
937
- Packages to use for this step. The key is the name of the package
938
- and the value is the version to use.
939
- libraries : Dict[str, str], default {}
940
- Supported for backward compatibility. When used with packages, packages will take precedence.
941
- python : str, optional, default None
942
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
943
- that the version used will correspond to the version of the Python interpreter used to start the run.
944
- disabled : bool, default False
945
- If set to True, disables @conda.
991
+ gpu : int
992
+ Number of GPUs to use.
993
+ gpu_type : str
994
+ Type of Nvidia GPU to use.
946
995
  """
947
996
  ...
948
997
 
949
998
  @typing.overload
950
- 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]]]:
999
+ 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]]:
951
1000
  """
952
- Creates a human-readable report, a Metaflow Card, after this step completes.
953
-
954
- Note that you may add multiple `@card` decorators in a step with different parameters.
1001
+ Specifies the event(s) that this flow depends on.
955
1002
 
1003
+ ```
1004
+ @trigger(event='foo')
1005
+ ```
1006
+ or
1007
+ ```
1008
+ @trigger(events=['foo', 'bar'])
1009
+ ```
956
1010
 
957
- Parameters
958
- ----------
959
- type : str, default 'default'
960
- Card type.
961
- id : str, optional, default None
962
- If multiple cards are present, use this id to identify this card.
963
- options : Dict[str, Any], default {}
964
- Options passed to the card. The contents depend on the card type.
965
- timeout : int, default 45
966
- Interrupt reporting if it takes more than this many seconds.
967
- """
968
- ...
969
-
970
- @typing.overload
971
- def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
972
- ...
973
-
974
- @typing.overload
975
- def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
976
- ...
977
-
978
- 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):
979
- """
980
- Creates a human-readable report, a Metaflow Card, after this step completes.
1011
+ Additionally, you can specify the parameter mappings
1012
+ to map event payload to Metaflow parameters for the flow.
1013
+ ```
1014
+ @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1015
+ ```
1016
+ or
1017
+ ```
1018
+ @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1019
+ {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1020
+ ```
981
1021
 
982
- Note that you may add multiple `@card` decorators in a step with different parameters.
1022
+ 'parameters' can also be a list of strings and tuples like so:
1023
+ ```
1024
+ @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1025
+ ```
1026
+ This is equivalent to:
1027
+ ```
1028
+ @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1029
+ ```
983
1030
 
984
1031
 
985
1032
  Parameters
986
1033
  ----------
987
- type : str, default 'default'
988
- Card type.
989
- id : str, optional, default None
990
- If multiple cards are present, use this id to identify this card.
1034
+ event : Union[str, Dict[str, Any]], optional, default None
1035
+ Event dependency for this flow.
1036
+ events : List[Union[str, Dict[str, Any]]], default []
1037
+ Events dependency for this flow.
991
1038
  options : Dict[str, Any], default {}
992
- Options passed to the card. The contents depend on the card type.
993
- timeout : int, default 45
994
- Interrupt reporting if it takes more than this many seconds.
995
- """
996
- ...
997
-
998
- @typing.overload
999
- def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1000
- """
1001
- Specifies the PyPI packages for all steps of the flow.
1002
-
1003
- Use `@pypi_base` to set common packages required by all
1004
- steps and use `@pypi` to specify step-specific overrides.
1005
-
1006
- Parameters
1007
- ----------
1008
- packages : Dict[str, str], default: {}
1009
- Packages to use for this flow. The key is the name of the package
1010
- and the value is the version to use.
1011
- python : str, optional, default: None
1012
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1013
- that the version used will correspond to the version of the Python interpreter used to start the run.
1014
- """
1015
- ...
1016
-
1017
- @typing.overload
1018
- def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1019
- ...
1020
-
1021
- def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
1022
- """
1023
- Specifies the PyPI packages for all steps of the flow.
1024
-
1025
- Use `@pypi_base` to set common packages required by all
1026
- steps and use `@pypi` to specify step-specific overrides.
1027
-
1028
- Parameters
1029
- ----------
1030
- packages : Dict[str, str], default: {}
1031
- Packages to use for this flow. The key is the name of the package
1032
- and the value is the version to use.
1033
- python : str, optional, default: None
1034
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1035
- that the version used will correspond to the version of the Python interpreter used to start the run.
1036
- """
1037
- ...
1038
-
1039
- @typing.overload
1040
- def schedule(*, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: typing.Optional[str] = None, timezone: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1041
- """
1042
- Specifies the times when the flow should be run when running on a
1043
- production scheduler.
1044
-
1045
-
1046
- Parameters
1047
- ----------
1048
- hourly : bool, default False
1049
- Run the workflow hourly.
1050
- daily : bool, default True
1051
- Run the workflow daily.
1052
- weekly : bool, default False
1053
- Run the workflow weekly.
1054
- cron : str, optional, default None
1055
- Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1056
- specified by this expression.
1057
- timezone : str, optional, default None
1058
- Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1059
- which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1039
+ Backend-specific configuration for tuning eventing behavior.
1060
1040
  """
1061
1041
  ...
1062
1042
 
1063
1043
  @typing.overload
1064
- def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1065
- ...
1066
-
1067
- def schedule(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: typing.Optional[str] = None, timezone: typing.Optional[str] = None):
1068
- """
1069
- Specifies the times when the flow should be run when running on a
1070
- production scheduler.
1071
-
1072
-
1073
- Parameters
1074
- ----------
1075
- hourly : bool, default False
1076
- Run the workflow hourly.
1077
- daily : bool, default True
1078
- Run the workflow daily.
1079
- weekly : bool, default False
1080
- Run the workflow weekly.
1081
- cron : str, optional, default None
1082
- Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1083
- specified by this expression.
1084
- timezone : str, optional, default None
1085
- Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1086
- which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1087
- """
1088
- ...
1089
-
1090
- def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1091
- """
1092
- Specifies what flows belong to the same project.
1093
-
1094
- A project-specific namespace is created for all flows that
1095
- use the same `@project(name)`.
1096
-
1097
-
1098
- Parameters
1099
- ----------
1100
- name : str
1101
- Project name. Make sure that the name is unique amongst all
1102
- projects that use the same production scheduler. The name may
1103
- contain only lowercase alphanumeric characters and underscores.
1104
-
1105
- branch : Optional[str], default None
1106
- The branch to use. If not specified, the branch is set to
1107
- `user.<username>` unless `production` is set to `True`. This can
1108
- also be set on the command line using `--branch` as a top-level option.
1109
- It is an error to specify `branch` in the decorator and on the command line.
1110
-
1111
- production : bool, default False
1112
- Whether or not the branch is the production branch. This can also be set on the
1113
- command line using `--production` as a top-level option. It is an error to specify
1114
- `production` in the decorator and on the command line.
1115
- The project branch name will be:
1116
- - if `branch` is specified:
1117
- - if `production` is True: `prod.<branch>`
1118
- - if `production` is False: `test.<branch>`
1119
- - if `branch` is not specified:
1120
- - if `production` is True: `prod`
1121
- - if `production` is False: `user.<username>`
1122
- """
1044
+ def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1123
1045
  ...
1124
1046
 
1125
- @typing.overload
1126
- def conda_base(*, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1047
+ def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, 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] = {}):
1127
1048
  """
1128
- Specifies the Conda environment for all steps of the flow.
1129
-
1130
- Use `@conda_base` to set common libraries required by all
1131
- steps and use `@conda` to specify step-specific additions.
1132
-
1049
+ Specifies the event(s) that this flow depends on.
1133
1050
 
1134
- Parameters
1135
- ----------
1136
- packages : Dict[str, str], default {}
1137
- Packages to use for this flow. The key is the name of the package
1138
- and the value is the version to use.
1139
- libraries : Dict[str, str], default {}
1140
- Supported for backward compatibility. When used with packages, packages will take precedence.
1141
- python : str, optional, default None
1142
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1143
- that the version used will correspond to the version of the Python interpreter used to start the run.
1144
- disabled : bool, default False
1145
- If set to True, disables Conda.
1146
- """
1147
- ...
1148
-
1149
- @typing.overload
1150
- def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1151
- ...
1152
-
1153
- def conda_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False):
1154
- """
1155
- Specifies the Conda environment for all steps of the flow.
1051
+ ```
1052
+ @trigger(event='foo')
1053
+ ```
1054
+ or
1055
+ ```
1056
+ @trigger(events=['foo', 'bar'])
1057
+ ```
1156
1058
 
1157
- Use `@conda_base` to set common libraries required by all
1158
- steps and use `@conda` to specify step-specific additions.
1059
+ Additionally, you can specify the parameter mappings
1060
+ to map event payload to Metaflow parameters for the flow.
1061
+ ```
1062
+ @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1063
+ ```
1064
+ or
1065
+ ```
1066
+ @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1067
+ {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1068
+ ```
1069
+
1070
+ 'parameters' can also be a list of strings and tuples like so:
1071
+ ```
1072
+ @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1073
+ ```
1074
+ This is equivalent to:
1075
+ ```
1076
+ @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1077
+ ```
1159
1078
 
1160
1079
 
1161
1080
  Parameters
1162
1081
  ----------
1163
- packages : Dict[str, str], default {}
1164
- Packages to use for this flow. The key is the name of the package
1165
- and the value is the version to use.
1166
- libraries : Dict[str, str], default {}
1167
- Supported for backward compatibility. When used with packages, packages will take precedence.
1168
- python : str, optional, default None
1169
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1170
- that the version used will correspond to the version of the Python interpreter used to start the run.
1171
- disabled : bool, default False
1172
- If set to True, disables Conda.
1082
+ event : Union[str, Dict[str, Any]], optional, default None
1083
+ Event dependency for this flow.
1084
+ events : List[Union[str, Dict[str, Any]]], default []
1085
+ Events dependency for this flow.
1086
+ options : Dict[str, Any], default {}
1087
+ Backend-specific configuration for tuning eventing behavior.
1173
1088
  """
1174
1089
  ...
1175
1090
 
@@ -1275,95 +1190,43 @@ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *
1275
1190
  ...
1276
1191
 
1277
1192
  @typing.overload
1278
- 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]]:
1193
+ def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1279
1194
  """
1280
- Specifies the event(s) that this flow depends on.
1281
-
1282
- ```
1283
- @trigger(event='foo')
1284
- ```
1285
- or
1286
- ```
1287
- @trigger(events=['foo', 'bar'])
1288
- ```
1289
-
1290
- Additionally, you can specify the parameter mappings
1291
- to map event payload to Metaflow parameters for the flow.
1292
- ```
1293
- @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1294
- ```
1295
- or
1296
- ```
1297
- @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1298
- {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1299
- ```
1300
-
1301
- 'parameters' can also be a list of strings and tuples like so:
1302
- ```
1303
- @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1304
- ```
1305
- This is equivalent to:
1306
- ```
1307
- @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1308
- ```
1195
+ Specifies the PyPI packages for all steps of the flow.
1309
1196
 
1197
+ Use `@pypi_base` to set common packages required by all
1198
+ steps and use `@pypi` to specify step-specific overrides.
1310
1199
 
1311
1200
  Parameters
1312
1201
  ----------
1313
- event : Union[str, Dict[str, Any]], optional, default None
1314
- Event dependency for this flow.
1315
- events : List[Union[str, Dict[str, Any]]], default []
1316
- Events dependency for this flow.
1317
- options : Dict[str, Any], default {}
1318
- Backend-specific configuration for tuning eventing behavior.
1202
+ packages : Dict[str, str], default: {}
1203
+ Packages to use for this flow. The key is the name of the package
1204
+ and the value is the version to use.
1205
+ python : str, optional, default: None
1206
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1207
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1319
1208
  """
1320
1209
  ...
1321
1210
 
1322
1211
  @typing.overload
1323
- def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1212
+ def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1324
1213
  ...
1325
1214
 
1326
- def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, 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] = {}):
1215
+ def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
1327
1216
  """
1328
- Specifies the event(s) that this flow depends on.
1329
-
1330
- ```
1331
- @trigger(event='foo')
1332
- ```
1333
- or
1334
- ```
1335
- @trigger(events=['foo', 'bar'])
1336
- ```
1337
-
1338
- Additionally, you can specify the parameter mappings
1339
- to map event payload to Metaflow parameters for the flow.
1340
- ```
1341
- @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1342
- ```
1343
- or
1344
- ```
1345
- @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1346
- {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1347
- ```
1348
-
1349
- 'parameters' can also be a list of strings and tuples like so:
1350
- ```
1351
- @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1352
- ```
1353
- This is equivalent to:
1354
- ```
1355
- @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1356
- ```
1217
+ Specifies the PyPI packages for all steps of the flow.
1357
1218
 
1219
+ Use `@pypi_base` to set common packages required by all
1220
+ steps and use `@pypi` to specify step-specific overrides.
1358
1221
 
1359
1222
  Parameters
1360
1223
  ----------
1361
- event : Union[str, Dict[str, Any]], optional, default None
1362
- Event dependency for this flow.
1363
- events : List[Union[str, Dict[str, Any]]], default []
1364
- Events dependency for this flow.
1365
- options : Dict[str, Any], default {}
1366
- Backend-specific configuration for tuning eventing behavior.
1224
+ packages : Dict[str, str], default: {}
1225
+ Packages to use for this flow. The key is the name of the package
1226
+ and the value is the version to use.
1227
+ python : str, optional, default: None
1228
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1229
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1367
1230
  """
1368
1231
  ...
1369
1232
 
@@ -1481,6 +1344,108 @@ def with_artifact_store(f: typing.Optional[typing.Type[FlowSpecDerived]] = None)
1481
1344
  """
1482
1345
  ...
1483
1346
 
1347
+ @typing.overload
1348
+ def schedule(*, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: typing.Optional[str] = None, timezone: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1349
+ """
1350
+ Specifies the times when the flow should be run when running on a
1351
+ production scheduler.
1352
+
1353
+
1354
+ Parameters
1355
+ ----------
1356
+ hourly : bool, default False
1357
+ Run the workflow hourly.
1358
+ daily : bool, default True
1359
+ Run the workflow daily.
1360
+ weekly : bool, default False
1361
+ Run the workflow weekly.
1362
+ cron : str, optional, default None
1363
+ Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1364
+ specified by this expression.
1365
+ timezone : str, optional, default None
1366
+ Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1367
+ which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1368
+ """
1369
+ ...
1370
+
1371
+ @typing.overload
1372
+ def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1373
+ ...
1374
+
1375
+ def schedule(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: typing.Optional[str] = None, timezone: typing.Optional[str] = None):
1376
+ """
1377
+ Specifies the times when the flow should be run when running on a
1378
+ production scheduler.
1379
+
1380
+
1381
+ Parameters
1382
+ ----------
1383
+ hourly : bool, default False
1384
+ Run the workflow hourly.
1385
+ daily : bool, default True
1386
+ Run the workflow daily.
1387
+ weekly : bool, default False
1388
+ Run the workflow weekly.
1389
+ cron : str, optional, default None
1390
+ Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1391
+ specified by this expression.
1392
+ timezone : str, optional, default None
1393
+ Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1394
+ which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1395
+ """
1396
+ ...
1397
+
1398
+ @typing.overload
1399
+ def conda_base(*, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1400
+ """
1401
+ Specifies the Conda environment for all steps of the flow.
1402
+
1403
+ Use `@conda_base` to set common libraries required by all
1404
+ steps and use `@conda` to specify step-specific additions.
1405
+
1406
+
1407
+ Parameters
1408
+ ----------
1409
+ packages : Dict[str, str], default {}
1410
+ Packages to use for this flow. The key is the name of the package
1411
+ and the value is the version to use.
1412
+ libraries : Dict[str, str], default {}
1413
+ Supported for backward compatibility. When used with packages, packages will take precedence.
1414
+ python : str, optional, default None
1415
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1416
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1417
+ disabled : bool, default False
1418
+ If set to True, disables Conda.
1419
+ """
1420
+ ...
1421
+
1422
+ @typing.overload
1423
+ def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1424
+ ...
1425
+
1426
+ def conda_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False):
1427
+ """
1428
+ Specifies the Conda environment for all steps of the flow.
1429
+
1430
+ Use `@conda_base` to set common libraries required by all
1431
+ steps and use `@conda` to specify step-specific additions.
1432
+
1433
+
1434
+ Parameters
1435
+ ----------
1436
+ packages : Dict[str, str], default {}
1437
+ Packages to use for this flow. The key is the name of the package
1438
+ and the value is the version to use.
1439
+ libraries : Dict[str, str], default {}
1440
+ Supported for backward compatibility. When used with packages, packages will take precedence.
1441
+ python : str, optional, default None
1442
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1443
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1444
+ disabled : bool, default False
1445
+ If set to True, disables Conda.
1446
+ """
1447
+ ...
1448
+
1484
1449
  def airflow_s3_key_sensor(*, timeout: int, poke_interval: int, mode: str, exponential_backoff: bool, pool: str, soft_fail: bool, name: str, description: str, bucket_key: typing.Union[str, typing.List[str]], bucket_name: str, wildcard_match: bool, aws_conn_id: str, verify: bool) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1485
1450
  """
1486
1451
  The `@airflow_s3_key_sensor` decorator attaches a Airflow [S3KeySensor](https://airflow.apache.org/docs/apache-airflow-providers-amazon/stable/_api/airflow/providers/amazon/aws/sensors/s3/index.html#airflow.providers.amazon.aws.sensors.s3.S3KeySensor)
@@ -1524,6 +1489,41 @@ def airflow_s3_key_sensor(*, timeout: int, poke_interval: int, mode: str, expone
1524
1489
  """
1525
1490
  ...
1526
1491
 
1492
+ def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1493
+ """
1494
+ Specifies what flows belong to the same project.
1495
+
1496
+ A project-specific namespace is created for all flows that
1497
+ use the same `@project(name)`.
1498
+
1499
+
1500
+ Parameters
1501
+ ----------
1502
+ name : str
1503
+ Project name. Make sure that the name is unique amongst all
1504
+ projects that use the same production scheduler. The name may
1505
+ contain only lowercase alphanumeric characters and underscores.
1506
+
1507
+ branch : Optional[str], default None
1508
+ The branch to use. If not specified, the branch is set to
1509
+ `user.<username>` unless `production` is set to `True`. This can
1510
+ also be set on the command line using `--branch` as a top-level option.
1511
+ It is an error to specify `branch` in the decorator and on the command line.
1512
+
1513
+ production : bool, default False
1514
+ Whether or not the branch is the production branch. This can also be set on the
1515
+ command line using `--production` as a top-level option. It is an error to specify
1516
+ `production` in the decorator and on the command line.
1517
+ The project branch name will be:
1518
+ - if `branch` is specified:
1519
+ - if `production` is True: `prod.<branch>`
1520
+ - if `production` is False: `test.<branch>`
1521
+ - if `branch` is not specified:
1522
+ - if `production` is True: `prod`
1523
+ - if `production` is False: `user.<username>`
1524
+ """
1525
+ ...
1526
+
1527
1527
  def airflow_external_task_sensor(*, timeout: int, poke_interval: int, mode: str, exponential_backoff: bool, pool: str, soft_fail: bool, name: str, description: str, external_dag_id: str, external_task_ids: typing.List[str], allowed_states: typing.List[str], failed_states: typing.List[str], execution_delta: "datetime.timedelta", check_existence: bool) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1528
1528
  """
1529
1529
  The `@airflow_external_task_sensor` decorator attaches a Airflow [ExternalTaskSensor](https://airflow.apache.org/docs/apache-airflow/stable/_api/airflow/sensors/external_task/index.html#airflow.sensors.external_task.ExternalTaskSensor) before the start step of the flow.