ob-metaflow-stubs 6.0.3.148__py2.py3-none-any.whl → 6.0.3.150__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 (198) hide show
  1. metaflow-stubs/__init__.pyi +574 -574
  2. metaflow-stubs/cards.pyi +2 -2
  3. metaflow-stubs/cli.pyi +2 -2
  4. metaflow-stubs/cli_components/__init__.pyi +2 -2
  5. metaflow-stubs/cli_components/utils.pyi +2 -2
  6. metaflow-stubs/client/__init__.pyi +2 -2
  7. metaflow-stubs/client/core.pyi +6 -6
  8. metaflow-stubs/client/filecache.pyi +2 -2
  9. metaflow-stubs/events.pyi +3 -3
  10. metaflow-stubs/exception.pyi +2 -2
  11. metaflow-stubs/flowspec.pyi +6 -6
  12. metaflow-stubs/generated_for.txt +1 -1
  13. metaflow-stubs/includefile.pyi +4 -4
  14. metaflow-stubs/info_file.pyi +2 -2
  15. metaflow-stubs/metadata_provider/__init__.pyi +2 -2
  16. metaflow-stubs/metadata_provider/heartbeat.pyi +2 -2
  17. metaflow-stubs/metadata_provider/metadata.pyi +3 -3
  18. metaflow-stubs/metadata_provider/util.pyi +2 -2
  19. metaflow-stubs/metaflow_config.pyi +2 -2
  20. metaflow-stubs/metaflow_current.pyi +86 -86
  21. metaflow-stubs/mf_extensions/__init__.pyi +2 -2
  22. metaflow-stubs/mf_extensions/obcheckpoint/__init__.pyi +2 -2
  23. metaflow-stubs/mf_extensions/obcheckpoint/plugins/__init__.pyi +2 -2
  24. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/__init__.pyi +2 -2
  25. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/__init__.pyi +2 -2
  26. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/async_cards.pyi +3 -3
  27. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/deco_injection_mixin.pyi +2 -2
  28. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/extra_components.pyi +4 -4
  29. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/__init__.pyi +2 -2
  30. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/__init__.pyi +2 -2
  31. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/checkpoint_lister.pyi +4 -4
  32. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/lineage_card.pyi +2 -2
  33. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/checkpoint_storage.pyi +5 -5
  34. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/constructors.pyi +2 -2
  35. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/core.pyi +4 -4
  36. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/decorator.pyi +5 -5
  37. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/exceptions.pyi +2 -2
  38. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/final_api.pyi +2 -2
  39. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/lineage.pyi +2 -2
  40. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/__init__.pyi +2 -2
  41. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/core.pyi +2 -2
  42. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/exceptions.pyi +2 -2
  43. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/task_utils.pyi +4 -4
  44. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/utils.pyi +2 -2
  45. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastructures.pyi +3 -3
  46. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/exceptions.pyi +2 -2
  47. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/hf_hub/__init__.pyi +2 -2
  48. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/hf_hub/decorator.pyi +2 -2
  49. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/__init__.pyi +2 -2
  50. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/core.pyi +2 -2
  51. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/exceptions.pyi +2 -2
  52. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/model_storage.pyi +4 -4
  53. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/__init__.pyi +2 -2
  54. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/flowspec_utils.pyi +2 -2
  55. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/general.pyi +2 -2
  56. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/identity_utils.pyi +3 -3
  57. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/__init__.pyi +2 -2
  58. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/base.pyi +2 -2
  59. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/tar.pyi +3 -3
  60. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/tar_utils.pyi +3 -3
  61. metaflow-stubs/mf_extensions/outerbounds/__init__.pyi +2 -2
  62. metaflow-stubs/mf_extensions/outerbounds/plugins/__init__.pyi +2 -2
  63. metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/__init__.pyi +2 -2
  64. metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/injector.pyi +2 -2
  65. metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/__init__.pyi +2 -2
  66. metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/ollama.pyi +2 -2
  67. metaflow-stubs/mf_extensions/outerbounds/plugins/snowflake/__init__.pyi +2 -2
  68. metaflow-stubs/mf_extensions/outerbounds/plugins/snowflake/snowflake.pyi +2 -2
  69. metaflow-stubs/mf_extensions/outerbounds/profilers/__init__.pyi +2 -2
  70. metaflow-stubs/mf_extensions/outerbounds/profilers/gpu.pyi +2 -2
  71. metaflow-stubs/mf_extensions/outerbounds/remote_config.pyi +2 -2
  72. metaflow-stubs/mf_extensions/outerbounds/toplevel/__init__.pyi +2 -2
  73. metaflow-stubs/mf_extensions/outerbounds/toplevel/global_aliases_for_metaflow_package.pyi +2 -2
  74. metaflow-stubs/multicore_utils.pyi +2 -2
  75. metaflow-stubs/parameters.pyi +4 -4
  76. metaflow-stubs/plugins/__init__.pyi +10 -10
  77. metaflow-stubs/plugins/airflow/__init__.pyi +2 -2
  78. metaflow-stubs/plugins/airflow/airflow_utils.pyi +2 -2
  79. metaflow-stubs/plugins/airflow/exception.pyi +2 -2
  80. metaflow-stubs/plugins/airflow/sensors/__init__.pyi +2 -2
  81. metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +2 -2
  82. metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +2 -2
  83. metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +2 -2
  84. metaflow-stubs/plugins/argo/__init__.pyi +2 -2
  85. metaflow-stubs/plugins/argo/argo_client.pyi +3 -3
  86. metaflow-stubs/plugins/argo/argo_events.pyi +2 -2
  87. metaflow-stubs/plugins/argo/argo_workflows.pyi +4 -4
  88. metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +2 -2
  89. metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +4 -4
  90. metaflow-stubs/plugins/argo/argo_workflows_deployer_objects.pyi +7 -5
  91. metaflow-stubs/plugins/aws/__init__.pyi +2 -2
  92. metaflow-stubs/plugins/aws/aws_client.pyi +2 -2
  93. metaflow-stubs/plugins/aws/aws_utils.pyi +2 -2
  94. metaflow-stubs/plugins/aws/batch/__init__.pyi +2 -2
  95. metaflow-stubs/plugins/aws/batch/batch.pyi +2 -2
  96. metaflow-stubs/plugins/aws/batch/batch_client.pyi +2 -2
  97. metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +2 -2
  98. metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +2 -2
  99. metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +4 -4
  100. metaflow-stubs/plugins/aws/step_functions/__init__.pyi +2 -2
  101. metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +2 -2
  102. metaflow-stubs/plugins/aws/step_functions/schedule_decorator.pyi +2 -2
  103. metaflow-stubs/plugins/aws/step_functions/step_functions.pyi +2 -2
  104. metaflow-stubs/plugins/aws/step_functions/step_functions_client.pyi +2 -2
  105. metaflow-stubs/plugins/aws/step_functions/step_functions_deployer.pyi +4 -4
  106. metaflow-stubs/plugins/aws/step_functions/step_functions_deployer_objects.pyi +4 -4
  107. metaflow-stubs/plugins/azure/__init__.pyi +2 -2
  108. metaflow-stubs/plugins/azure/azure_credential.pyi +2 -2
  109. metaflow-stubs/plugins/azure/azure_exceptions.pyi +2 -2
  110. metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +4 -4
  111. metaflow-stubs/plugins/azure/azure_utils.pyi +2 -2
  112. metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +2 -2
  113. metaflow-stubs/plugins/azure/includefile_support.pyi +2 -2
  114. metaflow-stubs/plugins/cards/__init__.pyi +6 -6
  115. metaflow-stubs/plugins/cards/card_client.pyi +3 -3
  116. metaflow-stubs/plugins/cards/card_creator.pyi +2 -2
  117. metaflow-stubs/plugins/cards/card_datastore.pyi +2 -2
  118. metaflow-stubs/plugins/cards/card_decorator.pyi +2 -2
  119. metaflow-stubs/plugins/cards/card_modules/__init__.pyi +2 -2
  120. metaflow-stubs/plugins/cards/card_modules/basic.pyi +3 -3
  121. metaflow-stubs/plugins/cards/card_modules/card.pyi +2 -2
  122. metaflow-stubs/plugins/cards/card_modules/components.pyi +4 -4
  123. metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +2 -2
  124. metaflow-stubs/plugins/cards/card_modules/renderer_tools.pyi +2 -2
  125. metaflow-stubs/plugins/cards/card_modules/test_cards.pyi +2 -2
  126. metaflow-stubs/plugins/cards/card_resolver.pyi +2 -2
  127. metaflow-stubs/plugins/cards/component_serializer.pyi +2 -2
  128. metaflow-stubs/plugins/cards/exception.pyi +2 -2
  129. metaflow-stubs/plugins/catch_decorator.pyi +3 -3
  130. metaflow-stubs/plugins/datatools/__init__.pyi +2 -2
  131. metaflow-stubs/plugins/datatools/local.pyi +2 -2
  132. metaflow-stubs/plugins/datatools/s3/__init__.pyi +2 -2
  133. metaflow-stubs/plugins/datatools/s3/s3.pyi +3 -3
  134. metaflow-stubs/plugins/datatools/s3/s3tail.pyi +2 -2
  135. metaflow-stubs/plugins/datatools/s3/s3util.pyi +2 -2
  136. metaflow-stubs/plugins/debug_logger.pyi +2 -2
  137. metaflow-stubs/plugins/debug_monitor.pyi +2 -2
  138. metaflow-stubs/plugins/environment_decorator.pyi +2 -2
  139. metaflow-stubs/plugins/events_decorator.pyi +2 -2
  140. metaflow-stubs/plugins/frameworks/__init__.pyi +2 -2
  141. metaflow-stubs/plugins/frameworks/pytorch.pyi +2 -2
  142. metaflow-stubs/plugins/gcp/__init__.pyi +2 -2
  143. metaflow-stubs/plugins/gcp/gcp_secret_manager_secrets_provider.pyi +4 -4
  144. metaflow-stubs/plugins/gcp/gs_exceptions.pyi +2 -2
  145. metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +2 -2
  146. metaflow-stubs/plugins/gcp/gs_utils.pyi +2 -2
  147. metaflow-stubs/plugins/gcp/includefile_support.pyi +2 -2
  148. metaflow-stubs/plugins/kubernetes/__init__.pyi +2 -2
  149. metaflow-stubs/plugins/kubernetes/kube_utils.pyi +3 -3
  150. metaflow-stubs/plugins/kubernetes/kubernetes.pyi +2 -2
  151. metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +2 -2
  152. metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +2 -2
  153. metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +2 -2
  154. metaflow-stubs/plugins/kubernetes/spot_monitor_sidecar.pyi +2 -2
  155. metaflow-stubs/plugins/ollama/__init__.pyi +2 -2
  156. metaflow-stubs/plugins/parallel_decorator.pyi +2 -2
  157. metaflow-stubs/plugins/perimeters.pyi +2 -2
  158. metaflow-stubs/plugins/project_decorator.pyi +2 -2
  159. metaflow-stubs/plugins/pypi/__init__.pyi +2 -2
  160. metaflow-stubs/plugins/pypi/conda_decorator.pyi +2 -2
  161. metaflow-stubs/plugins/pypi/conda_environment.pyi +4 -4
  162. metaflow-stubs/plugins/pypi/parsers.pyi +2 -2
  163. metaflow-stubs/plugins/pypi/pypi_decorator.pyi +2 -2
  164. metaflow-stubs/plugins/pypi/pypi_environment.pyi +2 -2
  165. metaflow-stubs/plugins/pypi/utils.pyi +2 -2
  166. metaflow-stubs/plugins/resources_decorator.pyi +2 -2
  167. metaflow-stubs/plugins/retry_decorator.pyi +2 -2
  168. metaflow-stubs/plugins/secrets/__init__.pyi +2 -2
  169. metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +3 -3
  170. metaflow-stubs/plugins/secrets/secrets_decorator.pyi +2 -2
  171. metaflow-stubs/plugins/snowflake/__init__.pyi +2 -2
  172. metaflow-stubs/plugins/storage_executor.pyi +2 -2
  173. metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +3 -3
  174. metaflow-stubs/plugins/timeout_decorator.pyi +3 -3
  175. metaflow-stubs/profilers/__init__.pyi +2 -2
  176. metaflow-stubs/pylint_wrapper.pyi +2 -2
  177. metaflow-stubs/runner/__init__.pyi +2 -2
  178. metaflow-stubs/runner/deployer.pyi +32 -30
  179. metaflow-stubs/runner/deployer_impl.pyi +3 -3
  180. metaflow-stubs/runner/metaflow_runner.pyi +5 -5
  181. metaflow-stubs/runner/nbdeploy.pyi +2 -2
  182. metaflow-stubs/runner/nbrun.pyi +2 -2
  183. metaflow-stubs/runner/subprocess_manager.pyi +2 -2
  184. metaflow-stubs/runner/utils.pyi +3 -3
  185. metaflow-stubs/system/__init__.pyi +2 -2
  186. metaflow-stubs/system/system_logger.pyi +3 -3
  187. metaflow-stubs/system/system_monitor.pyi +2 -2
  188. metaflow-stubs/tagging_util.pyi +2 -2
  189. metaflow-stubs/tuple_util.pyi +2 -2
  190. metaflow-stubs/user_configs/__init__.pyi +2 -2
  191. metaflow-stubs/user_configs/config_decorators.pyi +6 -6
  192. metaflow-stubs/user_configs/config_options.pyi +4 -4
  193. metaflow-stubs/user_configs/config_parameters.pyi +7 -7
  194. {ob_metaflow_stubs-6.0.3.148.dist-info → ob_metaflow_stubs-6.0.3.150.dist-info}/METADATA +1 -1
  195. ob_metaflow_stubs-6.0.3.150.dist-info/RECORD +198 -0
  196. ob_metaflow_stubs-6.0.3.148.dist-info/RECORD +0 -198
  197. {ob_metaflow_stubs-6.0.3.148.dist-info → ob_metaflow_stubs-6.0.3.150.dist-info}/WHEEL +0 -0
  198. {ob_metaflow_stubs-6.0.3.148.dist-info → ob_metaflow_stubs-6.0.3.150.dist-info}/top_level.txt +0 -0
