ob-metaflow-stubs 6.0.6.1__py2.py3-none-any.whl → 6.0.7.0__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 (261) hide show
  1. metaflow-stubs/__init__.pyi +894 -894
  2. metaflow-stubs/cards.pyi +2 -2
  3. metaflow-stubs/cli.pyi +2 -2
  4. metaflow-stubs/cli_components/__init__.pyi +2 -2
  5. metaflow-stubs/cli_components/utils.pyi +2 -2
  6. metaflow-stubs/client/__init__.pyi +2 -2
  7. metaflow-stubs/client/core.pyi +5 -5
  8. metaflow-stubs/client/filecache.pyi +2 -2
  9. metaflow-stubs/events.pyi +3 -3
  10. metaflow-stubs/exception.pyi +2 -2
  11. metaflow-stubs/flowspec.pyi +3 -3
  12. metaflow-stubs/generated_for.txt +1 -1
  13. metaflow-stubs/includefile.pyi +3 -3
  14. metaflow-stubs/meta_files.pyi +2 -2
  15. metaflow-stubs/metadata_provider/__init__.pyi +2 -2
  16. metaflow-stubs/metadata_provider/heartbeat.pyi +2 -2
  17. metaflow-stubs/metadata_provider/metadata.pyi +2 -2
  18. metaflow-stubs/metadata_provider/util.pyi +2 -2
  19. metaflow-stubs/metaflow_config.pyi +2 -2
  20. metaflow-stubs/metaflow_current.pyi +56 -56
  21. metaflow-stubs/metaflow_git.pyi +2 -2
  22. metaflow-stubs/mf_extensions/__init__.pyi +2 -2
  23. metaflow-stubs/mf_extensions/obcheckpoint/__init__.pyi +2 -2
  24. metaflow-stubs/mf_extensions/obcheckpoint/plugins/__init__.pyi +2 -2
  25. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/__init__.pyi +2 -2
  26. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/__init__.pyi +2 -2
  27. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/async_cards.pyi +2 -2
  28. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/deco_injection_mixin.pyi +2 -2
  29. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/extra_components.pyi +3 -3
  30. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/__init__.pyi +2 -2
  31. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/__init__.pyi +2 -2
  32. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/checkpoint_lister.pyi +5 -5
  33. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/lineage_card.pyi +2 -2
  34. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/checkpoint_storage.pyi +4 -4
  35. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/constructors.pyi +2 -2
  36. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/core.pyi +3 -3
  37. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/decorator.pyi +3 -3
  38. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/exceptions.pyi +2 -2
  39. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/final_api.pyi +2 -2
  40. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/lineage.pyi +2 -2
  41. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/__init__.pyi +2 -2
  42. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/context.pyi +3 -3
  43. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/core.pyi +3 -3
  44. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/decorator.pyi +2 -2
  45. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/exceptions.pyi +2 -2
  46. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/task_utils.pyi +2 -2
  47. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/utils.pyi +2 -2
  48. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastructures.pyi +2 -2
  49. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/exceptions.pyi +2 -2
  50. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/hf_hub/__init__.pyi +2 -2
  51. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/hf_hub/decorator.pyi +3 -3
  52. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/__init__.pyi +2 -2
  53. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/core.pyi +3 -3
  54. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/exceptions.pyi +2 -2
  55. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/model_storage.pyi +4 -4
  56. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/__init__.pyi +2 -2
  57. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/flowspec_utils.pyi +2 -2
  58. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/general.pyi +2 -2
  59. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/identity_utils.pyi +2 -2
  60. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/__init__.pyi +2 -2
  61. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/base.pyi +2 -2
  62. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/tar.pyi +2 -2
  63. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/tar_utils.pyi +2 -2
  64. metaflow-stubs/mf_extensions/outerbounds/__init__.pyi +2 -2
  65. metaflow-stubs/mf_extensions/outerbounds/plugins/__init__.pyi +2 -2
  66. metaflow-stubs/mf_extensions/outerbounds/plugins/apps/__init__.pyi +2 -2
  67. metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/__init__.pyi +2 -2
  68. metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/_state_machine.pyi +2 -2
  69. metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/_vendor/__init__.pyi +2 -2
  70. metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/_vendor/spinner/__init__.pyi +2 -2
  71. metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/_vendor/spinner/spinners.pyi +2 -2
  72. metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/app_cli.pyi +3 -3
  73. metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/app_config.pyi +3 -3
  74. metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/capsule.pyi +4 -4
  75. metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/click_importer.pyi +2 -2
  76. metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/code_package/__init__.pyi +2 -2
  77. metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/code_package/code_packager.pyi +3 -3
  78. metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/config/__init__.pyi +2 -2
  79. metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/config/cli_generator.pyi +2 -2
  80. metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/config/config_utils.pyi +3 -3
  81. metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/config/schema_export.pyi +2 -2
  82. metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/config/typed_configs.pyi +3 -3
  83. metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/config/unified_config.pyi +3 -3
  84. metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/dependencies.pyi +4 -4
  85. metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/deployer.pyi +5 -5
  86. metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/experimental/__init__.pyi +2 -2
  87. metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/perimeters.pyi +2 -2
  88. metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/utils.pyi +5 -5
  89. metaflow-stubs/mf_extensions/outerbounds/plugins/aws/__init__.pyi +2 -2
  90. metaflow-stubs/mf_extensions/outerbounds/plugins/aws/assume_role_decorator.pyi +3 -3
  91. metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/__init__.pyi +2 -2
  92. metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/async_cards.pyi +3 -3
  93. metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/injector.pyi +2 -2
  94. metaflow-stubs/mf_extensions/outerbounds/plugins/checkpoint_datastores/__init__.pyi +2 -2
  95. metaflow-stubs/mf_extensions/outerbounds/plugins/checkpoint_datastores/coreweave.pyi +3 -3
  96. metaflow-stubs/mf_extensions/outerbounds/plugins/checkpoint_datastores/nebius.pyi +3 -3
  97. metaflow-stubs/mf_extensions/outerbounds/plugins/fast_bakery/__init__.pyi +2 -2
  98. metaflow-stubs/mf_extensions/outerbounds/plugins/fast_bakery/baker.pyi +3 -3
  99. metaflow-stubs/mf_extensions/outerbounds/plugins/fast_bakery/docker_environment.pyi +3 -3
  100. metaflow-stubs/mf_extensions/outerbounds/plugins/fast_bakery/fast_bakery.pyi +2 -2
  101. metaflow-stubs/mf_extensions/outerbounds/plugins/kubernetes/__init__.pyi +2 -2
  102. metaflow-stubs/mf_extensions/outerbounds/plugins/kubernetes/pod_killer.pyi +2 -2
  103. metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/__init__.pyi +2 -2
  104. metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/constants.pyi +2 -2
  105. metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/exceptions.pyi +2 -2
  106. metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/ollama.pyi +2 -2
  107. metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/status_card.pyi +2 -2
  108. metaflow-stubs/mf_extensions/outerbounds/plugins/snowflake/__init__.pyi +2 -2
  109. metaflow-stubs/mf_extensions/outerbounds/plugins/snowflake/snowflake.pyi +2 -2
  110. metaflow-stubs/mf_extensions/outerbounds/profilers/__init__.pyi +2 -2
  111. metaflow-stubs/mf_extensions/outerbounds/profilers/gpu.pyi +2 -2
  112. metaflow-stubs/mf_extensions/outerbounds/remote_config.pyi +2 -2
  113. metaflow-stubs/mf_extensions/outerbounds/toplevel/__init__.pyi +2 -2
  114. metaflow-stubs/mf_extensions/outerbounds/toplevel/global_aliases_for_metaflow_package.pyi +2 -2
  115. metaflow-stubs/mf_extensions/outerbounds/toplevel/s3_proxy.pyi +2 -2
  116. metaflow-stubs/multicore_utils.pyi +2 -2
  117. metaflow-stubs/ob_internal.pyi +2 -2
  118. metaflow-stubs/packaging_sys/__init__.pyi +6 -6
  119. metaflow-stubs/packaging_sys/backend.pyi +4 -4
  120. metaflow-stubs/packaging_sys/distribution_support.pyi +4 -4
  121. metaflow-stubs/packaging_sys/tar_backend.pyi +5 -5
  122. metaflow-stubs/packaging_sys/utils.pyi +2 -2
  123. metaflow-stubs/packaging_sys/v1.pyi +3 -3
  124. metaflow-stubs/parameters.pyi +3 -3
  125. metaflow-stubs/plugins/__init__.pyi +9 -9
  126. metaflow-stubs/plugins/airflow/__init__.pyi +2 -2
  127. metaflow-stubs/plugins/airflow/airflow_utils.pyi +2 -2
  128. metaflow-stubs/plugins/airflow/exception.pyi +2 -2
  129. metaflow-stubs/plugins/airflow/sensors/__init__.pyi +2 -2
  130. metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +2 -2
  131. metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +2 -2
  132. metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +2 -2
  133. metaflow-stubs/plugins/argo/__init__.pyi +2 -2
  134. metaflow-stubs/plugins/argo/argo_client.pyi +2 -2
  135. metaflow-stubs/plugins/argo/argo_events.pyi +2 -2
  136. metaflow-stubs/plugins/argo/argo_workflows.pyi +3 -3
  137. metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +2 -2
  138. metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +3 -3
  139. metaflow-stubs/plugins/argo/argo_workflows_deployer_objects.pyi +2 -2
  140. metaflow-stubs/plugins/argo/exit_hooks.pyi +2 -2
  141. metaflow-stubs/plugins/aws/__init__.pyi +2 -2
  142. metaflow-stubs/plugins/aws/aws_client.pyi +2 -2
  143. metaflow-stubs/plugins/aws/aws_utils.pyi +2 -2
  144. metaflow-stubs/plugins/aws/batch/__init__.pyi +2 -2
  145. metaflow-stubs/plugins/aws/batch/batch.pyi +2 -2
  146. metaflow-stubs/plugins/aws/batch/batch_client.pyi +2 -2
  147. metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +2 -2
  148. metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +2 -2
  149. metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +3 -3
  150. metaflow-stubs/plugins/aws/step_functions/__init__.pyi +2 -2
  151. metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +2 -2
  152. metaflow-stubs/plugins/aws/step_functions/schedule_decorator.pyi +2 -2
  153. metaflow-stubs/plugins/aws/step_functions/step_functions.pyi +2 -2
  154. metaflow-stubs/plugins/aws/step_functions/step_functions_client.pyi +2 -2
  155. metaflow-stubs/plugins/aws/step_functions/step_functions_deployer.pyi +4 -4
  156. metaflow-stubs/plugins/aws/step_functions/step_functions_deployer_objects.pyi +3 -3
  157. metaflow-stubs/plugins/azure/__init__.pyi +2 -2
  158. metaflow-stubs/plugins/azure/azure_credential.pyi +2 -2
  159. metaflow-stubs/plugins/azure/azure_exceptions.pyi +2 -2
  160. metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +3 -3
  161. metaflow-stubs/plugins/azure/azure_utils.pyi +2 -2
  162. metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +2 -2
  163. metaflow-stubs/plugins/azure/includefile_support.pyi +2 -2
  164. metaflow-stubs/plugins/cards/__init__.pyi +2 -2
  165. metaflow-stubs/plugins/cards/card_client.pyi +2 -2
  166. metaflow-stubs/plugins/cards/card_creator.pyi +2 -2
  167. metaflow-stubs/plugins/cards/card_datastore.pyi +2 -2
  168. metaflow-stubs/plugins/cards/card_decorator.pyi +2 -2
  169. metaflow-stubs/plugins/cards/card_modules/__init__.pyi +2 -2
  170. metaflow-stubs/plugins/cards/card_modules/basic.pyi +3 -3
  171. metaflow-stubs/plugins/cards/card_modules/card.pyi +2 -2
  172. metaflow-stubs/plugins/cards/card_modules/components.pyi +4 -4
  173. metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +2 -2
  174. metaflow-stubs/plugins/cards/card_modules/renderer_tools.pyi +2 -2
  175. metaflow-stubs/plugins/cards/card_modules/test_cards.pyi +2 -2
  176. metaflow-stubs/plugins/cards/card_resolver.pyi +2 -2
  177. metaflow-stubs/plugins/cards/component_serializer.pyi +2 -2
  178. metaflow-stubs/plugins/cards/exception.pyi +2 -2
  179. metaflow-stubs/plugins/catch_decorator.pyi +2 -2
  180. metaflow-stubs/plugins/datatools/__init__.pyi +2 -2
  181. metaflow-stubs/plugins/datatools/local.pyi +2 -2
  182. metaflow-stubs/plugins/datatools/s3/__init__.pyi +2 -2
  183. metaflow-stubs/plugins/datatools/s3/s3.pyi +3 -3
  184. metaflow-stubs/plugins/datatools/s3/s3tail.pyi +2 -2
  185. metaflow-stubs/plugins/datatools/s3/s3util.pyi +2 -2
  186. metaflow-stubs/plugins/debug_logger.pyi +2 -2
  187. metaflow-stubs/plugins/debug_monitor.pyi +2 -2
  188. metaflow-stubs/plugins/environment_decorator.pyi +2 -2
  189. metaflow-stubs/plugins/events_decorator.pyi +2 -2
  190. metaflow-stubs/plugins/exit_hook/__init__.pyi +2 -2
  191. metaflow-stubs/plugins/exit_hook/exit_hook_decorator.pyi +2 -2
  192. metaflow-stubs/plugins/frameworks/__init__.pyi +2 -2
  193. metaflow-stubs/plugins/frameworks/pytorch.pyi +2 -2
  194. metaflow-stubs/plugins/gcp/__init__.pyi +2 -2
  195. metaflow-stubs/plugins/gcp/gcp_secret_manager_secrets_provider.pyi +3 -3
  196. metaflow-stubs/plugins/gcp/gs_exceptions.pyi +2 -2
  197. metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +2 -2
  198. metaflow-stubs/plugins/gcp/gs_utils.pyi +2 -2
  199. metaflow-stubs/plugins/gcp/includefile_support.pyi +2 -2
  200. metaflow-stubs/plugins/kubernetes/__init__.pyi +2 -2
  201. metaflow-stubs/plugins/kubernetes/kube_utils.pyi +2 -2
  202. metaflow-stubs/plugins/kubernetes/kubernetes.pyi +2 -2
  203. metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +2 -2
  204. metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +2 -2
  205. metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +2 -2
  206. metaflow-stubs/plugins/kubernetes/spot_monitor_sidecar.pyi +2 -2
  207. metaflow-stubs/plugins/ollama/__init__.pyi +2 -2
  208. metaflow-stubs/plugins/parallel_decorator.pyi +2 -2
  209. metaflow-stubs/plugins/perimeters.pyi +2 -2
  210. metaflow-stubs/plugins/project_decorator.pyi +2 -2
  211. metaflow-stubs/plugins/pypi/__init__.pyi +2 -2
  212. metaflow-stubs/plugins/pypi/conda_decorator.pyi +2 -2
  213. metaflow-stubs/plugins/pypi/conda_environment.pyi +5 -5
  214. metaflow-stubs/plugins/pypi/parsers.pyi +2 -2
  215. metaflow-stubs/plugins/pypi/pypi_decorator.pyi +2 -2
  216. metaflow-stubs/plugins/pypi/pypi_environment.pyi +2 -2
  217. metaflow-stubs/plugins/pypi/utils.pyi +2 -2
  218. metaflow-stubs/plugins/resources_decorator.pyi +2 -2
  219. metaflow-stubs/plugins/retry_decorator.pyi +2 -2
  220. metaflow-stubs/plugins/secrets/__init__.pyi +3 -3
  221. metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +2 -2
  222. metaflow-stubs/plugins/secrets/secrets_decorator.pyi +2 -2
  223. metaflow-stubs/plugins/secrets/secrets_func.pyi +2 -2
  224. metaflow-stubs/plugins/secrets/secrets_spec.pyi +2 -2
  225. metaflow-stubs/plugins/secrets/utils.pyi +2 -2
  226. metaflow-stubs/plugins/snowflake/__init__.pyi +2 -2
  227. metaflow-stubs/plugins/storage_executor.pyi +2 -2
  228. metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +2 -2
  229. metaflow-stubs/plugins/timeout_decorator.pyi +2 -2
  230. metaflow-stubs/plugins/torchtune/__init__.pyi +2 -2
  231. metaflow-stubs/plugins/uv/__init__.pyi +2 -2
  232. metaflow-stubs/plugins/uv/uv_environment.pyi +3 -3
  233. metaflow-stubs/profilers/__init__.pyi +2 -2
  234. metaflow-stubs/pylint_wrapper.pyi +2 -2
  235. metaflow-stubs/runner/__init__.pyi +2 -2
  236. metaflow-stubs/runner/deployer.pyi +6 -6
  237. metaflow-stubs/runner/deployer_impl.pyi +11 -3
  238. metaflow-stubs/runner/metaflow_runner.pyi +3 -3
  239. metaflow-stubs/runner/nbdeploy.pyi +2 -2
  240. metaflow-stubs/runner/nbrun.pyi +2 -2
  241. metaflow-stubs/runner/subprocess_manager.pyi +2 -2
  242. metaflow-stubs/runner/utils.pyi +4 -4
  243. metaflow-stubs/system/__init__.pyi +2 -2
  244. metaflow-stubs/system/system_logger.pyi +3 -3
  245. metaflow-stubs/system/system_monitor.pyi +2 -2
  246. metaflow-stubs/tagging_util.pyi +2 -2
  247. metaflow-stubs/tuple_util.pyi +2 -2
  248. metaflow-stubs/user_configs/__init__.pyi +2 -2
  249. metaflow-stubs/user_configs/config_options.pyi +3 -3
  250. metaflow-stubs/user_configs/config_parameters.pyi +5 -5
  251. metaflow-stubs/user_decorators/__init__.pyi +2 -2
  252. metaflow-stubs/user_decorators/common.pyi +2 -2
  253. metaflow-stubs/user_decorators/mutable_flow.pyi +5 -5
  254. metaflow-stubs/user_decorators/mutable_step.pyi +5 -5
  255. metaflow-stubs/user_decorators/user_flow_decorator.pyi +2 -2
  256. metaflow-stubs/user_decorators/user_step_decorator.pyi +4 -4
  257. {ob_metaflow_stubs-6.0.6.1.dist-info → ob_metaflow_stubs-6.0.7.0.dist-info}/METADATA +1 -1
  258. ob_metaflow_stubs-6.0.7.0.dist-info/RECORD +261 -0
  259. ob_metaflow_stubs-6.0.6.1.dist-info/RECORD +0 -261
  260. {ob_metaflow_stubs-6.0.6.1.dist-info → ob_metaflow_stubs-6.0.7.0.dist-info}/WHEEL +0 -0
  261. {ob_metaflow_stubs-6.0.6.1.dist-info → ob_metaflow_stubs-6.0.7.0.dist-info}/top_level.txt +0 -0
