ob-metaflow-stubs 6.0.10.12__py2.py3-none-any.whl → 6.0.10.13__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 (266) hide show
  1. metaflow-stubs/__init__.pyi +1024 -1024
  2. metaflow-stubs/cards.pyi +5 -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 +2 -2
  10. metaflow-stubs/exception.pyi +2 -2
  11. metaflow-stubs/flowspec.pyi +5 -5
  12. metaflow-stubs/generated_for.txt +1 -1
  13. metaflow-stubs/includefile.pyi +4 -4
  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 +3 -3
  18. metaflow-stubs/metadata_provider/util.pyi +2 -2
  19. metaflow-stubs/metaflow_config.pyi +2 -2
  20. metaflow-stubs/metaflow_current.pyi +44 -44
  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 +3 -3
  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 +4 -4
  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 +5 -5
  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 +5 -5
  38. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/exceptions.pyi +2 -2
  39. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/final_api.pyi +2 -2
  40. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/lineage.pyi +2 -2
  41. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/__init__.pyi +2 -2
  42. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/context.pyi +2 -2
  43. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/core.pyi +2 -2
  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 +3 -3
  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 +3 -3
  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/cards/__init__.pyi +2 -2
  52. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/hf_hub/cards/hf_hub_card.pyi +4 -4
  53. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/hf_hub/decorator.pyi +3 -3
  54. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/__init__.pyi +2 -2
  55. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/core.pyi +2 -2
  56. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/exceptions.pyi +2 -2
  57. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/model_storage.pyi +4 -4
  58. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/__init__.pyi +2 -2
  59. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/flowspec_utils.pyi +2 -2
  60. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/general.pyi +2 -2
  61. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/identity_utils.pyi +2 -2
  62. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/__init__.pyi +2 -2
  63. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/base.pyi +2 -2
  64. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/tar.pyi +3 -3
  65. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/tar_utils.pyi +3 -3
  66. metaflow-stubs/mf_extensions/outerbounds/__init__.pyi +2 -2
  67. metaflow-stubs/mf_extensions/outerbounds/plugins/__init__.pyi +2 -2
  68. metaflow-stubs/mf_extensions/outerbounds/plugins/apps/__init__.pyi +2 -2
  69. metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/__init__.pyi +2 -2
  70. metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/_state_machine.pyi +2 -2
  71. metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/_vendor/__init__.pyi +2 -2
  72. metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/_vendor/spinner/__init__.pyi +2 -2
  73. metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/_vendor/spinner/spinners.pyi +2 -2
  74. metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/app_cli.pyi +3 -3
  75. metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/app_config.pyi +2 -2
  76. metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/capsule.pyi +4 -4
  77. metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/click_importer.pyi +2 -2
  78. metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/code_package/__init__.pyi +2 -2
  79. metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/code_package/code_packager.pyi +2 -2
  80. metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/config/__init__.pyi +2 -2
  81. metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/config/cli_generator.pyi +2 -2
  82. metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/config/config_utils.pyi +5 -5
  83. metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/config/schema_export.pyi +2 -2
  84. metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/config/typed_configs.pyi +2 -2
  85. metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/config/unified_config.pyi +4 -4
  86. metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/dependencies.pyi +3 -3
  87. metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/deployer.pyi +6 -6
  88. metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/experimental/__init__.pyi +2 -2
  89. metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/perimeters.pyi +2 -2
  90. metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/utils.pyi +3 -3
  91. metaflow-stubs/mf_extensions/outerbounds/plugins/aws/__init__.pyi +2 -2
  92. metaflow-stubs/mf_extensions/outerbounds/plugins/aws/assume_role_decorator.pyi +3 -3
  93. metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/__init__.pyi +2 -2
  94. metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/async_cards.pyi +3 -3
  95. metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/injector.pyi +2 -2
  96. metaflow-stubs/mf_extensions/outerbounds/plugins/checkpoint_datastores/__init__.pyi +2 -2
  97. metaflow-stubs/mf_extensions/outerbounds/plugins/checkpoint_datastores/coreweave.pyi +3 -3
  98. metaflow-stubs/mf_extensions/outerbounds/plugins/checkpoint_datastores/nebius.pyi +3 -3
  99. metaflow-stubs/mf_extensions/outerbounds/plugins/fast_bakery/__init__.pyi +2 -2
  100. metaflow-stubs/mf_extensions/outerbounds/plugins/fast_bakery/baker.pyi +3 -3
  101. metaflow-stubs/mf_extensions/outerbounds/plugins/fast_bakery/docker_environment.pyi +2 -2
  102. metaflow-stubs/mf_extensions/outerbounds/plugins/fast_bakery/fast_bakery.pyi +2 -2
  103. metaflow-stubs/mf_extensions/outerbounds/plugins/kubernetes/__init__.pyi +2 -2
  104. metaflow-stubs/mf_extensions/outerbounds/plugins/kubernetes/pod_killer.pyi +2 -2
  105. metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/__init__.pyi +2 -2
  106. metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/constants.pyi +2 -2
  107. metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/exceptions.pyi +2 -2
  108. metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/ollama.pyi +2 -2
  109. metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/status_card.pyi +2 -2
  110. metaflow-stubs/mf_extensions/outerbounds/plugins/snowflake/__init__.pyi +2 -2
  111. metaflow-stubs/mf_extensions/outerbounds/plugins/snowflake/snowflake.pyi +2 -2
  112. metaflow-stubs/mf_extensions/outerbounds/profilers/__init__.pyi +2 -2
  113. metaflow-stubs/mf_extensions/outerbounds/profilers/gpu.pyi +2 -2
  114. metaflow-stubs/mf_extensions/outerbounds/remote_config.pyi +4 -4
  115. metaflow-stubs/mf_extensions/outerbounds/toplevel/__init__.pyi +2 -2
  116. metaflow-stubs/mf_extensions/outerbounds/toplevel/global_aliases_for_metaflow_package.pyi +2 -2
  117. metaflow-stubs/mf_extensions/outerbounds/toplevel/s3_proxy.pyi +2 -2
  118. metaflow-stubs/multicore_utils.pyi +2 -2
  119. metaflow-stubs/ob_internal.pyi +2 -2
  120. metaflow-stubs/packaging_sys/__init__.pyi +6 -6
  121. metaflow-stubs/packaging_sys/backend.pyi +4 -4
  122. metaflow-stubs/packaging_sys/distribution_support.pyi +4 -4
  123. metaflow-stubs/packaging_sys/tar_backend.pyi +6 -6
  124. metaflow-stubs/packaging_sys/utils.pyi +2 -2
  125. metaflow-stubs/packaging_sys/v1.pyi +3 -3
  126. metaflow-stubs/parameters.pyi +4 -4
  127. metaflow-stubs/plugins/__init__.pyi +12 -12
  128. metaflow-stubs/plugins/airflow/__init__.pyi +2 -2
  129. metaflow-stubs/plugins/airflow/airflow_utils.pyi +2 -2
  130. metaflow-stubs/plugins/airflow/exception.pyi +2 -2
  131. metaflow-stubs/plugins/airflow/sensors/__init__.pyi +2 -2
  132. metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +2 -2
  133. metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +2 -2
  134. metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +2 -2
  135. metaflow-stubs/plugins/argo/__init__.pyi +2 -2
  136. metaflow-stubs/plugins/argo/argo_client.pyi +2 -2
  137. metaflow-stubs/plugins/argo/argo_events.pyi +2 -2
  138. metaflow-stubs/plugins/argo/argo_workflows.pyi +4 -4
  139. metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +3 -3
  140. metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +4 -4
  141. metaflow-stubs/plugins/argo/argo_workflows_deployer_objects.pyi +4 -4
  142. metaflow-stubs/plugins/argo/exit_hooks.pyi +3 -3
  143. metaflow-stubs/plugins/aws/__init__.pyi +2 -2
  144. metaflow-stubs/plugins/aws/aws_client.pyi +2 -2
  145. metaflow-stubs/plugins/aws/aws_utils.pyi +2 -2
  146. metaflow-stubs/plugins/aws/batch/__init__.pyi +2 -2
  147. metaflow-stubs/plugins/aws/batch/batch.pyi +2 -2
  148. metaflow-stubs/plugins/aws/batch/batch_client.pyi +2 -2
  149. metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +2 -2
  150. metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +2 -2
  151. metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +3 -3
  152. metaflow-stubs/plugins/aws/step_functions/__init__.pyi +2 -2
  153. metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +2 -2
  154. metaflow-stubs/plugins/aws/step_functions/schedule_decorator.pyi +2 -2
  155. metaflow-stubs/plugins/aws/step_functions/step_functions.pyi +2 -2
  156. metaflow-stubs/plugins/aws/step_functions/step_functions_client.pyi +2 -2
  157. metaflow-stubs/plugins/aws/step_functions/step_functions_deployer.pyi +4 -4
  158. metaflow-stubs/plugins/aws/step_functions/step_functions_deployer_objects.pyi +4 -4
  159. metaflow-stubs/plugins/azure/__init__.pyi +2 -2
  160. metaflow-stubs/plugins/azure/azure_credential.pyi +2 -2
  161. metaflow-stubs/plugins/azure/azure_exceptions.pyi +2 -2
  162. metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +3 -3
  163. metaflow-stubs/plugins/azure/azure_utils.pyi +2 -2
  164. metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +2 -2
  165. metaflow-stubs/plugins/azure/includefile_support.pyi +2 -2
  166. metaflow-stubs/plugins/cards/__init__.pyi +2 -2
  167. metaflow-stubs/plugins/cards/card_client.pyi +3 -3
  168. metaflow-stubs/plugins/cards/card_creator.pyi +2 -2
  169. metaflow-stubs/plugins/cards/card_datastore.pyi +2 -2
  170. metaflow-stubs/plugins/cards/card_decorator.pyi +3 -3
  171. metaflow-stubs/plugins/cards/card_modules/__init__.pyi +3 -2
  172. metaflow-stubs/plugins/cards/card_modules/basic.pyi +3 -3
  173. metaflow-stubs/plugins/cards/card_modules/card.pyi +2 -2
  174. metaflow-stubs/plugins/cards/card_modules/components.pyi +168 -4
  175. metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +2 -2
  176. metaflow-stubs/plugins/cards/card_modules/json_viewer.pyi +119 -0
  177. metaflow-stubs/plugins/cards/card_modules/renderer_tools.pyi +2 -2
  178. metaflow-stubs/plugins/cards/card_modules/test_cards.pyi +2 -2
  179. metaflow-stubs/plugins/cards/card_resolver.pyi +2 -2
  180. metaflow-stubs/plugins/cards/component_serializer.pyi +2 -2
  181. metaflow-stubs/plugins/cards/exception.pyi +2 -2
  182. metaflow-stubs/plugins/catch_decorator.pyi +3 -3
  183. metaflow-stubs/plugins/datatools/__init__.pyi +2 -2
  184. metaflow-stubs/plugins/datatools/local.pyi +2 -2
  185. metaflow-stubs/plugins/datatools/s3/__init__.pyi +2 -2
  186. metaflow-stubs/plugins/datatools/s3/s3.pyi +4 -4
  187. metaflow-stubs/plugins/datatools/s3/s3tail.pyi +2 -2
  188. metaflow-stubs/plugins/datatools/s3/s3util.pyi +2 -2
  189. metaflow-stubs/plugins/debug_logger.pyi +2 -2
  190. metaflow-stubs/plugins/debug_monitor.pyi +2 -2
  191. metaflow-stubs/plugins/environment_decorator.pyi +2 -2
  192. metaflow-stubs/plugins/events_decorator.pyi +2 -2
  193. metaflow-stubs/plugins/exit_hook/__init__.pyi +2 -2
  194. metaflow-stubs/plugins/exit_hook/exit_hook_decorator.pyi +2 -2
  195. metaflow-stubs/plugins/frameworks/__init__.pyi +2 -2
  196. metaflow-stubs/plugins/frameworks/pytorch.pyi +2 -2
  197. metaflow-stubs/plugins/gcp/__init__.pyi +2 -2
  198. metaflow-stubs/plugins/gcp/gcp_secret_manager_secrets_provider.pyi +3 -3
  199. metaflow-stubs/plugins/gcp/gs_exceptions.pyi +2 -2
  200. metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +2 -2
  201. metaflow-stubs/plugins/gcp/gs_utils.pyi +2 -2
  202. metaflow-stubs/plugins/gcp/includefile_support.pyi +2 -2
  203. metaflow-stubs/plugins/kubernetes/__init__.pyi +2 -2
  204. metaflow-stubs/plugins/kubernetes/kube_utils.pyi +3 -3
  205. metaflow-stubs/plugins/kubernetes/kubernetes.pyi +2 -2
  206. metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +2 -2
  207. metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +2 -2
  208. metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +2 -2
  209. metaflow-stubs/plugins/kubernetes/spot_monitor_sidecar.pyi +2 -2
  210. metaflow-stubs/plugins/ollama/__init__.pyi +3 -3
  211. metaflow-stubs/plugins/optuna/__init__.pyi +2 -2
  212. metaflow-stubs/plugins/parallel_decorator.pyi +2 -2
  213. metaflow-stubs/plugins/parsers.pyi +2 -2
  214. metaflow-stubs/plugins/perimeters.pyi +2 -2
  215. metaflow-stubs/plugins/project_decorator.pyi +2 -2
  216. metaflow-stubs/plugins/pypi/__init__.pyi +2 -2
  217. metaflow-stubs/plugins/pypi/conda_decorator.pyi +2 -2
  218. metaflow-stubs/plugins/pypi/conda_environment.pyi +4 -4
  219. metaflow-stubs/plugins/pypi/parsers.pyi +2 -2
  220. metaflow-stubs/plugins/pypi/pypi_decorator.pyi +2 -2
  221. metaflow-stubs/plugins/pypi/pypi_environment.pyi +2 -2
  222. metaflow-stubs/plugins/pypi/utils.pyi +2 -2
  223. metaflow-stubs/plugins/resources_decorator.pyi +2 -2
  224. metaflow-stubs/plugins/retry_decorator.pyi +2 -2
  225. metaflow-stubs/plugins/secrets/__init__.pyi +3 -3
  226. metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +3 -3
  227. metaflow-stubs/plugins/secrets/secrets_decorator.pyi +2 -2
  228. metaflow-stubs/plugins/secrets/secrets_func.pyi +2 -2
  229. metaflow-stubs/plugins/secrets/secrets_spec.pyi +2 -2
  230. metaflow-stubs/plugins/secrets/utils.pyi +2 -2
  231. metaflow-stubs/plugins/snowflake/__init__.pyi +2 -2
  232. metaflow-stubs/plugins/storage_executor.pyi +2 -2
  233. metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +2 -2
  234. metaflow-stubs/plugins/timeout_decorator.pyi +3 -3
  235. metaflow-stubs/plugins/torchtune/__init__.pyi +2 -2
  236. metaflow-stubs/plugins/uv/__init__.pyi +2 -2
  237. metaflow-stubs/plugins/uv/uv_environment.pyi +2 -2
  238. metaflow-stubs/profilers/__init__.pyi +2 -2
  239. metaflow-stubs/pylint_wrapper.pyi +2 -2
  240. metaflow-stubs/runner/__init__.pyi +2 -2
  241. metaflow-stubs/runner/deployer.pyi +35 -35
  242. metaflow-stubs/runner/deployer_impl.pyi +3 -3
  243. metaflow-stubs/runner/metaflow_runner.pyi +5 -5
  244. metaflow-stubs/runner/nbdeploy.pyi +2 -2
  245. metaflow-stubs/runner/nbrun.pyi +2 -2
  246. metaflow-stubs/runner/subprocess_manager.pyi +2 -2
  247. metaflow-stubs/runner/utils.pyi +3 -3
  248. metaflow-stubs/system/__init__.pyi +2 -2
  249. metaflow-stubs/system/system_logger.pyi +3 -3
  250. metaflow-stubs/system/system_monitor.pyi +2 -2
  251. metaflow-stubs/tagging_util.pyi +2 -2
  252. metaflow-stubs/tuple_util.pyi +2 -2
  253. metaflow-stubs/user_configs/__init__.pyi +2 -2
  254. metaflow-stubs/user_configs/config_options.pyi +3 -3
  255. metaflow-stubs/user_configs/config_parameters.pyi +7 -7
  256. metaflow-stubs/user_decorators/__init__.pyi +2 -2
  257. metaflow-stubs/user_decorators/common.pyi +2 -2
  258. metaflow-stubs/user_decorators/mutable_flow.pyi +5 -5
  259. metaflow-stubs/user_decorators/mutable_step.pyi +4 -4
  260. metaflow-stubs/user_decorators/user_flow_decorator.pyi +5 -5
  261. metaflow-stubs/user_decorators/user_step_decorator.pyi +5 -5
  262. {ob_metaflow_stubs-6.0.10.12.dist-info → ob_metaflow_stubs-6.0.10.13.dist-info}/METADATA +1 -1
  263. ob_metaflow_stubs-6.0.10.13.dist-info/RECORD +266 -0
  264. ob_metaflow_stubs-6.0.10.12.dist-info/RECORD +0 -265
  265. {ob_metaflow_stubs-6.0.10.12.dist-info → ob_metaflow_stubs-6.0.10.13.dist-info}/WHEEL +0 -0
  266. {ob_metaflow_stubs-6.0.10.12.dist-info → ob_metaflow_stubs-6.0.10.13.dist-info}/top_level.txt +0 -0