@@ -1,7 +1,7 @@
1
1
  ######################################################################################################
2
2
  # Auto-generated Metaflow stub file #
3
- # MF version: 2.15.3.1+obcheckpoint(0.1.9);ob(v1) #
4
- # Generated on 2025-03-03T22:55:42.139654 #
3
+ # MF version: 2.15.5.1+obcheckpoint(0.1.9);ob(v1) #
4
+ # Generated on 2025-03-13T17:31:16.313988 #
5
5
  ######################################################################################################
6
6
 
7
7
  from __future__ import annotations
@@ -35,17 +35,17 @@ from .user_configs.config_parameters import ConfigValue as ConfigValue
35
35
  from .user_configs.config_parameters import config_expr as config_expr
36
36
  from .user_configs.config_decorators import CustomFlowDecorator as CustomFlowDecorator
37
37
  from .user_configs.config_decorators import CustomStepDecorator as CustomStepDecorator
38
- from . import cards as cards
39
38
  from . import tuple_util as tuple_util
39
+ from . import cards as cards
40
40
  from . import events as events
41
41
  from . import runner as runner
42
42
  from . import plugins as plugins
43
43
  from .mf_extensions.outerbounds.toplevel.global_aliases_for_metaflow_package import S3 as S3
44
44
  from . import includefile as includefile
45
45
  from .includefile import IncludeFile as IncludeFile
46
- from .plugins.pypi.parsers import pyproject_toml_parser as pyproject_toml_parser
47
- from .plugins.pypi.parsers import requirements_txt_parser as requirements_txt_parser
48
46
  from .plugins.pypi.parsers import conda_environment_yml_parser as conda_environment_yml_parser
47
+ from .plugins.pypi.parsers import requirements_txt_parser as requirements_txt_parser
48
+ from .plugins.pypi.parsers import pyproject_toml_parser as pyproject_toml_parser
49
49
  from . import client as client
50
50
  from .client.core import namespace as namespace
51
51
  from .client.core import get_namespace as get_namespace
@@ -149,164 +149,220 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
149
149
  """
150
150
  ...
151
151
 
152
- 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]]]:
152
+ @typing.overload
153
+ 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]]]:
153
154
  """
154
- This decorator is used to run NIM containers in Metaflow tasks as sidecars.
155
-
156
- User code call
157
- -----------
158
- @nim(
159
- models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
160
- backend='managed'
161
- )
162
-
163
- Valid backend options
164
- ---------------------
165
- - 'managed': Outerbounds selects a compute provider based on the model.
155
+ Creates a human-readable report, a Metaflow Card, after this step completes.
166
156
 
167
- Valid model options
168
- ----------------
169
- - 'meta/llama3-8b-instruct': 8B parameter model
170
- - 'meta/llama3-70b-instruct': 70B parameter model
171
- - any model here: https://nvcf.ngc.nvidia.com/functions?filter=nvidia-functions
157
+ Note that you may add multiple `@card` decorators in a step with different parameters.
172
158
 
173
159
 