@@ -1,15 +1,15 @@
1
1
  ######################################################################################################
2
2
  # Auto-generated Metaflow stub file #
3
- # MF version: 2.17.0.1+obcheckpoint(0.2.4);ob(v1) #
4
- # Generated on 2025-08-06T15:19:48.623789 #
3
+ # MF version: 2.17.1.0+obcheckpoint(0.2.4);ob(v1) #
4
+ # Generated on 2025-08-18T05:26:58.140419 #
5
5
  ######################################################################################################
6
6
 
7
7
  from __future__ import annotations
8
8
 
9
9
  import typing
10
10
  if typing.TYPE_CHECKING:
11
- import typing
12
11
  import datetime
12
+ import typing
13
13
  FlowSpecDerived = typing.TypeVar("FlowSpecDerived", bound="FlowSpec", contravariant=False, covariant=False)
14
14
  StepFlag = typing.NewType("StepFlag", bool)
15
15
 
@@ -48,8 +48,8 @@ from . import plugins as plugins
48
48
  from .mf_extensions.outerbounds.toplevel.global_aliases_for_metaflow_package import S3 as S3
49
49
  from . import includefile as includefile
50
50
  from .includefile import IncludeFile as IncludeFile
51
- from .plugins.pypi.parsers import requirements_txt_parser as requirements_txt_parser
52
51
  from .plugins.pypi.parsers import conda_environment_yml_parser as conda_environment_yml_parser
52
+ from .plugins.pypi.parsers import requirements_txt_parser as requirements_txt_parser
53
53
  from .plugins.pypi.parsers import pyproject_toml_parser as pyproject_toml_parser
54
54
  from . import client as client
55
55
  from .client.core import namespace as namespace
@@ -296,6 +296,146 @@ def model(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
296
296
  """
297
297
  ...
298
298
 
299
+ 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]]]:
300
+ """
301
+ Specifies that this step should execute on DGX cloud.
302
+
303
+
304
+ Parameters
305
+ ----------
306
+ gpu : int
307
+ Number of GPUs to use.
308
+ gpu_type : str
309
+ Type of Nvidia GPU to use.
310
+ queue_timeout : int
311
+ Time to keep the job in NVCF's queue.
312
+ """
313
+ ...
314
+
315
+ @typing.overload
316
+ 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]]]:
317
+ """
318
+ Specifies the number of times the task corresponding
319
+ to a step needs to be retried.
320
+
321
+ This decorator is useful for handling transient errors, such as networking issues.
322
+ If your task contains operations that can't be retried safely, e.g. database updates,
323
+ it is advisable to annotate it with `@retry(times=0)`.
324
+
325
+ This can be used in conjunction with the `@catch` decorator. The `@catch`
326
+ decorator will execute a no-op task after all retries have been exhausted,
327
+ ensuring that the flow execution can continue.
328
+
329
+
330
+ Parameters
331
+ ----------
332
+ times : int, default 3
333
+ Number of times to retry this task.
334
+ minutes_between_retries : int, default 2
335
+ Number of minutes between retries.
336
+ """
337
+ ...
338
+
339
+ @typing.overload
340
+ def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
341
+ ...
342
+
343
+ @typing.overload
344
+ def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
345
+ ...
346
+
347
+ 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):
348
+ """
349
+ Specifies the number of times the task corresponding
350
+ to a step needs to be retried.
351
+
352
+ This decorator is useful for handling transient errors, such as networking issues.
353
+ If your task contains operations that can't be retried safely, e.g. database updates,
354
+ it is advisable to annotate it with `@retry(times=0)`.
355
+
356
+ This can be used in conjunction with the `@catch` decorator. The `@catch`
357
+ decorator will execute a no-op task after all retries have been exhausted,
358
+ ensuring that the flow execution can continue.
359
+
360
+
361
+ Parameters
362
+ ----------
363
+ times : int, default 3
364
+ Number of times to retry this task.
365
+ minutes_between_retries : int, default 2
366
+ Number of minutes between retries.
367
+ """
368
+ ...
369
+
370
+ @typing.overload
371
+ def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
372
+ """
373
+ Decorator prototype for all step decorators. This function gets specialized
374
+ and imported for all decorators types by _import_plugin_decorators().
375
+ """
376
+ ...
377
+
378
+ @typing.overload
379
+ def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
380
+ ...
381
+
382
+ def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
383
+ """
384
+ Decorator prototype for all step decorators. This function gets specialized
385
+ and imported for all decorators types by _import_plugin_decorators().
386
+ """
387
+ ...
388
+
389
+ def vllm(*, model: str, backend: str, openai_api_server: bool, debug: bool, card_refresh_interval: int, max_retries: int, retry_alert_frequency: int, engine_args: dict) -> 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
+ This decorator is used to run vllm APIs as Metaflow task sidecars.
392
+
393
+ User code call
394
+ --------------
395
+ @vllm(
396
+ model="...",
397
+ ...
398
+ )
399
+
400
+ Valid backend options
401
+ ---------------------
402
+ - 'local': Run as a separate process on the local task machine.
403
+
404
+ Valid model options
405
+ -------------------
406
+ Any HuggingFace model identifier, e.g. 'meta-llama/Llama-3.2-1B'
407
+
408
+ NOTE: vLLM's OpenAI-compatible server serves ONE model per server instance.
409
+ If you need multiple models, you must create multiple @vllm decorators.
410
+
411
+
412
+ Parameters
413
+ ----------
414
+ model: str
415
+ HuggingFace model identifier to be served by vLLM.
416
+ backend: str
417
+ Determines where and how to run the vLLM process.
418
+ openai_api_server: bool
419
+ Whether to use OpenAI-compatible API server mode (subprocess) instead of native engine.
420
+ Default is False (uses native engine).
421
+ Set to True for backward compatibility with existing code.
422
+ debug: bool
423
+ Whether to turn on verbose debugging logs.
424
+ card_refresh_interval: int
425
+ Interval in seconds for refreshing the vLLM status card.
426
+ Only used when openai_api_server=True.
427
+ max_retries: int
428
+ Maximum number of retries checking for vLLM server startup.
429
+ Only used when openai_api_server=True.
430
+ retry_alert_frequency: int
431
+ Frequency of alert logs for vLLM server startup retries.
432
+ Only used when openai_api_server=True.
433
+ engine_args : dict
434
+ Additional keyword arguments to pass to the vLLM engine.
435
+ For example, `tensor_parallel_size=2`.
436
+ """
437
+ ...
438
+
299
439
  @typing.overload
300
440
  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]]]:
301
441
  """
@@ -355,50 +495,52 @@ def conda(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
355
495
  """
356
496
  ...
357
497
 
358
- 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]]]:
359
- """
360
- Specifies that this step should execute on DGX cloud.
361
-
362
-
363
- Parameters
364
- ----------
365
- gpu : int
366
- Number of GPUs to use.
367
- gpu_type : str
368
- Type of Nvidia GPU to use.
369
- """
370
- ...
371
-
372
498
  @typing.overload
373
- 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]]]:
499
+ 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]]]:
374
500
  """
375
- Specifies environment variables to be set prior to the execution of a step.
501
+ Creates a human-readable report, a Metaflow Card, after this step completes.
502
+
503
+ Note that you may add multiple `@card` decorators in a step with different parameters.
376
504
 
377
505
 
378
506
  Parameters
379
507
  ----------
380
- vars : Dict[str, str], default {}
381
- Dictionary of environment variables to set.
508
+ type : str, default 'default'
509
+ Card type.
510
+ id : str, optional, default None
511
+ If multiple cards are present, use this id to identify this card.
512
+ options : Dict[str, Any], default {}
513
+ Options passed to the card. The contents depend on the card type.
514
+ timeout : int, default 45
515
+ Interrupt reporting if it takes more than this many seconds.
382
516
  """
383
517
  ...
384
518
 
385
519
  @typing.overload
386
- def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
520
+ def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
387
521
  ...
388
522
 
389
523
  @typing.overload
390
- def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
524
+ def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
391
525
  ...
392
526
 
393
- def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
527
+ 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):
394
528
  """
395
- Specifies environment variables to be set prior to the execution of a step.
529
+ Creates a human-readable report, a Metaflow Card, after this step completes.
530
+
531
+ Note that you may add multiple `@card` decorators in a step with different parameters.
396
532
 
397
533
 
398
534
  Parameters
399
535
  ----------
400
- vars : Dict[str, str], default {}
401
- Dictionary of environment variables to set.
536
+ type : str, default 'default'
537
+ Card type.
538
+ id : str, optional, default None
539
+ If multiple cards are present, use this id to identify this card.
540
+ options : Dict[str, Any], default {}
541
+ Options passed to the card. The contents depend on the card type.
542
+ timeout : int, default 45
543
+ Interrupt reporting if it takes more than this many seconds.
402
544
  """
403
545
  ...
404
546
 
@@ -453,190 +595,135 @@ def pypi(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typ
453
595
  """
454
596
  ...
455
597
 
456
- @typing.overload
457
- 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]]]:
598
+ def ollama(*, models: list, backend: str, force_pull: bool, cache_update_policy: str, force_cache_update: bool, debug: bool, circuit_breaker_config: dict, timeout_config: dict) -> 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]]]:
458
599
  """
459
- Enables checkpointing for a step.
460
-
461
- > Examples
462
-
463
- - Saving Checkpoints
464
-
465
- ```python
466
- @checkpoint
467
- @step
468
- def train(self):
469
- model = create_model(self.parameters, checkpoint_path = None)
470
- for i in range(self.epochs):
471
- # some training logic
472
- loss = model.train(self.dataset)
473
- if i % 10 == 0:
474
- model.save(
475
- current.checkpoint.directory,
476
- )
477
- # saves the contents of the `current.checkpoint.directory` as a checkpoint
478
- # and returns a reference dictionary to the checkpoint saved in the datastore
479
- self.latest_checkpoint = current.checkpoint.save(
480
- name="epoch_checkpoint",
481
- metadata={
482
- "epoch": i,
483
- "loss": loss,
484
- }
485
- )
486
- ```
600
+ This decorator is used to run Ollama APIs as Metaflow task sidecars.
487
601
 
488
- - Using Loaded Checkpoints
602
+ User code call
603
+ --------------
604
+ @ollama(
605
+ models=[...],
606
+ ...
607
+ )
489
608
 
490
- ```python
491
- @retry(times=3)
492
- @checkpoint
493
- @step
494
- def train(self):
495
- # Assume that the task has restarted and the previous attempt of the task
496
- # saved a checkpoint
497
- checkpoint_path = None
498
- if current.checkpoint.is_loaded: # Check if a checkpoint is loaded
499
- print("Loaded checkpoint from the previous attempt")
500
- checkpoint_path = current.checkpoint.directory
609
+ Valid backend options
610
+ ---------------------
611
+ - 'local': Run as a separate process on the local task machine.
612
+ - (TODO) 'managed': Outerbounds hosts and selects compute provider.
613
+ - (TODO) 'remote': Spin up separate instance to serve Ollama models.
501
614
 
502
- model = create_model(self.parameters, checkpoint_path = checkpoint_path)
503
- for i in range(self.epochs):
504
- ...
505
- ```
615
+ Valid model options
616
+ -------------------
617
+ Any model here https://ollama.com/search, e.g. 'llama3.2', 'llama3.3'
506
618
 
507
619
 
508
620
  Parameters
509
621
  ----------
510
- load_policy : str, default: "fresh"
511
- The policy for loading the checkpoint. The following policies are supported:
512
- - "eager": Loads the the latest available checkpoint within the namespace.
513
- With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
514
- will be loaded at the start of the task.
515
- - "none": Do not load any checkpoint
516
- - "fresh": Loads the lastest checkpoint created within the running Task.
517
- This mode helps loading checkpoints across various retry attempts of the same task.
518
- With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
519
- created within the task will be loaded when the task is retries execution on failure.
622
+ models: list[str]
623
+ List of Ollama containers running models in sidecars.
624
+ backend: str
625
+ Determines where and how to run the Ollama process.
626
+ force_pull: bool
627
+ Whether to run `ollama pull` no matter what, or first check the remote cache in Metaflow datastore for this model key.
628
+ cache_update_policy: str
629
+ Cache update policy: "auto", "force", or "never".
630
+ force_cache_update: bool
631
+ Simple override for "force" cache update policy.
632
+ debug: bool
633
+ Whether to turn on verbose debugging logs.
634
+ circuit_breaker_config: dict
635
+ Configuration for circuit breaker protection. Keys: failure_threshold, recovery_timeout, reset_timeout.
636
+ timeout_config: dict
637
+ Configuration for various operation timeouts. Keys: pull, stop, health_check, install, server_startup.
638
+ """
639
+ ...
640
+
641
+ 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]]]:
642
+ """
643
+ Specifies that this step should execute on DGX cloud.
520
644
 
521
- temp_dir_root : str, default: None
522
- The root directory under which `current.checkpoint.directory` will be created.
645
+
646
+ Parameters
647
+ ----------
648
+ gpu : int
649
+ Number of GPUs to use.
650
+ gpu_type : str
651
+ Type of Nvidia GPU to use.
523
652
  """
524
653
  ...
525
654
 
526
655
  @typing.overload
527
- def checkpoint(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
656
+ def nebius_s3_proxy(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
657
+ """
658
+ Nebius-specific S3 Proxy decorator for routing S3 requests through a local proxy service.
659
+ It exists to make it easier for users to know that this decorator should only be used with
660
+ a Neo Cloud like Nebius.
661
+ """
528
662
  ...
529
663
 
530
664
  @typing.overload
531
- def checkpoint(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
665
+ def nebius_s3_proxy(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
532
666
  ...
533
667
 
534
- 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):
668
+ def nebius_s3_proxy(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
535
669
  """
536
- Enables checkpointing for a step.
537
-
538
- > Examples
539
-
540
- - Saving Checkpoints
541
-
542
- ```python
543
- @checkpoint
544
- @step
545
- def train(self):
546
- model = create_model(self.parameters, checkpoint_path = None)
547
- for i in range(self.epochs):
548
- # some training logic
549
- loss = model.train(self.dataset)
550
- if i % 10 == 0:
551
- model.save(
552
- current.checkpoint.directory,
553
- )
554
- # saves the contents of the `current.checkpoint.directory` as a checkpoint
555
- # and returns a reference dictionary to the checkpoint saved in the datastore
556
- self.latest_checkpoint = current.checkpoint.save(
557
- name="epoch_checkpoint",
558
- metadata={
559
- "epoch": i,
560
- "loss": loss,
561
- }
562
- )
563
- ```
564
-
565
- - Using Loaded Checkpoints
566
-
567
- ```python
568
- @retry(times=3)
569
- @checkpoint
570
- @step
571
- def train(self):
572
- # Assume that the task has restarted and the previous attempt of the task
573
- # saved a checkpoint
574
- checkpoint_path = None
575
- if current.checkpoint.is_loaded: # Check if a checkpoint is loaded
576
- print("Loaded checkpoint from the previous attempt")
577
- checkpoint_path = current.checkpoint.directory
578
-
579
- model = create_model(self.parameters, checkpoint_path = checkpoint_path)
580
- for i in range(self.epochs):
581
- ...
582
- ```
583
-
584
-
585
- Parameters
586
- ----------
587
- load_policy : str, default: "fresh"
588
- The policy for loading the checkpoint. The following policies are supported:
589
- - "eager": Loads the the latest available checkpoint within the namespace.
590
- With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
591
- will be loaded at the start of the task.
592
- - "none": Do not load any checkpoint
593
- - "fresh": Loads the lastest checkpoint created within the running Task.
594
- This mode helps loading checkpoints across various retry attempts of the same task.
595
- With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
596
- created within the task will be loaded when the task is retries execution on failure.
597
-
598
- temp_dir_root : str, default: None
599
- The root directory under which `current.checkpoint.directory` will be created.
670
+ Nebius-specific S3 Proxy decorator for routing S3 requests through a local proxy service.
671
+ It exists to make it easier for users to know that this decorator should only be used with
672
+ a Neo Cloud like Nebius.
600
673
  """
601
674
  ...
602
675
 
603
676
  @typing.overload
604
- def test_append_card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
677
+ def coreweave_s3_proxy(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
605
678
  """
606
- A simple decorator that demonstrates using CardDecoratorInjector
607
- to inject a card and render simple markdown content.
679
+ CoreWeave-specific S3 Proxy decorator for routing S3 requests through a local proxy service.
680
+ It exists to make it easier for users to know that this decorator should only be used with
681
+ a Neo Cloud like CoreWeave.
608
682
  """
609
683
  ...
610
684
 
611
685
  @typing.overload
612
- def test_append_card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
686
+ def coreweave_s3_proxy(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
613
687
  ...
614
688
 
615
- def test_append_card(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
689
+ def coreweave_s3_proxy(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
616
690
  """
617
- A simple decorator that demonstrates using CardDecoratorInjector
618
- to inject a card and render simple markdown content.
691
+ CoreWeave-specific S3 Proxy decorator for routing S3 requests through a local proxy service.
692
+ It exists to make it easier for users to know that this decorator should only be used with
693
+ a Neo Cloud like CoreWeave.
619
694
  """
620
695
  ...
621
696
 
622
697
  @typing.overload
623
- def nebius_s3_proxy(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
698
+ 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]]]:
624
699
  """
625
- Nebius-specific S3 Proxy decorator for routing S3 requests through a local proxy service.
626
- It exists to make it easier for users to know that this decorator should only be used with
627
- a Neo Cloud like Nebius.
700
+ Specifies environment variables to be set prior to the execution of a step.
701
+
702
+
703
+ Parameters
704
+ ----------
705
+ vars : Dict[str, str], default {}
706
+ Dictionary of environment variables to set.
628
707
  """
629
708
  ...
630
709
 
631
710
  @typing.overload
632
- def nebius_s3_proxy(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
711
+ def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
633
712
  ...
634
713
 
635
- def nebius_s3_proxy(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
714
+ @typing.overload
715
+ def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
716
+ ...
717
+
718
+ def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
636
719
  """
637
- Nebius-specific S3 Proxy decorator for routing S3 requests through a local proxy service.
638
- It exists to make it easier for users to know that this decorator should only be used with
639
- a Neo Cloud like Nebius.
720
+ Specifies environment variables to be set prior to the execution of a step.
721
+
722
+
723
+ Parameters
724
+ ----------
725
+ vars : Dict[str, str], default {}
726
+ Dictionary of environment variables to set.
640
727
  """
641
728
  ...
642
729
 
@@ -699,104 +786,72 @@ def timeout(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None],
699
786
  """
700
787
  ...
701
788
 
702
- 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]]]:
703
- """
704
- Specifies that this step should execute on DGX cloud.
705
-
706
-
707
- Parameters
708
- ----------
709
- gpu : int
710
- Number of GPUs to use.
711
- gpu_type : str
712
- Type of Nvidia GPU to use.
713
- queue_timeout : int
714
- Time to keep the job in NVCF's queue.
715
- """
716
- ...
717
-
718
789
  @typing.overload