@@ -1,7 +1,7 @@
1
1
  ######################################################################################################
2
2
  # Auto-generated Metaflow stub file #
3
- # MF version: 2.18.9.1+obcheckpoint(0.2.8);ob(v1) #
4
- # Generated on 2025-09-30T17:31:30.391243 #
3
+ # MF version: 2.18.10.1+obcheckpoint(0.2.8);ob(v1) #
4
+ # Generated on 2025-10-02T16:55:23.853861 #
5
5
  ######################################################################################################
6
6
 
7
7
  from __future__ import annotations
@@ -39,19 +39,19 @@ from .user_decorators.user_step_decorator import UserStepDecorator as UserStepDe
39
39
  from .user_decorators.user_step_decorator import StepMutator as StepMutator
40
40
  from .user_decorators.user_step_decorator import user_step_decorator as user_step_decorator
41
41
  from .user_decorators.user_flow_decorator import FlowMutator as FlowMutator
42
- from . import events as events
43
- from . import cards as cards
44
42
  from . import tuple_util as tuple_util
43
+ from . import cards as cards
45
44
  from . import metaflow_git as metaflow_git
45
+ from . import events as events
46
46
  from . import runner as runner
47
47
  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
51
  from .plugins.parsers import yaml_parser as yaml_parser
52
+ from .plugins.pypi.parsers import requirements_txt_parser as requirements_txt_parser
52
53
  from .plugins.pypi.parsers import conda_environment_yml_parser as conda_environment_yml_parser
53
54
  from .plugins.pypi.parsers import pyproject_toml_parser as pyproject_toml_parser
54
- from .plugins.pypi.parsers import requirements_txt_parser as requirements_txt_parser
55
55
  from . import client as client
56
56
  from .client.core import namespace as namespace
57
57
  from .client.core import get_namespace as get_namespace
@@ -170,149 +170,57 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
170
170
  ...
171
171
 
172
172
  @typing.overload
173
- 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]]]:
173
+ 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]]]:
174
174
  """
175
- Enables checkpointing for a step.
176
-
177
- > Examples
178
-
179
- - Saving Checkpoints
180
-
181
- ```python
182
- @checkpoint
183
- @step
184
- def train(self):
185
- model = create_model(self.parameters, checkpoint_path = None)
186
- for i in range(self.epochs):
187
- # some training logic
188
- loss = model.train(self.dataset)
189
- if i % 10 == 0:
190
- model.save(
191
- current.checkpoint.directory,
192
- )
193
- # saves the contents of the `current.checkpoint.directory` as a checkpoint
194
- # and returns a reference dictionary to the checkpoint saved in the datastore
195
- self.latest_checkpoint = current.checkpoint.save(
196
- name="epoch_checkpoint",
197
- metadata={
198
- "epoch": i,
199
- "loss": loss,
200
- }
201
- )
202
- ```
203
-
204
- - Using Loaded Checkpoints
175
+ Specifies the number of times the task corresponding
176
+ to a step needs to be retried.
205
177
 
206
- ```python
207
- @retry(times=3)
208
- @checkpoint
209
- @step
210
- def train(self):
211
- # Assume that the task has restarted and the previous attempt of the task
212
- # saved a checkpoint
213
- checkpoint_path = None
214
- if current.checkpoint.is_loaded: # Check if a checkpoint is loaded
215
- print("Loaded checkpoint from the previous attempt")
216
- checkpoint_path = current.checkpoint.directory
178
+ This decorator is useful for handling transient errors, such as networking issues.
179
+ If your task contains operations that can't be retried safely, e.g. database updates,
180
+ it is advisable to annotate it with `@retry(times=0)`.
217
181
 
218
- model = create_model(self.parameters, checkpoint_path = checkpoint_path)
219
- for i in range(self.epochs):
220
- ...
221
- ```
182
+ This can be used in conjunction with the `@catch` decorator. The `@catch`
183
+ decorator will execute a no-op task after all retries have been exhausted,
184
+ ensuring that the flow execution can continue.
222
185
 
223
186
 
224
187
  Parameters
225
188
  ----------
226
- load_policy : str, default: "fresh"
227
- The policy for loading the checkpoint. The following policies are supported:
228
- - "eager": Loads the the latest available checkpoint within the namespace.
229
- With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
230
- will be loaded at the start of the task.
231
- - "none": Do not load any checkpoint
232
- - "fresh": Loads the lastest checkpoint created within the running Task.
233
- This mode helps loading checkpoints across various retry attempts of the same task.
234
- With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
235
- created within the task will be loaded when the task is retries execution on failure.
236
-
237
- temp_dir_root : str, default: None
238
- The root directory under which `current.checkpoint.directory` will be created.
189
+ times : int, default 3
190
+ Number of times to retry this task.
191
+ minutes_between_retries : int, default 2
192
+ Number of minutes between retries.
239
193
  """
240
194
  ...
241
195
 
242
196
  @typing.overload
243
- def checkpoint(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
197
+ def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
244
198
  ...
245
199
 
246
200
  @typing.overload
247
- def checkpoint(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
201
+ def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
248
202
  ...
249
203
 
250
- 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):
204
+ 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):
251
205
  """
252
- Enables checkpointing for a step.
253
-
254
- > Examples
255
-
256
- - Saving Checkpoints
257
-
258
- ```python
259
- @checkpoint
260
- @step
261
- def train(self):
262
- model = create_model(self.parameters, checkpoint_path = None)
263
- for i in range(self.epochs):
264
- # some training logic
265
- loss = model.train(self.dataset)
266
- if i % 10 == 0:
267
- model.save(
268
- current.checkpoint.directory,
269
- )
270
- # saves the contents of the `current.checkpoint.directory` as a checkpoint
271
- # and returns a reference dictionary to the checkpoint saved in the datastore
272
- self.latest_checkpoint = current.checkpoint.save(
273
- name="epoch_checkpoint",
274
- metadata={
275
- "epoch": i,
276
- "loss": loss,
277
- }
278
- )
279
- ```
280
-
281
- - Using Loaded Checkpoints
206
+ Specifies the number of times the task corresponding
207
+ to a step needs to be retried.
282
208
 
283
- ```python
284
- @retry(times=3)
285
- @checkpoint
286
- @step
287
- def train(self):
288
- # Assume that the task has restarted and the previous attempt of the task
289
- # saved a checkpoint
290
- checkpoint_path = None
291
- if current.checkpoint.is_loaded: # Check if a checkpoint is loaded
292
- print("Loaded checkpoint from the previous attempt")
293
- checkpoint_path = current.checkpoint.directory
209
+ This decorator is useful for handling transient errors, such as networking issues.
210
+ If your task contains operations that can't be retried safely, e.g. database updates,
211
+ it is advisable to annotate it with `@retry(times=0)`.
294
212
 
295
- model = create_model(self.parameters, checkpoint_path = checkpoint_path)
296
- for i in range(self.epochs):
297
- ...
298
- ```
213
+ This can be used in conjunction with the `@catch` decorator. The `@catch`
214
+ decorator will execute a no-op task after all retries have been exhausted,
215
+ ensuring that the flow execution can continue.
299
216
 
300
217
 
301
218
  Parameters
302
219
  ----------
303
- load_policy : str, default: "fresh"
304
- The policy for loading the checkpoint. The following policies are supported:
305
- - "eager": Loads the the latest available checkpoint within the namespace.
306
- With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
307
- will be loaded at the start of the task.
308
- - "none": Do not load any checkpoint
309
- - "fresh": Loads the lastest checkpoint created within the running Task.
310
- This mode helps loading checkpoints across various retry attempts of the same task.
311
- With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
312
- created within the task will be loaded when the task is retries execution on failure.
313
-
314
- temp_dir_root : str, default: None
315
- The root directory under which `current.checkpoint.directory` will be created.
220
+ times : int, default 3
221
+ Number of times to retry this task.
222
+ minutes_between_retries : int, default 2
223
+ Number of minutes between retries.
316
224
  """
317
225
  ...
318
226
 