174
160
  Parameters
175
161
  ----------
176
- models: list[NIM]
177
- List of NIM containers running models in sidecars.
178
- backend: str
179
- Compute provider to run the NIM container.
180
- queue_timeout : int
181
- Time to keep the job in NVCF's queue.
162
+ type : str, default 'default'
163
+ Card type.
164
+ id : str, optional, default None
165
+ If multiple cards are present, use this id to identify this card.
166
+ options : Dict[str, Any], default {}
167
+ Options passed to the card. The contents depend on the card type.
168
+ timeout : int, default 45
169
+ Interrupt reporting if it takes more than this many seconds.
182
170
  """
183
171
  ...
184
172
 
185
- 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]]]:
173
+ @typing.overload
174
+ def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
175
+ ...
176
+
177
+ @typing.overload
178
+ def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
179
+ ...
180
+
181
+ 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):
186
182
  """
187
- This decorator is used to run Ollama APIs as Metaflow task sidecars.
188
-
189
- User code call
190
- -----------
191
- @ollama(
192
- models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
193
- backend='local'
194
- )
195
-
196
- Valid backend options
197
- ---------------------
198
- - 'local': Run as a separate process on the local task machine.
199
- - (TODO) 'managed': Outerbounds hosts and selects compute provider.
200
- - (TODO) 'remote': Spin up separate instance to serve Ollama models.
183
+ Creates a human-readable report, a Metaflow Card, after this step completes.
201
184
 
202
- Valid model options
203
- ----------------
204
- - 'llama3.2'
205
- - 'llama3.3'
206
- - any model here https://ollama.com/search
185
+ Note that you may add multiple `@card` decorators in a step with different parameters.
207
186
 
208
187
 
209
188
  Parameters
210
189
  ----------
211
- models: list[Ollama]
212
- List of Ollama containers running models in sidecars.
213
- backend: str
214
- Determines where and how to run the Ollama process.
190
+ type : str, default 'default'
191
+ Card type.
192
+ id : str, optional, default None
193
+ If multiple cards are present, use this id to identify this card.
194
+ options : Dict[str, Any], default {}
195
+ Options passed to the card. The contents depend on the card type.
196
+ timeout : int, default 45
197
+ Interrupt reporting if it takes more than this many seconds.
215
198
  """
216
199
  ...
217
200
 
218
201
  @typing.overload
219
- def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
202
+ 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]]]:
220
203
  """
221
- Decorator prototype for all step decorators. This function gets specialized
222
- and imported for all decorators types by _import_plugin_decorators().
204
+ Specifies the Conda environment for the step.
205
+
206
+ Information in this decorator will augment any
207
+ attributes set in the `@conda_base` flow-level decorator. Hence,
208
+ you can use `@conda_base` to set packages required by all
209
+ steps and use `@conda` to specify step-specific overrides.
210
+
211
+
212
+ Parameters
213
+ ----------
214
+ packages : Dict[str, str], default {}
215
+ Packages to use for this step. The key is the name of the package
216
+ and the value is the version to use.
217
+ libraries : Dict[str, str], default {}
218
+ Supported for backward compatibility. When used with packages, packages will take precedence.
219
+ python : str, optional, default None
220
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
221
+ that the version used will correspond to the version of the Python interpreter used to start the run.
222
+ disabled : bool, default False
223
+ If set to True, disables @conda.
223
224
  """
224
225
  ...
225
226
 
226
227
  @typing.overload
227
- def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
228
+ def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
228
229
  ...
229
230
 
230
- def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
231
- """
232
- Decorator prototype for all step decorators. This function gets specialized
233
- and imported for all decorators types by _import_plugin_decorators().
234
- """
231
+ @typing.overload
232
+ def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
235
233
  ...
236
234
 
237
- 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]]]:
235
+ 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):
238
236
  """
239
- Decorator that helps cache, version and store models/datasets from huggingface hub.
237
+ Specifies the Conda environment for the step.
238
+
239
+ Information in this decorator will augment any
240
+ attributes set in the `@conda_base` flow-level decorator. Hence,
241
+ you can use `@conda_base` to set packages required by all
242
+ steps and use `@conda` to specify step-specific overrides.
240
243
 
241
244
 
242
245
  Parameters
243
246
  ----------
244
- temp_dir_root : str, optional
245
- The root directory that will hold the temporary directory where objects will be downloaded.
247
+ packages : Dict[str, str], default {}
248
+ Packages to use for this step. The key is the name of the package
249
+ and the value is the version to use.
250
+ libraries : Dict[str, str], default {}
251
+ Supported for backward compatibility. When used with packages, packages will take precedence.
252
+ python : str, optional, default None
253
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
254
+ that the version used will correspond to the version of the Python interpreter used to start the run.
255
+ disabled : bool, default False
256
+ If set to True, disables @conda.
257
+ """
258
+ ...
259
+
260
+ @typing.overload
261
+ 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]]]:
262
+ """
263
+ Enables checkpointing for a step.
246
264
 
247
- load: Union[List[str], List[Tuple[Dict, str]], List[Tuple[str, str]], List[Dict], None]
248
- The list of repos (models/datasets) to load.
249
265
 
250
- Loaded repos can be accessed via `current.huggingface_hub.loaded`. If load is set, then the following happens:
251
266
 
252
- - If repo (model/dataset) is not found in the datastore:
253
- - Downloads the repo from Hugging Face Hub to a temporary directory (or uses specified path) for local access
254
- - Stores it in Metaflow's datastore (s3/gcs/azure etc.) with a unique name based on repo_type/repo_id
255
- - All HF models loaded for a `@step` will be cached separately under flow/step/namespace.
267
+ Parameters
268
+ ----------
269
+ load_policy : str, default: "fresh"
270
+ The policy for loading the checkpoint. The following policies are supported:
271
+ - "eager": Loads the the latest available checkpoint within the namespace.
272
+ With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
273
+ will be loaded at the start of the task.
274
+ - "none": Do not load any checkpoint
275
+ - "fresh": Loads the lastest checkpoint created within the running Task.
276
+ This mode helps loading checkpoints across various retry attempts of the same task.
277
+ With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
278
+ created within the task will be loaded when the task is retries execution on failure.
256
279
 
257
- - If repo is found in the datastore:
258
- - Loads it directly from datastore to local path (can be temporary directory or specified path)
280
+ temp_dir_root : str, default: None
281
+ The root directory under which `current.checkpoint.directory` will be created.
259
282
  """
260
283
  ...
261
284
 
262
285
  @typing.overload
263
- 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]]]:
286
+ def checkpoint(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
287
+ ...
288
+
289
+ @typing.overload
290
+ def checkpoint(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
291
+ ...
292
+
293
+ 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):
264
294
  """
265
- Specifies that the step will success under all circumstances.
295
+ Enables checkpointing for a step.
266
296
 
267
- The decorator will create an optional artifact, specified by `var`, which
268
- contains the exception raised. You can use it to detect the presence
269
- of errors, indicating that all happy-path artifacts produced by the step
270
- are missing.
271
297
 
272
298
 
273
299
  Parameters
274
300
  ----------
275
- var : str, optional, default None
276
- Name of the artifact in which to store the caught exception.
277
- If not specified, the exception is not stored.
278
- print_exception : bool, default True
279
- Determines whether or not the exception is printed to
280
- stdout when caught.
301
+ load_policy : str, default: "fresh"
302
+ The policy for loading the checkpoint. The following policies are supported:
303
+ - "eager": Loads the the latest available checkpoint within the namespace.
304
+ With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
305
+ will be loaded at the start of the task.
306
+ - "none": Do not load any checkpoint
307
+ - "fresh": Loads the lastest checkpoint created within the running Task.
308
+ This mode helps loading checkpoints across various retry attempts of the same task.
309
+ With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
310
+ created within the task will be loaded when the task is retries execution on failure.
311
+
312
+ temp_dir_root : str, default: None
313
+ The root directory under which `current.checkpoint.directory` will be created.
281
314
  """
282
315
  ...
283
316
 
284
317
  @typing.overload
285
- def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
318
+ def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
319
+ """
320
+ Decorator prototype for all step decorators. This function gets specialized
321
+ and imported for all decorators types by _import_plugin_decorators().
322
+ """
286
323
  ...
287
324
 
288
325
  @typing.overload
289
- def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
326
+ def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
290
327
  ...
291
328
 
292
- 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):
329
+ def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
293
330
  """
294
- Specifies that the step will success under all circumstances.
331
+ Decorator prototype for all step decorators. This function gets specialized
332
+ and imported for all decorators types by _import_plugin_decorators().
333
+ """
334
+ ...
335
+
336
+ 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]]]:
337
+ """
338
+ This decorator is used to run NIM containers in Metaflow tasks as sidecars.
295
339
 