719
- 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]]]:
790
+ def app_deploy(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
720
791
  """
721
- Specifies the number of times the task corresponding
722
- to a step needs to be retried.
723
-
724
- This decorator is useful for handling transient errors, such as networking issues.
725
- If your task contains operations that can't be retried safely, e.g. database updates,
726
- it is advisable to annotate it with `@retry(times=0)`.
727
-
728
- This can be used in conjunction with the `@catch` decorator. The `@catch`
729
- decorator will execute a no-op task after all retries have been exhausted,
730
- ensuring that the flow execution can continue.
731
-
732
-
733
- Parameters
734
- ----------
735
- times : int, default 3
736
- Number of times to retry this task.
737
- minutes_between_retries : int, default 2
738
- Number of minutes between retries.
792
+ Decorator prototype for all step decorators. This function gets specialized
793
+ and imported for all decorators types by _import_plugin_decorators().
739
794
  """
740
795
  ...
741
796
 
742
797
  @typing.overload
743
- def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
798
+ def app_deploy(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
744
799
  ...
745
800
 
746
- @typing.overload
747
- def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
801
+ def app_deploy(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
802
+ """
803
+ Decorator prototype for all step decorators. This function gets specialized
804
+ and imported for all decorators types by _import_plugin_decorators().
805
+ """
748
806
  ...
749
807
 
750
- 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):
808
+ @typing.overload
809
+ def secrets(*, sources: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = [], role: 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]]]:
751
810
  """
752
- Specifies the number of times the task corresponding
753
- to a step needs to be retried.
754
-
755
- This decorator is useful for handling transient errors, such as networking issues.
756
- If your task contains operations that can't be retried safely, e.g. database updates,
757
- it is advisable to annotate it with `@retry(times=0)`.
758
-
759
- This can be used in conjunction with the `@catch` decorator. The `@catch`
760
- decorator will execute a no-op task after all retries have been exhausted,
761
- ensuring that the flow execution can continue.
811
+ Specifies secrets to be retrieved and injected as environment variables prior to
812
+ the execution of a step.
762
813
 
763
814
 
764
815
  Parameters
765
816
  ----------
766
- times : int, default 3
767
- Number of times to retry this task.
768
- minutes_between_retries : int, default 2
769
- Number of minutes between retries.
817
+ sources : List[Union[str, Dict[str, Any]]], default: []
818
+ List of secret specs, defining how the secrets are to be retrieved
819
+ role : str, optional, default: None
820
+ Role to use for fetching secrets
770
821
  """
771
822
  ...
772
823
 
773
824
  @typing.overload
774
- def app_deploy(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
775
- """
776
- Decorator prototype for all step decorators. This function gets specialized
777
- and imported for all decorators types by _import_plugin_decorators().
778
- """
825
+ def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
779
826
  ...
780
827
 
781
828
  @typing.overload
782
- def app_deploy(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
783
- ...
784
-
785
- def app_deploy(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
786
- """
787
- Decorator prototype for all step decorators. This function gets specialized
788
- and imported for all decorators types by _import_plugin_decorators().
789
- """
829
+ def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
790
830
  ...
791
831
 
792
- def s3_proxy(*, integration_name: typing.Optional[str] = None, write_mode: typing.Optional[str] = None, debug: typing.Optional[bool] = 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]]]:
832
+ 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]]] = [], role: typing.Optional[str] = None):
793
833
  """
794
- S3 Proxy decorator for routing S3 requests through a local proxy service.
834
+ Specifies secrets to be retrieved and injected as environment variables prior to
835
+ the execution of a step.
795
836
 
796
837
 
797
838
  Parameters
798
839
  ----------
799
- integration_name : str, optional
840
+ sources : List[Union[str, Dict[str, Any]]], default: []
841
+ List of secret specs, defining how the secrets are to be retrieved
842
+ role : str, optional, default: None
843
+ Role to use for fetching secrets
844
+ """
845
+ ...
846
+
847
+ def s3_proxy(*, integration_name: typing.Optional[str] = None, write_mode: typing.Optional[str] = None, debug: typing.Optional[bool] = 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]]]:
848
+ """
849
+ S3 Proxy decorator for routing S3 requests through a local proxy service.
850
+
851
+
852
+ Parameters
853
+ ----------
854
+ integration_name : str, optional
800
855
  Name of the S3 proxy integration. If not specified, will use the only
801
856
  available S3 proxy integration in the namespace (fails if multiple exist).
802
857
  write_mode : str, optional
@@ -812,51 +867,38 @@ def s3_proxy(*, integration_name: typing.Optional[str] = None, write_mode: typin
812
867
  ...
813
868
 
814
869
  @typing.overload
815
- 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]]]:
870
+ def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
816
871
  """
817
- Creates a human-readable report, a Metaflow Card, after this step completes.
818
-
819
- Note that you may add multiple `@card` decorators in a step with different parameters.
820
-
821
-
822
- Parameters
823
- ----------
824
- type : str, default 'default'
825
- Card type.
826
- id : str, optional, default None
827
- If multiple cards are present, use this id to identify this card.
828
- options : Dict[str, Any], default {}
829
- Options passed to the card. The contents depend on the card type.
830
- timeout : int, default 45
831
- Interrupt reporting if it takes more than this many seconds.
872
+ Internal decorator to support Fast bakery
832
873
  """
833
874
  ...
834
875
 
835
876
  @typing.overload
836
- def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
877
+ def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
878
+ ...
879
+
880
+ def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
881
+ """
882
+ Internal decorator to support Fast bakery
883
+ """
837
884
  ...
838
885
 
839
886
  @typing.overload
840
- def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
887
+ def test_append_card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
888
+ """
889
+ A simple decorator that demonstrates using CardDecoratorInjector
890
+ to inject a card and render simple markdown content.
891
+ """
841
892
  ...
842
893
 
843
- 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):
894
+ @typing.overload
895
+ def test_append_card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
896
+ ...
897
+
898
+ def test_append_card(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
844
899
  """
845
- Creates a human-readable report, a Metaflow Card, after this step completes.
846
-
847
- Note that you may add multiple `@card` decorators in a step with different parameters.
848
-
849
-
850
- Parameters
851
- ----------
852
- type : str, default 'default'
853
- Card type.
854
- id : str, optional, default None
855
- If multiple cards are present, use this id to identify this card.
856
- options : Dict[str, Any], default {}
857
- Options passed to the card. The contents depend on the card type.
858
- timeout : int, default 45
859
- Interrupt reporting if it takes more than this many seconds.
900
+ A simple decorator that demonstrates using CardDecoratorInjector
901
+ to inject a card and render simple markdown content.
860
902
  """
861
903
  ...
862
904
 
@@ -940,53 +982,133 @@ def huggingface_hub(*, temp_dir_root: typing.Optional[str] = None, load: typing.
940
982
  """
941
983
  ...
942
984
 
