ob-metaflow-stubs 6.0.3.180rc3__py2.py3-none-any.whl → 6.0.3.180rc4__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 (220) hide show
  1. metaflow-stubs/__init__.pyi +637 -637
  2. metaflow-stubs/cards.pyi +1 -1
  3. metaflow-stubs/cli.pyi +1 -1
  4. metaflow-stubs/cli_components/__init__.pyi +1 -1
  5. metaflow-stubs/cli_components/utils.pyi +1 -1
  6. metaflow-stubs/client/__init__.pyi +1 -1
  7. metaflow-stubs/client/core.pyi +4 -4
  8. metaflow-stubs/client/filecache.pyi +1 -1
  9. metaflow-stubs/events.pyi +2 -2
  10. metaflow-stubs/exception.pyi +1 -1
  11. metaflow-stubs/flowspec.pyi +3 -3
  12. metaflow-stubs/generated_for.txt +1 -1
  13. metaflow-stubs/includefile.pyi +2 -2
  14. metaflow-stubs/info_file.pyi +1 -1
  15. metaflow-stubs/metadata_provider/__init__.pyi +1 -1
  16. metaflow-stubs/metadata_provider/heartbeat.pyi +1 -1
  17. metaflow-stubs/metadata_provider/metadata.pyi +1 -1
  18. metaflow-stubs/metadata_provider/util.pyi +1 -1
  19. metaflow-stubs/metaflow_config.pyi +1 -1
  20. metaflow-stubs/metaflow_current.pyi +91 -91
  21. metaflow-stubs/metaflow_git.pyi +1 -1
  22. metaflow-stubs/mf_extensions/__init__.pyi +1 -1
  23. metaflow-stubs/mf_extensions/obcheckpoint/__init__.pyi +1 -1
  24. metaflow-stubs/mf_extensions/obcheckpoint/plugins/__init__.pyi +1 -1
  25. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/__init__.pyi +1 -1
  26. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/__init__.pyi +1 -1
  27. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/async_cards.pyi +2 -2
  28. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/deco_injection_mixin.pyi +1 -1
  29. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/extra_components.pyi +1 -1
  30. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/__init__.pyi +1 -1
  31. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/__init__.pyi +1 -1
  32. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/checkpoint_lister.pyi +3 -3
  33. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/lineage_card.pyi +1 -1
  34. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/checkpoint_storage.pyi +3 -3
  35. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/constructors.pyi +1 -1
  36. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/core.pyi +3 -3
  37. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/decorator.pyi +4 -4
  38. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/exceptions.pyi +1 -1
  39. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/final_api.pyi +2 -2
  40. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/lineage.pyi +1 -1
  41. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/__init__.pyi +1 -1
  42. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/context.pyi +1 -1
  43. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/core.pyi +1 -1
  44. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/decorator.pyi +1 -1
  45. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/exceptions.pyi +1 -1
  46. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/task_utils.pyi +1 -1
  47. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/utils.pyi +1 -1
  48. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastructures.pyi +1 -1
  49. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/exceptions.pyi +1 -1
  50. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/hf_hub/__init__.pyi +1 -1
  51. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/hf_hub/decorator.pyi +2 -2
  52. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/__init__.pyi +1 -1
  53. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/core.pyi +2 -2
  54. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/exceptions.pyi +1 -1
  55. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/model_storage.pyi +2 -2
  56. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/__init__.pyi +1 -1
  57. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/flowspec_utils.pyi +1 -1
  58. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/general.pyi +1 -1
  59. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/identity_utils.pyi +1 -1
  60. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/__init__.pyi +1 -1
  61. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/base.pyi +1 -1
  62. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/tar.pyi +1 -1
  63. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/tar_utils.pyi +1 -1
  64. metaflow-stubs/mf_extensions/outerbounds/__init__.pyi +1 -1
  65. metaflow-stubs/mf_extensions/outerbounds/plugins/__init__.pyi +1 -1
  66. metaflow-stubs/mf_extensions/outerbounds/plugins/aws/__init__.pyi +1 -1
  67. metaflow-stubs/mf_extensions/outerbounds/plugins/aws/assume_role_decorator.pyi +1 -1
  68. metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/__init__.pyi +1 -1
  69. metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/async_cards.pyi +2 -2
  70. metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/injector.pyi +1 -1
  71. metaflow-stubs/mf_extensions/outerbounds/plugins/checkpoint_datastores/__init__.pyi +1 -1
  72. metaflow-stubs/mf_extensions/outerbounds/plugins/checkpoint_datastores/coreweave.pyi +1 -1
  73. metaflow-stubs/mf_extensions/outerbounds/plugins/checkpoint_datastores/nebius.pyi +1 -1
  74. metaflow-stubs/mf_extensions/outerbounds/plugins/fast_bakery/__init__.pyi +1 -1
  75. metaflow-stubs/mf_extensions/outerbounds/plugins/fast_bakery/baker.pyi +2 -2
  76. metaflow-stubs/mf_extensions/outerbounds/plugins/fast_bakery/docker_environment.pyi +1 -1
  77. metaflow-stubs/mf_extensions/outerbounds/plugins/fast_bakery/fast_bakery.pyi +1 -1
  78. metaflow-stubs/mf_extensions/outerbounds/plugins/kubernetes/__init__.pyi +1 -1
  79. metaflow-stubs/mf_extensions/outerbounds/plugins/kubernetes/pod_killer.pyi +1 -1
  80. metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/__init__.pyi +1 -1
  81. metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/constants.pyi +1 -1
  82. metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/exceptions.pyi +1 -1
  83. metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/ollama.pyi +1 -1
  84. metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/status_card.pyi +1 -1
  85. metaflow-stubs/mf_extensions/outerbounds/plugins/snowflake/__init__.pyi +1 -1
  86. metaflow-stubs/mf_extensions/outerbounds/plugins/snowflake/snowflake.pyi +1 -1
  87. metaflow-stubs/mf_extensions/outerbounds/profilers/__init__.pyi +1 -1
  88. metaflow-stubs/mf_extensions/outerbounds/profilers/gpu.pyi +1 -1
  89. metaflow-stubs/mf_extensions/outerbounds/remote_config.pyi +1 -1
  90. metaflow-stubs/mf_extensions/outerbounds/toplevel/__init__.pyi +1 -1
  91. metaflow-stubs/mf_extensions/outerbounds/toplevel/global_aliases_for_metaflow_package.pyi +1 -1
  92. metaflow-stubs/multicore_utils.pyi +1 -1
  93. metaflow-stubs/ob_internal.pyi +1 -1
  94. metaflow-stubs/parameters.pyi +2 -2
  95. metaflow-stubs/plugins/__init__.pyi +9 -9
  96. metaflow-stubs/plugins/airflow/__init__.pyi +1 -1
  97. metaflow-stubs/plugins/airflow/airflow_utils.pyi +1 -1
  98. metaflow-stubs/plugins/airflow/exception.pyi +1 -1
  99. metaflow-stubs/plugins/airflow/sensors/__init__.pyi +1 -1
  100. metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +1 -1
  101. metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +1 -1
  102. metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +1 -1
  103. metaflow-stubs/plugins/argo/__init__.pyi +1 -1
  104. metaflow-stubs/plugins/argo/argo_client.pyi +1 -1
  105. metaflow-stubs/plugins/argo/argo_events.pyi +1 -1
  106. metaflow-stubs/plugins/argo/argo_workflows.pyi +1 -1
  107. metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +2 -2
  108. metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +2 -2
  109. metaflow-stubs/plugins/argo/argo_workflows_deployer_objects.pyi +1 -1
  110. metaflow-stubs/plugins/aws/__init__.pyi +1 -1
  111. metaflow-stubs/plugins/aws/aws_client.pyi +1 -1
  112. metaflow-stubs/plugins/aws/aws_utils.pyi +1 -1
  113. metaflow-stubs/plugins/aws/batch/__init__.pyi +1 -1
  114. metaflow-stubs/plugins/aws/batch/batch.pyi +1 -1
  115. metaflow-stubs/plugins/aws/batch/batch_client.pyi +1 -1
  116. metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +1 -1
  117. metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +1 -1
  118. metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +2 -2
  119. metaflow-stubs/plugins/aws/step_functions/__init__.pyi +1 -1
  120. metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +1 -1
  121. metaflow-stubs/plugins/aws/step_functions/schedule_decorator.pyi +1 -1
  122. metaflow-stubs/plugins/aws/step_functions/step_functions.pyi +1 -1
  123. metaflow-stubs/plugins/aws/step_functions/step_functions_client.pyi +1 -1
  124. metaflow-stubs/plugins/aws/step_functions/step_functions_deployer.pyi +2 -2
  125. metaflow-stubs/plugins/aws/step_functions/step_functions_deployer_objects.pyi +1 -1
  126. metaflow-stubs/plugins/azure/__init__.pyi +1 -1
  127. metaflow-stubs/plugins/azure/azure_credential.pyi +1 -1
  128. metaflow-stubs/plugins/azure/azure_exceptions.pyi +1 -1
  129. metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +2 -2
  130. metaflow-stubs/plugins/azure/azure_utils.pyi +1 -1
  131. metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +1 -1
  132. metaflow-stubs/plugins/azure/includefile_support.pyi +1 -1
  133. metaflow-stubs/plugins/cards/__init__.pyi +1 -1
  134. metaflow-stubs/plugins/cards/card_client.pyi +2 -2
  135. metaflow-stubs/plugins/cards/card_creator.pyi +1 -1
  136. metaflow-stubs/plugins/cards/card_datastore.pyi +1 -1
  137. metaflow-stubs/plugins/cards/card_decorator.pyi +1 -1
  138. metaflow-stubs/plugins/cards/card_modules/__init__.pyi +1 -1
  139. metaflow-stubs/plugins/cards/card_modules/basic.pyi +2 -2
  140. metaflow-stubs/plugins/cards/card_modules/card.pyi +1 -1
  141. metaflow-stubs/plugins/cards/card_modules/components.pyi +1 -1
  142. metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +1 -1
  143. metaflow-stubs/plugins/cards/card_modules/renderer_tools.pyi +1 -1
  144. metaflow-stubs/plugins/cards/card_modules/test_cards.pyi +1 -1
  145. metaflow-stubs/plugins/cards/card_resolver.pyi +1 -1
  146. metaflow-stubs/plugins/cards/component_serializer.pyi +1 -1
  147. metaflow-stubs/plugins/cards/exception.pyi +1 -1
  148. metaflow-stubs/plugins/catch_decorator.pyi +1 -1
  149. metaflow-stubs/plugins/datatools/__init__.pyi +1 -1
  150. metaflow-stubs/plugins/datatools/local.pyi +1 -1
  151. metaflow-stubs/plugins/datatools/s3/__init__.pyi +1 -1
  152. metaflow-stubs/plugins/datatools/s3/s3.pyi +2 -2
  153. metaflow-stubs/plugins/datatools/s3/s3tail.pyi +1 -1
  154. metaflow-stubs/plugins/datatools/s3/s3util.pyi +1 -1
  155. metaflow-stubs/plugins/debug_logger.pyi +1 -1
  156. metaflow-stubs/plugins/debug_monitor.pyi +1 -1
  157. metaflow-stubs/plugins/environment_decorator.pyi +1 -1
  158. metaflow-stubs/plugins/events_decorator.pyi +1 -1
  159. metaflow-stubs/plugins/frameworks/__init__.pyi +1 -1
  160. metaflow-stubs/plugins/frameworks/pytorch.pyi +1 -1
  161. metaflow-stubs/plugins/gcp/__init__.pyi +1 -1
  162. metaflow-stubs/plugins/gcp/gcp_secret_manager_secrets_provider.pyi +2 -2
  163. metaflow-stubs/plugins/gcp/gs_exceptions.pyi +1 -1
  164. metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +1 -1
  165. metaflow-stubs/plugins/gcp/gs_utils.pyi +1 -1
  166. metaflow-stubs/plugins/gcp/includefile_support.pyi +1 -1
  167. metaflow-stubs/plugins/kubernetes/__init__.pyi +1 -1
  168. metaflow-stubs/plugins/kubernetes/kube_utils.pyi +1 -1
  169. metaflow-stubs/plugins/kubernetes/kubernetes.pyi +1 -1
  170. metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +1 -1
  171. metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +1 -1
  172. metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +1 -1
  173. metaflow-stubs/plugins/kubernetes/spot_monitor_sidecar.pyi +1 -1
  174. metaflow-stubs/plugins/ollama/__init__.pyi +1 -1
  175. metaflow-stubs/plugins/parallel_decorator.pyi +1 -1
  176. metaflow-stubs/plugins/perimeters.pyi +1 -1
  177. metaflow-stubs/plugins/project_decorator.pyi +1 -1
  178. metaflow-stubs/plugins/pypi/__init__.pyi +1 -1
  179. metaflow-stubs/plugins/pypi/conda_decorator.pyi +1 -1
  180. metaflow-stubs/plugins/pypi/conda_environment.pyi +3 -3
  181. metaflow-stubs/plugins/pypi/parsers.pyi +1 -1
  182. metaflow-stubs/plugins/pypi/pypi_decorator.pyi +1 -1
  183. metaflow-stubs/plugins/pypi/pypi_environment.pyi +1 -1
  184. metaflow-stubs/plugins/pypi/utils.pyi +1 -1
  185. metaflow-stubs/plugins/resources_decorator.pyi +1 -1
  186. metaflow-stubs/plugins/retry_decorator.pyi +1 -1
  187. metaflow-stubs/plugins/secrets/__init__.pyi +1 -1
  188. metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +2 -2
  189. metaflow-stubs/plugins/secrets/secrets_decorator.pyi +1 -1
  190. metaflow-stubs/plugins/snowflake/__init__.pyi +1 -1
  191. metaflow-stubs/plugins/storage_executor.pyi +1 -1
  192. metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +2 -2
  193. metaflow-stubs/plugins/timeout_decorator.pyi +1 -1
  194. metaflow-stubs/plugins/torchtune/__init__.pyi +1 -1
  195. metaflow-stubs/plugins/uv/__init__.pyi +1 -1
  196. metaflow-stubs/plugins/uv/uv_environment.pyi +1 -1
  197. metaflow-stubs/profilers/__init__.pyi +1 -1
  198. metaflow-stubs/pylint_wrapper.pyi +1 -1
  199. metaflow-stubs/runner/__init__.pyi +1 -1
  200. metaflow-stubs/runner/deployer.pyi +27 -27
  201. metaflow-stubs/runner/deployer_impl.pyi +1 -1
  202. metaflow-stubs/runner/metaflow_runner.pyi +1 -1
  203. metaflow-stubs/runner/nbdeploy.pyi +1 -1
  204. metaflow-stubs/runner/nbrun.pyi +1 -1
  205. metaflow-stubs/runner/subprocess_manager.pyi +1 -1
  206. metaflow-stubs/runner/utils.pyi +1 -1
  207. metaflow-stubs/system/__init__.pyi +1 -1
  208. metaflow-stubs/system/system_logger.pyi +2 -2
  209. metaflow-stubs/system/system_monitor.pyi +1 -1
  210. metaflow-stubs/tagging_util.pyi +1 -1
  211. metaflow-stubs/tuple_util.pyi +1 -1
  212. metaflow-stubs/user_configs/__init__.pyi +1 -1
  213. metaflow-stubs/user_configs/config_decorators.pyi +5 -5
  214. metaflow-stubs/user_configs/config_options.pyi +1 -1
  215. metaflow-stubs/user_configs/config_parameters.pyi +5 -5
  216. {ob_metaflow_stubs-6.0.3.180rc3.dist-info → ob_metaflow_stubs-6.0.3.180rc4.dist-info}/METADATA +1 -1
  217. ob_metaflow_stubs-6.0.3.180rc4.dist-info/RECORD +220 -0
  218. ob_metaflow_stubs-6.0.3.180rc3.dist-info/RECORD +0 -220
  219. {ob_metaflow_stubs-6.0.3.180rc3.dist-info → ob_metaflow_stubs-6.0.3.180rc4.dist-info}/WHEEL +0 -0
  220. {ob_metaflow_stubs-6.0.3.180rc3.dist-info → ob_metaflow_stubs-6.0.3.180rc4.dist-info}/top_level.txt +0 -0