296
- The decorator will create an optional artifact, specified by `var`, which
297
- contains the exception raised. You can use it to detect the presence
298
- of errors, indicating that all happy-path artifacts produced by the step
299
- are missing.
340
+ User code call
341
+ -----------
342
+ @nim(
343
+ models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
344
+ backend='managed'
345
+ )
346
+
347
+ Valid backend options
348
+ ---------------------
349
+ - 'managed': Outerbounds selects a compute provider based on the model.
350
+
351
+ Valid model options
352
+ ----------------
353
+ - 'meta/llama3-8b-instruct': 8B parameter model
354
+ - 'meta/llama3-70b-instruct': 70B parameter model
355
+ - any model here: https://nvcf.ngc.nvidia.com/functions?filter=nvidia-functions
300
356
 
301
357
 
302
358
  Parameters
303
359
  ----------
304
- var : str, optional, default None
305
- Name of the artifact in which to store the caught exception.
306
- If not specified, the exception is not stored.
307
- print_exception : bool, default True
308
- Determines whether or not the exception is printed to
309
- stdout when caught.
360
+ models: list[NIM]
361
+ List of NIM containers running models in sidecars.
362
+ backend: str
363
+ Compute provider to run the NIM container.
364
+ queue_timeout : int
365
+ Time to keep the job in NVCF's queue.
310
366
  """
311
367
  ...
312
368
 
@@ -365,272 +421,130 @@ def retry(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
365
421
  """
366
422
  ...
367
423
 
368
- def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: typing.Optional[str] = None, image_pull_policy: str = 'KUBERNETES_IMAGE_PULL_POLICY', service_account: str = 'METAFLOW_KUBERNETES_SERVICE_ACCOUNT', secrets: typing.Optional[typing.List[str]] = None, node_selector: typing.Union[typing.Dict[str, str], str, None] = None, namespace: str = 'METAFLOW_KUBERNETES_NAMESPACE', gpu: typing.Optional[int] = None, gpu_vendor: str = 'KUBERNETES_GPU_VENDOR', tolerations: typing.List[str] = [], labels: typing.Dict[str, str] = 'METAFLOW_KUBERNETES_LABELS', annotations: typing.Dict[str, str] = 'METAFLOW_KUBERNETES_ANNOTATIONS', use_tmpfs: bool = False, tmpfs_tempdir: bool = True, tmpfs_size: typing.Optional[int] = None, tmpfs_path: typing.Optional[str] = '/metaflow_temp', persistent_volume_claims: typing.Optional[typing.Dict[str, str]] = None, shared_memory: typing.Optional[int] = None, port: typing.Optional[int] = None, compute_pool: typing.Optional[str] = None, hostname_resolution_timeout: int = 600, qos: str = 'Burstable') -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
369
- """
370
- Specifies that this step should execute on Kubernetes.
371
-
372
-
373
- Parameters
374
- ----------
375
- cpu : int, default 1
376
- Number of CPUs required for this step. If `@resources` is
377
- also present, the maximum value from all decorators is used.
378
- memory : int, default 4096
379
- Memory size (in MB) required for this step. If
380
- `@resources` is also present, the maximum value from all decorators is
381
- used.
382
- disk : int, default 10240
383
- Disk size (in MB) required for this step. If
384
- `@resources` is also present, the maximum value from all decorators is
385
- used.
386
- image : str, optional, default None
387
- Docker image to use when launching on Kubernetes. If not specified, and
388
- METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
389
- not, a default Docker image mapping to the current version of Python is used.
390
- image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
391
- If given, the imagePullPolicy to be applied to the Docker image of the step.
392
- service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
393
- Kubernetes service account to use when launching pod in Kubernetes.
394
- secrets : List[str], optional, default None
395
- Kubernetes secrets to use when launching pod in Kubernetes. These
396
- secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
397
- in Metaflow configuration.
398
- node_selector: Union[Dict[str,str], str], optional, default None
399
- Kubernetes node selector(s) to apply to the pod running the task.
400
- Can be passed in as a comma separated string of values e.g.
401
- 'kubernetes.io/os=linux,kubernetes.io/arch=amd64' or as a dictionary
402
- {'kubernetes.io/os': 'linux', 'kubernetes.io/arch': 'amd64'}
403
- namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
404
- Kubernetes namespace to use when launching pod in Kubernetes.
405
- gpu : int, optional, default None
406
- Number of GPUs required for this step. A value of zero implies that
407
- the scheduled node should not have GPUs.
408
- gpu_vendor : str, default KUBERNETES_GPU_VENDOR
409
- The vendor of the GPUs to be used for this step.
410
- tolerations : List[str], default []
411
- The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
412
- Kubernetes tolerations to use when launching pod in Kubernetes.
413
- labels: Dict[str, str], default: METAFLOW_KUBERNETES_LABELS
414
- Kubernetes labels to use when launching pod in Kubernetes.
415
- annotations: Dict[str, str], default: METAFLOW_KUBERNETES_ANNOTATIONS
416
- Kubernetes annotations to use when launching pod in Kubernetes.
417
- use_tmpfs : bool, default False
418
- This enables an explicit tmpfs mount for this step.
419
- tmpfs_tempdir : bool, default True
420
- sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
421
- tmpfs_size : int, optional, default: None
422
- The value for the size (in MiB) of the tmpfs mount for this step.
423
- This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
424
- memory allocated for this step.
425
- tmpfs_path : str, optional, default /metaflow_temp
426
- Path to tmpfs mount for this step.
427
- persistent_volume_claims : Dict[str, str], optional, default None
428
- A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
429
- volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
430
- shared_memory: int, optional
431
- Shared memory size (in MiB) required for this step
432
- port: int, optional
433
- Port number to specify in the Kubernetes job object
434
- compute_pool : str, optional, default None
435
- Compute pool to be used for for this step.
436
- If not specified, any accessible compute pool within the perimeter is used.
437
- hostname_resolution_timeout: int, default 10 * 60
438
- Timeout in seconds for the workers tasks in the gang scheduled cluster to resolve the hostname of control task.
439
- Only applicable when @parallel is used.
440
- qos: str, default: Burstable
441
- Quality of Service class to assign to the pod. Supported values are: Guaranteed, Burstable, BestEffort
442
- """
443
- ...
444
-
445
424
  @typing.overload
446
- 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]]]:
425
+ 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]]]:
447
426
  """
448
- Specifies the Conda environment for the step.
427
+ Specifies the PyPI packages for the step.
449
428
 
450
429
  Information in this decorator will augment any
451
- attributes set in the `@conda_base` flow-level decorator. Hence,
452
- you can use `@conda_base` to set packages required by all
453
- steps and use `@conda` to specify step-specific overrides.
430
+ attributes set in the `@pyi_base` flow-level decorator. Hence,
431
+ you can use `@pypi_base` to set packages required by all
432
+ steps and use `@pypi` to specify step-specific overrides.
454
433
 
455
434
 
456
435
  Parameters
457
436
  ----------
458
- packages : Dict[str, str], default {}
437
+ packages : Dict[str, str], default: {}
459
438
  Packages to use for this step. The key is the name of the package
460
439
  and the value is the version to use.
461
- libraries : Dict[str, str], default {}
462
- Supported for backward compatibility. When used with packages, packages will take precedence.
463
- python : str, optional, default None
440
+ python : str, optional, default: None
464
441
  Version of Python to use, e.g. '3.7.4'. A default value of None implies
465
442
  that the version used will correspond to the version of the Python interpreter used to start the run.
466
- disabled : bool, default False
467
- If set to True, disables @conda.
468
443
  """
469
444
  ...
470
445
 
471
446
  @typing.overload
472
- def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
447
+ def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
473
448
  ...
474
449
 
475
450
  @typing.overload
476
- def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
451
+ def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
477
452
  ...
478
453
 