943
- def vllm(*, model: str, backend: str, openai_api_server: bool, debug: bool, card_refresh_interval: int, max_retries: int, retry_alert_frequency: int, engine_args: dict) -> 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]]]:
985
+ @typing.overload
986
+ 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]]]:
944
987
  """
945
- This decorator is used to run vllm APIs as Metaflow task sidecars.
988
+ Specifies the resources needed when executing this step.
946
989
 
947
- User code call
948
- --------------
949
- @vllm(
950
- model="...",
951
- ...
952
- )
990
+ Use `@resources` to specify the resource requirements
991
+ independently of the specific compute layer (`@batch`, `@kubernetes`).
953
992
 
954
- Valid backend options
955
- ---------------------
956
- - 'local': Run as a separate process on the local task machine.
993
+ You can choose the compute layer on the command line by executing e.g.
994
+ ```
995
+ python myflow.py run --with batch
996
+ ```
997
+ or
998
+ ```
999
+ python myflow.py run --with kubernetes
1000
+ ```
1001
+ which executes the flow on the desired system using the
1002
+ requirements specified in `@resources`.
957
1003
 
958
- Valid model options
959
- -------------------
960
- Any HuggingFace model identifier, e.g. 'meta-llama/Llama-3.2-1B'
961
1004
 
962
- NOTE: vLLM's OpenAI-compatible server serves ONE model per server instance.
963
- If you need multiple models, you must create multiple @vllm decorators.
1005
+ Parameters
1006
+ ----------
1007
+ cpu : int, default 1
1008
+ Number of CPUs required for this step.
1009
+ gpu : int, optional, default None
1010
+ Number of GPUs required for this step.
1011
+ disk : int, optional, default None
1012
+ Disk size (in MB) required for this step. Only applies on Kubernetes.
1013
+ memory : int, default 4096
1014
+ Memory size (in MB) required for this step.
1015
+ shared_memory : int, optional, default None
1016
+ The value for the size (in MiB) of the /dev/shm volume for this step.
1017
+ This parameter maps to the `--shm-size` option in Docker.
1018
+ """
1019
+ ...
1020
+
1021
+ @typing.overload
1022
+ def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1023
+ ...
1024
+
1025
+ @typing.overload
1026
+ def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1027
+ ...
1028
+
1029
+ 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):
1030
+ """
1031
+ Specifies the resources needed when executing this step.
1032
+
1033
+ Use `@resources` to specify the resource requirements
1034
+ independently of the specific compute layer (`@batch`, `@kubernetes`).
1035
+
1036
+ You can choose the compute layer on the command line by executing e.g.
1037
+ ```
1038
+ python myflow.py run --with batch
1039
+ ```
1040
+ or
1041
+ ```
1042
+ python myflow.py run --with kubernetes
1043
+ ```
1044
+ which executes the flow on the desired system using the
1045
+ requirements specified in `@resources`.
964
1046
 
965
1047
 
966
1048
  Parameters
967
1049
  ----------
968
- model: str
969
- HuggingFace model identifier to be served by vLLM.
970
- backend: str
971
- Determines where and how to run the vLLM process.
972
- openai_api_server: bool
973
- Whether to use OpenAI-compatible API server mode (subprocess) instead of native engine.
974
- Default is False (uses native engine).
975
- Set to True for backward compatibility with existing code.
976
- debug: bool
977
- Whether to turn on verbose debugging logs.
978
- card_refresh_interval: int
979
- Interval in seconds for refreshing the vLLM status card.
980
- Only used when openai_api_server=True.
981
- max_retries: int
982
- Maximum number of retries checking for vLLM server startup.
983
- Only used when openai_api_server=True.
984
- retry_alert_frequency: int
985
- Frequency of alert logs for vLLM server startup retries.
986
- Only used when openai_api_server=True.
987
- engine_args : dict
988
- Additional keyword arguments to pass to the vLLM engine.
989
- For example, `tensor_parallel_size=2`.
1050
+ cpu : int, default 1
1051
+ Number of CPUs required for this step.
1052
+ gpu : int, optional, default None
1053
+ Number of GPUs required for this step.
1054
+ disk : int, optional, default None
1055
+ Disk size (in MB) required for this step. Only applies on Kubernetes.
1056
+ memory : int, default 4096
1057
+ Memory size (in MB) required for this step.
1058
+ shared_memory : int, optional, default None
1059
+ The value for the size (in MiB) of the /dev/shm volume for this step.
1060
+ This parameter maps to the `--shm-size` option in Docker.
1061
+ """
1062
+ ...
1063
+
1064
+ @typing.overload
1065
+ 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]]]:
1066
+ """
1067
+ Specifies that the step will success under all circumstances.
1068
+
1069
+ The decorator will create an optional artifact, specified by `var`, which
1070
+ contains the exception raised. You can use it to detect the presence
1071
+ of errors, indicating that all happy-path artifacts produced by the step
1072
+ are missing.
1073
+
1074
+
1075
+ Parameters
1076
+ ----------
1077
+ var : str, optional, default None
1078
+ Name of the artifact in which to store the caught exception.
1079
+ If not specified, the exception is not stored.
1080
+ print_exception : bool, default True
1081
+ Determines whether or not the exception is printed to
1082
+ stdout when caught.
1083
+ """
1084
+ ...
1085
+
1086
+ @typing.overload
1087
+ def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1088
+ ...
1089
+
1090
+ @typing.overload
1091
+ def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1092
+ ...
1093
+
1094
+ 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):
1095
+ """
1096
+ Specifies that the step will success under all circumstances.
1097
+
1098
+ The decorator will create an optional artifact, specified by `var`, which
1099
+ contains the exception raised. You can use it to detect the presence
1100
+ of errors, indicating that all happy-path artifacts produced by the step
1101
+ are missing.
1102
+
1103
+
1104
+ Parameters
1105
+ ----------
1106
+ var : str, optional, default None
1107
+ Name of the artifact in which to store the caught exception.
1108
+ If not specified, the exception is not stored.
1109
+ print_exception : bool, default True
1110
+ Determines whether or not the exception is printed to
1111
+ stdout when caught.
990
1112
  """
991
1113
  ...
992
1114
 
@@ -1080,512 +1202,243 @@ def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: ty
1080
1202
  ...
1081
1203
 
1082
1204
  @typing.overload
1083
- def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1084
- """
1085
- Decorator prototype for all step decorators. This function gets specialized
1086
- and imported for all decorators types by _import_plugin_decorators().
1087
- """
1088
- ...
1089
-
1090
- @typing.overload
1091
- def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1092
- ...
1093
-
1094
- def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
1095
- """
1096
- Decorator prototype for all step decorators. This function gets specialized
1097
- and imported for all decorators types by _import_plugin_decorators().
1098
- """
1099
- ...
1100
-
1101
- @typing.overload
1102
- def secrets(*, sources: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = [], role: 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]]]:
1205
+ 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]]]:
1103
1206
  """
1104
- Specifies secrets to be retrieved and injected as environment variables prior to
1105
- the execution of a step.
1207
+ Enables checkpointing for a step.
1106
1208
 
1209
+ > Examples
1107
1210
 
1108
- Parameters
1109
- ----------
1110
- sources : List[Union[str, Dict[str, Any]]], default: []
1111
- List of secret specs, defining how the secrets are to be retrieved
1112
- role : str, optional, default: None
1113
- Role to use for fetching secrets
1114
- """
1115
- ...
1116
-
1117
- @typing.overload
1118
- def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1119
- ...
1120
-
1121
- @typing.overload
1122
- def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1123
- ...
1124
-
1125
- 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]]] = [], role: typing.Optional[str] = None):
1126
- """
1127
- Specifies secrets to be retrieved and injected as environment variables prior to
1128
- the execution of a step.
1129
-
1130
-
1131
- Parameters
1132
- ----------
1133
- sources : List[Union[str, Dict[str, Any]]], default: []
1134
- List of secret specs, defining how the secrets are to be retrieved
1135
- role : str, optional, default: None
1136
- Role to use for fetching secrets
1137
- """
1138
- ...
1139
-
1140
- @typing.overload
1141
- def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1142
- """
1143
- Internal decorator to support Fast bakery
1144
- """
1145
- ...
1146
-
1147
- @typing.overload
1148
- def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1149
- ...
1150
-
1151
- def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
1152
- """
1153
- Internal decorator to support Fast bakery
1154
- """
1155
- ...
1156
-
1157
- @typing.overload
1158
- 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]]]:
1159
- """
1160
- Specifies the resources needed when executing this step.
1161
-
1162
- Use `@resources` to specify the resource requirements
1163
- independently of the specific compute layer (`@batch`, `@kubernetes`).
1211
+ - Saving Checkpoints
1164
1212
 
1165
- You can choose the compute layer on the command line by executing e.g.
1166
- ```
1167
- python myflow.py run --with batch
1168
- ```
1169
- or
1170
- ```
1171
- python myflow.py run --with kubernetes
1213
+ ```python
1214
+ @checkpoint
1215
+ @step
1216
+ def train(self):
1217
+ model = create_model(self.parameters, checkpoint_path = None)
1218
+ for i in range(self.epochs):
1219
+ # some training logic
1220
+ loss = model.train(self.dataset)
1221
+ if i % 10 == 0:
1222
+ model.save(
1223
+ current.checkpoint.directory,
1224
+ )
1225
+ # saves the contents of the `current.checkpoint.directory` as a checkpoint
1226
+ # and returns a reference dictionary to the checkpoint saved in the datastore
1227
+ self.latest_checkpoint = current.checkpoint.save(
1228
+ name="epoch_checkpoint",
1229
+ metadata={
1230
+ "epoch": i,
1231
+ "loss": loss,
1232
+ }
1233
+ )
1172
1234
  ```
1173
- which executes the flow on the desired system using the
1174
- requirements specified in `@resources`.
1175
-
1176
1235
 
1177
- Parameters
1178
- ----------
1179
- cpu : int, default 1
1180
- Number of CPUs required for this step.
1181
- gpu : int, optional, default None
1182
- Number of GPUs required for this step.
1183
- disk : int, optional, default None
1184
- Disk size (in MB) required for this step. Only applies on Kubernetes.
1185
- memory : int, default 4096
1186
- Memory size (in MB) required for this step.
1187
- shared_memory : int, optional, default None
1188
- The value for the size (in MiB) of the /dev/shm volume for this step.
1189
- This parameter maps to the `--shm-size` option in Docker.
1190
- """
1191
- ...
1192
-
1193
- @typing.overload
1194
- def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1195
- ...
1196
-
1197
- @typing.overload
1198
- def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1199
- ...
1200
-
1201
- 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):
1202
- """
1203
- Specifies the resources needed when executing this step.
1236
+ - Using Loaded Checkpoints
1204
1237
 
1205
- Use `@resources` to specify the resource requirements
1206
- independently of the specific compute layer (`@batch`, `@kubernetes`).
1238
+ ```python
1239
+ @retry(times=3)
1240
+ @checkpoint
1241
+ @step
1242
+ def train(self):
1243
+ # Assume that the task has restarted and the previous attempt of the task
1244
+ # saved a checkpoint
1245
+ checkpoint_path = None
1246
+ if current.checkpoint.is_loaded: # Check if a checkpoint is loaded
1247
+ print("Loaded checkpoint from the previous attempt")
1248
+ checkpoint_path = current.checkpoint.directory
1207
1249
 
1208
- You can choose the compute layer on the command line by executing e.g.
1209
- ```
1210
- python myflow.py run --with batch
1211
- ```
1212
- or
1213
- ```
1214
- python myflow.py run --with kubernetes
1250
+ model = create_model(self.parameters, checkpoint_path = checkpoint_path)
1251
+ for i in range(self.epochs):
1252
+ ...
1215
1253
  ```
1216
- which executes the flow on the desired system using the
1217
- requirements specified in `@resources`.
1218
1254
 
1219
1255
 
1220
1256
  Parameters
1221
1257
  ----------
1222
- cpu : int, default 1
1223
- Number of CPUs required for this step.
1224
- gpu : int, optional, default None
1225
- Number of GPUs required for this step.
1226
- disk : int, optional, default None
1227
- Disk size (in MB) required for this step. Only applies on Kubernetes.
1228
- memory : int, default 4096
1229
- Memory size (in MB) required for this step.
1230
- shared_memory : int, optional, default None
1231
- The value for the size (in MiB) of the /dev/shm volume for this step.
1232
- This parameter maps to the `--shm-size` option in Docker.
1233
- """
1234
- ...
1235
-
1236
- @typing.overload
1237
- 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]]]:
1238
- """
1239
- Specifies that the step will success under all circumstances.
1240
-
1241
- The decorator will create an optional artifact, specified by `var`, which
1242
- contains the exception raised. You can use it to detect the presence
1243
- of errors, indicating that all happy-path artifacts produced by the step
1244
- are missing.
1245
-
1246
-
1247
- Parameters
1248
- ----------
1249
- var : str, optional, default None
1250
- Name of the artifact in which to store the caught exception.
1251
- If not specified, the exception is not stored.
1252
- print_exception : bool, default True
1253
- Determines whether or not the exception is printed to
1254
- stdout when caught.
1255
- """
1256
- ...
1257
-
1258
- @typing.overload
1259
- def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1260
- ...
1261
-
1262
- @typing.overload
1263
- def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1264
- ...
1265
-
1266
- 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):
1267
- """
1268
- Specifies that the step will success under all circumstances.
1269
-
1270
- The decorator will create an optional artifact, specified by `var`, which
1271
- contains the exception raised. You can use it to detect the presence
1272
- of errors, indicating that all happy-path artifacts produced by the step
1273
- are missing.
1274
-
1258
+ load_policy : str, default: "fresh"
1259
+ The policy for loading the checkpoint. The following policies are supported:
1260
+ - "eager": Loads the the latest available checkpoint within the namespace.
1261
+ With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
1262
+ will be loaded at the start of the task.
1263
+ - "none": Do not load any checkpoint
1264
+ - "fresh": Loads the lastest checkpoint created within the running Task.
1265
+ This mode helps loading checkpoints across various retry attempts of the same task.
1266
+ With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
1267
+ created within the task will be loaded when the task is retries execution on failure.
1275
1268
 
1276
- Parameters
1277
- ----------
1278
- var : str, optional, default None
1279
- Name of the artifact in which to store the caught exception.
1280
- If not specified, the exception is not stored.
1281
- print_exception : bool, default True
1282
- Determines whether or not the exception is printed to
1283
- stdout when caught.
1269
+ temp_dir_root : str, default: None
1270
+ The root directory under which `current.checkpoint.directory` will be created.
1284
1271
  """
1285
1272
  ...
1286
1273
 
