ob-metaflow-stubs 6.0.10.8__py2.py3-none-any.whl → 6.0.10.9__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.

Potentially problematic release.


This version of ob-metaflow-stubs might be problematic. Click here for more details.

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