479
- 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):
454
+ 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):
480
455
  """
481
- Specifies the Conda environment for the step.
456
+ Specifies the PyPI packages for the step.
482
457
 
483
458
  Information in this decorator will augment any
484
- attributes set in the `@conda_base` flow-level decorator. Hence,
485
- you can use `@conda_base` to set packages required by all
486
- steps and use `@conda` to specify step-specific overrides.
459
+ attributes set in the `@pyi_base` flow-level decorator. Hence,
460
+ you can use `@pypi_base` to set packages required by all
461
+ steps and use `@pypi` to specify step-specific overrides.
487
462
 
488
463
 
489
464
  Parameters
490
465
  ----------
491
- packages : Dict[str, str], default {}
466
+ packages : Dict[str, str], default: {}
492
467
  Packages to use for this step. The key is the name of the package
493
468
  and the value is the version to use.
494
- libraries : Dict[str, str], default {}
495
- Supported for backward compatibility. When used with packages, packages will take precedence.
496
- python : str, optional, default None
469
+ python : str, optional, default: None
497
470
  Version of Python to use, e.g. '3.7.4'. A default value of None implies
498
471
  that the version used will correspond to the version of the Python interpreter used to start the run.
499
- disabled : bool, default False
500
- If set to True, disables @conda.
501
- """
502
- ...
503
-
504
- 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]]]:
505
- """
506
- Specifies that this step should execute on DGX cloud.
507
-
508
-
509
- Parameters
510
- ----------
511
- gpu : int
512
- Number of GPUs to use.
513
- gpu_type : str
514
- Type of Nvidia GPU to use.
515
- queue_timeout : int
516
- Time to keep the job in NVCF's queue.
517
472
  """
518
473
  ...
519
474
 
520
475
  @typing.overload
521
- 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]]]:
476
+ 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]]]:
522
477
  """
523
- Creates a human-readable report, a Metaflow Card, after this step completes.
478
+ Specifies that the step will success under all circumstances.
524
479
 
525
- Note that you may add multiple `@card` decorators in a step with different parameters.
480
+ The decorator will create an optional artifact, specified by `var`, which
481
+ contains the exception raised. You can use it to detect the presence
482
+ of errors, indicating that all happy-path artifacts produced by the step
483
+ are missing.
526
484
 
527
485
 
528
486
  Parameters
529
487
  ----------
530
- type : str, default 'default'
531
- Card type.
532
- id : str, optional, default None
533
- If multiple cards are present, use this id to identify this card.
534
- options : Dict[str, Any], default {}
535
- Options passed to the card. The contents depend on the card type.
536
- timeout : int, default 45
537
- Interrupt reporting if it takes more than this many seconds.
488
+ var : str, optional, default None
489
+ Name of the artifact in which to store the caught exception.
490
+ If not specified, the exception is not stored.
491
+ print_exception : bool, default True
492
+ Determines whether or not the exception is printed to
493
+ stdout when caught.
538
494
  """
539
495
  ...
540
496
 
541
497
  @typing.overload
542
- def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
498
+ def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
543
499
  ...
544
500
 
545
501
  @typing.overload
546
- def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
502
+ def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
547
503
  ...
548
504
 
549
- 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):
505
+ 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):
550
506
  """
551
- Creates a human-readable report, a Metaflow Card, after this step completes.
507
+ Specifies that the step will success under all circumstances.
552
508
 
553
- Note that you may add multiple `@card` decorators in a step with different parameters.
509
+ The decorator will create an optional artifact, specified by `var`, which
510
+ contains the exception raised. You can use it to detect the presence
511
+ of errors, indicating that all happy-path artifacts produced by the step
512
+ are missing.
554
513
 
555
514
 
556
515
  Parameters
557
516
  ----------
558
- type : str, default 'default'
559
- Card type.
560
- id : str, optional, default None
561
- If multiple cards are present, use this id to identify this card.
562
- options : Dict[str, Any], default {}
563
- Options passed to the card. The contents depend on the card type.
564
- timeout : int, default 45
565
- Interrupt reporting if it takes more than this many seconds.
566
- """
567
- ...
568
-
569
- @typing.overload
570
- def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
571
- """
572
- Internal decorator to support Fast bakery
573
- """
574
- ...
575
-
576
- @typing.overload
577
- def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
578
- ...
579
-
580
- def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
581
- """
582
- Internal decorator to support Fast bakery
517
+ var : str, optional, default None
518
+ Name of the artifact in which to store the caught exception.
519
+ If not specified, the exception is not stored.
520
+ print_exception : bool, default True
521
+ Determines whether or not the exception is printed to
522
+ stdout when caught.
583
523
  """
584
524
  ...
585
525
 
586
- @typing.overload
587
- 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]]]:
526
+ 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]]]:
588
527
  """
589
- Specifies the PyPI packages for the step.
590
-
591
- Information in this decorator will augment any
592
- attributes set in the `@pyi_base` flow-level decorator. Hence,
593
- you can use `@pypi_base` to set packages required by all
594
- steps and use `@pypi` to specify step-specific overrides.
528
+ Decorator that helps cache, version and store models/datasets from huggingface hub.
595
529
 
596
530
 
597
531
  Parameters
598
532
  ----------
599
- packages : Dict[str, str], default: {}
600
- Packages to use for this step. The key is the name of the package
601
- and the value is the version to use.
602
- python : str, optional, default: None
603
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
604
- that the version used will correspond to the version of the Python interpreter used to start the run.
605
- """
606
- ...
607
-
608
- @typing.overload
609
- def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
610
- ...
611
-
612
- @typing.overload
613
- def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
614
- ...
615
-
616
- 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):
617
- """
618
- Specifies the PyPI packages for the step.
533
+ temp_dir_root : str, optional
534
+ The root directory that will hold the temporary directory where objects will be downloaded.
619
535
 
620
- Information in this decorator will augment any
621
- attributes set in the `@pyi_base` flow-level decorator. Hence,
622
- you can use `@pypi_base` to set packages required by all
623
- steps and use `@pypi` to specify step-specific overrides.
536
+ load: Union[List[str], List[Tuple[Dict, str]], List[Tuple[str, str]], List[Dict], None]
537
+ The list of repos (models/datasets) to load.
624
538
 
539
+ Loaded repos can be accessed via `current.huggingface_hub.loaded`. If load is set, then the following happens:
625
540
 
626
- Parameters
627
- ----------
628
- packages : Dict[str, str], default: {}
629
- Packages to use for this step. The key is the name of the package
630
- and the value is the version to use.
631
- python : str, optional, default: None
632
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
633
- that the version used will correspond to the version of the Python interpreter used to start the run.
541
+ - If repo (model/dataset) is not found in the datastore:
542
+ - Downloads the repo from Hugging Face Hub to a temporary directory (or uses specified path) for local access
543
+ - Stores it in Metaflow's datastore (s3/gcs/azure etc.) with a unique name based on repo_type/repo_id
544
+ - All HF models loaded for a `@step` will be cached separately under flow/step/namespace.
545
+
546
+ - If repo is found in the datastore:
547
+ - Loads it directly from datastore to local path (can be temporary directory or specified path)
634
548
  """
635
549
  ...
636
550
 
@@ -726,119 +640,148 @@ def secrets(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None],
726
640
  """
727
641
  ...
728
642
 
729
- @typing.overload
730
- 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]]]:
643
+ 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]]]:
731
644
  """
732
- Specifies a timeout for your step.
733
-
734
- This decorator is useful if this step may hang indefinitely.
735
-
736
- This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
737
- A timeout is considered to be an exception thrown by the step. It will cause the step to be
738
- retried if needed and the exception will be caught by the `@catch` decorator, if present.
739
-
740
- Note that all the values specified in parameters are added together so if you specify
741
- 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
645
+ Specifies that this step should execute on DGX cloud.
742
646
 
743
647
 
744
648
  Parameters
745
649
  ----------
746
- seconds : int, default 0
747
- Number of seconds to wait prior to timing out.
748
- minutes : int, default 0
749
- Number of minutes to wait prior to timing out.
750
- hours : int, default 0
751
- Number of hours to wait prior to timing out.
650
+ gpu : int
651
+ Number of GPUs to use.
652
+ gpu_type : str
653
+ Type of Nvidia GPU to use.
654
+ queue_timeout : int
655
+ Time to keep the job in NVCF's queue.
752
656
  """
753
657
  ...
754
658
 
755
- @typing.overload
756
- def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
757
- ...
758
-
759
- @typing.overload
760
- def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
761
- ...
762
-
763
- 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):
659
+ 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]]]:
764
660
  """
765
- Specifies a timeout for your step.
661
+ This decorator is used to run Ollama APIs as Metaflow task sidecars.
766
662
 
767
- This decorator is useful if this step may hang indefinitely.
663
+ User code call
664
+ -----------
665
+ @ollama(
666
+ models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
667
+ backend='local'
668
+ )
768
669
 
769
- This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
770
- A timeout is considered to be an exception thrown by the step. It will cause the step to be
771
- retried if needed and the exception will be caught by the `@catch` decorator, if present.
670
+ Valid backend options
671
+ ---------------------
672
+ - 'local': Run as a separate process on the local task machine.
673
+ - (TODO) 'managed': Outerbounds hosts and selects compute provider.
674
+ - (TODO) 'remote': Spin up separate instance to serve Ollama models.
772
675
 