@@ -1,7 +1,7 @@
1
1
  ######################################################################################################
2
2
  # Auto-generated Metaflow stub file #
3
3
  # MF version: 2.15.17.1+obcheckpoint(0.2.1);ob(v1) #
4
- # Generated on 2025-06-17T10:52:54.470733 #
4
+ # Generated on 2025-06-17T18:51:01.431227 #
5
5
  ######################################################################################################
6
6
 
7
7
  from __future__ import annotations
@@ -36,8 +36,8 @@ 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
38
  from . import cards as cards
39
- from . import tuple_util as tuple_util
40
39
  from . import metaflow_git as metaflow_git
40
+ from . import tuple_util as tuple_util
41
41
  from . import events as events
42
42
  from . import runner as runner
43
43
  from . import plugins as plugins
@@ -198,6 +198,142 @@ def ollama(*, models: list, backend: str, force_pull: bool, cache_update_policy:
198
198
  """
199
199
  ...
200
200
 
201
+ @typing.overload
202
+ 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]]]:
203
+ """
204
+ Specifies the PyPI packages for the step.
205
+
206
+ Information in this decorator will augment any
207
+ attributes set in the `@pyi_base` flow-level decorator. Hence,
208
+ you can use `@pypi_base` to set packages required by all
209
+ steps and use `@pypi` 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
+ python : str, optional, default: None
218
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
219
+ that the version used will correspond to the version of the Python interpreter used to start the run.
220
+ """
221
+ ...
222
+
223
+ @typing.overload
224
+ def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
225
+ ...
226
+
227
+ @typing.overload
228
+ def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
229
+ ...
230
+
231
+ 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):
232
+ """
233
+ Specifies the PyPI packages for the step.
234
+
235
+ Information in this decorator will augment any
236
+ attributes set in the `@pyi_base` flow-level decorator. Hence,
237
+ you can use `@pypi_base` to set packages required by all
238
+ steps and use `@pypi` to specify step-specific overrides.
239
+
240
+
241
+ Parameters
242
+ ----------
243
+ packages : Dict[str, str], default: {}
244
+ Packages to use for this step. The key is the name of the package
245
+ and the value is the version to use.
246
+ python : str, optional, default: None
247
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
248
+ that the version used will correspond to the version of the Python interpreter used to start the run.
249
+ """
250
+ ...
251
+
252
+ 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]]]:
253
+ """
254
+ Specifies that this step should execute on DGX cloud.
255
+
256
+
257
+ Parameters
258
+ ----------
259
+ gpu : int
260
+ Number of GPUs to use.
261
+ gpu_type : str
262
+ Type of Nvidia GPU to use.
263
+ queue_timeout : int
264
+ Time to keep the job in NVCF's queue.
265
+ """
266
+ ...
267
+
268
+ def nvct(*, gpu: int, gpu_type: str) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
269
+ """
270
+ Specifies that this step should execute on DGX cloud.
271
+
272
+
273
+ Parameters
274
+ ----------
275
+ gpu : int
276
+ Number of GPUs to use.
277
+ gpu_type : str
278
+ Type of Nvidia GPU to use.
279
+ """
280
+ ...
281
+
282
+ @typing.overload
283
+ def retry(*, times: int = 3, minutes_between_retries: int = 2) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
284
+ """
285
+ Specifies the number of times the task corresponding
286
+ to a step needs to be retried.
287
+
288
+ This decorator is useful for handling transient errors, such as networking issues.
289
+ If your task contains operations that can't be retried safely, e.g. database updates,
290
+ it is advisable to annotate it with `@retry(times=0)`.
291
+
292
+ This can be used in conjunction with the `@catch` decorator. The `@catch`
293
+ decorator will execute a no-op task after all retries have been exhausted,
294
+ ensuring that the flow execution can continue.
295
+
296
+
297
+ Parameters
298
+ ----------
299
+ times : int, default 3
300
+ Number of times to retry this task.
301
+ minutes_between_retries : int, default 2
302
+ Number of minutes between retries.
303
+ """
304
+ ...
305
+
306
+ @typing.overload
307
+ def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
308
+ ...
309
+
310
+ @typing.overload
311
+ def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
312
+ ...
313
+
314
+ def retry(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, times: int = 3, minutes_between_retries: int = 2):
315
+ """
316
+ Specifies the number of times the task corresponding
317
+ to a step needs to be retried.
318
+
319
+ This decorator is useful for handling transient errors, such as networking issues.
320
+ If your task contains operations that can't be retried safely, e.g. database updates,
321
+ it is advisable to annotate it with `@retry(times=0)`.
322
+
323
+ This can be used in conjunction with the `@catch` decorator. The `@catch`
324
+ decorator will execute a no-op task after all retries have been exhausted,
325
+ ensuring that the flow execution can continue.
326
+
327
+
328
+ Parameters
329
+ ----------
330
+ times : int, default 3
331
+ Number of times to retry this task.
332
+ minutes_between_retries : int, default 2
333
+ Number of minutes between retries.
334
+ """
335
+ ...
336
+
201
337
  @typing.overload
202
338
  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]]]:
203
339
  """
@@ -249,6 +385,41 @@ def catch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
249
385
  """
250
386
  ...
251
387
 
388
+ @typing.overload
389
+ def secrets(*, sources: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = []) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
390
+ """
391
+ Specifies secrets to be retrieved and injected as environment variables prior to
392
+ the execution of a step.
393
+
394
+
395
+ Parameters
396
+ ----------
397
+ sources : List[Union[str, Dict[str, Any]]], default: []
398
+ List of secret specs, defining how the secrets are to be retrieved
399
+ """
400
+ ...
401
+
402
+ @typing.overload
403
+ def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
404
+ ...
405
+
406
+ @typing.overload
407
+ def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
408
+ ...
409
+
410
+ def secrets(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, sources: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = []):
411
+ """
412
+ Specifies secrets to be retrieved and injected as environment variables prior to
413
+ the execution of a step.
414
+
415
+
416
+ Parameters
417
+ ----------
418
+ sources : List[Union[str, Dict[str, Any]]], default: []
419
+ List of secret specs, defining how the secrets are to be retrieved
420
+ """
421
+ ...
422
+
252
423
  @typing.overload
253
424
  def model(*, load: typing.Union[typing.List[str], str, typing.List[typing.Tuple[str, typing.Optional[str]]]] = None, temp_dir_root: str = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
254
425
  """
@@ -306,200 +477,107 @@ def model(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
306
477
  """
307
478
  ...
308
479
 
309
- @typing.overload
310
- def environment(*, vars: typing.Dict[str, str] = {}) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
480
+ 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]]]:
311
481
  """
312
- Specifies environment variables to be set prior to the execution of a step.
482
+ Decorator that helps cache, version and store models/datasets from huggingface hub.
313
483
 
314
484
 
315
485
  Parameters
316
486
  ----------
317
- vars : Dict[str, str], default {}
318
- Dictionary of environment variables to set.
319
- """
320
- ...
321
-
322
- @typing.overload
323
- def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
324
- ...
325
-
326
- @typing.overload
327
- def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
328
- ...
329
-
330
- def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
331
- """
332
- Specifies environment variables to be set prior to the execution of a step.
487
+ temp_dir_root : str, optional
488
+ The root directory that will hold the temporary directory where objects will be downloaded.
333
489
 
490
+ load: Union[List[str], List[Tuple[Dict, str]], List[Tuple[str, str]], List[Dict], None]
491
+ The list of repos (models/datasets) to load.
334
492
 
335
- Parameters
336
- ----------
337
- vars : Dict[str, str], default {}
338
- Dictionary of environment variables to set.
493
+ Loaded repos can be accessed via `current.huggingface_hub.loaded`. If load is set, then the following happens:
494
+
495
+ - If repo (model/dataset) is not found in the datastore:
496
+ - Downloads the repo from Hugging Face Hub to a temporary directory (or uses specified path) for local access
497
+ - Stores it in Metaflow's datastore (s3/gcs/azure etc.) with a unique name based on repo_type/repo_id
498
+ - All HF models loaded for a `@step` will be cached separately under flow/step/namespace.
499
+
500
+ - If repo is found in the datastore:
501
+ - Loads it directly from datastore to local path (can be temporary directory or specified path)
339
502
  """
340
503
  ...
341
504
 
342
505
  @typing.overload
343
- 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]]]:
506
+ 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]]]:
344
507
  """
345
- Specifies the PyPI packages for the step.
508
+ Specifies the resources needed when executing this step.
346
509
 
347
- Information in this decorator will augment any
348
- attributes set in the `@pyi_base` flow-level decorator. Hence,
349
- you can use `@pypi_base` to set packages required by all
350
- steps and use `@pypi` to specify step-specific overrides.
510
+ Use `@resources` to specify the resource requirements
511
+ independently of the specific compute layer (`@batch`, `@kubernetes`).
512
+
513
+ You can choose the compute layer on the command line by executing e.g.
514
+ ```
515
+ python myflow.py run --with batch
516
+ ```
517
+ or
518
+ ```
519
+ python myflow.py run --with kubernetes
520
+ ```
521
+ which executes the flow on the desired system using the
522
+ requirements specified in `@resources`.
351
523
 
352
524
 
353
525
  Parameters
354
526
  ----------
355
- packages : Dict[str, str], default: {}
356
- Packages to use for this step. The key is the name of the package
357
- and the value is the version to use.
358
- python : str, optional, default: None
359
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
360
- that the version used will correspond to the version of the Python interpreter used to start the run.
527
+ cpu : int, default 1
528
+ Number of CPUs required for this step.
529
+ gpu : int, optional, default None
530
+ Number of GPUs required for this step.
531
+ disk : int, optional, default None
532
+ Disk size (in MB) required for this step. Only applies on Kubernetes.
533
+ memory : int, default 4096
534
+ Memory size (in MB) required for this step.
535
+ shared_memory : int, optional, default None
536
+ The value for the size (in MiB) of the /dev/shm volume for this step.
537
+ This parameter maps to the `--shm-size` option in Docker.
361
538
  """
362
539
  ...
363
540
 
364
541
  @typing.overload
365
- def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
542
+ def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
366
543
  ...
367
544
 
368
545
  @typing.overload
369
- def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
546
+ def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
370
547
  ...
371
548
 
372
- 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):
549
+ 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):
373
550
  """
374
- Specifies the PyPI packages for the step.
375
-
376
- Information in this decorator will augment any
377
- attributes set in the `@pyi_base` flow-level decorator. Hence,
378
- you can use `@pypi_base` to set packages required by all
379
- steps and use `@pypi` to specify step-specific overrides.
380
-
381
-
382
- Parameters
383
- ----------
384
- packages : Dict[str, str], default: {}
385
- Packages to use for this step. The key is the name of the package
386
- and the value is the version to use.
387
- python : str, optional, default: None
388
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
389
- that the version used will correspond to the version of the Python interpreter used to start the run.
390
- """
391
- ...
392
-
393
- @typing.overload
394
- 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]]]:
395
- """
396
- Specifies a timeout for your step.
397
-
398
- This decorator is useful if this step may hang indefinitely.
399
-
400
- This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
401
- A timeout is considered to be an exception thrown by the step. It will cause the step to be
402
- retried if needed and the exception will be caught by the `@catch` decorator, if present.
403
-
404
- Note that all the values specified in parameters are added together so if you specify
405
- 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
406
-
407
-
408
- Parameters
409
- ----------
410
- seconds : int, default 0
411
- Number of seconds to wait prior to timing out.
412
- minutes : int, default 0
413
- Number of minutes to wait prior to timing out.
414
- hours : int, default 0
415
- Number of hours to wait prior to timing out.
416
- """
417
- ...
418
-
419
- @typing.overload
420
- def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
421
- ...
422
-
423
- @typing.overload
424
- def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
425
- ...
426
-
427
- 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):
428
- """
429
- Specifies a timeout for your step.
430
-
431
- This decorator is useful if this step may hang indefinitely.
432
-
433
- This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
434
- A timeout is considered to be an exception thrown by the step. It will cause the step to be
435
- retried if needed and the exception will be caught by the `@catch` decorator, if present.
436
-
437
- Note that all the values specified in parameters are added together so if you specify
438
- 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
439
-
440
-
441
- Parameters
442
- ----------
443
- seconds : int, default 0
444
- Number of seconds to wait prior to timing out.
445
- minutes : int, default 0
446
- Number of minutes to wait prior to timing out.
447
- hours : int, default 0
448
- Number of hours to wait prior to timing out.
449
- """
450
- ...
451
-
452
- @typing.overload
453
- def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
454
- """
455
- Decorator prototype for all step decorators. This function gets specialized
456
- and imported for all decorators types by _import_plugin_decorators().
457
- """
458
- ...
459
-
460
- @typing.overload
461
- def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
462
- ...
463
-
464
- def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
465
- """
466
- Decorator prototype for all step decorators. This function gets specialized
467
- and imported for all decorators types by _import_plugin_decorators().
468
- """
469
- ...
470
-
471
- @typing.overload
472
- def secrets(*, sources: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = []) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
473
- """
474
- Specifies secrets to be retrieved and injected as environment variables prior to
475
- the execution of a step.
551
+ Specifies the resources needed when executing this step.
476
552
 
553
+ Use `@resources` to specify the resource requirements
554
+ independently of the specific compute layer (`@batch`, `@kubernetes`).
477
555
 
478
- Parameters
479
- ----------
480
- sources : List[Union[str, Dict[str, Any]]], default: []
481
- List of secret specs, defining how the secrets are to be retrieved
482
- """
483
- ...
484
-
485
- @typing.overload
486
- def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
487
- ...
488
-
489
- @typing.overload
490
- def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
491
- ...
492
-
493
- def secrets(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, sources: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = []):
494
- """
495
- Specifies secrets to be retrieved and injected as environment variables prior to
496
- the execution of a step.
556
+ You can choose the compute layer on the command line by executing e.g.
557
+ ```
558
+ python myflow.py run --with batch
559
+ ```
560
+ or
561
+ ```
562
+ python myflow.py run --with kubernetes
563
+ ```
564
+ which executes the flow on the desired system using the
565
+ requirements specified in `@resources`.
497
566
 
498
567
 
499
568
  Parameters
500
569
  ----------
501
- sources : List[Union[str, Dict[str, Any]]], default: []
502
- List of secret specs, defining how the secrets are to be retrieved
570
+ cpu : int, default 1
571
+ Number of CPUs required for this step.
572
+ gpu : int, optional, default None
573
+ Number of GPUs required for this step.
574
+ disk : int, optional, default None
575
+ Disk size (in MB) required for this step. Only applies on Kubernetes.
576
+ memory : int, default 4096
577
+ Memory size (in MB) required for this step.
578
+ shared_memory : int, optional, default None
579
+ The value for the size (in MiB) of the /dev/shm volume for this step.
580
+ This parameter maps to the `--shm-size` option in Docker.
503
581
  """
504
582
  ...
505
583
 
@@ -620,113 +698,21 @@ def checkpoint(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None
620
698
  ...
621
699
 
622
700
  @typing.overload
623
- def retry(*, times: int = 3, minutes_between_retries: int = 2) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
624
- """
625
- Specifies the number of times the task corresponding
626
- to a step needs to be retried.
627
-
628
- This decorator is useful for handling transient errors, such as networking issues.
629
- If your task contains operations that can't be retried safely, e.g. database updates,
630
- it is advisable to annotate it with `@retry(times=0)`.
631
-
632
- This can be used in conjunction with the `@catch` decorator. The `@catch`
633
- decorator will execute a no-op task after all retries have been exhausted,
634
- ensuring that the flow execution can continue.
635
-
636
-
637
- Parameters
638
- ----------
639
- times : int, default 3
640
- Number of times to retry this task.
641
- minutes_between_retries : int, default 2
642
- Number of minutes between retries.
643
- """
644
- ...
645
-
646
- @typing.overload
647
- def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
648
- ...
649
-
650
- @typing.overload
651
- def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
652
- ...
653
-
654
- def retry(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, times: int = 3, minutes_between_retries: int = 2):
655
- """
656
- Specifies the number of times the task corresponding
657
- to a step needs to be retried.
658
-
659
- This decorator is useful for handling transient errors, such as networking issues.
660
- If your task contains operations that can't be retried safely, e.g. database updates,
661
- it is advisable to annotate it with `@retry(times=0)`.
662
-
663
- This can be used in conjunction with the `@catch` decorator. The `@catch`
664
- decorator will execute a no-op task after all retries have been exhausted,
665
- ensuring that the flow execution can continue.
666
-
667
-
668
- Parameters
669
- ----------
670
- times : int, default 3
671
- Number of times to retry this task.
672
- minutes_between_retries : int, default 2
673
- Number of minutes between retries.
674
- """
675
- ...
676
-
677
- def nvct(*, gpu: int, gpu_type: str) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
678
- """
679
- Specifies that this step should execute on DGX cloud.
680
-
681
-
682
- Parameters
683
- ----------
684
- gpu : int
685
- Number of GPUs to use.
686
- gpu_type : str
687
- Type of Nvidia GPU to use.
688
- """
689
- ...
690
-
691
- 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]]]:
692
- """
693
- Decorator that helps cache, version and store models/datasets from huggingface hub.
694
-
695
-
696
- Parameters
697
- ----------
698
- temp_dir_root : str, optional
699
- The root directory that will hold the temporary directory where objects will be downloaded.
700
-
701
- load: Union[List[str], List[Tuple[Dict, str]], List[Tuple[str, str]], List[Dict], None]
702
- The list of repos (models/datasets) to load.
703
-
704
- Loaded repos can be accessed via `current.huggingface_hub.loaded`. If load is set, then the following happens:
705
-
706
- - If repo (model/dataset) is not found in the datastore:
707
- - Downloads the repo from Hugging Face Hub to a temporary directory (or uses specified path) for local access
708
- - Stores it in Metaflow's datastore (s3/gcs/azure etc.) with a unique name based on repo_type/repo_id
709
- - All HF models loaded for a `@step` will be cached separately under flow/step/namespace.
710
-
711
- - If repo is found in the datastore:
712
- - Loads it directly from datastore to local path (can be temporary directory or specified path)
713
- """
714
- ...
715
-
716
- @typing.overload
717
- def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
701
+ def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
718
702
  """
719
- Internal decorator to support Fast bakery
703
+ Decorator prototype for all step decorators. This function gets specialized
704
+ and imported for all decorators types by _import_plugin_decorators().
720
705
  """
721
706
  ...
722
707
 
723
708
  @typing.overload
724
- def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
709
+ def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
725
710
  ...
726
711
 
727
- def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
712
+ def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
728
713
  """
729
- Internal decorator to support Fast bakery
714
+ Decorator prototype for all step decorators. This function gets specialized
715
+ and imported for all decorators types by _import_plugin_decorators().
730
716
  """
731
717
  ...
732
718
 
@@ -769,81 +755,68 @@ def vllm(*, model: str, backend: str, debug: bool, kwargs: typing.Any) -> typing
769
755
  ...
770
756
 
771
757
  @typing.overload
772
- 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]]]:
758
+ def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
773
759
  """
774
- Specifies the resources needed when executing this step.
775
-
776
- Use `@resources` to specify the resource requirements
777
- independently of the specific compute layer (`@batch`, `@kubernetes`).
760
+ Internal decorator to support Fast bakery
761
+ """
762
+ ...
763
+
764
+ @typing.overload
765
+ def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
766
+ ...
767
+
768
+ def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
769
+ """
770
+ Internal decorator to support Fast bakery
771
+ """
772
+ ...
773
+
774
+ @typing.overload
775
+ 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]]]:
776
+ """
777
+ Creates a human-readable report, a Metaflow Card, after this step completes.
778
778
 
779
- You can choose the compute layer on the command line by executing e.g.
780
- ```
781
- python myflow.py run --with batch
782
- ```
783
- or
784
- ```
785
- python myflow.py run --with kubernetes
786
- ```
787
- which executes the flow on the desired system using the
788
- requirements specified in `@resources`.
779
+ Note that you may add multiple `@card` decorators in a step with different parameters.
789
780
 
790
781
 
791
782
  Parameters
792
783
  ----------
793
- cpu : int, default 1
794
- Number of CPUs required for this step.
795
- gpu : int, optional, default None
796
- Number of GPUs required for this step.
797
- disk : int, optional, default None
798
- Disk size (in MB) required for this step. Only applies on Kubernetes.
799
- memory : int, default 4096
800
- Memory size (in MB) required for this step.
801
- shared_memory : int, optional, default None
802
- The value for the size (in MiB) of the /dev/shm volume for this step.
803
- This parameter maps to the `--shm-size` option in Docker.
784
+ type : str, default 'default'
785
+ Card type.
786
+ id : str, optional, default None
787
+ If multiple cards are present, use this id to identify this card.
788
+ options : Dict[str, Any], default {}
789
+ Options passed to the card. The contents depend on the card type.
790
+ timeout : int, default 45
791
+ Interrupt reporting if it takes more than this many seconds.
804
792
  """
805
793
  ...
806
794
 
807
795
  @typing.overload
808
- def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
796
+ def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
809
797
  ...
810
798
 
811
799
  @typing.overload
812
- def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
800
+ def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
813
801
  ...
814
802
 
815
- 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):
803
+ 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):
816
804
  """
817
- Specifies the resources needed when executing this step.
818
-
819
- Use `@resources` to specify the resource requirements
820
- independently of the specific compute layer (`@batch`, `@kubernetes`).
805
+ Creates a human-readable report, a Metaflow Card, after this step completes.
821
806
 
822
- You can choose the compute layer on the command line by executing e.g.
823
- ```
824
- python myflow.py run --with batch
825
- ```
826
- or
827
- ```
828
- python myflow.py run --with kubernetes
829
- ```
830
- which executes the flow on the desired system using the
831
- requirements specified in `@resources`.
807
+ Note that you may add multiple `@card` decorators in a step with different parameters.
832
808
 
833
809
 
834
810
  Parameters
835
811
  ----------
836
- cpu : int, default 1
837
- Number of CPUs required for this step.
838
- gpu : int, optional, default None
839
- Number of GPUs required for this step.
840
- disk : int, optional, default None
841
- Disk size (in MB) required for this step. Only applies on Kubernetes.
842
- memory : int, default 4096
843
- Memory size (in MB) required for this step.
844
- shared_memory : int, optional, default None
845
- The value for the size (in MiB) of the /dev/shm volume for this step.
846
- This parameter maps to the `--shm-size` option in Docker.
812
+ type : str, default 'default'
813
+ Card type.
814
+ id : str, optional, default None
815
+ If multiple cards are present, use this id to identify this card.
816
+ options : Dict[str, Any], default {}
817
+ Options passed to the card. The contents depend on the card type.
818
+ timeout : int, default 45
819
+ Interrupt reporting if it takes more than this many seconds.
847
820
  """
848
821
  ...
849
822
 
@@ -936,83 +909,110 @@ def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: ty
936
909
  """
937
910
  ...
938
911
 
939
- def app_deploy(*, app_port: int, app_name: str) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
912
+ @typing.overload
913
+ def environment(*, vars: typing.Dict[str, str] = {}) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
940
914
  """
941
- Specifies that this step is used to deploy an instance of the app.
942
- Requires that self.app_name, self.app_port, self.entrypoint and self.deployDir is set.
915
+ Specifies environment variables to be set prior to the execution of a step.
943
916
 
944
917
 
945
918
  Parameters
946
919
  ----------
947
- app_port : int
948
- Number of GPUs to use.
949
- app_name : str
950
- Name of the app to deploy.
920
+ vars : Dict[str, str], default {}
921
+ Dictionary of environment variables to set.
951
922
  """
952
923
  ...
953
924
 
954
925
  @typing.overload
955
- 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]]]:
926
+ def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
927
+ ...
928
+
929
+ @typing.overload
930
+ def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
931
+ ...
932
+
933
+ def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
956
934
  """
957
- Creates a human-readable report, a Metaflow Card, after this step completes.
935
+ Specifies environment variables to be set prior to the execution of a step.
958
936
 
959
- Note that you may add multiple `@card` decorators in a step with different parameters.
937
+
938
+ Parameters
939
+ ----------
940
+ vars : Dict[str, str], default {}
941
+ Dictionary of environment variables to set.
942
+ """
943
+ ...
944
+
945
+ @typing.overload
946
+ 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]]]:
947
+ """
948
+ Specifies a timeout for your step.
949
+
950
+ This decorator is useful if this step may hang indefinitely.
951
+
952
+ This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
953
+ A timeout is considered to be an exception thrown by the step. It will cause the step to be
954
+ retried if needed and the exception will be caught by the `@catch` decorator, if present.
955
+
956
+ Note that all the values specified in parameters are added together so if you specify
957
+ 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
960
958
 
961
959
 
962
960
  Parameters
963
961
  ----------
964
- type : str, default 'default'
965
- Card type.
966
- id : str, optional, default None
967
- If multiple cards are present, use this id to identify this card.
968
- options : Dict[str, Any], default {}
969
- Options passed to the card. The contents depend on the card type.
970
- timeout : int, default 45
971
- Interrupt reporting if it takes more than this many seconds.
962
+ seconds : int, default 0
963
+ Number of seconds to wait prior to timing out.
964
+ minutes : int, default 0
965
+ Number of minutes to wait prior to timing out.
966
+ hours : int, default 0
967
+ Number of hours to wait prior to timing out.
972
968
  """