1287
1274
  @typing.overload
1288
- def coreweave_s3_proxy(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1289
- """
1290
- CoreWeave-specific S3 Proxy decorator for routing S3 requests through a local proxy service.
1291
- It exists to make it easier for users to know that this decorator should only be used with
1292
- a Neo Cloud like CoreWeave.
1293
- """
1275
+ def checkpoint(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1294
1276
  ...
1295
1277
 
1296
1278
  @typing.overload
1297
- def coreweave_s3_proxy(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1298
- ...
1299
-
1300
- def coreweave_s3_proxy(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
1301
- """
1302
- CoreWeave-specific S3 Proxy decorator for routing S3 requests through a local proxy service.
1303
- It exists to make it easier for users to know that this decorator should only be used with
1304
- a Neo Cloud like CoreWeave.
1305
- """
1279
+ def checkpoint(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1306
1280
  ...
1307
1281
 
1308
- def ollama(*, models: list, backend: str, force_pull: bool, cache_update_policy: str, force_cache_update: bool, debug: bool, circuit_breaker_config: dict, timeout_config: dict) -> 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]]]:
1282
+ 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):
1309
1283
  """
1310
- This decorator is used to run Ollama APIs as Metaflow task sidecars.
1311
-
1312
- User code call
1313
- --------------
1314
- @ollama(
1315
- models=[...],
1316
- ...
1317
- )
1284
+ Enables checkpointing for a step.
1318
1285
 
1319
- Valid backend options
1320
- ---------------------
1321
- - 'local': Run as a separate process on the local task machine.
1322
- - (TODO) 'managed': Outerbounds hosts and selects compute provider.
1323
- - (TODO) 'remote': Spin up separate instance to serve Ollama models.
1286
+ > Examples
1324
1287
 
1325
- Valid model options
1326
- -------------------
1327
- Any model here https://ollama.com/search, e.g. 'llama3.2', 'llama3.3'
1288
+ - Saving Checkpoints
1328
1289
 
1290
+ ```python
1291
+ @checkpoint
1292
+ @step
1293
+ def train(self):
1294
+ model = create_model(self.parameters, checkpoint_path = None)
1295
+ for i in range(self.epochs):
1296
+ # some training logic
1297
+ loss = model.train(self.dataset)
1298
+ if i % 10 == 0:
1299
+ model.save(
1300
+ current.checkpoint.directory,
1301
+ )
1302
+ # saves the contents of the `current.checkpoint.directory` as a checkpoint
1303
+ # and returns a reference dictionary to the checkpoint saved in the datastore
1304
+ self.latest_checkpoint = current.checkpoint.save(
1305
+ name="epoch_checkpoint",
1306
+ metadata={
1307
+ "epoch": i,
1308
+ "loss": loss,
1309
+ }
1310
+ )
1311
+ ```
1329
1312
 
1330
- Parameters
1331
- ----------
1332
- models: list[str]
1333
- List of Ollama containers running models in sidecars.
1334
- backend: str
1335
- Determines where and how to run the Ollama process.
1336
- force_pull: bool
1337
- Whether to run `ollama pull` no matter what, or first check the remote cache in Metaflow datastore for this model key.
1338
- cache_update_policy: str
1339
- Cache update policy: "auto", "force", or "never".
1340
- force_cache_update: bool
1341
- Simple override for "force" cache update policy.
1342
- debug: bool
1343
- Whether to turn on verbose debugging logs.
1344
- circuit_breaker_config: dict
1345
- Configuration for circuit breaker protection. Keys: failure_threshold, recovery_timeout, reset_timeout.
1346
- timeout_config: dict
1347
- Configuration for various operation timeouts. Keys: pull, stop, health_check, install, server_startup.
1348
- """
1349
- ...
1350
-
1351
- 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]]:
1352
- """
1353
- 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)
1354
- before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
1355
- and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
1356
- added as a flow decorators. Adding more than one decorator will ensure that `start` step
1357
- starts only after all sensors finish.
1313
+ - Using Loaded Checkpoints
1358
1314
 
1315
+ ```python
1316
+ @retry(times=3)
1317
+ @checkpoint
1318
+ @step
1319
+ def train(self):
1320
+ # Assume that the task has restarted and the previous attempt of the task
1321
+ # saved a checkpoint
1322
+ checkpoint_path = None
1323
+ if current.checkpoint.is_loaded: # Check if a checkpoint is loaded
1324
+ print("Loaded checkpoint from the previous attempt")
1325
+ checkpoint_path = current.checkpoint.directory
1359
1326
 
1360
- Parameters
1361
- ----------
1362
- timeout : int
1363
- Time, in seconds before the task times out and fails. (Default: 3600)
1364
- poke_interval : int
1365
- Time in seconds that the job should wait in between each try. (Default: 60)
1366
- mode : str
1367
- How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1368
- exponential_backoff : bool
1369
- allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1370
- pool : str
1371
- the slot pool this task should run in,
1372
- slot pools are a way to limit concurrency for certain tasks. (Default:None)
1373
- soft_fail : bool
1374
- Set to true to mark the task as SKIPPED on failure. (Default: False)
1375
- name : str
1376
- Name of the sensor on Airflow
1377
- description : str
1378
- Description of sensor in the Airflow UI
1379
- bucket_key : Union[str, List[str]]
1380
- The key(s) being waited on. Supports full s3:// style url or relative path from root level.
1381
- When it's specified as a full s3:// url, please leave `bucket_name` as None
1382
- bucket_name : str
1383
- Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
1384
- When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
1385
- wildcard_match : bool
1386
- whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
1387
- aws_conn_id : str
1388
- a reference to the s3 connection on Airflow. (Default: None)
1389
- verify : bool
1390
- Whether or not to verify SSL certificates for S3 connection. (Default: None)
1391
- """
1392
- ...
1393
-
1394
- def airflow_external_task_sensor(*, timeout: int, poke_interval: int, mode: str, exponential_backoff: bool, pool: str, soft_fail: bool, name: str, description: str, external_dag_id: str, external_task_ids: typing.List[str], allowed_states: typing.List[str], failed_states: typing.List[str], execution_delta: "datetime.timedelta", check_existence: bool) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1395
- """
1396
- The `@airflow_external_task_sensor` decorator attaches a Airflow [ExternalTaskSensor](https://airflow.apache.org/docs/apache-airflow/stable/_api/airflow/sensors/external_task/index.html#airflow.sensors.external_task.ExternalTaskSensor) before the start step of the flow.
1397
- This decorator only works when a flow is scheduled on Airflow and is compiled using `airflow create`. More than one `@airflow_external_task_sensor` can be added as a flow decorators. Adding more than one decorator will ensure that `start` step starts only after all sensors finish.
1327
+ model = create_model(self.parameters, checkpoint_path = checkpoint_path)
1328
+ for i in range(self.epochs):
1329
+ ...
1330
+ ```
1398
1331
 
1399
1332
 
1400
1333
  Parameters
1401
1334
  ----------
1402
- timeout : int
1403
- Time, in seconds before the task times out and fails. (Default: 3600)
1404
- poke_interval : int
1405
- Time in seconds that the job should wait in between each try. (Default: 60)
1406
- mode : str
1407
- How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1408
- exponential_backoff : bool
1409
- allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1410
- pool : str
1411
- the slot pool this task should run in,
1412
- slot pools are a way to limit concurrency for certain tasks. (Default:None)
1413
- soft_fail : bool
1414
- Set to true to mark the task as SKIPPED on failure. (Default: False)
1415
- name : str
1416
- Name of the sensor on Airflow
1417
- description : str
1418
- Description of sensor in the Airflow UI
1419
- external_dag_id : str
1420
- The dag_id that contains the task you want to wait for.
1421
- external_task_ids : List[str]
1422
- The list of task_ids that you want to wait for.
1423
- If None (default value) the sensor waits for the DAG. (Default: None)
1424
- allowed_states : List[str]
1425
- Iterable of allowed states, (Default: ['success'])
1426
- failed_states : List[str]
1427
- Iterable of failed or dis-allowed states. (Default: None)
1428
- execution_delta : datetime.timedelta
1429
- time difference with the previous execution to look at,
1430
- the default is the same logical date as the current task or DAG. (Default: None)
1431
- check_existence: bool
1432
- Set to True to check if the external task exists or check if
1433
- the DAG to wait for exists. (Default: True)
1434
- """
1435
- ...
1436
-
1437
- def with_artifact_store(f: typing.Optional[typing.Type[FlowSpecDerived]] = None):
1438
- """
1439
- Allows setting external datastores to save data for the
1440
- `@checkpoint`/`@model`/`@huggingface_hub` decorators.
1441
-
1442
- This decorator is useful when users wish to save data to a different datastore
1443
- than what is configured in Metaflow. This can be for variety of reasons:
1444
-
1445
- 1. Data security: The objects needs to be stored in a bucket (object storage) that is not accessible by other flows.
1446
- 2. Data Locality: The location where the task is executing is not located in the same region as the datastore.
1447
- - Example: Metaflow datastore lives in US East, but the task is executing in Finland datacenters.
1448
- 3. Data Lifecycle Policies: The objects need to be archived / managed separately from the Metaflow managed objects.
1449
- - Example: Flow is training very large models that need to be stored separately and will be deleted more aggressively than the Metaflow managed objects.
1450
-
1451
- Usage:
1452
- ----------
1453
-
1454
- - Using a custom IAM role to access the datastore.
1455
-
1456
- ```python
1457
- @with_artifact_store(
1458
- type="s3",
1459
- config=lambda: {
1460
- "root": "s3://my-bucket-foo/path/to/root",
1461
- "role_arn": ROLE,
1462
- },
1463
- )
1464
- class MyFlow(FlowSpec):
1465
-
1466
- @checkpoint
1467
- @step
1468
- def start(self):
1469
- with open("my_file.txt", "w") as f:
1470
- f.write("Hello, World!")
1471
- self.external_bucket_checkpoint = current.checkpoint.save("my_file.txt")
1472
- self.next(self.end)
1473
-
1474
- ```
1475
-
1476
- - Using credentials to access the s3-compatible datastore.
1477
-
1478
- ```python
1479
- @with_artifact_store(
1480
- type="s3",
1481
- config=lambda: {
1482
- "root": "s3://my-bucket-foo/path/to/root",
1483
- "client_params": {
1484
- "aws_access_key_id": os.environ.get("MY_CUSTOM_ACCESS_KEY"),
1485
- "aws_secret_access_key": os.environ.get("MY_CUSTOM_SECRET_KEY"),
1486
- },
1487
- },
1488
- )
1489
- class MyFlow(FlowSpec):
1490
-
1491
- @checkpoint
1492
- @step
1493
- def start(self):
1494
- with open("my_file.txt", "w") as f:
1495
- f.write("Hello, World!")
1496
- self.external_bucket_checkpoint = current.checkpoint.save("my_file.txt")
1497
- self.next(self.end)
1498
-
1499
- ```
1500
-
1501
- - Accessing objects stored in external datastores after task execution.
1502
-
1503
- ```python
1504
- run = Run("CheckpointsTestsFlow/8992")
1505
- with artifact_store_from(run=run, config={
1506
- "client_params": {
1507
- "aws_access_key_id": os.environ.get("MY_CUSTOM_ACCESS_KEY"),
1508
- "aws_secret_access_key": os.environ.get("MY_CUSTOM_SECRET_KEY"),
1509
- },
1510
- }):
1511
- with Checkpoint() as cp:
1512
- latest = cp.list(
1513
- task=run["start"].task
1514
- )[0]
1515
- print(latest)
1516
- cp.load(
1517
- latest,
1518
- "test-checkpoints"
1519
- )
1520
-
1521
- task = Task("TorchTuneFlow/8484/train/53673")
1522
- with artifact_store_from(run=run, config={
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
- load_model(
1529
- task.data.model_ref,
1530
- "test-models"
1531
- )
1532
- ```
1533
- Parameters:
1534
- ----------
1535
-
1536
- type: str
1537
- The type of the datastore. Can be one of 's3', 'gcs', 'azure' or any other supported metaflow Datastore.
1538
-
1539
- config: dict or Callable
1540
- Dictionary of configuration options for the datastore. The following keys are required:
1541
- - root: The root path in the datastore where the data will be saved. (needs to be in the format expected by the datastore)
1542
- - example: 's3://bucket-name/path/to/root'
1543
- - example: 'gs://bucket-name/path/to/root'
1544
- - example: 'https://myblockacc.blob.core.windows.net/metaflow/'
1545
- - role_arn (optional): AWS IAM role to access s3 bucket (only when `type` is 's3')
1546
- - session_vars (optional): AWS session variables to access s3 bucket (only when `type` is 's3')
1547
- - client_params (optional): AWS client parameters to access s3 bucket (only when `type` is 's3')
1335
+ load_policy : str, default: "fresh"
1336
+ The policy for loading the checkpoint. The following policies are supported:
1337
+ - "eager": Loads the the latest available checkpoint within the namespace.
1338
+ With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
1339
+ will be loaded at the start of the task.
1340
+ - "none": Do not load any checkpoint
1341
+ - "fresh": Loads the lastest checkpoint created within the running Task.
1342
+ This mode helps loading checkpoints across various retry attempts of the same task.
1343
+ With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
1344
+ created within the task will be loaded when the task is retries execution on failure.
1345
+
1346
+ temp_dir_root : str, default: None
1347
+ The root directory under which `current.checkpoint.directory` will be created.
1548
1348
  """