773
- Note that all the values specified in parameters are added together so if you specify
774
- 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
676
+ Valid model options
677
+ ----------------
678
+ - 'llama3.2'
679
+ - 'llama3.3'
680
+ - any model here https://ollama.com/search
775
681
 
776
682
 
777
683
  Parameters
778
684
  ----------
779
- seconds : int, default 0
780
- Number of seconds to wait prior to timing out.
781
- minutes : int, default 0
782
- Number of minutes to wait prior to timing out.
783
- hours : int, default 0
784
- Number of hours to wait prior to timing out.
685
+ models: list[Ollama]
686
+ List of Ollama containers running models in sidecars.
687
+ backend: str
688
+ Determines where and how to run the Ollama process.
785
689
  """
786
690
  ...
787
691
 
788
692
  @typing.overload
789
- 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]]]:
693
+ 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]]]:
790
694
  """
791
- Enables checkpointing for a step.
695
+ Specifies the resources needed when executing this step.
792
696
 
697
+ Use `@resources` to specify the resource requirements
698
+ independently of the specific compute layer (`@batch`, `@kubernetes`).
699
+
700
+ You can choose the compute layer on the command line by executing e.g.
701
+ ```
702
+ python myflow.py run --with batch
703
+ ```
704
+ or
705
+ ```
706
+ python myflow.py run --with kubernetes
707
+ ```
708
+ which executes the flow on the desired system using the
709
+ requirements specified in `@resources`.
793
710
 
794
711
 
795
712
  Parameters
796
713
  ----------
797
- load_policy : str, default: "fresh"
798
- The policy for loading the checkpoint. The following policies are supported:
799
- - "eager": Loads the the latest available checkpoint within the namespace.
800
- With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
801
- will be loaded at the start of the task.
802
- - "none": Do not load any checkpoint
803
- - "fresh": Loads the lastest checkpoint created within the running Task.
804
- This mode helps loading checkpoints across various retry attempts of the same task.
805
- With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
806
- created within the task will be loaded when the task is retries execution on failure.
807
-
808
- temp_dir_root : str, default: None
809
- The root directory under which `current.checkpoint.directory` will be created.
714
+ cpu : int, default 1
715
+ Number of CPUs required for this step.
716
+ gpu : int, optional, default None
717
+ Number of GPUs required for this step.
718
+ disk : int, optional, default None
719
+ Disk size (in MB) required for this step. Only applies on Kubernetes.
720
+ memory : int, default 4096
721
+ Memory size (in MB) required for this step.
722
+ shared_memory : int, optional, default None
723
+ The value for the size (in MiB) of the /dev/shm volume for this step.
724
+ This parameter maps to the `--shm-size` option in Docker.
810
725
  """
811
726
  ...
812
727
 
813
728
  @typing.overload
814
- def checkpoint(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
729
+ def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
815
730
  ...
816
731
 
817
732
  @typing.overload
818
- def checkpoint(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
733
+ def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
819
734
  ...
820
735
 
821
- 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):
736
+ 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):
822
737
  """
823
- Enables checkpointing for a step.
738
+ Specifies the resources needed when executing this step.
824
739
 
740
+ Use `@resources` to specify the resource requirements
741
+ independently of the specific compute layer (`@batch`, `@kubernetes`).
742
+
743
+ You can choose the compute layer on the command line by executing e.g.
744
+ ```
745
+ python myflow.py run --with batch
746
+ ```
747
+ or
748
+ ```
749
+ python myflow.py run --with kubernetes
750
+ ```
751
+ which executes the flow on the desired system using the
752
+ requirements specified in `@resources`.
825
753
 
826
754
 
827
755
  Parameters
828
756
  ----------
829
- load_policy : str, default: "fresh"
830
- The policy for loading the checkpoint. The following policies are supported:
831
- - "eager": Loads the the latest available checkpoint within the namespace.
832
- With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
833
- will be loaded at the start of the task.
834
- - "none": Do not load any checkpoint
835
- - "fresh": Loads the lastest checkpoint created within the running Task.
836
- This mode helps loading checkpoints across various retry attempts of the same task.
837
- With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
838
- created within the task will be loaded when the task is retries execution on failure.
839
-
840
- temp_dir_root : str, default: None
841
- The root directory under which `current.checkpoint.directory` will be created.
757
+ cpu : int, default 1
758
+ Number of CPUs required for this step.
759
+ gpu : int, optional, default None
760
+ Number of GPUs required for this step.
761
+ disk : int, optional, default None
762
+ Disk size (in MB) required for this step. Only applies on Kubernetes.
763
+ memory : int, default 4096
764
+ Memory size (in MB) required for this step.
765
+ shared_memory : int, optional, default None
766
+ The value for the size (in MiB) of the /dev/shm volume for this step.
767
+ This parameter maps to the `--shm-size` option in Docker.
768
+ """
769
+ ...
770
+
771
+ @typing.overload
772
+ def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
773
+ """
774
+ Internal decorator to support Fast bakery
775
+ """
776
+ ...
777
+
778
+ @typing.overload
779
+ def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
780
+ ...
781
+
782
+ def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
783
+ """
784
+ Internal decorator to support Fast bakery
842
785
  """
843
786
  ...
844
787
 
@@ -876,81 +819,222 @@ def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], Non
876
819
  ...
877
820
 
878
821
  @typing.overload
879
- 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]]]:
822
+ 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]]]:
880
823
  """
881
- Specifies the resources needed when executing this step.
824
+ Specifies a timeout for your step.
882
825
 
883
- Use `@resources` to specify the resource requirements
884
- independently of the specific compute layer (`@batch`, `@kubernetes`).
826
+ This decorator is useful if this step may hang indefinitely.
885
827
 
886
- You can choose the compute layer on the command line by executing e.g.
887
- ```
888
- python myflow.py run --with batch
889
- ```
890
- or
891
- ```
892
- python myflow.py run --with kubernetes
893
- ```
894
- which executes the flow on the desired system using the
895
- requirements specified in `@resources`.
828
+ This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
829
+ A timeout is considered to be an exception thrown by the step. It will cause the step to be
830
+ retried if needed and the exception will be caught by the `@catch` decorator, if present.
831
+
832
+ Note that all the values specified in parameters are added together so if you specify
833
+ 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
834
+
835
+
836
+ Parameters
837
+ ----------
838
+ seconds : int, default 0
839
+ Number of seconds to wait prior to timing out.
840
+ minutes : int, default 0
841
+ Number of minutes to wait prior to timing out.
842
+ hours : int, default 0
843
+ Number of hours to wait prior to timing out.
844
+ """
845
+ ...
846
+
847
+ @typing.overload
848
+ def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
849
+ ...
850
+
851
+ @typing.overload
852
+ def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
853
+ ...
854
+
855
+ 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):
856
+ """
857
+ Specifies a timeout for your step.
858
+
859
+ This decorator is useful if this step may hang indefinitely.
860
+
861
+ This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
862
+ A timeout is considered to be an exception thrown by the step. It will cause the step to be
863
+ retried if needed and the exception will be caught by the `@catch` decorator, if present.
864
+
865
+ Note that all the values specified in parameters are added together so if you specify
866
+ 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
867
+
868
+
869
+ Parameters
870
+ ----------
871
+ seconds : int, default 0
872
+ Number of seconds to wait prior to timing out.
873
+ minutes : int, default 0
874
+ Number of minutes to wait prior to timing out.
875
+ hours : int, default 0
876
+ Number of hours to wait prior to timing out.
877
+ """
878
+ ...
879
+
880
+ def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: typing.Optional[str] = None, image_pull_policy: str = 'KUBERNETES_IMAGE_PULL_POLICY', service_account: str = 'METAFLOW_KUBERNETES_SERVICE_ACCOUNT', secrets: typing.Optional[typing.List[str]] = None, node_selector: typing.Union[typing.Dict[str, str], str, None] = None, namespace: str = 'METAFLOW_KUBERNETES_NAMESPACE', gpu: typing.Optional[int] = None, gpu_vendor: str = 'KUBERNETES_GPU_VENDOR', tolerations: typing.List[str] = [], labels: typing.Dict[str, str] = 'METAFLOW_KUBERNETES_LABELS', annotations: typing.Dict[str, str] = 'METAFLOW_KUBERNETES_ANNOTATIONS', use_tmpfs: bool = False, tmpfs_tempdir: bool = True, tmpfs_size: typing.Optional[int] = None, tmpfs_path: typing.Optional[str] = '/metaflow_temp', persistent_volume_claims: typing.Optional[typing.Dict[str, str]] = None, shared_memory: typing.Optional[int] = None, port: typing.Optional[int] = None, compute_pool: typing.Optional[str] = None, hostname_resolution_timeout: int = 600, qos: str = 'Burstable') -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
881
+ """
882
+ Specifies that this step should execute on Kubernetes.
896
883
 