@@ -445,101 +353,122 @@ def model(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
445
353
  """
446
354
  ...
447
355
 
448
- 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]]]:
356
+ @typing.overload
357
+ def app_deploy(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
449
358
  """
450
- Specifies that this step should execute on DGX cloud.
451
-
452
-
453
- Parameters
454
- ----------
455
- gpu : int
456
- Number of GPUs to use.
457
- gpu_type : str
458
- Type of Nvidia GPU to use.
459
- queue_timeout : int
460
- Time to keep the job in NVCF's queue.
359
+ Decorator prototype for all step decorators. This function gets specialized
360
+ and imported for all decorators types by _import_plugin_decorators().
461
361
  """
462
362
  ...
463
363
 
464
364
  @typing.overload
465
- 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]]]:
365
+ def app_deploy(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
366
+ ...
367
+
368
+ def app_deploy(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
466
369
  """
467
- Specifies that the step will success under all circumstances.
468
-
469
- The decorator will create an optional artifact, specified by `var`, which
470
- contains the exception raised. You can use it to detect the presence
471
- of errors, indicating that all happy-path artifacts produced by the step
472
- are missing.
370
+ Decorator prototype for all step decorators. This function gets specialized
371
+ and imported for all decorators types by _import_plugin_decorators().
372
+ """
373
+ ...
374
+
375
+ @typing.overload
376
+ 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]]]:
377
+ """
378
+ Specifies environment variables to be set prior to the execution of a step.
473
379
 
474
380
 
475
381
  Parameters
476
382
  ----------
477
- var : str, optional, default None
478
- Name of the artifact in which to store the caught exception.
479
- If not specified, the exception is not stored.
480
- print_exception : bool, default True
481
- Determines whether or not the exception is printed to
482
- stdout when caught.
383
+ vars : Dict[str, str], default {}
384
+ Dictionary of environment variables to set.
483
385
  """
484
386
  ...
485
387
 
486
388
  @typing.overload
487
- def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
389
+ def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
488
390
  ...
489
391
 
490
392
  @typing.overload
491
- def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
393
+ def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
492
394
  ...
493
395
 
494
- 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):
396
+ def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
495
397
  """
496
- Specifies that the step will success under all circumstances.
497
-
498
- The decorator will create an optional artifact, specified by `var`, which
499
- contains the exception raised. You can use it to detect the presence
500
- of errors, indicating that all happy-path artifacts produced by the step
501
- are missing.
398
+ Specifies environment variables to be set prior to the execution of a step.
502
399
 
503
400
 
504
401
  Parameters
505
402
  ----------
506
- var : str, optional, default None
507
- Name of the artifact in which to store the caught exception.
508
- If not specified, the exception is not stored.
509
- print_exception : bool, default True
510
- Determines whether or not the exception is printed to
511
- stdout when caught.
403
+ vars : Dict[str, str], default {}
404
+ Dictionary of environment variables to set.
512
405
  """
513
406
  ...
514
407
 
515
408
  @typing.overload
516
- 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]]]:
409
+ 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]]]:
517
410
  """
518
- Specifies secrets to be retrieved and injected as environment variables prior to
519
- the execution of a step.
411
+ Specifies the Conda environment for the step.
412
+
413
+ Information in this decorator will augment any
414
+ attributes set in the `@conda_base` flow-level decorator. Hence,
415
+ you can use `@conda_base` to set packages required by all
416
+ steps and use `@conda` to specify step-specific overrides.
520
417
 
521
418
 
522
419
  Parameters
523
420
  ----------
524
- sources : List[Union[str, Dict[str, Any]]], default: []
525
- List of secret specs, defining how the secrets are to be retrieved
526
- role : str, optional, default: None
527
- Role to use for fetching secrets
421
+ packages : Dict[str, str], default {}
422
+ Packages to use for this step. The key is the name of the package
423
+ and the value is the version to use.
424
+ libraries : Dict[str, str], default {}
425
+ Supported for backward compatibility. When used with packages, packages will take precedence.
426
+ python : str, optional, default None
427
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
428
+ that the version used will correspond to the version of the Python interpreter used to start the run.
429
+ disabled : bool, default False
430
+ If set to True, disables @conda.
528
431
  """
529
432
  ...
530
433
 
531
434
  @typing.overload
532
- def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
435
+ def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
533
436
  ...
534
437
 
535
438
  @typing.overload
536
- def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
439
+ def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
537
440
  ...
538
441
 
539
- 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):
442
+ def conda(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False):
540
443
  """
541
- Specifies secrets to be retrieved and injected as environment variables prior to
542
- the execution of a step.
444
+ Specifies the Conda environment for the step.
445
+
446
+ Information in this decorator will augment any
447
+ attributes set in the `@conda_base` flow-level decorator. Hence,
448
+ you can use `@conda_base` to set packages required by all
449
+ steps and use `@conda` to specify step-specific overrides.
450
+
451
+
452
+ Parameters
453
+ ----------
454
+ packages : Dict[str, str], default {}
455
+ Packages to use for this step. The key is the name of the package
456
+ and the value is the version to use.
457
+ libraries : Dict[str, str], default {}
458
+ Supported for backward compatibility. When used with packages, packages will take precedence.
459
+ python : str, optional, default None
460
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
461
+ that the version used will correspond to the version of the Python interpreter used to start the run.
462
+ disabled : bool, default False
463
+ If set to True, disables @conda.
464
+ """
465
+ ...
466
+
467
+ @typing.overload
468
+ 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]]]:
469
+ """
470
+ Specifies secrets to be retrieved and injected as environment variables prior to
471
+ the execution of a step.
543
472
 
544
473
 
545
474
  Parameters
@@ -551,13 +480,100 @@ def secrets(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None],
551
480
  """
552
481
  ...
553
482
 
554
- def nebius_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]]]:
483
+ @typing.overload
484
+ def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
485
+ ...
486
+
487
+ @typing.overload
488
+ def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
489
+ ...
490
+
491
+ 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):
555
492
  """
556
- `@nebius_s3_proxy` is a Nebius-specific S3 Proxy decorator for routing S3 requests through a local proxy service.
557
- It exists to make it easier for users to know that this decorator should only be used with
558
- a Neo Cloud like Nebius. The underlying mechanics of the decorator is the same as the `@s3_proxy`:
493
+ Specifies secrets to be retrieved and injected as environment variables prior to
494
+ the execution of a step.
495
+
496
+
497
+ Parameters
498
+ ----------
499
+ sources : List[Union[str, Dict[str, Any]]], default: []
500
+ List of secret specs, defining how the secrets are to be retrieved
501
+ role : str, optional, default: None
502
+ Role to use for fetching secrets
503
+ """
504
+ ...
505
+
506
+ @typing.overload
507
+ def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
508
+ """
509
+ Decorator prototype for all step decorators. This function gets specialized
510
+ and imported for all decorators types by _import_plugin_decorators().
511
+ """
512
+ ...
513
+
514
+ @typing.overload
515
+ def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
516
+ ...
517
+
518
+ def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
519
+ """
520
+ Decorator prototype for all step decorators. This function gets specialized
521
+ and imported for all decorators types by _import_plugin_decorators().
522
+ """
523
+ ...
524
+
525
+ 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]]]:
526
+ """
527
+ This decorator is used to run vllm APIs as Metaflow task sidecars.
528
+
529
+ User code call
530
+ --------------
531
+ @vllm(
532
+ model="...",
533
+ ...
534
+ )
535
+
536
+ Valid backend options
537
+ ---------------------
538
+ - 'local': Run as a separate process on the local task machine.
539
+
540
+ Valid model options
541
+ -------------------
542
+ Any HuggingFace model identifier, e.g. 'meta-llama/Llama-3.2-1B'
543
+
544
+ NOTE: vLLM's OpenAI-compatible server serves ONE model per server instance.
545
+ If you need multiple models, you must create multiple @vllm decorators.
559
546
 
560
547
 
548
+ Parameters
549
+ ----------
550
+ model: str
551
+ HuggingFace model identifier to be served by vLLM.
552
+ backend: str
553
+ Determines where and how to run the vLLM process.
554
+ openai_api_server: bool
555
+ Whether to use OpenAI-compatible API server mode (subprocess) instead of native engine.
556
+ Default is False (uses native engine).
557
+ Set to True for backward compatibility with existing code.
558
+ debug: bool
559
+ Whether to turn on verbose debugging logs.
560
+ card_refresh_interval: int
561
+ Interval in seconds for refreshing the vLLM status card.
562
+ Only used when openai_api_server=True.
563
+ max_retries: int
564
+ Maximum number of retries checking for vLLM server startup.
565
+ Only used when openai_api_server=True.
566
+ retry_alert_frequency: int
567
+ Frequency of alert logs for vLLM server startup retries.
568
+ Only used when openai_api_server=True.
569
+ engine_args : dict
570
+ Additional keyword arguments to pass to the vLLM engine.
571
+ For example, `tensor_parallel_size=2`.
572
+ """
573
+ ...
574
+
575
+ 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]]]:
576
+ """
561
577
  Set up an S3 proxy that caches objects in an external, S3‑compatible bucket
562
578
  for S3 read and write requests.
563
579
 
@@ -616,327 +632,136 @@ def nebius_s3_proxy(*, integration_name: typing.Optional[str] = None, write_mode
616
632
  ...
617
633
 
618
634
  @typing.overload
619
- 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]]]:
620
- """
621
- Specifies environment variables to be set prior to the execution of a step.
622
-
623
-
624
- Parameters
625
- ----------
626
- vars : Dict[str, str], default {}
627
- Dictionary of environment variables to set.
628
- """
629
- ...
630
-
631
- @typing.overload
632
- def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
633
- ...
634
-
635
- @typing.overload
636
- def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
637
- ...
638
-
639
- def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
640
- """
641
- Specifies environment variables to be set prior to the execution of a step.
642
-
643
-
644
- Parameters
645
- ----------
646
- vars : Dict[str, str], default {}
647
- Dictionary of environment variables to set.
648
- """
649
- ...
650
-
651
- @typing.overload
652
- def app_deploy(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
635
+ def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
653
636
  """
654
- Decorator prototype for all step decorators. This function gets specialized
655
- and imported for all decorators types by _import_plugin_decorators().
637
+ Internal decorator to support Fast bakery
656
638
  """
657
639
  ...
658
640
 
659
641
  @typing.overload
660
- def app_deploy(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
642
+ def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
661
643
  ...
662
644
 
663
- def app_deploy(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
645
+ def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
664
646
  """
665
- Decorator prototype for all step decorators. This function gets specialized
666
- and imported for all decorators types by _import_plugin_decorators().
647
+ Internal decorator to support Fast bakery
667
648
  """
668
649
  ...
669
650
 
670
- @typing.overload
671
- 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]]]:
651
+ def huggingface_hub(*, temp_dir_root: typing.Optional[str] = None, cache_scope: typing.Optional[str] = None, load: typing.Union[typing.List[str], typing.List[typing.Tuple[typing.Dict, str]], typing.List[typing.Tuple[str, str]], typing.List[typing.Dict], None]) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
672
652
  """
673
- Specifies the number of times the task corresponding
674
- to a step needs to be retried.
653
+ Decorator that helps cache, version, and store models/datasets from the Hugging Face Hub.
675
654
 
676
- This decorator is useful for handling transient errors, such as networking issues.
677
- If your task contains operations that can't be retried safely, e.g. database updates,
678
- it is advisable to annotate it with `@retry(times=0)`.
655
+ Examples
656
+ --------
679
657
 
680
- This can be used in conjunction with the `@catch` decorator. The `@catch`
681
- decorator will execute a no-op task after all retries have been exhausted,
682
- ensuring that the flow execution can continue.
658
+ ```python
659
+ # **Usage: creating references to models from the Hugging Face Hub that may be loaded in downstream steps**
660
+ @huggingface_hub
661
+ @step
662
+ def pull_model_from_huggingface(self):
663
+ # `current.huggingface_hub.snapshot_download` downloads the model from the Hugging Face Hub
664
+ # and saves it in the backend storage based on the model's `repo_id`. If there exists a model
665
+ # with the same `repo_id` in the backend storage, it will not download the model again. The return
666
+ # value of the function is a reference to the model in the backend storage.
667
+ # This reference can be used to load the model in the subsequent steps via `@model(load=["llama_model"])`
683
668
 
669
+ self.model_id = "mistralai/Mistral-7B-Instruct-v0.1"
670
+ self.llama_model = current.huggingface_hub.snapshot_download(
671
+ repo_id=self.model_id,
672
+ allow_patterns=["*.safetensors", "*.json", "tokenizer.*"],
673
+ )
674
+ self.next(self.train)
684
675
 
685
- Parameters
686
- ----------
687
- times : int, default 3
688
- Number of times to retry this task.
689
- minutes_between_retries : int, default 2
690
- Number of minutes between retries.
691
- """
692
- ...
693
-
694
- @typing.overload
695
- def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
696
- ...
697
-
698
- @typing.overload
699
- def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
700
- ...
701
-
702
- 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):
703
- """
704
- Specifies the number of times the task corresponding
705
- to a step needs to be retried.
676
+ # **Usage: explicitly loading models at runtime from the Hugging Face Hub or from cache (from Metaflow's datastore)**
677
+ @huggingface_hub
678
+ @step
679
+ def run_training(self):
680
+ # Temporary directory (auto-cleaned on exit)
681
+ with current.huggingface_hub.load(
682
+ repo_id="google-bert/bert-base-uncased",
683
+ allow_patterns=["*.bin"],
684
+ ) as local_path:
685
+ # Use files under local_path
686
+ train_model(local_path)
687
+ ...
706
688
 
707
- This decorator is useful for handling transient errors, such as networking issues.
708
- If your task contains operations that can't be retried safely, e.g. database updates,
709
- it is advisable to annotate it with `@retry(times=0)`.
689
+ # **Usage: loading models directly from the Hugging Face Hub or from cache (from Metaflow's datastore)**
710
690
 
711
- This can be used in conjunction with the `@catch` decorator. The `@catch`
712
- decorator will execute a no-op task after all retries have been exhausted,
713
- ensuring that the flow execution can continue.
691
+ @huggingface_hub(load=["mistralai/Mistral-7B-Instruct-v0.1"])
692
+ @step
693
+ def pull_model_from_huggingface(self):
694
+ path_to_model = current.huggingface_hub.loaded["mistralai/Mistral-7B-Instruct-v0.1"]
714
695
 
696
+ @huggingface_hub(load=[("mistralai/Mistral-7B-Instruct-v0.1", "/my-directory"), ("myorg/mistral-lora", "/my-lora-directory")])
697
+ @step
698
+ def finetune_model(self):
699
+ path_to_model = current.huggingface_hub.loaded["mistralai/Mistral-7B-Instruct-v0.1"]
700
+ # path_to_model will be /my-directory
715
701
 
716
- Parameters
717
- ----------
718
- times : int, default 3
719
- Number of times to retry this task.
720
- minutes_between_retries : int, default 2
721
- Number of minutes between retries.
722
- """
723
- ...
724
-
725
- @typing.overload
726
- def timeout(*, seconds: int = 0, minutes: int = 0, hours: int = 0) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
727
- """
728
- Specifies a timeout for your step.
729
702
 
730
- This decorator is useful if this step may hang indefinitely.
731
-
732
- This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
733
- A timeout is considered to be an exception thrown by the step. It will cause the step to be
734
- retried if needed and the exception will be caught by the `@catch` decorator, if present.
735
-
736
- Note that all the values specified in parameters are added together so if you specify
737
- 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
738
-
739
-
740
- Parameters
741
- ----------
742
- seconds : int, default 0
743
- Number of seconds to wait prior to timing out.
744
- minutes : int, default 0
745
- Number of minutes to wait prior to timing out.
746
- hours : int, default 0
747
- Number of hours to wait prior to timing out.
748
- """
749
- ...
750
-
751
- @typing.overload
752
- def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
753
- ...
754
-
755
- @typing.overload
756
- def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
757
- ...
758
-
759
- def timeout(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, seconds: int = 0, minutes: int = 0, hours: int = 0):
760
- """
761
- Specifies a timeout for your step.
762
-
763
- This decorator is useful if this step may hang indefinitely.
764
-
765
- This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
766
- A timeout is considered to be an exception thrown by the step. It will cause the step to be
767
- retried if needed and the exception will be caught by the `@catch` decorator, if present.
768
-
769
- Note that all the values specified in parameters are added together so if you specify
770
- 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
771
-
772
-
773
- Parameters
774
- ----------
775
- seconds : int, default 0
776
- Number of seconds to wait prior to timing out.
777
- minutes : int, default 0
778
- Number of minutes to wait prior to timing out.
779
- hours : int, default 0
780
- Number of hours to wait prior to timing out.
781
- """
782
- ...
783
-
784
- @typing.overload
785
- def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], 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
- """
790
- ...
791
-
792
- @typing.overload
793
- def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
794
- ...
795
-
796
- def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
797
- """
798
- Decorator prototype for all step decorators. This function gets specialized
799
- and imported for all decorators types by _import_plugin_decorators().
800
- """
801
- ...
802
-
803
- @typing.overload
804
- def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
805
- """
806
- Internal decorator to support Fast bakery
807
- """
808
- ...
809
-
810
- @typing.overload
811
- def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
812
- ...
813
-
814
- def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
815
- """
816
- Internal decorator to support Fast bakery
817
- """
818
- ...
819
-
820
- 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]]]:
821
- """
822
- Specifies that this step should execute on DGX cloud.
823
-
824
-
825
- Parameters
826
- ----------
827
- gpu : int
828
- Number of GPUs to use.
829
- gpu_type : str
830
- Type of Nvidia GPU to use.
831
- """
832
- ...
833
-
834
- 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]]]:
835
- """
836
- This decorator is used to run vllm APIs as Metaflow task sidecars.
837
-
838
- User code call
839
- --------------
840
- @vllm(
841
- model="...",
842
- ...
843
- )
844
-
845
- Valid backend options
846
- ---------------------
847
- - 'local': Run as a separate process on the local task machine.
848
-
849
- Valid model options
850
- -------------------
851
- Any HuggingFace model identifier, e.g. 'meta-llama/Llama-3.2-1B'
852
-
853
- NOTE: vLLM's OpenAI-compatible server serves ONE model per server instance.
854
- If you need multiple models, you must create multiple @vllm decorators.
703
+ # Takes all the arguments passed to `snapshot_download`
704
+ # except for `local_dir`
705
+ @huggingface_hub(load=[
706
+ {
707
+ "repo_id": "mistralai/Mistral-7B-Instruct-v0.1",
708
+ },
709
+ {
710
+ "repo_id": "myorg/mistral-lora",
711
+ "repo_type": "model",
712
+ },
713
+ ])
714
+ @step
715
+ def finetune_model(self):
716
+ path_to_model = current.huggingface_hub.loaded["mistralai/Mistral-7B-Instruct-v0.1"]
717
+ # path_to_model will be /my-directory
718
+ ```
855
719
 
856
720
 
857
721
  Parameters
858
722
  ----------
859
- model: str
860
- HuggingFace model identifier to be served by vLLM.
861
- backend: str
862
- Determines where and how to run the vLLM process.
863
- openai_api_server: bool
864
- Whether to use OpenAI-compatible API server mode (subprocess) instead of native engine.
865
- Default is False (uses native engine).
866
- Set to True for backward compatibility with existing code.
867
- debug: bool
868
- Whether to turn on verbose debugging logs.
869
- card_refresh_interval: int
870
- Interval in seconds for refreshing the vLLM status card.
871
- Only used when openai_api_server=True.
872
- max_retries: int
873
- Maximum number of retries checking for vLLM server startup.
874
- Only used when openai_api_server=True.
875
- retry_alert_frequency: int
876
- Frequency of alert logs for vLLM server startup retries.
877
- Only used when openai_api_server=True.
878
- engine_args : dict
879
- Additional keyword arguments to pass to the vLLM engine.
880
- For example, `tensor_parallel_size=2`.
881
- """
882
- ...
883
-
884
- 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]]]:
885
- """
886
- Set up an S3 proxy that caches objects in an external, S3‑compatible bucket
887
- for S3 read and write requests.
888
-
889
- This decorator requires an integration in the Outerbounds platform that
890
- points to an external bucket. It affects S3 operations performed via
891
- Metaflow's `get_aws_client` and `S3` within a `@step`.
723
+ temp_dir_root : str, optional
724
+ The root directory that will hold the temporary directory where objects will be downloaded.
892
725
 
893
- Read operations
894
- ---------------
895
- All read operations pass through the proxy. If an object does not already
896
- exist in the external bucket, it is cached there. For example, if code reads
897
- from buckets `FOO` and `BAR` using the `S3` interface, objects from both
898
- buckets are cached in the external bucket.
726
+ cache_scope : str, optional
727
+ The scope of the cache. Can be `checkpoint` / `flow` / `global`.
728
+ - `checkpoint` (default): All repos are stored like objects saved by `@checkpoint`.
729
+ i.e., the cached path is derived from the namespace, flow, step, and Metaflow foreach iteration.
730
+ Any repo downloaded under this scope will only be retrieved from the cache when the step runs under the same namespace in the same flow (at the same foreach index).
899
731
 
900
- During task execution, all S3‑related read requests are routed through the
901
- proxy:
902
- - If the object is present in the external object store, the proxy
903
- streams it directly from there without accessing the requested origin
904
- bucket.
905
- - If the object is not present in the external storage, the proxy
906
- fetches it from the requested bucket, caches it in the external
907
- storage, and streams the response from the origin bucket.
732
+ - `flow`: All repos are cached under the flow, regardless of namespace.
733
+ i.e., the cached path is derived solely from the flow name.
734
+ When to use this mode: (1) Multiple users are executing the same flow and want shared access to the repos cached by the decorator. (2) Multiple versions of a flow are deployed, all needing access to the same repos cached by the decorator.
908
735
 
909
- Warning
910
- -------
911
- All READ operations (e.g., GetObject, HeadObject) pass through the external
912
- bucket regardless of the bucket specified in user code. Even
913
- `S3(run=self)` and `S3(s3root="mybucketfoo")` requests go through the
914
- external bucket cache.
736
+ - `global`: All repos are cached under a globally static path.
737
+ i.e., the base path of the cache is static and all repos are stored under it.
738
+ When to use this mode:
739
+ - All repos from the Hugging Face Hub need to be shared by users across all flow executions.
740
+ - Each caching scope comes with its own trade-offs:
741
+ - `checkpoint`:
742
+ - Has explicit control over when caches are populated (controlled by the same flow that has the `@huggingface_hub` decorator) but ends up hitting the Hugging Face Hub more often if there are many users/namespaces/steps.
743
+ - Since objects are written on a `namespace/flow/step` basis, the blast radius of a bad checkpoint is limited to a particular flow in a namespace.
744
+ - `flow`:
745
+ - Has less control over when caches are populated (can be written by any execution instance of a flow from any namespace) but results in more cache hits.
746
+ - The blast radius of a bad checkpoint is limited to all runs of a particular flow.
747
+ - It doesn't promote cache reuse across flows.
748
+ - `global`:
749
+ - Has no control over when caches are populated (can be written by any flow execution) but has the highest cache hit rate.
750
+ - It promotes cache reuse across flows.
751
+ - The blast radius of a bad checkpoint spans every flow that could be using a particular repo.
915
752
 
916
- Write operations
917
- ----------------
918
- Write behavior is controlled by the `write_mode` parameter, which determines
919
- whether writes also persist objects in the cache.
753
+ load: Union[List[str], List[Tuple[Dict, str]], List[Tuple[str, str]], List[Dict], None]
754
+ The list of repos (models/datasets) to load.
920
755
 
921
- `write_mode` values:
922
- - `origin-and-cache`: objects are written both to the cache and to their
923
- intended origin bucket.
924
- - `origin`: objects are written only to their intended origin bucket.
756
+ Loaded repos can be accessed via `current.huggingface_hub.loaded`. If load is set, then the following happens:
925
757
 
758
+ - If repo (model/dataset) is not found in the datastore:
759
+ - Downloads the repo from Hugging Face Hub to a temporary directory (or uses specified path) for local access
760
+ - Stores it in Metaflow's datastore (s3/gcs/azure etc.) with a unique name based on repo_type/repo_id
761
+ - All HF models loaded for a `@step` will be cached separately under flow/step/namespace.
926
762
 
927
- Parameters
928
- ----------
929
- integration_name : str, optional
930
- [Outerbounds integration name](https://docs.outerbounds.com/outerbounds/configuring-secrets/#integrations-view)
931
- that holds the configuration for the external, S3‑compatible object
932
- storage bucket. If not specified, the only available S3 proxy
933
- integration in the namespace is used (fails if multiple exist).
934
- write_mode : str, optional
935
- Controls whether writes also go to the external bucket.
936
- - `origin` (default)
937
- - `origin-and-cache`
938
- debug : bool, optional
939
- Enables debug logging for proxy operations.
763
+ - If repo is found in the datastore:
764
+ - Loads it directly from datastore to local path (can be temporary directory or specified path)
940
765
  """
941
766
  ...
942
767
 
@@ -1019,134 +844,7 @@ def resources(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None]
1019
844
  """
1020
845
  ...
1021
846
 
1022
- @typing.overload
1023
- def test_append_card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1024
- """
1025
- A simple decorator that demonstrates using CardDecoratorInjector
1026
- to inject a card and render simple markdown content.
1027
- """
1028
- ...
1029
-
1030
- @typing.overload
1031
- def test_append_card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1032
- ...
1033
-
1034
- def test_append_card(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
1035
- """
1036
- A simple decorator that demonstrates using CardDecoratorInjector
1037
- to inject a card and render simple markdown content.
1038
- """
1039
- ...
1040
-
1041
- @typing.overload
1042
- 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]]]:
1043
- """
1044
- Specifies the Conda environment for the step.
1045
-
1046
- Information in this decorator will augment any
1047
- attributes set in the `@conda_base` flow-level decorator. Hence,
1048
- you can use `@conda_base` to set packages required by all
1049
- steps and use `@conda` to specify step-specific overrides.
1050
-
1051
-
1052
- Parameters
1053
- ----------
1054
- packages : Dict[str, str], default {}
1055
- Packages to use for this step. The key is the name of the package
1056
- and the value is the version to use.
1057
- libraries : Dict[str, str], default {}
1058
- Supported for backward compatibility. When used with packages, packages will take precedence.
1059
- python : str, optional, default None
1060
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1061
- that the version used will correspond to the version of the Python interpreter used to start the run.
1062
- disabled : bool, default False
1063
- If set to True, disables @conda.
1064
- """
1065
- ...
1066
-
1067
- @typing.overload
1068
- def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1069
- ...
1070
-
1071
- @typing.overload
1072
- def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1073
- ...
1074
-
1075
- def conda(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False):
1076
- """
1077
- Specifies the Conda environment for the step.
1078
-
1079
- Information in this decorator will augment any
1080
- attributes set in the `@conda_base` flow-level decorator. Hence,
1081
- you can use `@conda_base` to set packages required by all
1082
- steps and use `@conda` to specify step-specific overrides.
1083
-
1084
-
1085
- Parameters
1086
- ----------
1087
- packages : Dict[str, str], default {}
1088
- Packages to use for this step. The key is the name of the package
1089
- and the value is the version to use.
1090
- libraries : Dict[str, str], default {}
1091
- Supported for backward compatibility. When used with packages, packages will take precedence.
1092
- python : str, optional, default None
1093
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1094
- that the version used will correspond to the version of the Python interpreter used to start the run.
1095
- disabled : bool, default False
1096
- If set to True, disables @conda.
1097
- """
1098
- ...
1099
-
1100
- @typing.overload
1101
- 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]]]:
1102
- """
1103
- Creates a human-readable report, a Metaflow Card, after this step completes.
1104
-
1105
- Note that you may add multiple `@card` decorators in a step with different parameters.
1106
-
1107
-
1108
- Parameters
1109
- ----------
1110
- type : str, default 'default'
1111
- Card type.
1112
- id : str, optional, default None
1113
- If multiple cards are present, use this id to identify this card.
1114
- options : Dict[str, Any], default {}
1115
- Options passed to the card. The contents depend on the card type.
1116
- timeout : int, default 45
1117
- Interrupt reporting if it takes more than this many seconds.
1118
- """
1119
- ...
1120
-
1121
- @typing.overload
1122
- def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1123
- ...
1124
-
1125
- @typing.overload
1126
- def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1127
- ...
1128
-
1129
- 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):
1130
- """
1131
- Creates a human-readable report, a Metaflow Card, after this step completes.
1132
-
1133
- Note that you may add multiple `@card` decorators in a step with different parameters.
1134
-
1135
-
1136
- Parameters
1137
- ----------
1138
- type : str, default 'default'
1139
- Card type.
1140
- id : str, optional, default None
1141
- If multiple cards are present, use this id to identify this card.
1142
- options : Dict[str, Any], default {}
1143
- Options passed to the card. The contents depend on the card type.
1144
- timeout : int, default 45
1145
- Interrupt reporting if it takes more than this many seconds.
1146
- """
1147
- ...
1148
-
1149
- def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: typing.Optional[str] = None, image_pull_policy: str = 'KUBERNETES_IMAGE_PULL_POLICY', image_pull_secrets: typing.List[str] = [], service_account: str = 'METAFLOW_KUBERNETES_SERVICE_ACCOUNT', secrets: typing.Optional[typing.List[str]] = None, node_selector: typing.Union[typing.Dict[str, str], str, None] = None, namespace: str = 'METAFLOW_KUBERNETES_NAMESPACE', gpu: typing.Optional[int] = None, gpu_vendor: str = 'KUBERNETES_GPU_VENDOR', tolerations: typing.List[typing.Dict[str, str]] = [], labels: typing.Dict[str, str] = 'METAFLOW_KUBERNETES_LABELS', annotations: typing.Dict[str, str] = 'METAFLOW_KUBERNETES_ANNOTATIONS', use_tmpfs: bool = False, tmpfs_tempdir: bool = True, tmpfs_size: typing.Optional[int] = None, tmpfs_path: typing.Optional[str] = '/metaflow_temp', persistent_volume_claims: typing.Optional[typing.Dict[str, str]] = None, shared_memory: typing.Optional[int] = None, port: typing.Optional[int] = None, compute_pool: typing.Optional[str] = None, hostname_resolution_timeout: int = 600, qos: str = 'Burstable', security_context: typing.Optional[typing.Dict[str, typing.Any]] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
847
+ def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: typing.Optional[str] = None, image_pull_policy: str = 'KUBERNETES_IMAGE_PULL_POLICY', image_pull_secrets: typing.List[str] = [], service_account: str = 'METAFLOW_KUBERNETES_SERVICE_ACCOUNT', secrets: typing.Optional[typing.List[str]] = None, node_selector: typing.Union[typing.Dict[str, str], str, None] = None, namespace: str = 'METAFLOW_KUBERNETES_NAMESPACE', gpu: typing.Optional[int] = None, gpu_vendor: str = 'KUBERNETES_GPU_VENDOR', tolerations: typing.List[typing.Dict[str, str]] = [], labels: typing.Dict[str, str] = 'METAFLOW_KUBERNETES_LABELS', annotations: typing.Dict[str, str] = 'METAFLOW_KUBERNETES_ANNOTATIONS', use_tmpfs: bool = False, tmpfs_tempdir: bool = True, tmpfs_size: typing.Optional[int] = None, tmpfs_path: typing.Optional[str] = '/metaflow_temp', persistent_volume_claims: typing.Optional[typing.Dict[str, str]] = None, shared_memory: typing.Optional[int] = None, port: typing.Optional[int] = None, compute_pool: typing.Optional[str] = None, hostname_resolution_timeout: int = 600, qos: str = 'Burstable', security_context: typing.Optional[typing.Dict[str, typing.Any]] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
1150
848
  """
1151
849
  Specifies that this step should execute on Kubernetes.
1152
850
 
@@ -1235,171 +933,202 @@ def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: ty
1235
933
  """
1236
934
  ...
1237
935
 
1238
- 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]]]:
936
+ @typing.overload
937
+ def test_append_card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1239
938
  """
1240
- This decorator is used to run Ollama APIs as Metaflow task sidecars.
939
+ A simple decorator that demonstrates using CardDecoratorInjector
940
+ to inject a card and render simple markdown content.
941
+ """
942
+ ...
943
+
944
+ @typing.overload
945
+ def test_append_card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
946
+ ...
947
+
948
+ def test_append_card(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
949
+ """
950
+ A simple decorator that demonstrates using CardDecoratorInjector
951
+ to inject a card and render simple markdown content.
952
+ """
953
+ ...
954
+
955
+ def coreweave_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]]]:
956
+ """
957
+ `@coreweave_s3_proxy` is a CoreWeave-specific S3 Proxy decorator for routing S3 requests through a local proxy service.
958
+ It exists to make it easier for users to know that this decorator should only be used with
959
+ a Neo Cloud like CoreWeave. The underlying mechanics of the decorator is the same as the `@s3_proxy`:
1241
960
 
1242
- User code call
1243
- --------------
1244
- @ollama(
1245
- models=[...],
1246
- ...
1247
- )
1248
961
 
1249
- Valid backend options
1250
- ---------------------
1251
- - 'local': Run as a separate process on the local task machine.
1252
- - (TODO) 'managed': Outerbounds hosts and selects compute provider.
1253
- - (TODO) 'remote': Spin up separate instance to serve Ollama models.
962
+ Set up an S3 proxy that caches objects in an external, S3‑compatible bucket
963
+ for S3 read and write requests.
1254
964
 
1255
- Valid model options
1256
- -------------------
1257
- Any model here https://ollama.com/search, e.g. 'llama3.2', 'llama3.3'
965
+ This decorator requires an integration in the Outerbounds platform that
966
+ points to an external bucket. It affects S3 operations performed via
967
+ Metaflow's `get_aws_client` and `S3` within a `@step`.
968
+
969
+ Read operations
970
+ ---------------
971
+ All read operations pass through the proxy. If an object does not already
972
+ exist in the external bucket, it is cached there. For example, if code reads
973
+ from buckets `FOO` and `BAR` using the `S3` interface, objects from both
974
+ buckets are cached in the external bucket.
975
+
976
+ During task execution, all S3‑related read requests are routed through the
977
+ proxy:
978
+ - If the object is present in the external object store, the proxy
979
+ streams it directly from there without accessing the requested origin
980
+ bucket.
981
+ - If the object is not present in the external storage, the proxy
982
+ fetches it from the requested bucket, caches it in the external
983
+ storage, and streams the response from the origin bucket.
984
+
985
+ Warning
986
+ -------
987
+ All READ operations (e.g., GetObject, HeadObject) pass through the external
988
+ bucket regardless of the bucket specified in user code. Even
989
+ `S3(run=self)` and `S3(s3root="mybucketfoo")` requests go through the
990
+ external bucket cache.
991
+
992
+ Write operations
993
+ ----------------
994
+ Write behavior is controlled by the `write_mode` parameter, which determines
995
+ whether writes also persist objects in the cache.
996
+
997
+ `write_mode` values:
998
+ - `origin-and-cache`: objects are written both to the cache and to their
999
+ intended origin bucket.
1000
+ - `origin`: objects are written only to their intended origin bucket.
1258
1001
 
1259
1002
 
1260
1003
  Parameters
1261
1004
  ----------
1262
- models: list[str]
1263
- List of Ollama containers running models in sidecars.
1264
- backend: str
1265
- Determines where and how to run the Ollama process.
1266
- force_pull: bool
1267
- Whether to run `ollama pull` no matter what, or first check the remote cache in Metaflow datastore for this model key.
1268
- cache_update_policy: str
1269
- Cache update policy: "auto", "force", or "never".
1270
- force_cache_update: bool
1271
- Simple override for "force" cache update policy.
1272
- debug: bool
1273
- Whether to turn on verbose debugging logs.
1274
- circuit_breaker_config: dict
1275
- Configuration for circuit breaker protection. Keys: failure_threshold, recovery_timeout, reset_timeout.
1276
- timeout_config: dict
1277
- Configuration for various operation timeouts. Keys: pull, stop, health_check, install, server_startup.
1005
+ integration_name : str, optional
1006
+ [Outerbounds integration name](https://docs.outerbounds.com/outerbounds/configuring-secrets/#integrations-view)
1007
+ that holds the configuration for the external, S3‑compatible object
1008
+ storage bucket. If not specified, the only available S3 proxy
1009
+ integration in the namespace is used (fails if multiple exist).
1010
+ write_mode : str, optional
1011
+ Controls whether writes also go to the external bucket.
1012
+ - `origin` (default)
1013
+ - `origin-and-cache`
1014
+ debug : bool, optional
1015
+ Enables debug logging for proxy operations.
1278
1016
  """
1279
1017
  ...
1280
1018
 
1281
- def huggingface_hub(*, temp_dir_root: typing.Optional[str] = None, cache_scope: typing.Optional[str] = None, load: typing.Union[typing.List[str], typing.List[typing.Tuple[typing.Dict, str]], typing.List[typing.Tuple[str, str]], typing.List[typing.Dict], None]) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
1019
+ @typing.overload
1020
+ def timeout(*, seconds: int = 0, minutes: int = 0, hours: int = 0) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
1282
1021
  """
1283
- Decorator that helps cache, version, and store models/datasets from the Hugging Face Hub.
1022
+ Specifies a timeout for your step.
1284
1023
 
1285
- Examples
1286
- --------
1024
+ This decorator is useful if this step may hang indefinitely.
1287
1025
 
1288
- ```python
1289
- # **Usage: creating references to models from the Hugging Face Hub that may be loaded in downstream steps**
1290
- @huggingface_hub
1291
- @step
1292
- def pull_model_from_huggingface(self):
1293
- # `current.huggingface_hub.snapshot_download` downloads the model from the Hugging Face Hub
1294
- # and saves it in the backend storage based on the model's `repo_id`. If there exists a model
1295
- # with the same `repo_id` in the backend storage, it will not download the model again. The return
1296
- # value of the function is a reference to the model in the backend storage.
1297
- # This reference can be used to load the model in the subsequent steps via `@model(load=["llama_model"])`
1026
+ This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
1027
+ A timeout is considered to be an exception thrown by the step. It will cause the step to be
1028
+ retried if needed and the exception will be caught by the `@catch` decorator, if present.
1298
1029
 