1549
1349
  ...
1550
1350
 
1551
1351
  @typing.overload
1552
- def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1352
+ 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]]:
1553
1353
  """
1554
- Specifies the PyPI packages for all steps of the flow.
1354
+ Specifies the Conda environment for all steps of the flow.
1355
+
1356
+ Use `@conda_base` to set common libraries required by all
1357
+ steps and use `@conda` to specify step-specific additions.
1555
1358
 
1556
- Use `@pypi_base` to set common packages required by all
1557
- steps and use `@pypi` to specify step-specific overrides.
1558
1359
 
1559
1360
  Parameters
1560
1361
  ----------
1561
- packages : Dict[str, str], default: {}
1362
+ packages : Dict[str, str], default {}
1562
1363
  Packages to use for this flow. The key is the name of the package
1563
1364
  and the value is the version to use.
1564
- python : str, optional, default: None
1365
+ libraries : Dict[str, str], default {}
1366
+ Supported for backward compatibility. When used with packages, packages will take precedence.
1367
+ python : str, optional, default None
1565
1368
  Version of Python to use, e.g. '3.7.4'. A default value of None implies
1566
1369
  that the version used will correspond to the version of the Python interpreter used to start the run.
1370
+ disabled : bool, default False
1371
+ If set to True, disables Conda.
1567
1372
  """
1568
1373
  ...
1569
1374
 
1570
1375
  @typing.overload
1571
- def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1376
+ def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1572
1377
  ...
1573
1378
 
1574
- def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
1379
+ 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):
1575
1380
  """
1576
- Specifies the PyPI packages for all steps of the flow.
1381
+ Specifies the Conda environment for all steps of the flow.
1382
+
1383
+ Use `@conda_base` to set common libraries required by all
1384
+ steps and use `@conda` to specify step-specific additions.
1577
1385
 
1578
- Use `@pypi_base` to set common packages required by all
1579
- steps and use `@pypi` to specify step-specific overrides.
1580
1386
 
1581
1387
  Parameters
1582
1388
  ----------
1583
- packages : Dict[str, str], default: {}
1389
+ packages : Dict[str, str], default {}
1584
1390
  Packages to use for this flow. The key is the name of the package
1585
1391
  and the value is the version to use.
1586
- python : str, optional, default: None
1392
+ libraries : Dict[str, str], default {}
1393
+ Supported for backward compatibility. When used with packages, packages will take precedence.
1394
+ python : str, optional, default None
1587
1395
  Version of Python to use, e.g. '3.7.4'. A default value of None implies
1588
1396
  that the version used will correspond to the version of the Python interpreter used to start the run.
1397
+ disabled : bool, default False
1398
+ If set to True, disables Conda.
1399
+ """
1400
+ ...
1401
+
1402
+ def airflow_external_task_sensor(*, timeout: int, poke_interval: int, mode: str, exponential_backoff: bool, pool: str, soft_fail: bool, name: str, description: str, external_dag_id: str, external_task_ids: typing.List[str], allowed_states: typing.List[str], failed_states: typing.List[str], execution_delta: "datetime.timedelta", check_existence: bool) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1403
+ """
1404
+ The `@airflow_external_task_sensor` decorator attaches a Airflow [ExternalTaskSensor](https://airflow.apache.org/docs/apache-airflow/stable/_api/airflow/sensors/external_task/index.html#airflow.sensors.external_task.ExternalTaskSensor) before the start step of the flow.
1405
+ This decorator only works when a flow is scheduled on Airflow and is compiled using `airflow create`. More than one `@airflow_external_task_sensor` can be added as a flow decorators. Adding more than one decorator will ensure that `start` step starts only after all sensors finish.
1406
+
1407
+
1408
+ Parameters
1409
+ ----------
1410
+ timeout : int
1411
+ Time, in seconds before the task times out and fails. (Default: 3600)
1412
+ poke_interval : int
1413
+ Time in seconds that the job should wait in between each try. (Default: 60)
1414
+ mode : str
1415
+ How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1416
+ exponential_backoff : bool
1417
+ allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1418
+ pool : str
1419
+ the slot pool this task should run in,
1420
+ slot pools are a way to limit concurrency for certain tasks. (Default:None)
1421
+ soft_fail : bool
1422
+ Set to true to mark the task as SKIPPED on failure. (Default: False)
1423
+ name : str
1424
+ Name of the sensor on Airflow
1425
+ description : str
1426
+ Description of sensor in the Airflow UI
1427
+ external_dag_id : str
1428
+ The dag_id that contains the task you want to wait for.
1429
+ external_task_ids : List[str]
1430
+ The list of task_ids that you want to wait for.
1431
+ If None (default value) the sensor waits for the DAG. (Default: None)
1432
+ allowed_states : List[str]
1433
+ Iterable of allowed states, (Default: ['success'])
1434
+ failed_states : List[str]
1435
+ Iterable of failed or dis-allowed states. (Default: None)
1436
+ execution_delta : datetime.timedelta
1437
+ time difference with the previous execution to look at,
1438
+ the default is the same logical date as the current task or DAG. (Default: None)
1439
+ check_existence: bool
1440
+ Set to True to check if the external task exists or check if
1441
+ the DAG to wait for exists. (Default: True)
1589
1442
  """
1590
1443
  ...
1591
1444
 
@@ -1640,38 +1493,180 @@ def schedule(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, hourly:
1640
1493
  """
1641
1494
  ...
1642
1495
 
1643
- def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1496
+ 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]]:
1644
1497
  """
1645
- Specifies what flows belong to the same project.
1646
-
1647
- A project-specific namespace is created for all flows that
1648
- use the same `@project(name)`.
1498
+ 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)
1499
+ before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
1500
+ and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
1501
+ added as a flow decorators. Adding more than one decorator will ensure that `start` step
1502
+ starts only after all sensors finish.
1649
1503
 
1650
1504
 
1651
1505
  Parameters
1652
1506
  ----------
1507
+ timeout : int
1508
+ Time, in seconds before the task times out and fails. (Default: 3600)
1509
+ poke_interval : int
1510
+ Time in seconds that the job should wait in between each try. (Default: 60)
1511
+ mode : str
1512
+ How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1513
+ exponential_backoff : bool
1514
+ allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1515
+ pool : str
1516
+ the slot pool this task should run in,
1517
+ slot pools are a way to limit concurrency for certain tasks. (Default:None)
1518
+ soft_fail : bool
1519
+ Set to true to mark the task as SKIPPED on failure. (Default: False)
1653
1520
  name : str
1654
- Project name. Make sure that the name is unique amongst all
1655
- projects that use the same production scheduler. The name may
1656
- contain only lowercase alphanumeric characters and underscores.
1521
+ Name of the sensor on Airflow
1522
+ description : str
1523
+ Description of sensor in the Airflow UI
1524
+ bucket_key : Union[str, List[str]]
1525
+ The key(s) being waited on. Supports full s3:// style url or relative path from root level.
1526
+ When it's specified as a full s3:// url, please leave `bucket_name` as None
1527
+ bucket_name : str
1528
+ Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
1529
+ When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
1530
+ wildcard_match : bool
1531
+ whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
1532
+ aws_conn_id : str
1533
+ a reference to the s3 connection on Airflow. (Default: None)
1534
+ verify : bool
1535
+ Whether or not to verify SSL certificates for S3 connection. (Default: None)
1536
+ """
1537
+ ...
1538
+
1539
+ @typing.overload
1540
+ def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1541
+ """
1542
+ Specifies the PyPI packages for all steps of the flow.
1543
+
1544
+ Use `@pypi_base` to set common packages required by all
1545
+ steps and use `@pypi` to specify step-specific overrides.
1546
+
1547
+ Parameters
1548
+ ----------
1549
+ packages : Dict[str, str], default: {}
1550
+ Packages to use for this flow. The key is the name of the package
1551
+ and the value is the version to use.
1552
+ python : str, optional, default: None
1553
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1554
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1555
+ """
1556
+ ...
1557
+
1558
+ @typing.overload
1559
+ def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1560
+ ...
1561
+
1562
+ def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
1563
+ """
1564
+ Specifies the PyPI packages for all steps of the flow.
1565
+
1566
+ Use `@pypi_base` to set common packages required by all
1567
+ steps and use `@pypi` to specify step-specific overrides.
1568
+
1569
+ Parameters
1570
+ ----------
1571
+ packages : Dict[str, str], default: {}
1572
+ Packages to use for this flow. The key is the name of the package
1573
+ and the value is the version to use.
1574
+ python : str, optional, default: None
1575
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1576
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1577
+ """
1578
+ ...
1579
+
1580
+ @typing.overload
1581
+ 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]]:
1582
+ """
1583
+ Specifies the event(s) that this flow depends on.
1584
+
1585
+ ```
1586
+ @trigger(event='foo')
1587
+ ```
1588
+ or
1589
+ ```
1590
+ @trigger(events=['foo', 'bar'])
1591
+ ```
1592
+
1593
+ Additionally, you can specify the parameter mappings
1594
+ to map event payload to Metaflow parameters for the flow.
1595
+ ```
1596
+ @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1597
+ ```
1598
+ or
1599
+ ```
1600
+ @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1601
+ {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1602
+ ```
1603
+
1604
+ 'parameters' can also be a list of strings and tuples like so:
1605
+ ```
1606
+ @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1607
+ ```
1608
+ This is equivalent to:
1609
+ ```
1610
+ @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1611
+ ```
1612
+
1613
+
1614
+ Parameters
1615
+ ----------
1616
+ event : Union[str, Dict[str, Any]], optional, default None
1617
+ Event dependency for this flow.
1618
+ events : List[Union[str, Dict[str, Any]]], default []
1619
+ Events dependency for this flow.
1620
+ options : Dict[str, Any], default {}
1621
+ Backend-specific configuration for tuning eventing behavior.
1622
+ """
1623
+ ...
1624
+
1625
+ @typing.overload
1626
+ def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1627
+ ...
1628
+
1629
+ 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] = {}):
1630
+ """
1631
+ Specifies the event(s) that this flow depends on.
1632
+
1633
+ ```
1634
+ @trigger(event='foo')
1635
+ ```
1636
+ or
1637
+ ```
1638
+ @trigger(events=['foo', 'bar'])
1639
+ ```
1640
+
1641
+ Additionally, you can specify the parameter mappings
1642
+ to map event payload to Metaflow parameters for the flow.
1643
+ ```
1644
+ @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1645
+ ```
1646
+ or
1647
+ ```
1648
+ @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1649
+ {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1650
+ ```
1651
+
1652
+ 'parameters' can also be a list of strings and tuples like so:
1653
+ ```
1654
+ @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1655
+ ```
1656
+ This is equivalent to:
1657
+ ```
1658
+ @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1659
+ ```
1657
1660
 