973
969
  ...
974
970
 
975
971
  @typing.overload
976
- def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
972
+ def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
977
973
  ...
978
974
 
979
975
  @typing.overload
980
- def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
976
+ def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
981
977
  ...
982
978
 
983
- def card(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, type: str = 'default', id: typing.Optional[str] = None, options: typing.Dict[str, typing.Any] = {}, timeout: int = 45):
979
+ 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):
984
980
  """
985
- Creates a human-readable report, a Metaflow Card, after this step completes.
981
+ Specifies a timeout for your step.
986
982
 
987
- Note that you may add multiple `@card` decorators in a step with different parameters.
983
+ This decorator is useful if this step may hang indefinitely.
984
+
985
+ This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
986
+ A timeout is considered to be an exception thrown by the step. It will cause the step to be
987
+ retried if needed and the exception will be caught by the `@catch` decorator, if present.
988
+
989
+ Note that all the values specified in parameters are added together so if you specify
990
+ 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
988
991
 
989
992
 
990
993
  Parameters
991
994
  ----------
992
- type : str, default 'default'
993
- Card type.
994
- id : str, optional, default None
995
- If multiple cards are present, use this id to identify this card.
996
- options : Dict[str, Any], default {}
997
- Options passed to the card. The contents depend on the card type.
998
- timeout : int, default 45
999
- Interrupt reporting if it takes more than this many seconds.
995
+ seconds : int, default 0
996
+ Number of seconds to wait prior to timing out.
997
+ minutes : int, default 0
998
+ Number of minutes to wait prior to timing out.
999
+ hours : int, default 0
1000
+ Number of hours to wait prior to timing out.
1000
1001
  """