897
884
 
898
885
  Parameters
899
886
  ----------
900
887
  cpu : int, default 1
901
- Number of CPUs required for this step.
902
- gpu : int, optional, default None
903
- Number of GPUs required for this step.
904
- disk : int, optional, default None
905
- Disk size (in MB) required for this step. Only applies on Kubernetes.
888
+ Number of CPUs required for this step. If `@resources` is
889
+ also present, the maximum value from all decorators is used.
906
890
  memory : int, default 4096
907
- Memory size (in MB) required for this step.
908
- shared_memory : int, optional, default None
909
- The value for the size (in MiB) of the /dev/shm volume for this step.
910
- This parameter maps to the `--shm-size` option in Docker.
891
+ Memory size (in MB) required for this step. If
892
+ `@resources` is also present, the maximum value from all decorators is
893
+ used.
894
+ disk : int, default 10240
895
+ Disk size (in MB) required for this step. If
896
+ `@resources` is also present, the maximum value from all decorators is
897
+ used.
898
+ image : str, optional, default None
899
+ Docker image to use when launching on Kubernetes. If not specified, and
900
+ METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
901
+ not, a default Docker image mapping to the current version of Python is used.
902
+ image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
903
+ If given, the imagePullPolicy to be applied to the Docker image of the step.
904
+ service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
905
+ Kubernetes service account to use when launching pod in Kubernetes.
906
+ secrets : List[str], optional, default None
907
+ Kubernetes secrets to use when launching pod in Kubernetes. These
908
+ secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
909
+ in Metaflow configuration.
910
+ node_selector: Union[Dict[str,str], str], optional, default None
911
+ Kubernetes node selector(s) to apply to the pod running the task.
912
+ Can be passed in as a comma separated string of values e.g.
913
+ 'kubernetes.io/os=linux,kubernetes.io/arch=amd64' or as a dictionary
914
+ {'kubernetes.io/os': 'linux', 'kubernetes.io/arch': 'amd64'}
915
+ namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
916
+ Kubernetes namespace to use when launching pod in Kubernetes.
917
+ gpu : int, optional, default None
918
+ Number of GPUs required for this step. A value of zero implies that
919
+ the scheduled node should not have GPUs.
920
+ gpu_vendor : str, default KUBERNETES_GPU_VENDOR
921
+ The vendor of the GPUs to be used for this step.
922
+ tolerations : List[str], default []
923
+ The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
924
+ Kubernetes tolerations to use when launching pod in Kubernetes.
925
+ labels: Dict[str, str], default: METAFLOW_KUBERNETES_LABELS
926
+ Kubernetes labels to use when launching pod in Kubernetes.
927
+ annotations: Dict[str, str], default: METAFLOW_KUBERNETES_ANNOTATIONS
928
+ Kubernetes annotations to use when launching pod in Kubernetes.
929
+ use_tmpfs : bool, default False
930
+ This enables an explicit tmpfs mount for this step.
931
+ tmpfs_tempdir : bool, default True
932
+ sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
933
+ tmpfs_size : int, optional, default: None
934
+ The value for the size (in MiB) of the tmpfs mount for this step.
935
+ This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
936
+ memory allocated for this step.
937
+ tmpfs_path : str, optional, default /metaflow_temp
938
+ Path to tmpfs mount for this step.
939
+ persistent_volume_claims : Dict[str, str], optional, default None
940
+ A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
941
+ volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
942
+ shared_memory: int, optional
943
+ Shared memory size (in MiB) required for this step
944
+ port: int, optional
945
+ Port number to specify in the Kubernetes job object
946
+ compute_pool : str, optional, default None
947
+ Compute pool to be used for for this step.
948
+ If not specified, any accessible compute pool within the perimeter is used.
949
+ hostname_resolution_timeout: int, default 10 * 60
950
+ Timeout in seconds for the workers tasks in the gang scheduled cluster to resolve the hostname of control task.
951
+ Only applicable when @parallel is used.
952
+ qos: str, default: Burstable
953
+ Quality of Service class to assign to the pod. Supported values are: Guaranteed, Burstable, BestEffort
954
+ """
955
+ ...
956
+
957
+ 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]]:
958
+ """
959
+ 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)
960
+ before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
961
+ and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
962
+ added as a flow decorators. Adding more than one decorator will ensure that `start` step
963
+ starts only after all sensors finish.
964
+
965
+
966
+ Parameters
967
+ ----------
968
+ timeout : int
969
+ Time, in seconds before the task times out and fails. (Default: 3600)
970
+ poke_interval : int
971
+ Time in seconds that the job should wait in between each try. (Default: 60)
972
+ mode : str
973
+ How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
974
+ exponential_backoff : bool
975
+ allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
976
+ pool : str
977
+ the slot pool this task should run in,
978
+ slot pools are a way to limit concurrency for certain tasks. (Default:None)
979
+ soft_fail : bool
980
+ Set to true to mark the task as SKIPPED on failure. (Default: False)
981
+ name : str
982
+ Name of the sensor on Airflow
983
+ description : str
984
+ Description of sensor in the Airflow UI
985
+ bucket_key : Union[str, List[str]]
986
+ The key(s) being waited on. Supports full s3:// style url or relative path from root level.
987
+ When it's specified as a full s3:// url, please leave `bucket_name` as None
988
+ bucket_name : str
989
+ Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
990
+ When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
991
+ wildcard_match : bool
992
+ whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
993
+ aws_conn_id : str
994
+ a reference to the s3 connection on Airflow. (Default: None)
995
+ verify : bool
996
+ Whether or not to verify SSL certificates for S3 connection. (Default: None)
911
997
  """
912
998
  ...
913
999
 
914
1000
  @typing.overload
915
- def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1001
+ def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1002
+ """
1003
+ Specifies the PyPI packages for all steps of the flow.
1004
+
1005
+ Use `@pypi_base` to set common packages required by all
1006
+ steps and use `@pypi` to specify step-specific overrides.
1007
+
1008
+ Parameters
1009
+ ----------
1010
+ packages : Dict[str, str], default: {}
1011
+ Packages to use for this flow. The key is the name of the package
1012
+ and the value is the version to use.
1013
+ python : str, optional, default: None
1014
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1015
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1016
+ """
916
1017
  ...
917
1018
 
918
1019
  @typing.overload
919
- def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1020
+ def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
920
1021
  ...
921
1022
 
922
- 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):
1023
+ def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
923
1024
  """
924
- Specifies the resources needed when executing this step.
925
-
926
- Use `@resources` to specify the resource requirements
927
- independently of the specific compute layer (`@batch`, `@kubernetes`).
928
-
929
- You can choose the compute layer on the command line by executing e.g.
930
- ```
931
- python myflow.py run --with batch
932
- ```
933
- or
934
- ```
935
- python myflow.py run --with kubernetes
936
- ```
937
- which executes the flow on the desired system using the
938
- requirements specified in `@resources`.
1025
+ Specifies the PyPI packages for all steps of the flow.
939
1026
 
1027
+ Use `@pypi_base` to set common packages required by all
1028
+ steps and use `@pypi` to specify step-specific overrides.
940
1029
 
941
1030
  Parameters
942
1031
  ----------
943
- cpu : int, default 1
944
- Number of CPUs required for this step.
945
- gpu : int, optional, default None
946
- Number of GPUs required for this step.
947
- disk : int, optional, default None
948
- Disk size (in MB) required for this step. Only applies on Kubernetes.
949
- memory : int, default 4096
950
- Memory size (in MB) required for this step.
951
- shared_memory : int, optional, default None
952
- The value for the size (in MiB) of the /dev/shm volume for this step.
953
- This parameter maps to the `--shm-size` option in Docker.
1032
+ packages : Dict[str, str], default: {}
1033
+ Packages to use for this flow. The key is the name of the package
1034
+ and the value is the version to use.
1035
+ python : str, optional, default: None
1036
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1037
+ that the version used will correspond to the version of the Python interpreter used to start the run.
954
1038
  """
955
1039
  ...
956
1040
 
@@ -1055,46 +1139,54 @@ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *
1055
1139
  """
1056
1140
  ...
1057
1141
 