1658
- branch : Optional[str], default None
1659
- The branch to use. If not specified, the branch is set to
1660
- `user.<username>` unless `production` is set to `True`. This can
1661
- also be set on the command line using `--branch` as a top-level option.
1662
- It is an error to specify `branch` in the decorator and on the command line.
1663
1661
 
1664
- production : bool, default False
1665
- Whether or not the branch is the production branch. This can also be set on the
1666
- command line using `--production` as a top-level option. It is an error to specify
1667
- `production` in the decorator and on the command line.
1668
- The project branch name will be:
1669
- - if `branch` is specified:
1670
- - if `production` is True: `prod.<branch>`
1671
- - if `production` is False: `test.<branch>`
1672
- - if `branch` is not specified:
1673
- - if `production` is True: `prod`
1674
- - if `production` is False: `user.<username>`
1662
+ Parameters
1663
+ ----------
1664
+ event : Union[str, Dict[str, Any]], optional, default None
1665
+ Event dependency for this flow.
1666
+ events : List[Union[str, Dict[str, Any]]], default []
1667
+ Events dependency for this flow.
1668
+ options : Dict[str, Any], default {}
1669
+ Backend-specific configuration for tuning eventing behavior.
1675
1670
  """
1676
1671
  ...
1677
1672
 
@@ -1776,147 +1771,152 @@ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *
1776
1771
  """
1777
1772
  ...
1778
1773
 
1779
- @typing.overload
1780
- 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]]:
1774
+ def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1781
1775
  """
1782
- Specifies the Conda environment for all steps of the flow.
1776
+ Specifies what flows belong to the same project.
1783
1777
 
1784
- Use `@conda_base` to set common libraries required by all
1785
- steps and use `@conda` to specify step-specific additions.
1778
+ A project-specific namespace is created for all flows that
1779
+ use the same `@project(name)`.
1786
1780
 
1787
1781
 
1788
1782
  Parameters
1789
1783
  ----------
1790
- packages : Dict[str, str], default {}
1791
- Packages to use for this flow. The key is the name of the package
1792
- and the value is the version to use.
1793
- libraries : Dict[str, str], default {}
1794
- Supported for backward compatibility. When used with packages, packages will take precedence.
1795
- python : str, optional, default None
1796
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1797
- that the version used will correspond to the version of the Python interpreter used to start the run.
1798
- disabled : bool, default False
1799
- If set to True, disables Conda.
1784
+ name : str
1785
+ Project name. Make sure that the name is unique amongst all
1786
+ projects that use the same production scheduler. The name may
1787
+ contain only lowercase alphanumeric characters and underscores.
1788
+
1789
+ branch : Optional[str], default None
1790
+ The branch to use. If not specified, the branch is set to
1791
+ `user.<username>` unless `production` is set to `True`. This can
1792
+ also be set on the command line using `--branch` as a top-level option.
1793
+ It is an error to specify `branch` in the decorator and on the command line.
1794
+
1795
+ production : bool, default False
1796
+ Whether or not the branch is the production branch. This can also be set on the
1797
+ command line using `--production` as a top-level option. It is an error to specify
1798
+ `production` in the decorator and on the command line.
1799
+ The project branch name will be:
1800
+ - if `branch` is specified:
1801
+ - if `production` is True: `prod.<branch>`
1802
+ - if `production` is False: `test.<branch>`
1803
+ - if `branch` is not specified:
1804
+ - if `production` is True: `prod`
1805
+ - if `production` is False: `user.<username>`
1800
1806
  """
1801
1807
  ...
1802
1808
 
1803
- @typing.overload
1804
- def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1805
- ...
1806
-
1807
- 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):
1809
+ def with_artifact_store(f: typing.Optional[typing.Type[FlowSpecDerived]] = None):
1808
1810
  """
1809
- Specifies the Conda environment for all steps of the flow.
1811
+ Allows setting external datastores to save data for the
1812
+ `@checkpoint`/`@model`/`@huggingface_hub` decorators.
1810
1813
 
1811
- Use `@conda_base` to set common libraries required by all
1812
- steps and use `@conda` to specify step-specific additions.
1814
+ This decorator is useful when users wish to save data to a different datastore
1815
+ than what is configured in Metaflow. This can be for variety of reasons:
1813
1816
 
1817
+ 1. Data security: The objects needs to be stored in a bucket (object storage) that is not accessible by other flows.
1818
+ 2. Data Locality: The location where the task is executing is not located in the same region as the datastore.
1819
+ - Example: Metaflow datastore lives in US East, but the task is executing in Finland datacenters.
1820
+ 3. Data Lifecycle Policies: The objects need to be archived / managed separately from the Metaflow managed objects.
1821
+ - Example: Flow is training very large models that need to be stored separately and will be deleted more aggressively than the Metaflow managed objects.
1814
1822
 
1815
- Parameters
1823
+ Usage:
1816
1824
  ----------
1817
- packages : Dict[str, str], default {}
1818
- Packages to use for this flow. The key is the name of the package
1819
- and the value is the version to use.
1820
- libraries : Dict[str, str], default {}
1821
- Supported for backward compatibility. When used with packages, packages will take precedence.
1822
- python : str, optional, default None
1823
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1824
- that the version used will correspond to the version of the Python interpreter used to start the run.
1825
- disabled : bool, default False
1826
- If set to True, disables Conda.
1827
- """
1828
- ...
1829
-
1830
- @typing.overload
1831
- 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]]:
1832
- """
1833
- Specifies the event(s) that this flow depends on.
1834
1825
 
1835
- ```
1836
- @trigger(event='foo')
1837
- ```
1838
- or
1839
- ```
1840
- @trigger(events=['foo', 'bar'])
1841
- ```
1826
+ - Using a custom IAM role to access the datastore.
1842
1827
 
1843
- Additionally, you can specify the parameter mappings
1844
- to map event payload to Metaflow parameters for the flow.
1845
- ```
1846
- @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1847
- ```
1848
- or
1849
- ```
1850
- @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1851
- {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1852
- ```
1828
+ ```python
1829
+ @with_artifact_store(
1830
+ type="s3",
1831
+ config=lambda: {
1832
+ "root": "s3://my-bucket-foo/path/to/root",
1833
+ "role_arn": ROLE,
1834
+ },
1835
+ )
1836
+ class MyFlow(FlowSpec):
1853
1837
 
1854
- 'parameters' can also be a list of strings and tuples like so:
1855
- ```
1856
- @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1857
- ```
1858
- This is equivalent to:
1859
- ```
1860
- @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1861
- ```
1838
+ @checkpoint
1839
+ @step
1840
+ def start(self):
1841
+ with open("my_file.txt", "w") as f:
1842
+ f.write("Hello, World!")
1843
+ self.external_bucket_checkpoint = current.checkpoint.save("my_file.txt")
1844
+ self.next(self.end)
1862
1845
 
1846
+ ```
1863
1847
 
1864
- Parameters
1865
- ----------
1866
- event : Union[str, Dict[str, Any]], optional, default None
1867
- Event dependency for this flow.
1868
- events : List[Union[str, Dict[str, Any]]], default []
1869
- Events dependency for this flow.
1870
- options : Dict[str, Any], default {}
1871
- Backend-specific configuration for tuning eventing behavior.
1872
- """
1873
- ...
1874
-
1875
- @typing.overload
1876
- def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1877
- ...
1878
-
1879
- 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] = {}):
1880
- """
1881
- Specifies the event(s) that this flow depends on.
1848
+ - Using credentials to access the s3-compatible datastore.
1882
1849
 
1883
- ```
1884
- @trigger(event='foo')
1885
- ```
1886
- or
1887
- ```
1888
- @trigger(events=['foo', 'bar'])
1889
- ```
1850
+ ```python
1851
+ @with_artifact_store(
1852
+ type="s3",
1853
+ config=lambda: {
1854
+ "root": "s3://my-bucket-foo/path/to/root",
1855
+ "client_params": {
1856
+ "aws_access_key_id": os.environ.get("MY_CUSTOM_ACCESS_KEY"),
1857
+ "aws_secret_access_key": os.environ.get("MY_CUSTOM_SECRET_KEY"),
1858
+ },
1859
+ },
1860
+ )
1861
+ class MyFlow(FlowSpec):
1890
1862
 
1891
- Additionally, you can specify the parameter mappings
1892
- to map event payload to Metaflow parameters for the flow.
1893
- ```
1894
- @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1895
- ```
1896
- or
1897
- ```
1898
- @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1899
- {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1900
- ```
1863
+ @checkpoint
1864
+ @step
1865
+ def start(self):
1866
+ with open("my_file.txt", "w") as f:
1867
+ f.write("Hello, World!")
1868
+ self.external_bucket_checkpoint = current.checkpoint.save("my_file.txt")
1869
+ self.next(self.end)
1901
1870
 
1902
- 'parameters' can also be a list of strings and tuples like so:
1903
- ```
1904
- @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1905
- ```
1906
- This is equivalent to:
1907
- ```
1908
- @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1909
- ```
1871
+ ```
1910
1872
 
1873
+ - Accessing objects stored in external datastores after task execution.
1911
1874
 
1912
- Parameters
1875
+ ```python
1876
+ run = Run("CheckpointsTestsFlow/8992")
1877
+ with artifact_store_from(run=run, config={
1878
+ "client_params": {
1879
+ "aws_access_key_id": os.environ.get("MY_CUSTOM_ACCESS_KEY"),
1880
+ "aws_secret_access_key": os.environ.get("MY_CUSTOM_SECRET_KEY"),
1881
+ },
1882
+ }):
1883
+ with Checkpoint() as cp:
1884
+ latest = cp.list(
1885
+ task=run["start"].task
1886
+ )[0]
1887
+ print(latest)
1888
+ cp.load(
1889
+ latest,
1890
+ "test-checkpoints"
1891
+ )
1892
+
1893
+ task = Task("TorchTuneFlow/8484/train/53673")
1894
+ with artifact_store_from(run=run, config={
1895
+ "client_params": {
1896
+ "aws_access_key_id": os.environ.get("MY_CUSTOM_ACCESS_KEY"),
1897
+ "aws_secret_access_key": os.environ.get("MY_CUSTOM_SECRET_KEY"),
1898
+ },
1899
+ }):
1900
+ load_model(
1901
+ task.data.model_ref,
1902
+ "test-models"
1903
+ )
1904
+ ```
1905
+ Parameters:
1913
1906
  ----------
1914
- event : Union[str, Dict[str, Any]], optional, default None
1915
- Event dependency for this flow.
1916
- events : List[Union[str, Dict[str, Any]]], default []
1917
- Events dependency for this flow.
1918
- options : Dict[str, Any], default {}
1919
- Backend-specific configuration for tuning eventing behavior.
1907
+
1908
+ type: str
1909
+ The type of the datastore. Can be one of 's3', 'gcs', 'azure' or any other supported metaflow Datastore.
1910
+
1911
+ config: dict or Callable
1912
+ Dictionary of configuration options for the datastore. The following keys are required:
1913
+ - root: The root path in the datastore where the data will be saved. (needs to be in the format expected by the datastore)
1914
+ - example: 's3://bucket-name/path/to/root'
1915
+ - example: 'gs://bucket-name/path/to/root'
1916
+ - example: 'https://myblockacc.blob.core.windows.net/metaflow/'
1917
+ - role_arn (optional): AWS IAM role to access s3 bucket (only when `type` is 's3')
1918
+ - session_vars (optional): AWS session variables to access s3 bucket (only when `type` is 's3')
1919
+ - client_params (optional): AWS client parameters to access s3 bucket (only when `type` is 's3')
1920
1920
  """
1921
1921
  ...
1922
1922