1001
1002
  ...
1002
1003
 
1003
- 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]]]:
1004
+ def app_deploy(*, app_port: int, app_name: str) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
1004
1005
  """
1005
- Specifies that this step should execute on DGX cloud.
1006
+ Specifies that this step is used to deploy an instance of the app.
1007
+ Requires that self.app_name, self.app_port, self.entrypoint and self.deployDir is set.
1006
1008
 
1007
1009
 
1008
1010
  Parameters
1009
1011
  ----------
1010
- gpu : int
1012
+ app_port : int
1011
1013
  Number of GPUs to use.
1012
- gpu_type : str
1013
- Type of Nvidia GPU to use.
1014
- queue_timeout : int
1015
- Time to keep the job in NVCF's queue.
1014
+ app_name : str
1015
+ Name of the app to deploy.
1016
1016
  """
1017
1017
  ...
1018
1018
 
@@ -1068,179 +1068,167 @@ def conda_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packa
1068
1068
  ...
1069
1069
 
1070
1070
  @typing.overload
1071
- 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]]:
1071
+ def schedule(*, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: typing.Optional[str] = None, timezone: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1072
1072
  """
1073
- Specifies the event(s) that this flow depends on.
1074
-
1075
- ```
1076
- @trigger(event='foo')
1077
- ```
1078
- or
1079
- ```
1080
- @trigger(events=['foo', 'bar'])
1081
- ```
1082
-
1083
- Additionally, you can specify the parameter mappings
1084
- to map event payload to Metaflow parameters for the flow.
1085
- ```
1086
- @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1087
- ```
1088
- or
1089
- ```
1090
- @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1091
- {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1092
- ```
1093
-
1094
- 'parameters' can also be a list of strings and tuples like so:
1095
- ```
1096
- @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1097
- ```
1098
- This is equivalent to:
1099
- ```
1100
- @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1101
- ```
1073
+ Specifies the times when the flow should be run when running on a
1074
+ production scheduler.
1102
1075
 
1103
1076
 
1104
1077
  Parameters
1105
1078
  ----------
1106
- event : Union[str, Dict[str, Any]], optional, default None
1107
- Event dependency for this flow.
1108
- events : List[Union[str, Dict[str, Any]]], default []
1109
- Events dependency for this flow.
1110
- options : Dict[str, Any], default {}
1111
- Backend-specific configuration for tuning eventing behavior.
1079
+ hourly : bool, default False
1080
+ Run the workflow hourly.
1081
+ daily : bool, default True
1082
+ Run the workflow daily.
1083
+ weekly : bool, default False
1084
+ Run the workflow weekly.
1085
+ cron : str, optional, default None
1086
+ Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1087
+ specified by this expression.
1088
+ timezone : str, optional, default None
1089
+ Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1090
+ which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1112
1091
  """
1113
1092
  ...
1114
1093
 
1115
1094
  @typing.overload
1116
- def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1095
+ def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1117
1096
  ...
1118
1097
 
1119
- def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, event: typing.Union[str, typing.Dict[str, typing.Any], None] = None, events: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = [], options: typing.Dict[str, typing.Any] = {}):
1098
+ def schedule(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: typing.Optional[str] = None, timezone: typing.Optional[str] = None):
1120
1099
  """
1121
- Specifies the event(s) that this flow depends on.
1122
-
1123
- ```
1124
- @trigger(event='foo')
1125
- ```
1126
- or
1127
- ```
1128
- @trigger(events=['foo', 'bar'])
1129
- ```
1130
-
1131
- Additionally, you can specify the parameter mappings
1132
- to map event payload to Metaflow parameters for the flow.
1133
- ```
1134
- @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1135
- ```
1136
- or
1137
- ```
1138
- @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1139
- {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1140
- ```
1141
-
1142
- 'parameters' can also be a list of strings and tuples like so:
1143
- ```
1144
- @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1145
- ```
1146
- This is equivalent to:
1147
- ```
1148
- @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1149
- ```
1100
+ Specifies the times when the flow should be run when running on a
1101
+ production scheduler.
1150
1102
 
1151
1103
 
1152
1104
  Parameters
1153
1105
  ----------
1154
- event : Union[str, Dict[str, Any]], optional, default None
1155
- Event dependency for this flow.
1156
- events : List[Union[str, Dict[str, Any]]], default []
1157
- Events dependency for this flow.
1158
- options : Dict[str, Any], default {}
1159
- Backend-specific configuration for tuning eventing behavior.
1106
+ hourly : bool, default False
1107
+ Run the workflow hourly.
1108
+ daily : bool, default True
1109
+ Run the workflow daily.
1110
+ weekly : bool, default False
1111
+ Run the workflow weekly.
1112
+ cron : str, optional, default None
1113
+ Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1114
+ specified by this expression.
1115
+ timezone : str, optional, default None
1116
+ Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1117
+ which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1160
1118
  """