1058
- 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]]:
1142
+ @typing.overload
1143
+ 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]]:
1059
1144
  """
1060
- 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)
1061
- before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
1062
- and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
1063
- added as a flow decorators. Adding more than one decorator will ensure that `start` step
1064
- starts only after all sensors finish.
1145
+ Specifies the Conda environment for all steps of the flow.
1146
+
1147
+ Use `@conda_base` to set common libraries required by all
1148
+ steps and use `@conda` to specify step-specific additions.
1065
1149
 
1066
1150
 
1067
1151
  Parameters
1068
1152
  ----------
1069
- timeout : int
1070
- Time, in seconds before the task times out and fails. (Default: 3600)
1071
- poke_interval : int
1072
- Time in seconds that the job should wait in between each try. (Default: 60)
1073
- mode : str
1074
- How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1075
- exponential_backoff : bool
1076
- allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1077
- pool : str
1078
- the slot pool this task should run in,
1079
- slot pools are a way to limit concurrency for certain tasks. (Default:None)
1080
- soft_fail : bool
1081
- Set to true to mark the task as SKIPPED on failure. (Default: False)
1082
- name : str
1083
- Name of the sensor on Airflow
1084
- description : str
1085
- Description of sensor in the Airflow UI
1086
- bucket_key : Union[str, List[str]]
1087
- The key(s) being waited on. Supports full s3:// style url or relative path from root level.
1088
- When it's specified as a full s3:// url, please leave `bucket_name` as None
1089
- bucket_name : str
1090
- Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
1091
- When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
1092
- wildcard_match : bool
1093
- whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
1094
- aws_conn_id : str
1095
- a reference to the s3 connection on Airflow. (Default: None)
1096
- verify : bool
1097
- Whether or not to verify SSL certificates for S3 connection. (Default: None)
1153
+ packages : Dict[str, str], default {}
1154
+ Packages to use for this flow. The key is the name of the package
1155
+ and the value is the version to use.
1156
+ libraries : Dict[str, str], default {}
1157
+ Supported for backward compatibility. When used with packages, packages will take precedence.
1158
+ python : str, optional, default None
1159
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1160
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1161
+ disabled : bool, default False
1162
+ If set to True, disables Conda.
1163
+ """
1164
+ ...
1165
+
1166
+ @typing.overload
1167
+ def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1168
+ ...
1169
+
1170
+ 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):
1171
+ """
1172
+ Specifies the Conda environment for all steps of the flow.
1173
+
1174
+ Use `@conda_base` to set common libraries required by all
1175
+ steps and use `@conda` to specify step-specific additions.
1176
+
1177
+
1178
+ Parameters
1179
+ ----------
1180
+ packages : Dict[str, str], default {}
1181
+ Packages to use for this flow. The key is the name of the package
1182
+ and the value is the version to use.
1183
+ libraries : Dict[str, str], default {}
1184
+ Supported for backward compatibility. When used with packages, packages will take precedence.
1185
+ python : str, optional, default None
1186
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1187
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1188
+ disabled : bool, default False
1189
+ If set to True, disables Conda.
1098
1190
  """
1099
1191
  ...
1100
1192
 
@@ -1141,82 +1233,6 @@ def airflow_external_task_sensor(*, timeout: int, poke_interval: int, mode: str,
1141
1233
  """
1142
1234
  ...
1143
1235
 
1144
- def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1145
- """
1146
- Specifies what flows belong to the same project.
1147
-
1148
- A project-specific namespace is created for all flows that
1149
- use the same `@project(name)`.
1150
-
1151
-
1152
- Parameters
1153
- ----------
1154
- name : str
1155
- Project name. Make sure that the name is unique amongst all
1156
- projects that use the same production scheduler. The name may
1157
- contain only lowercase alphanumeric characters and underscores.
1158
-
1159
- branch : Optional[str], default None
1160
- The branch to use. If not specified, the branch is set to
1161
- `user.<username>` unless `production` is set to `True`. This can
1162
- also be set on the command line using `--branch` as a top-level option.
1163
- It is an error to specify `branch` in the decorator and on the command line.
1164
-
1165
- production : bool, default False
1166
- Whether or not the branch is the production branch. This can also be set on the
1167
- command line using `--production` as a top-level option. It is an error to specify
1168
- `production` in the decorator and on the command line.
1169
- The project branch name will be:
1170
- - if `branch` is specified:
1171
- - if `production` is True: `prod.<branch>`
1172
- - if `production` is False: `test.<branch>`
1173
- - if `branch` is not specified:
1174
- - if `production` is True: `prod`
1175
- - if `production` is False: `user.<username>`
1176
- """
1177
- ...
1178
-
1179
- @typing.overload
1180
- def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1181
- """
1182
- Specifies the PyPI packages for all steps of the flow.
1183
-
1184
- Use `@pypi_base` to set common packages required by all
1185
- steps and use `@pypi` to specify step-specific overrides.
1186
-
1187
- Parameters
1188
- ----------
1189
- packages : Dict[str, str], default: {}
1190
- Packages to use for this flow. The key is the name of the package
1191
- and the value is the version to use.
1192
- python : str, optional, default: None
1193
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1194
- that the version used will correspond to the version of the Python interpreter used to start the run.
1195
- """
1196
- ...
1197
-
1198
- @typing.overload
1199
- def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1200
- ...
1201
-
1202
- def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
1203
- """
1204
- Specifies the PyPI packages for all steps of the flow.
1205
-
1206
- Use `@pypi_base` to set common packages required by all
1207
- steps and use `@pypi` to specify step-specific overrides.
1208
-
1209
- Parameters
1210
- ----------
1211
- packages : Dict[str, str], default: {}
1212
- Packages to use for this flow. The key is the name of the package
1213
- and the value is the version to use.
1214
- python : str, optional, default: None
1215
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1216
- that the version used will correspond to the version of the Python interpreter used to start the run.
1217
- """
1218
- ...
1219
-
1220
1236
  @typing.overload
1221
1237
  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]]:
1222
1238
  """
@@ -1361,54 +1377,38 @@ def schedule(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, hourly:
1361
1377
  """
1362
1378
  ...
1363
1379
 
1364
- @typing.overload
1365
- 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]]:
1380
+ def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1366
1381
  """
1367
- Specifies the Conda environment for all steps of the flow.
1382
+ Specifies what flows belong to the same project.
1368
1383
 
1369
- Use `@conda_base` to set common libraries required by all
1370
- steps and use `@conda` to specify step-specific additions.
1384
+ A project-specific namespace is created for all flows that
1385
+ use the same `@project(name)`.
1371
1386
 
1372
1387
 
1373
1388
  Parameters
1374
1389
  ----------
1375
- packages : Dict[str, str], default {}
1376
- Packages to use for this flow. The key is the name of the package
1377
- and the value is the version to use.
1378
- libraries : Dict[str, str], default {}
1379
- Supported for backward compatibility. When used with packages, packages will take precedence.
1380
- python : str, optional, default None
1381
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1382
- that the version used will correspond to the version of the Python interpreter used to start the run.
1383
- disabled : bool, default False
1384
- If set to True, disables Conda.
1385
- """
1386
- ...
1387
-
1388
- @typing.overload
1389
- def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1390
- ...
1391
-
1392
- 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):
1393
- """
1394
- Specifies the Conda environment for all steps of the flow.
1395
-
1396
- Use `@conda_base` to set common libraries required by all
1397
- steps and use `@conda` to specify step-specific additions.
1390
+ name : str
1391
+ Project name. Make sure that the name is unique amongst all
1392
+ projects that use the same production scheduler. The name may
1393
+ contain only lowercase alphanumeric characters and underscores.
1398
1394
 
1395
+ branch : Optional[str], default None
1396
+ The branch to use. If not specified, the branch is set to
1397
+ `user.<username>` unless `production` is set to `True`. This can
1398
+ also be set on the command line using `--branch` as a top-level option.
1399
+ It is an error to specify `branch` in the decorator and on the command line.
1399
1400
 
1400
- Parameters
1401
- ----------
1402
- packages : Dict[str, str], default {}
1403
- Packages to use for this flow. The key is the name of the package
1404
- and the value is the version to use.
1405
- libraries : Dict[str, str], default {}
1406
- Supported for backward compatibility. When used with packages, packages will take precedence.
1407
- python : str, optional, default None
1408
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1409
- that the version used will correspond to the version of the Python interpreter used to start the run.
1410
- disabled : bool, default False
1411
- If set to True, disables Conda.
1401
+ production : bool, default False
1402
+ Whether or not the branch is the production branch. This can also be set on the
1403
+ command line using `--production` as a top-level option. It is an error to specify
1404
+ `production` in the decorator and on the command line.
1405
+ The project branch name will be:
1406
+ - if `branch` is specified:
1407
+ - if `production` is True: `prod.<branch>`
1408
+ - if `production` is False: `test.<branch>`
1409
+ - if `branch` is not specified:
1410
+ - if `production` is True: `prod`
1411
+ - if `production` is False: `user.<username>`
1412
1412
  """
1413
1413
  ...
1414
1414