1299
- self.model_id = "mistralai/Mistral-7B-Instruct-v0.1"
1300
- self.llama_model = current.huggingface_hub.snapshot_download(
1301
- repo_id=self.model_id,
1302
- allow_patterns=["*.safetensors", "*.json", "tokenizer.*"],
1303
- )
1304
- self.next(self.train)
1030
+ Note that all the values specified in parameters are added together so if you specify
1031
+ 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
1305
1032
 
1306
- # **Usage: explicitly loading models at runtime from the Hugging Face Hub or from cache (from Metaflow's datastore)**
1307
- @huggingface_hub
1308
- @step
1309
- def run_training(self):
1310
- # Temporary directory (auto-cleaned on exit)
1311
- with current.huggingface_hub.load(
1312
- repo_id="google-bert/bert-base-uncased",
1313
- allow_patterns=["*.bin"],
1314
- ) as local_path:
1315
- # Use files under local_path
1316
- train_model(local_path)
1317
- ...
1318
-
1319
- # **Usage: loading models directly from the Hugging Face Hub or from cache (from Metaflow's datastore)**
1320
1033
 
1321
- @huggingface_hub(load=["mistralai/Mistral-7B-Instruct-v0.1"])
1322
- @step
1323
- def pull_model_from_huggingface(self):
1324
- path_to_model = current.huggingface_hub.loaded["mistralai/Mistral-7B-Instruct-v0.1"]
1034
+ Parameters
1035
+ ----------
1036
+ seconds : int, default 0
1037
+ Number of seconds to wait prior to timing out.
1038
+ minutes : int, default 0
1039
+ Number of minutes to wait prior to timing out.
1040
+ hours : int, default 0
1041
+ Number of hours to wait prior to timing out.
1042
+ """
1043
+ ...
1044
+
1045
+ @typing.overload
1046
+ def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1047
+ ...
1048
+
1049
+ @typing.overload
1050
+ def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1051
+ ...
1052
+
1053
+ def timeout(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, seconds: int = 0, minutes: int = 0, hours: int = 0):
1054
+ """
1055
+ Specifies a timeout for your step.
1325
1056
 