1161
1119
  ...
1162
1120
 
1163
- 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]]:
1121
+ def with_artifact_store(f: typing.Optional[typing.Type[FlowSpecDerived]] = None):
1164
1122
  """
1165
- 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)
1166
- before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
1167
- and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
1168
- added as a flow decorators. Adding more than one decorator will ensure that `start` step
1169
- starts only after all sensors finish.
1123
+ Allows setting external datastores to save data for the
1124
+ `@checkpoint`/`@model`/`@huggingface_hub` decorators.
1170
1125
 
1126
+ This decorator is useful when users wish to save data to a different datastore
1127
+ than what is configured in Metaflow. This can be for variety of reasons:
1171
1128
 
1172
- Parameters
1129
+ 1. Data security: The objects needs to be stored in a bucket (object storage) that is not accessible by other flows.
1130
+ 2. Data Locality: The location where the task is executing is not located in the same region as the datastore.
1131
+ - Example: Metaflow datastore lives in US East, but the task is executing in Finland datacenters.
1132
+ 3. Data Lifecycle Policies: The objects need to be archived / managed separately from the Metaflow managed objects.
1133
+ - Example: Flow is training very large models that need to be stored separately and will be deleted more aggressively than the Metaflow managed objects.
1134
+
1135
+ Usage:
1173
1136
  ----------
1174
- timeout : int
1175
- Time, in seconds before the task times out and fails. (Default: 3600)
1176
- poke_interval : int
1177
- Time in seconds that the job should wait in between each try. (Default: 60)
1178
- mode : str
1179
- How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1180
- exponential_backoff : bool
1181
- allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1182
- pool : str
1183
- the slot pool this task should run in,
1184
- slot pools are a way to limit concurrency for certain tasks. (Default:None)
1185
- soft_fail : bool
1186
- Set to true to mark the task as SKIPPED on failure. (Default: False)
1187
- name : str
1188
- Name of the sensor on Airflow
1189
- description : str
1190
- Description of sensor in the Airflow UI
1191
- bucket_key : Union[str, List[str]]
1192
- The key(s) being waited on. Supports full s3:// style url or relative path from root level.
1193
- When it's specified as a full s3:// url, please leave `bucket_name` as None
1194
- bucket_name : str
1195
- Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
1196
- When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
1197
- wildcard_match : bool
1198
- whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
1199
- aws_conn_id : str
1200
- a reference to the s3 connection on Airflow. (Default: None)
1201
- verify : bool
1202
- Whether or not to verify SSL certificates for S3 connection. (Default: None)
1203
- """
1204
- ...
1205
-
1206
- @typing.overload
1207
- def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1208
- """
1209
- Specifies the PyPI packages for all steps of the flow.
1210
1137
 
1211
- Use `@pypi_base` to set common packages required by all
1212
- steps and use `@pypi` to specify step-specific overrides.
1138
+ - Using a custom IAM role to access the datastore.
1213
1139
 
1214
- Parameters
1215
- ----------
1216
- packages : Dict[str, str], default: {}
1217
- Packages to use for this flow. The key is the name of the package
1218
- and the value is the version to use.
1219
- python : str, optional, default: None
1220
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1221
- that the version used will correspond to the version of the Python interpreter used to start the run.
1222
- """
1223
- ...
1224
-
1225
- @typing.overload
1226
- def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1227
- ...
1228
-
1229
- def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
1230
- """
1231
- Specifies the PyPI packages for all steps of the flow.
1140
+ ```python
1141
+ @with_artifact_store(
1142
+ type="s3",
1143
+ config=lambda: {
1144
+ "root": "s3://my-bucket-foo/path/to/root",
1145
+ "role_arn": ROLE,
1146
+ },
1147
+ )
1148
+ class MyFlow(FlowSpec):
1232
1149
 
1233
- Use `@pypi_base` to set common packages required by all
1234
- steps and use `@pypi` to specify step-specific overrides.
1150
+ @checkpoint
1151
+ @step
1152
+ def start(self):
1153
+ with open("my_file.txt", "w") as f:
1154
+ f.write("Hello, World!")
1155
+ self.external_bucket_checkpoint = current.checkpoint.save("my_file.txt")
1156
+ self.next(self.end)
1235
1157
 
1236
- Parameters
1158
+ ```
1159
+
1160
+ - Using credentials to access the s3-compatible datastore.
1161
+
1162
+ ```python
1163
+ @with_artifact_store(
1164
+ type="s3",
1165
+ config=lambda: {
1166
+ "root": "s3://my-bucket-foo/path/to/root",
1167
+ "client_params": {
1168
+ "aws_access_key_id": os.environ.get("MY_CUSTOM_ACCESS_KEY"),
1169
+ "aws_secret_access_key": os.environ.get("MY_CUSTOM_SECRET_KEY"),
1170
+ },
1171
+ },
1172
+ )
1173
+ class MyFlow(FlowSpec):
1174
+
1175
+ @checkpoint
1176
+ @step
1177
+ def start(self):
1178
+ with open("my_file.txt", "w") as f:
1179
+ f.write("Hello, World!")
1180
+ self.external_bucket_checkpoint = current.checkpoint.save("my_file.txt")
1181
+ self.next(self.end)
1182
+
1183
+ ```
1184
+
1185
+ - Accessing objects stored in external datastores after task execution.
1186
+
1187
+ ```python
1188
+ run = Run("CheckpointsTestsFlow/8992")
1189
+ with artifact_store_from(run=run, config={
1190
+ "client_params": {
1191
+ "aws_access_key_id": os.environ.get("MY_CUSTOM_ACCESS_KEY"),
1192
+ "aws_secret_access_key": os.environ.get("MY_CUSTOM_SECRET_KEY"),
1193
+ },
1194
+ }):
1195
+ with Checkpoint() as cp:
1196
+ latest = cp.list(
1197
+ task=run["start"].task
1198
+ )[0]
1199
+ print(latest)
1200
+ cp.load(
1201
+ latest,
1202
+ "test-checkpoints"
1203
+ )
1204
+
1205
+ task = Task("TorchTuneFlow/8484/train/53673")
1206
+ with artifact_store_from(run=run, config={
1207
+ "client_params": {
1208
+ "aws_access_key_id": os.environ.get("MY_CUSTOM_ACCESS_KEY"),
1209
+ "aws_secret_access_key": os.environ.get("MY_CUSTOM_SECRET_KEY"),
1210
+ },
1211
+ }):
1212
+ load_model(
1213
+ task.data.model_ref,
1214
+ "test-models"
1215
+ )
1216
+ ```
1217
+ Parameters:
1237
1218
  ----------
1238
- packages : Dict[str, str], default: {}
1239
- Packages to use for this flow. The key is the name of the package
1240
- and the value is the version to use.
1241
- python : str, optional, default: None
1242
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1243
- that the version used will correspond to the version of the Python interpreter used to start the run.
1219
+
1220
+ type: str
1221
+ The type of the datastore. Can be one of 's3', 'gcs', 'azure' or any other supported metaflow Datastore.
1222
+
1223
+ config: dict or Callable
1224
+ Dictionary of configuration options for the datastore. The following keys are required:
1225
+ - root: The root path in the datastore where the data will be saved. (needs to be in the format expected by the datastore)
1226
+ - example: 's3://bucket-name/path/to/root'
1227
+ - example: 'gs://bucket-name/path/to/root'
1228
+ - example: 'https://myblockacc.blob.core.windows.net/metaflow/'
1229
+ - role_arn (optional): AWS IAM role to access s3 bucket (only when `type` is 's3')
1230
+ - session_vars (optional): AWS session variables to access s3 bucket (only when `type` is 's3')
1231
+ - client_params (optional): AWS client parameters to access s3 bucket (only when `type` is 's3')
1244
1232
  """
1245
1233
  ...
1246
1234
 
@@ -1345,54 +1333,46 @@ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *
1345
1333
  """
1346
1334
  ...
1347
1335
 
1348
- @typing.overload
1349
- def schedule(*, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: typing.Optional[str] = None, timezone: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1350
- """
1351
- Specifies the times when the flow should be run when running on a
1352
- production scheduler.
1353
-
1354
-
1355
- Parameters
1356
- ----------
1357
- hourly : bool, default False
1358
- Run the workflow hourly.
1359
- daily : bool, default True
1360
- Run the workflow daily.
1361
- weekly : bool, default False
1362
- Run the workflow weekly.
1363
- cron : str, optional, default None
1364
- Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1365
- specified by this expression.
1366
- timezone : str, optional, default None
1367
- Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1368
- which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1369
- """
1370
- ...
1371
-
1372
- @typing.overload
1373
- def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1374
- ...
1375
-
1376
- def schedule(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: typing.Optional[str] = None, timezone: typing.Optional[str] = None):
1336
+ def airflow_s3_key_sensor(*, timeout: int, poke_interval: int, mode: str, exponential_backoff: bool, pool: str, soft_fail: bool, name: str, description: str, bucket_key: typing.Union[str, typing.List[str]], bucket_name: str, wildcard_match: bool, aws_conn_id: str, verify: bool) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1377
1337
  """