1326
- @huggingface_hub(load=[("mistralai/Mistral-7B-Instruct-v0.1", "/my-directory"), ("myorg/mistral-lora", "/my-lora-directory")])
1327
- @step
1328
- def finetune_model(self):
1329
- path_to_model = current.huggingface_hub.loaded["mistralai/Mistral-7B-Instruct-v0.1"]
1330
- # path_to_model will be /my-directory
1057
+ This decorator is useful if this step may hang indefinitely.
1331
1058
 
1059
+ This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
1060
+ A timeout is considered to be an exception thrown by the step. It will cause the step to be
1061
+ retried if needed and the exception will be caught by the `@catch` decorator, if present.
1332
1062
 
1333
- # Takes all the arguments passed to `snapshot_download`
1334
- # except for `local_dir`
1335
- @huggingface_hub(load=[
1336
- {
1337
- "repo_id": "mistralai/Mistral-7B-Instruct-v0.1",
1338
- },
1339
- {
1340
- "repo_id": "myorg/mistral-lora",
1341
- "repo_type": "model",
1342
- },
1343
- ])
1344
- @step
1345
- def finetune_model(self):
1346
- path_to_model = current.huggingface_hub.loaded["mistralai/Mistral-7B-Instruct-v0.1"]
1347
- # path_to_model will be /my-directory
1348
- ```
1063
+ Note that all the values specified in parameters are added together so if you specify
1064
+ 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
1349
1065
 
1350
1066
 
1351
1067
  Parameters
1352
1068
  ----------
1353
- temp_dir_root : str, optional
1354
- The root directory that will hold the temporary directory where objects will be downloaded.
1069
+ seconds : int, default 0
1070
+ Number of seconds to wait prior to timing out.
1071
+ minutes : int, default 0
1072
+ Number of minutes to wait prior to timing out.
1073
+ hours : int, default 0
1074
+ Number of hours to wait prior to timing out.
1075
+ """
1076
+ ...
1077
+
1078
+ @typing.overload
1079
+ 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]]]:
1080
+ """
1081
+ Creates a human-readable report, a Metaflow Card, after this step completes.
1355
1082
 
1356
- cache_scope : str, optional
1357
- The scope of the cache. Can be `checkpoint` / `flow` / `global`.
1358
- - `checkpoint` (default): All repos are stored like objects saved by `@checkpoint`.
1359
- i.e., the cached path is derived from the namespace, flow, step, and Metaflow foreach iteration.
1360
- Any repo downloaded under this scope will only be retrieved from the cache when the step runs under the same namespace in the same flow (at the same foreach index).
1083
+ Note that you may add multiple `@card` decorators in a step with different parameters.
1361
1084
 
1362
- - `flow`: All repos are cached under the flow, regardless of namespace.
1363
- i.e., the cached path is derived solely from the flow name.
1364
- When to use this mode: (1) Multiple users are executing the same flow and want shared access to the repos cached by the decorator. (2) Multiple versions of a flow are deployed, all needing access to the same repos cached by the decorator.
1365
1085
 
1366
- - `global`: All repos are cached under a globally static path.
1367
- i.e., the base path of the cache is static and all repos are stored under it.
1368
- When to use this mode:
1369
- - All repos from the Hugging Face Hub need to be shared by users across all flow executions.
1370
- - Each caching scope comes with its own trade-offs:
1371
- - `checkpoint`:
1372
- - Has explicit control over when caches are populated (controlled by the same flow that has the `@huggingface_hub` decorator) but ends up hitting the Hugging Face Hub more often if there are many users/namespaces/steps.
1373
- - Since objects are written on a `namespace/flow/step` basis, the blast radius of a bad checkpoint is limited to a particular flow in a namespace.
1374
- - `flow`:
1375
- - Has less control over when caches are populated (can be written by any execution instance of a flow from any namespace) but results in more cache hits.
1376
- - The blast radius of a bad checkpoint is limited to all runs of a particular flow.
1377
- - It doesn't promote cache reuse across flows.
1378
- - `global`:
1379
- - Has no control over when caches are populated (can be written by any flow execution) but has the highest cache hit rate.
1380
- - It promotes cache reuse across flows.
1381
- - The blast radius of a bad checkpoint spans every flow that could be using a particular repo.
1382
-
1383
- load: Union[List[str], List[Tuple[Dict, str]], List[Tuple[str, str]], List[Dict], None]
1384
- The list of repos (models/datasets) to load.
1086
+ Parameters
1087
+ ----------
1088
+ type : str, default 'default'
1089
+ Card type.
1090
+ id : str, optional, default None
1091
+ If multiple cards are present, use this id to identify this card.
1092
+ options : Dict[str, Any], default {}
1093
+ Options passed to the card. The contents depend on the card type.
1094
+ timeout : int, default 45
1095
+ Interrupt reporting if it takes more than this many seconds.
1096
+ """
1097
+ ...
1098
+
1099
+ @typing.overload
1100
+ def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1101
+ ...
1102
+
1103
+ @typing.overload
1104
+ def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1105
+ ...
1106
+
1107
+ 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):
1108
+ """
1109
+ Creates a human-readable report, a Metaflow Card, after this step completes.
1385
1110
 
1386
- Loaded repos can be accessed via `current.huggingface_hub.loaded`. If load is set, then the following happens:
1111
+ Note that you may add multiple `@card` decorators in a step with different parameters.
1387
1112
 
1388
- - If repo (model/dataset) is not found in the datastore:
1389
- - Downloads the repo from Hugging Face Hub to a temporary directory (or uses specified path) for local access
1390
- - Stores it in Metaflow's datastore (s3/gcs/azure etc.) with a unique name based on repo_type/repo_id
1391
- - All HF models loaded for a `@step` will be cached separately under flow/step/namespace.
1392
1113
 
1393
- - If repo is found in the datastore:
1394
- - Loads it directly from datastore to local path (can be temporary directory or specified path)
1114
+ Parameters
1115
+ ----------
1116
+ type : str, default 'default'
1117
+ Card type.
1118
+ id : str, optional, default None
1119
+ If multiple cards are present, use this id to identify this card.
1120
+ options : Dict[str, Any], default {}
1121
+ Options passed to the card. The contents depend on the card type.
1122
+ timeout : int, default 45
1123
+ Interrupt reporting if it takes more than this many seconds.
1395
1124
  """
1396
1125
  ...
1397
1126
 
1398
- def coreweave_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]]]:
1127
+ def nebius_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]]]:
1399
1128
  """
1400
- `@coreweave_s3_proxy` is a CoreWeave-specific S3 Proxy decorator for routing S3 requests through a local proxy service.
1129
+ `@nebius_s3_proxy` is a Nebius-specific S3 Proxy decorator for routing S3 requests through a local proxy service.
1401
1130
  It exists to make it easier for users to know that this decorator should only be used with
1402
- a Neo Cloud like CoreWeave. The underlying mechanics of the decorator is the same as the `@s3_proxy`:
1131
+ a Neo Cloud like Nebius. The underlying mechanics of the decorator is the same as the `@s3_proxy`:
1403
1132
 
1404
1133
 
1405
1134
  Set up an S3 proxy that caches objects in an external, S3‑compatible bucket
@@ -1459,54 +1188,403 @@ def coreweave_s3_proxy(*, integration_name: typing.Optional[str] = None, write_m
1459
1188
  """
1460
1189
  ...
1461
1190
 
1462
- @typing.overload
1463
- def pypi(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
1191
+ @typing.overload
1192
+ 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]]]:
1193
+ """
1194
+ Specifies that the step will success under all circumstances.
1195
+
1196
+ The decorator will create an optional artifact, specified by `var`, which
1197
+ contains the exception raised. You can use it to detect the presence
1198
+ of errors, indicating that all happy-path artifacts produced by the step
1199
+ are missing.
1200
+
1201
+
1202
+ Parameters
1203
+ ----------
1204
+ var : str, optional, default None
1205
+ Name of the artifact in which to store the caught exception.
1206
+ If not specified, the exception is not stored.
1207
+ print_exception : bool, default True
1208
+ Determines whether or not the exception is printed to
1209
+ stdout when caught.
1210
+ """
1211
+ ...
1212
+
1213
+ @typing.overload
1214
+ def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1215
+ ...
1216
+
1217
+ @typing.overload
1218
+ def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1219
+ ...
1220
+
1221
+ 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):
1222
+ """
1223
+ Specifies that the step will success under all circumstances.
1224
+
1225
+ The decorator will create an optional artifact, specified by `var`, which
1226
+ contains the exception raised. You can use it to detect the presence
1227
+ of errors, indicating that all happy-path artifacts produced by the step
1228
+ are missing.
1229
+
1230
+
1231
+ Parameters
1232
+ ----------
1233
+ var : str, optional, default None
1234
+ Name of the artifact in which to store the caught exception.
1235
+ If not specified, the exception is not stored.
1236
+ print_exception : bool, default True
1237
+ Determines whether or not the exception is printed to
1238
+ stdout when caught.
1239
+ """
1240
+ ...
1241
+
1242
+ 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]]]:
1243
+ """
1244
+ Specifies that this step should execute on DGX cloud.
1245
+
1246
+
1247
+ Parameters
1248
+ ----------
1249
+ gpu : int
1250
+ Number of GPUs to use.
1251
+ gpu_type : str
1252
+ Type of Nvidia GPU to use.
1253
+ queue_timeout : int
1254
+ Time to keep the job in NVCF's queue.
1255
+ """
1256
+ ...
1257
+
1258
+ 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]]]:
1259
+ """
1260
+ Specifies that this step should execute on DGX cloud.
1261
+
1262
+
1263
+ Parameters
1264
+ ----------
1265
+ gpu : int
1266
+ Number of GPUs to use.
1267
+ gpu_type : str
1268
+ Type of Nvidia GPU to use.
1269
+ """
1270
+ ...
1271
+
1272
+ 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]]]:
1273
+ """
1274
+ This decorator is used to run Ollama APIs as Metaflow task sidecars.
1275
+
1276
+ User code call
1277
+ --------------
1278
+ @ollama(
1279
+ models=[...],
1280
+ ...
1281
+ )
1282
+
1283
+ Valid backend options
1284
+ ---------------------
1285
+ - 'local': Run as a separate process on the local task machine.
1286
+ - (TODO) 'managed': Outerbounds hosts and selects compute provider.
1287
+ - (TODO) 'remote': Spin up separate instance to serve Ollama models.
1288
+
1289
+ Valid model options
1290
+ -------------------
1291
+ Any model here https://ollama.com/search, e.g. 'llama3.2', 'llama3.3'
1292
+
1293
+
1294
+ Parameters
1295
+ ----------
1296
+ models: list[str]
1297
+ List of Ollama containers running models in sidecars.
1298
+ backend: str
1299
+ Determines where and how to run the Ollama process.
1300
+ force_pull: bool
1301
+ Whether to run `ollama pull` no matter what, or first check the remote cache in Metaflow datastore for this model key.
1302
+ cache_update_policy: str
1303
+ Cache update policy: "auto", "force", or "never".
1304
+ force_cache_update: bool
1305
+ Simple override for "force" cache update policy.
1306
+ debug: bool
1307
+ Whether to turn on verbose debugging logs.
1308
+ circuit_breaker_config: dict
1309
+ Configuration for circuit breaker protection. Keys: failure_threshold, recovery_timeout, reset_timeout.
1310
+ timeout_config: dict
1311
+ Configuration for various operation timeouts. Keys: pull, stop, health_check, install, server_startup.
1312
+ """
1313
+ ...
1314
+
1315
+ @typing.overload
1316
+ def pypi(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
1317
+ """
1318
+ Specifies the PyPI packages for the step.
1319
+
1320
+ Information in this decorator will augment any
1321
+ attributes set in the `@pyi_base` flow-level decorator. Hence,
1322
+ you can use `@pypi_base` to set packages required by all
1323
+ steps and use `@pypi` to specify step-specific overrides.
1324
+
1325
+
1326
+ Parameters
1327
+ ----------
1328
+ packages : Dict[str, str], default: {}
1329
+ Packages to use for this step. The key is the name of the package
1330
+ and the value is the version to use.
1331
+ python : str, optional, default: None
1332
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1333
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1334
+ """
1335
+ ...
1336
+
1337
+ @typing.overload
1338
+ def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1339
+ ...
1340
+
1341
+ @typing.overload
1342
+ def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1343
+ ...
1344
+
1345
+ def pypi(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
1346
+ """
1347
+ Specifies the PyPI packages for the step.
1348
+
1349
+ Information in this decorator will augment any
1350
+ attributes set in the `@pyi_base` flow-level decorator. Hence,
1351
+ you can use `@pypi_base` to set packages required by all
1352
+ steps and use `@pypi` to specify step-specific overrides.
1353
+
1354
+
1355
+ Parameters
1356
+ ----------
1357
+ packages : Dict[str, str], default: {}
1358
+ Packages to use for this step. The key is the name of the package
1359
+ and the value is the version to use.
1360
+ python : str, optional, default: None
1361
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1362
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1363
+ """
1364
+ ...
1365
+
1366
+ @typing.overload
1367
+ 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]]]:
1368
+ """
1369
+ Enables checkpointing for a step.
1370
+
1371
+ > Examples
1372
+
1373
+ - Saving Checkpoints
1374
+
1375
+ ```python
1376
+ @checkpoint
1377
+ @step
1378
+ def train(self):
1379
+ model = create_model(self.parameters, checkpoint_path = None)
1380
+ for i in range(self.epochs):
1381
+ # some training logic
1382
+ loss = model.train(self.dataset)
1383
+ if i % 10 == 0:
1384
+ model.save(
1385
+ current.checkpoint.directory,
1386
+ )
1387
+ # saves the contents of the `current.checkpoint.directory` as a checkpoint
1388
+ # and returns a reference dictionary to the checkpoint saved in the datastore
1389
+ self.latest_checkpoint = current.checkpoint.save(
1390
+ name="epoch_checkpoint",
1391
+ metadata={
1392
+ "epoch": i,
1393
+ "loss": loss,
1394
+ }
1395
+ )
1396
+ ```
1397
+
1398
+ - Using Loaded Checkpoints
1399
+
1400
+ ```python
1401
+ @retry(times=3)
1402
+ @checkpoint
1403
+ @step
1404
+ def train(self):
1405
+ # Assume that the task has restarted and the previous attempt of the task
1406
+ # saved a checkpoint
1407
+ checkpoint_path = None
1408
+ if current.checkpoint.is_loaded: # Check if a checkpoint is loaded
1409
+ print("Loaded checkpoint from the previous attempt")
1410
+ checkpoint_path = current.checkpoint.directory
1411
+
1412
+ model = create_model(self.parameters, checkpoint_path = checkpoint_path)
1413
+ for i in range(self.epochs):
1414
+ ...
1415
+ ```
1416
+
1417
+
1418
+ Parameters
1419
+ ----------
1420
+ load_policy : str, default: "fresh"
1421
+ The policy for loading the checkpoint. The following policies are supported:
1422
+ - "eager": Loads the the latest available checkpoint within the namespace.
1423
+ With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
1424
+ will be loaded at the start of the task.
1425
+ - "none": Do not load any checkpoint
1426
+ - "fresh": Loads the lastest checkpoint created within the running Task.
1427
+ This mode helps loading checkpoints across various retry attempts of the same task.
1428
+ With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
1429
+ created within the task will be loaded when the task is retries execution on failure.
1430
+
1431
+ temp_dir_root : str, default: None
1432
+ The root directory under which `current.checkpoint.directory` will be created.
1433
+ """
1434
+ ...
1435
+
1436
+ @typing.overload
1437
+ def checkpoint(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1438
+ ...
1439
+
1440
+ @typing.overload
1441
+ def checkpoint(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1442
+ ...
1443
+
1444
+ 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):
1445
+ """
1446
+ Enables checkpointing for a step.
1447
+
1448
+ > Examples
1449
+
1450
+ - Saving Checkpoints
1451
+
1452
+ ```python
1453
+ @checkpoint
1454
+ @step
1455
+ def train(self):
1456
+ model = create_model(self.parameters, checkpoint_path = None)
1457
+ for i in range(self.epochs):
1458
+ # some training logic
1459
+ loss = model.train(self.dataset)
1460
+ if i % 10 == 0:
1461
+ model.save(
1462
+ current.checkpoint.directory,
1463
+ )
1464
+ # saves the contents of the `current.checkpoint.directory` as a checkpoint
1465
+ # and returns a reference dictionary to the checkpoint saved in the datastore
1466
+ self.latest_checkpoint = current.checkpoint.save(
1467
+ name="epoch_checkpoint",
1468
+ metadata={
1469
+ "epoch": i,
1470
+ "loss": loss,
1471
+ }
1472
+ )
1473
+ ```
1474
+
1475
+ - Using Loaded Checkpoints
1476
+
1477
+ ```python
1478
+ @retry(times=3)
1479
+ @checkpoint
1480
+ @step
1481
+ def train(self):
1482
+ # Assume that the task has restarted and the previous attempt of the task
1483
+ # saved a checkpoint
1484
+ checkpoint_path = None
1485
+ if current.checkpoint.is_loaded: # Check if a checkpoint is loaded
1486
+ print("Loaded checkpoint from the previous attempt")
1487
+ checkpoint_path = current.checkpoint.directory
1488
+
1489
+ model = create_model(self.parameters, checkpoint_path = checkpoint_path)
1490
+ for i in range(self.epochs):
1491
+ ...
1492
+ ```
1493
+
1494
+
1495
+ Parameters
1496
+ ----------
1497
+ load_policy : str, default: "fresh"
1498
+ The policy for loading the checkpoint. The following policies are supported:
1499
+ - "eager": Loads the the latest available checkpoint within the namespace.
1500
+ With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
1501
+ will be loaded at the start of the task.
1502
+ - "none": Do not load any checkpoint
1503
+ - "fresh": Loads the lastest checkpoint created within the running Task.
1504
+ This mode helps loading checkpoints across various retry attempts of the same task.
1505
+ With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
1506
+ created within the task will be loaded when the task is retries execution on failure.
1507
+
1508
+ temp_dir_root : str, default: None
1509
+ The root directory under which `current.checkpoint.directory` will be created.
1510
+ """
1511
+ ...
1512
+
1513
+ 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]]:
1514
+ """
1515
+ 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.
1516
+ 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.
1517
+
1518
+
1519
+ Parameters
1520
+ ----------
1521
+ timeout : int
1522
+ Time, in seconds before the task times out and fails. (Default: 3600)
1523
+ poke_interval : int
1524
+ Time in seconds that the job should wait in between each try. (Default: 60)
1525
+ mode : str
1526
+ How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1527
+ exponential_backoff : bool
1528
+ allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1529
+ pool : str
1530
+ the slot pool this task should run in,
1531
+ slot pools are a way to limit concurrency for certain tasks. (Default:None)
1532
+ soft_fail : bool
1533
+ Set to true to mark the task as SKIPPED on failure. (Default: False)
1534
+ name : str
1535
+ Name of the sensor on Airflow
1536
+ description : str
1537
+ Description of sensor in the Airflow UI
1538
+ external_dag_id : str
1539
+ The dag_id that contains the task you want to wait for.
1540
+ external_task_ids : List[str]
1541
+ The list of task_ids that you want to wait for.
1542
+ If None (default value) the sensor waits for the DAG. (Default: None)
1543
+ allowed_states : List[str]
1544
+ Iterable of allowed states, (Default: ['success'])
1545
+ failed_states : List[str]
1546
+ Iterable of failed or dis-allowed states. (Default: None)
1547
+ execution_delta : datetime.timedelta
1548
+ time difference with the previous execution to look at,
1549
+ the default is the same logical date as the current task or DAG. (Default: None)
1550
+ check_existence: bool
1551
+ Set to True to check if the external task exists or check if
1552
+ the DAG to wait for exists. (Default: True)
1553
+ """
1554
+ ...
1555
+
1556
+ def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1464
1557
  """
1465
- Specifies the PyPI packages for the step.
1558
+ Specifies what flows belong to the same project.
1466
1559
 
1467
- Information in this decorator will augment any
1468
- attributes set in the `@pyi_base` flow-level decorator. Hence,
1469
- you can use `@pypi_base` to set packages required by all
1470
- steps and use `@pypi` to specify step-specific overrides.
1560
+ A project-specific namespace is created for all flows that
1561
+ use the same `@project(name)`.
1471
1562
 
1472
1563
 
1473
1564
  Parameters
1474
1565
  ----------
1475
- packages : Dict[str, str], default: {}
1476
- Packages to use for this step. The key is the name of the package
1477
- and the value is the version to use.
1478
- python : str, optional, default: None
1479
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1480
- that the version used will correspond to the version of the Python interpreter used to start the run.
1481
- """
1482
- ...
1483
-
1484
- @typing.overload
1485
- def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1486
- ...
1487
-
1488
- @typing.overload
1489
- def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1490
- ...
1491
-
1492
- def pypi(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
1493
- """
1494
- Specifies the PyPI packages for the step.
1495
-
1496
- Information in this decorator will augment any
1497
- attributes set in the `@pyi_base` flow-level decorator. Hence,
1498
- you can use `@pypi_base` to set packages required by all
1499
- steps and use `@pypi` to specify step-specific overrides.
1566
+ name : str
1567
+ Project name. Make sure that the name is unique amongst all
1568
+ projects that use the same production scheduler. The name may
1569
+ contain only lowercase alphanumeric characters and underscores.
1500
1570
 
1571
+ branch : Optional[str], default None
1572
+ The branch to use. If not specified, the branch is set to
1573
+ `user.<username>` unless `production` is set to `True`. This can
1574
+ also be set on the command line using `--branch` as a top-level option.
1575
+ It is an error to specify `branch` in the decorator and on the command line.
1501
1576
 
1502
- Parameters
1503
- ----------
1504
- packages : Dict[str, str], default: {}
1505
- Packages to use for this step. The key is the name of the package
1506
- and the value is the version to use.
1507
- python : str, optional, default: None
1508
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1509
- that the version used will correspond to the version of the Python interpreter used to start the run.
1577
+ production : bool, default False
1578
+ Whether or not the branch is the production branch. This can also be set on the
1579
+ command line using `--production` as a top-level option. It is an error to specify
1580
+ `production` in the decorator and on the command line.
1581
+ The project branch name will be:
1582
+ - if `branch` is specified:
1583
+ - if `production` is True: `prod.<branch>`
1584
+ - if `production` is False: `test.<branch>`
1585
+ - if `branch` is not specified:
1586
+ - if `production` is True: `prod`
1587
+ - if `production` is False: `user.<username>`
1510
1588
  """
1511
1589
  ...
1512
1590
 
@@ -1561,216 +1639,137 @@ def schedule(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, hourly:
1561
1639
  """
1562
1640
  ...
1563
1641
 
1564
- def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1565
- """
1566
- Specifies what flows belong to the same project.
1567
-
1568
- A project-specific namespace is created for all flows that
1569
- use the same `@project(name)`.
1570
-
1571
-
1572
- Parameters
1573
- ----------
1574
- name : str
1575
- Project name. Make sure that the name is unique amongst all
1576
- projects that use the same production scheduler. The name may
1577
- contain only lowercase alphanumeric characters and underscores.
1578
-
1579
- branch : Optional[str], default None
1580
- The branch to use. If not specified, the branch is set to
1581
- `user.<username>` unless `production` is set to `True`. This can
1582
- also be set on the command line using `--branch` as a top-level option.
1583
- It is an error to specify `branch` in the decorator and on the command line.
1584
-
1585
- production : bool, default False
1586
- Whether or not the branch is the production branch. This can also be set on the
1587
- command line using `--production` as a top-level option. It is an error to specify
1588
- `production` in the decorator and on the command line.
1589
- The project branch name will be:
1590
- - if `branch` is specified:
1591
- - if `production` is True: `prod.<branch>`
1592
- - if `production` is False: `test.<branch>`
1593
- - if `branch` is not specified:
1594
- - if `production` is True: `prod`
1595
- - if `production` is False: `user.<username>`
1596
- """
1597
- ...
1598
-
1599
1642
  @typing.overload
1600
- 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]]:
1643
+ def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1601
1644
  """
1602
- Specifies the Conda environment for all steps of the flow.
1603
-
1604
- Use `@conda_base` to set common libraries required by all
1605
- steps and use `@conda` to specify step-specific additions.
1645
+ Specifies the PyPI packages for all steps of the flow.
1606
1646
 
1647
+ Use `@pypi_base` to set common packages required by all
1648
+ steps and use `@pypi` to specify step-specific overrides.
1607
1649
 
1608
1650
  Parameters
1609
1651
  ----------
1610
- packages : Dict[str, str], default {}
1652
+ packages : Dict[str, str], default: {}
1611
1653
  Packages to use for this flow. The key is the name of the package
1612
1654
  and the value is the version to use.
1613
- libraries : Dict[str, str], default {}
1614
- Supported for backward compatibility. When used with packages, packages will take precedence.
1615
- python : str, optional, default None
1655
+ python : str, optional, default: None
1616
1656
  Version of Python to use, e.g. '3.7.4'. A default value of None implies
1617
1657
  that the version used will correspond to the version of the Python interpreter used to start the run.
1618
- disabled : bool, default False
1619
- If set to True, disables Conda.
1620
1658
  """
1621
1659
  ...
1622
1660
 
1623
1661
  @typing.overload
1624
- def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1662
+ def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1625
1663
  ...
1626
1664
 
1627
- 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):
1665
+ def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
1628
1666
  """
1629
- Specifies the Conda environment for all steps of the flow.
1630
-
1631
- Use `@conda_base` to set common libraries required by all
1632
- steps and use `@conda` to specify step-specific additions.
1667
+ Specifies the PyPI packages for all steps of the flow.
1633
1668
 
1669
+ Use `@pypi_base` to set common packages required by all
1670
+ steps and use `@pypi` to specify step-specific overrides.
1634
1671
 
1635
1672
  Parameters
1636
1673
  ----------
1637
- packages : Dict[str, str], default {}
1674
+ packages : Dict[str, str], default: {}
1638
1675
  Packages to use for this flow. The key is the name of the package
1639
1676
  and the value is the version to use.
1640
- libraries : Dict[str, str], default {}
1641
- Supported for backward compatibility. When used with packages, packages will take precedence.
1642
- python : str, optional, default None
1677
+ python : str, optional, default: None
1643
1678
  Version of Python to use, e.g. '3.7.4'. A default value of None implies
1644
1679
  that the version used will correspond to the version of the Python interpreter used to start the run.
1645
- disabled : bool, default False
1646
- If set to True, disables Conda.
1647
1680
  """
1648
1681
  ...
1649
1682
 
1650
- 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]]:
1683
+ @typing.overload
1684
+ 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]]:
1651
1685
  """
1652
- 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.
1653
- 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.
1654
-
1686
+ Specifies the event(s) that this flow depends on.
1655
1687
 
1656
- Parameters
1657
- ----------
1658
- timeout : int
1659
- Time, in seconds before the task times out and fails. (Default: 3600)
1660
- poke_interval : int
1661
- Time in seconds that the job should wait in between each try. (Default: 60)
1662
- mode : str
1663
- How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1664
- exponential_backoff : bool
1665
- allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1666
- pool : str
1667
- the slot pool this task should run in,
1668
- slot pools are a way to limit concurrency for certain tasks. (Default:None)
1669
- soft_fail : bool
1670
- Set to true to mark the task as SKIPPED on failure. (Default: False)
1671
- name : str
1672
- Name of the sensor on Airflow
1673
- description : str
1674
- Description of sensor in the Airflow UI
1675
- external_dag_id : str
1676
- The dag_id that contains the task you want to wait for.
1677
- external_task_ids : List[str]
1678
- The list of task_ids that you want to wait for.
1679
- If None (default value) the sensor waits for the DAG. (Default: None)
1680
- allowed_states : List[str]
1681
- Iterable of allowed states, (Default: ['success'])
1682
- failed_states : List[str]
1683
- Iterable of failed or dis-allowed states. (Default: None)
1684
- execution_delta : datetime.timedelta
1685
- time difference with the previous execution to look at,
1686
- the default is the same logical date as the current task or DAG. (Default: None)
1687
- check_existence: bool
1688
- Set to True to check if the external task exists or check if
1689
- the DAG to wait for exists. (Default: True)
1690
- """
1691
- ...
1692
-
1693
- 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]]:
1694
- """
1695
- 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)
1696
- before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
1697
- and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
1698
- added as a flow decorators. Adding more than one decorator will ensure that `start` step
1699
- starts only after all sensors finish.
1688
+ ```
1689
+ @trigger(event='foo')
1690
+ ```
1691
+ or
1692
+ ```
1693
+ @trigger(events=['foo', 'bar'])
1694
+ ```
1700
1695
 
1696
+ Additionally, you can specify the parameter mappings
1697
+ to map event payload to Metaflow parameters for the flow.
1698
+ ```
1699
+ @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1700
+ ```
1701
+ or
1702
+ ```
1703
+ @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1704
+ {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1705
+ ```
1701
1706
 
1702
- Parameters
1703
- ----------
1704
- timeout : int
1705
- Time, in seconds before the task times out and fails. (Default: 3600)
1706
- poke_interval : int
1707
- Time in seconds that the job should wait in between each try. (Default: 60)
1708
- mode : str
1709
- How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1710
- exponential_backoff : bool
1711
- allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1712
- pool : str
1713
- the slot pool this task should run in,
1714
- slot pools are a way to limit concurrency for certain tasks. (Default:None)
1715
- soft_fail : bool
1716
- Set to true to mark the task as SKIPPED on failure. (Default: False)
1717
- name : str
1718
- Name of the sensor on Airflow
1719
- description : str
1720
- Description of sensor in the Airflow UI
1721
- bucket_key : Union[str, List[str]]
1722
- The key(s) being waited on. Supports full s3:// style url or relative path from root level.
1723
- When it's specified as a full s3:// url, please leave `bucket_name` as None
1724
- bucket_name : str
1725
- Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
1726
- When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
1727
- wildcard_match : bool
1728
- whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
1729
- aws_conn_id : str
1730
- a reference to the s3 connection on Airflow. (Default: None)
1731
- verify : bool
1732
- Whether or not to verify SSL certificates for S3 connection. (Default: None)
1733
- """
1734
- ...
1735
-
1736
- @typing.overload
1737
- def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1738
- """
1739
- Specifies the PyPI packages for all steps of the flow.
1707
+ 'parameters' can also be a list of strings and tuples like so:
1708
+ ```
1709
+ @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1710
+ ```
1711
+ This is equivalent to:
1712
+ ```
1713
+ @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1714
+ ```
1740
1715
 
1741
- Use `@pypi_base` to set common packages required by all
1742
- steps and use `@pypi` to specify step-specific overrides.
1743
1716
 
1744
1717
  Parameters
1745
1718
  ----------
1746
- packages : Dict[str, str], default: {}
1747
- Packages to use for this flow. The key is the name of the package
1748
- and the value is the version to use.
1749
- python : str, optional, default: None
1750
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1751
- that the version used will correspond to the version of the Python interpreter used to start the run.
1719
+ event : Union[str, Dict[str, Any]], optional, default None
1720
+ Event dependency for this flow.
1721
+ events : List[Union[str, Dict[str, Any]]], default []
1722
+ Events dependency for this flow.
1723
+ options : Dict[str, Any], default {}
1724
+ Backend-specific configuration for tuning eventing behavior.
1752
1725
  """
1753
1726
  ...
1754
1727
 
1755
1728
  @typing.overload
1756
- def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1729
+ def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1757
1730
  ...
1758
1731
 
1759
- def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
1732
+ 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] = {}):
1760
1733
  """
1761
- Specifies the PyPI packages for all steps of the flow.
1734
+ Specifies the event(s) that this flow depends on.
1735
+
1736
+ ```
1737
+ @trigger(event='foo')
1738
+ ```
1739
+ or
1740
+ ```
1741
+ @trigger(events=['foo', 'bar'])
1742
+ ```
1743
+
1744
+ Additionally, you can specify the parameter mappings
1745
+ to map event payload to Metaflow parameters for the flow.
1746
+ ```
1747
+ @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1748
+ ```
1749
+ or
1750
+ ```
1751
+ @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1752
+ {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1753
+ ```
1754
+
1755
+ 'parameters' can also be a list of strings and tuples like so:
1756
+ ```
1757
+ @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1758
+ ```
1759
+ This is equivalent to:
1760
+ ```
1761
+ @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1762
+ ```
1762
1763
 
1763
- Use `@pypi_base` to set common packages required by all
1764
- steps and use `@pypi` to specify step-specific overrides.
1765
1764
 
1766
1765
  Parameters
1767
1766
  ----------
1768
- packages : Dict[str, str], default: {}
1769
- Packages to use for this flow. The key is the name of the package
1770
- and the value is the version to use.
1771
- python : str, optional, default: None
1772
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1773
- that the version used will correspond to the version of the Python interpreter used to start the run.
1767
+ event : Union[str, Dict[str, Any]], optional, default None
1768
+ Event dependency for this flow.
1769
+ events : List[Union[str, Dict[str, Any]]], default []
1770
+ Events dependency for this flow.
1771
+ options : Dict[str, Any], default {}
1772
+ Backend-specific configuration for tuning eventing behavior.
1774
1773
  """
1775
1774
  ...
1776
1775
 
@@ -1888,6 +1887,100 @@ def with_artifact_store(f: typing.Optional[typing.Type[FlowSpecDerived]] = None)
1888
1887
  """
1889
1888
  ...
1890
1889
 
1890
+ @typing.overload
1891
+ 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]]:
1892
+ """
1893
+ Specifies the Conda environment for all steps of the flow.
1894
+
1895
+ Use `@conda_base` to set common libraries required by all
1896
+ steps and use `@conda` to specify step-specific additions.
1897
+
1898
+
1899
+ Parameters
1900
+ ----------
1901
+ packages : Dict[str, str], default {}
1902
+ Packages to use for this flow. The key is the name of the package
1903
+ and the value is the version to use.
1904
+ libraries : Dict[str, str], default {}
1905
+ Supported for backward compatibility. When used with packages, packages will take precedence.
1906
+ python : str, optional, default None
1907
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1908
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1909
+ disabled : bool, default False
1910
+ If set to True, disables Conda.
1911
+ """
1912
+ ...
1913
+
1914
+ @typing.overload
1915
+ def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1916
+ ...
1917
+
1918
+ 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):
1919
+ """
1920
+ Specifies the Conda environment for all steps of the flow.
1921
+
1922
+ Use `@conda_base` to set common libraries required by all
1923
+ steps and use `@conda` to specify step-specific additions.
1924
+
1925
+
1926
+ Parameters
1927
+ ----------
1928
+ packages : Dict[str, str], default {}
1929
+ Packages to use for this flow. The key is the name of the package
1930
+ and the value is the version to use.
1931
+ libraries : Dict[str, str], default {}
1932
+ Supported for backward compatibility. When used with packages, packages will take precedence.
1933
+ python : str, optional, default None
1934
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1935
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1936
+ disabled : bool, default False
1937
+ If set to True, disables Conda.
1938
+ """
1939
+ ...
1940
+
1941
+ 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]]:
1942
+ """
1943
+ 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)
1944
+ before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
1945
+ and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
1946
+ added as a flow decorators. Adding more than one decorator will ensure that `start` step
1947
+ starts only after all sensors finish.
1948
+
1949
+
1950
+ Parameters
1951
+ ----------
1952
+ timeout : int
1953
+ Time, in seconds before the task times out and fails. (Default: 3600)
1954
+ poke_interval : int
1955
+ Time in seconds that the job should wait in between each try. (Default: 60)
1956
+ mode : str
1957
+ How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1958
+ exponential_backoff : bool
1959
+ allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1960
+ pool : str
1961
+ the slot pool this task should run in,
1962
+ slot pools are a way to limit concurrency for certain tasks. (Default:None)
1963
+ soft_fail : bool
1964
+ Set to true to mark the task as SKIPPED on failure. (Default: False)
1965
+ name : str
1966
+ Name of the sensor on Airflow
1967
+ description : str
1968
+ Description of sensor in the Airflow UI
1969
+ bucket_key : Union[str, List[str]]
1970
+ The key(s) being waited on. Supports full s3:// style url or relative path from root level.
1971
+ When it's specified as a full s3:// url, please leave `bucket_name` as None
1972
+ bucket_name : str
1973
+ Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
1974
+ When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
1975
+ wildcard_match : bool
1976
+ whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
1977
+ aws_conn_id : str
1978
+ a reference to the s3 connection on Airflow. (Default: None)
1979
+ verify : bool
1980
+ Whether or not to verify SSL certificates for S3 connection. (Default: None)
1981
+ """
1982
+ ...
1983
+
1891
1984
  @typing.overload
1892
1985
  def trigger_on_finish(*, flow: typing.Union[typing.Dict[str, str], str, None] = None, flows: typing.List[typing.Union[str, typing.Dict[str, str]]] = [], options: typing.Dict[str, typing.Any] = {}) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1893
1986
  """
@@ -1989,98 +2082,5 @@ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *
1989
2082
  """
1990
2083
  ...
1991
2084
 
1992
- @typing.overload
1993
- 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]]:
1994
- """
1995
- Specifies the event(s) that this flow depends on.
1996
-
1997
- ```
1998
- @trigger(event='foo')
1999
- ```
2000
- or
2001
- ```
2002
- @trigger(events=['foo', 'bar'])
2003
- ```
2004
-
2005
- Additionally, you can specify the parameter mappings
2006
- to map event payload to Metaflow parameters for the flow.
2007
- ```
2008
- @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
2009
- ```
2010
- or
2011
- ```
2012
- @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
2013
- {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
2014
- ```
2015
-
2016
- 'parameters' can also be a list of strings and tuples like so:
2017
- ```
2018
- @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
2019
- ```
2020
- This is equivalent to:
2021
- ```
2022
- @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
2023
- ```
2024
-
2025
-
2026
- Parameters
2027
- ----------
2028
- event : Union[str, Dict[str, Any]], optional, default None
2029
- Event dependency for this flow.
2030
- events : List[Union[str, Dict[str, Any]]], default []
2031
- Events dependency for this flow.
2032
- options : Dict[str, Any], default {}
2033
- Backend-specific configuration for tuning eventing behavior.
2034
- """
2035
- ...
2036
-
2037
- @typing.overload
2038
- def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
2039
- ...
2040
-
2041
- 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] = {}):
2042
- """
2043
- Specifies the event(s) that this flow depends on.
2044
-
2045
- ```
2046
- @trigger(event='foo')
2047
- ```
2048
- or
2049
- ```
2050
- @trigger(events=['foo', 'bar'])
2051
- ```
2052
-
2053
- Additionally, you can specify the parameter mappings
2054
- to map event payload to Metaflow parameters for the flow.
2055
- ```
2056
- @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
2057
- ```
2058
- or
2059
- ```
2060
- @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
2061
- {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
2062
- ```
2063
-
2064
- 'parameters' can also be a list of strings and tuples like so:
2065
- ```
2066
- @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
2067
- ```
2068
- This is equivalent to:
2069
- ```
2070
- @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
2071
- ```
2072
-
2073
-
2074
- Parameters
2075
- ----------
2076
- event : Union[str, Dict[str, Any]], optional, default None
2077
- Event dependency for this flow.
2078
- events : List[Union[str, Dict[str, Any]]], default []
2079
- Events dependency for this flow.
2080
- options : Dict[str, Any], default {}
2081
- Backend-specific configuration for tuning eventing behavior.
2082
- """
2083
- ...
2084
-
2085
2085
  pkg_name: str
2086
2086