1378
- Specifies the times when the flow should be run when running on a
1379
- production scheduler.
1338
+ The `@airflow_s3_key_sensor` decorator attaches a Airflow [S3KeySensor](https://airflow.apache.org/docs/apache-airflow-providers-amazon/stable/_api/airflow/providers/amazon/aws/sensors/s3/index.html#airflow.providers.amazon.aws.sensors.s3.S3KeySensor)
1339
+ before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
1340
+ and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
1341
+ added as a flow decorators. Adding more than one decorator will ensure that `start` step
1342
+ starts only after all sensors finish.
1380
1343
 
1381
1344
 
1382
1345
  Parameters
1383
1346
  ----------
1384
- hourly : bool, default False
1385
- Run the workflow hourly.
1386
- daily : bool, default True
1387
- Run the workflow daily.
1388
- weekly : bool, default False
1389
- Run the workflow weekly.
1390
- cron : str, optional, default None
1391
- Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1392
- specified by this expression.
1393
- timezone : str, optional, default None
1394
- Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1395
- which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1347
+ timeout : int
1348
+ Time, in seconds before the task times out and fails. (Default: 3600)
1349
+ poke_interval : int
1350
+ Time in seconds that the job should wait in between each try. (Default: 60)
1351
+ mode : str
1352
+ How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1353
+ exponential_backoff : bool
1354
+ allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1355
+ pool : str
1356
+ the slot pool this task should run in,
1357
+ slot pools are a way to limit concurrency for certain tasks. (Default:None)
1358
+ soft_fail : bool
1359
+ Set to true to mark the task as SKIPPED on failure. (Default: False)
1360
+ name : str
1361
+ Name of the sensor on Airflow
1362
+ description : str
1363
+ Description of sensor in the Airflow UI
1364
+ bucket_key : Union[str, List[str]]
1365
+ The key(s) being waited on. Supports full s3:// style url or relative path from root level.
1366
+ When it's specified as a full s3:// url, please leave `bucket_name` as None
1367
+ bucket_name : str
1368
+ Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
1369
+ When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
1370
+ wildcard_match : bool
1371
+ whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
1372
+ aws_conn_id : str
1373
+ a reference to the s3 connection on Airflow. (Default: None)
1374
+ verify : bool
1375
+ Whether or not to verify SSL certificates for S3 connection. (Default: None)
1396
1376
  """
1397
1377
  ...
1398
1378
 
@@ -1474,117 +1454,137 @@ def airflow_external_task_sensor(*, timeout: int, poke_interval: int, mode: str,
1474
1454
  """
1475
1455
  ...
1476
1456
 
1477
- def with_artifact_store(f: typing.Optional[typing.Type[FlowSpecDerived]] = None):
1457
+ @typing.overload
1458
+ def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1478
1459
  """
1479
- Allows setting external datastores to save data for the
1480
- `@checkpoint`/`@model`/`@huggingface_hub` decorators.
1481
-
1482
- This decorator is useful when users wish to save data to a different datastore
1483
- than what is configured in Metaflow. This can be for variety of reasons:
1460
+ Specifies the PyPI packages for all steps of the flow.
1484
1461
 
1485
- 1. Data security: The objects needs to be stored in a bucket (object storage) that is not accessible by other flows.
1486
- 2. Data Locality: The location where the task is executing is not located in the same region as the datastore.
1487
- - Example: Metaflow datastore lives in US East, but the task is executing in Finland datacenters.
1488
- 3. Data Lifecycle Policies: The objects need to be archived / managed separately from the Metaflow managed objects.
1489
- - Example: Flow is training very large models that need to be stored separately and will be deleted more aggressively than the Metaflow managed objects.
1462
+ Use `@pypi_base` to set common packages required by all
1463
+ steps and use `@pypi` to specify step-specific overrides.
1490
1464
 
1491
- Usage:
1465
+ Parameters
1492
1466
  ----------
1467
+ packages : Dict[str, str], default: {}
1468
+ Packages to use for this flow. The key is the name of the package
1469
+ and the value is the version to use.
1470
+ python : str, optional, default: None
1471
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1472
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1473
+ """
1474
+ ...
1475
+
1476
+ @typing.overload
1477
+ def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1478
+ ...
1479
+
1480
+ def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
1481
+ """
1482
+ Specifies the PyPI packages for all steps of the flow.
1493
1483
 
1494
- - Using a custom IAM role to access the datastore.
1495
-
1496
- ```python
1497
- @with_artifact_store(
1498
- type="s3",
1499
- config=lambda: {
1500
- "root": "s3://my-bucket-foo/path/to/root",
1501
- "role_arn": ROLE,
1502
- },
1503
- )
1504
- class MyFlow(FlowSpec):
1484
+ Use `@pypi_base` to set common packages required by all
1485
+ steps and use `@pypi` to specify step-specific overrides.
1505
1486
 
1506
- @checkpoint
1507
- @step
1508
- def start(self):
1509
- with open("my_file.txt", "w") as f:
1510
- f.write("Hello, World!")
1511
- self.external_bucket_checkpoint = current.checkpoint.save("my_file.txt")
1512
- self.next(self.end)
1487
+ Parameters
1488
+ ----------
1489
+ packages : Dict[str, str], default: {}
1490
+ Packages to use for this flow. The key is the name of the package
1491
+ and the value is the version to use.
1492
+ python : str, optional, default: None
1493
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1494
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1495
+ """
1496
+ ...
1497
+
1498
+ @typing.overload
1499
+ 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]]:
1500
+ """
1501
+ Specifies the event(s) that this flow depends on.
1513
1502
 
1514
- ```
1503
+ ```
1504
+ @trigger(event='foo')
1505
+ ```
1506
+ or
1507
+ ```
1508
+ @trigger(events=['foo', 'bar'])
1509
+ ```
1515
1510
 
1516
- - Using credentials to access the s3-compatible datastore.
1511
+ Additionally, you can specify the parameter mappings
1512
+ to map event payload to Metaflow parameters for the flow.
1513
+ ```
1514
+ @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1515
+ ```
1516
+ or
1517
+ ```
1518
+ @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1519
+ {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1520
+ ```
1517
1521
 
1518
- ```python
1519
- @with_artifact_store(
1520
- type="s3",
1521
- config=lambda: {
1522
- "root": "s3://my-bucket-foo/path/to/root",
1523
- "client_params": {
1524
- "aws_access_key_id": os.environ.get("MY_CUSTOM_ACCESS_KEY"),
1525
- "aws_secret_access_key": os.environ.get("MY_CUSTOM_SECRET_KEY"),
1526
- },
1527
- },
1528
- )
1529
- class MyFlow(FlowSpec):
1522
+ 'parameters' can also be a list of strings and tuples like so:
1523
+ ```
1524
+ @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1525
+ ```
1526
+ This is equivalent to:
1527
+ ```
1528
+ @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1529
+ ```
1530
1530
 
1531
- @checkpoint
1532
- @step
1533
- def start(self):
1534
- with open("my_file.txt", "w") as f:
1535
- f.write("Hello, World!")
1536
- self.external_bucket_checkpoint = current.checkpoint.save("my_file.txt")
1537
- self.next(self.end)
1538
1531
 
1539
- ```
1532
+ Parameters
1533
+ ----------
1534
+ event : Union[str, Dict[str, Any]], optional, default None
1535
+ Event dependency for this flow.
1536
+ events : List[Union[str, Dict[str, Any]]], default []
1537
+ Events dependency for this flow.
1538
+ options : Dict[str, Any], default {}
1539
+ Backend-specific configuration for tuning eventing behavior.
1540
+ """
1541
+ ...
1542
+
1543
+ @typing.overload
1544
+ def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1545
+ ...
1546
+
1547
+ def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, event: typing.Union[str, typing.Dict[str, typing.Any], None] = None, events: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = [], options: typing.Dict[str, typing.Any] = {}):
1548
+ """
1549
+ Specifies the event(s) that this flow depends on.
1540
1550
 
1541
- - Accessing objects stored in external datastores after task execution.
1551
+ ```
1552
+ @trigger(event='foo')
1553
+ ```
1554
+ or
1555
+ ```
1556
+ @trigger(events=['foo', 'bar'])
1557
+ ```
1542
1558
 
1543
- ```python
1544
- run = Run("CheckpointsTestsFlow/8992")
1545
- with artifact_store_from(run=run, config={
1546
- "client_params": {
1547
- "aws_access_key_id": os.environ.get("MY_CUSTOM_ACCESS_KEY"),
1548
- "aws_secret_access_key": os.environ.get("MY_CUSTOM_SECRET_KEY"),
1549
- },
1550
- }):
1551
- with Checkpoint() as cp:
1552
- latest = cp.list(
1553
- task=run["start"].task
1554
- )[0]
1555
- print(latest)
1556
- cp.load(
1557
- latest,
1558
- "test-checkpoints"
1559
- )
1559
+ Additionally, you can specify the parameter mappings
1560
+ to map event payload to Metaflow parameters for the flow.
1561
+ ```
1562
+ @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1563
+ ```
1564
+ or
1565
+ ```
1566
+ @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1567
+ {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1568
+ ```
1560
1569
 
1561
- task = Task("TorchTuneFlow/8484/train/53673")
1562
- with artifact_store_from(run=run, config={
1563
- "client_params": {
1564
- "aws_access_key_id": os.environ.get("MY_CUSTOM_ACCESS_KEY"),
1565
- "aws_secret_access_key": os.environ.get("MY_CUSTOM_SECRET_KEY"),
1566
- },
1567
- }):
1568
- load_model(
1569
- task.data.model_ref,
1570
- "test-models"
1571
- )
1572
- ```
1573
- Parameters:
1574
- ----------
1570
+ 'parameters' can also be a list of strings and tuples like so:
1571
+ ```
1572
+ @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1573
+ ```
1574
+ This is equivalent to:
1575
+ ```
1576
+ @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1577
+ ```
1575
1578
 
1576
- type: str
1577
- The type of the datastore. Can be one of 's3', 'gcs', 'azure' or any other supported metaflow Datastore.
1578
1579
 
1579
- config: dict or Callable
1580
- Dictionary of configuration options for the datastore. The following keys are required:
1581
- - root: The root path in the datastore where the data will be saved. (needs to be in the format expected by the datastore)
1582
- - example: 's3://bucket-name/path/to/root'
1583
- - example: 'gs://bucket-name/path/to/root'
1584
- - example: 'https://myblockacc.blob.core.windows.net/metaflow/'
1585
- - role_arn (optional): AWS IAM role to access s3 bucket (only when `type` is 's3')
1586
- - session_vars (optional): AWS session variables to access s3 bucket (only when `type` is 's3')
1587
- - client_params (optional): AWS client parameters to access s3 bucket (only when `type` is 's3')
1580
+ Parameters
1581
+ ----------
1582
+ event : Union[str, Dict[str, Any]], optional, default None
1583
+ Event dependency for this flow.
1584
+ events : List[Union[str, Dict[str, Any]]], default []
1585
+ Events dependency for this flow.
1586
+ options : Dict[str, Any], default {}
1587
+ Backend-specific configuration for tuning eventing behavior.
1588
1588
  """
1589
1589
  ...
1590
1590