ob-metaflow-stubs 6.0.7.4__py2.py3-none-any.whl → 6.0.8.2__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (262) hide show
  1. metaflow-stubs/__init__.pyi +975 -975
  2. metaflow-stubs/cards.pyi +1 -1
  3. metaflow-stubs/cli.pyi +1 -1
  4. metaflow-stubs/cli_components/__init__.pyi +1 -1
  5. metaflow-stubs/cli_components/utils.pyi +1 -1
  6. metaflow-stubs/client/__init__.pyi +1 -1
  7. metaflow-stubs/client/core.pyi +2 -2
  8. metaflow-stubs/client/filecache.pyi +1 -1
  9. metaflow-stubs/events.pyi +1 -1
  10. metaflow-stubs/exception.pyi +1 -1
  11. metaflow-stubs/flowspec.pyi +4 -4
  12. metaflow-stubs/generated_for.txt +1 -1
  13. metaflow-stubs/includefile.pyi +2 -2
  14. metaflow-stubs/meta_files.pyi +1 -1
  15. metaflow-stubs/metadata_provider/__init__.pyi +1 -1
  16. metaflow-stubs/metadata_provider/heartbeat.pyi +1 -1
  17. metaflow-stubs/metadata_provider/metadata.pyi +1 -1
  18. metaflow-stubs/metadata_provider/util.pyi +1 -1
  19. metaflow-stubs/metaflow_config.pyi +1 -1
  20. metaflow-stubs/metaflow_current.pyi +56 -56
  21. metaflow-stubs/metaflow_git.pyi +1 -1
  22. metaflow-stubs/mf_extensions/__init__.pyi +1 -1
  23. metaflow-stubs/mf_extensions/obcheckpoint/__init__.pyi +1 -1
  24. metaflow-stubs/mf_extensions/obcheckpoint/plugins/__init__.pyi +1 -1
  25. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/__init__.pyi +1 -1
  26. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/__init__.pyi +1 -1
  27. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/async_cards.pyi +2 -2
  28. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/deco_injection_mixin.pyi +1 -1
  29. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/extra_components.pyi +1 -1
  30. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/__init__.pyi +1 -1
  31. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/__init__.pyi +1 -1
  32. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/checkpoint_lister.pyi +4 -4
  33. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/lineage_card.pyi +1 -1
  34. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/checkpoint_storage.pyi +2 -2
  35. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/constructors.pyi +1 -1
  36. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/core.pyi +2 -2
  37. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/decorator.pyi +2 -2
  38. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/exceptions.pyi +1 -1
  39. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/final_api.pyi +1 -1
  40. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/lineage.pyi +1 -1
  41. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/__init__.pyi +1 -1
  42. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/context.pyi +2 -2
  43. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/core.pyi +1 -1
  44. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/decorator.pyi +1 -1
  45. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/exceptions.pyi +1 -1
  46. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/task_utils.pyi +1 -1
  47. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/utils.pyi +1 -1
  48. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastructures.pyi +1 -1
  49. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/exceptions.pyi +1 -1
  50. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/hf_hub/__init__.pyi +1 -1
  51. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/hf_hub/decorator.pyi +1 -1
  52. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/__init__.pyi +1 -1
  53. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/core.pyi +3 -3
  54. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/exceptions.pyi +1 -1
  55. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/model_storage.pyi +2 -2
  56. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/__init__.pyi +1 -1
  57. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/flowspec_utils.pyi +1 -1
  58. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/general.pyi +1 -1
  59. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/identity_utils.pyi +1 -1
  60. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/__init__.pyi +1 -1
  61. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/base.pyi +1 -1
  62. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/tar.pyi +1 -1
  63. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/tar_utils.pyi +1 -1
  64. metaflow-stubs/mf_extensions/outerbounds/__init__.pyi +1 -1
  65. metaflow-stubs/mf_extensions/outerbounds/plugins/__init__.pyi +1 -1
  66. metaflow-stubs/mf_extensions/outerbounds/plugins/apps/__init__.pyi +1 -1
  67. metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/__init__.pyi +1 -1
  68. metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/_state_machine.pyi +1 -1
  69. metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/_vendor/__init__.pyi +1 -1
  70. metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/_vendor/spinner/__init__.pyi +1 -1
  71. metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/_vendor/spinner/spinners.pyi +1 -1
  72. metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/app_cli.pyi +1 -1
  73. metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/app_config.pyi +1 -1
  74. metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/capsule.pyi +3 -3
  75. metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/click_importer.pyi +1 -1
  76. metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/code_package/__init__.pyi +1 -1
  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 +1 -1
  79. metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/config/cli_generator.pyi +1 -1
  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 +1 -1
  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 +1 -1
  84. metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/dependencies.pyi +2 -2
  85. metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/deployer.pyi +3 -3
  86. metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/experimental/__init__.pyi +1 -1
  87. metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/perimeters.pyi +1 -1
  88. metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/utils.pyi +2 -2
  89. metaflow-stubs/mf_extensions/outerbounds/plugins/aws/__init__.pyi +1 -1
  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 +1 -1
  92. metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/async_cards.pyi +2 -2
  93. metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/injector.pyi +1 -1
  94. metaflow-stubs/mf_extensions/outerbounds/plugins/checkpoint_datastores/__init__.pyi +1 -1
  95. metaflow-stubs/mf_extensions/outerbounds/plugins/checkpoint_datastores/coreweave.pyi +3 -3
  96. metaflow-stubs/mf_extensions/outerbounds/plugins/checkpoint_datastores/nebius.pyi +3 -3
  97. metaflow-stubs/mf_extensions/outerbounds/plugins/fast_bakery/__init__.pyi +1 -1
  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 +2 -2
  100. metaflow-stubs/mf_extensions/outerbounds/plugins/fast_bakery/fast_bakery.pyi +1 -1
  101. metaflow-stubs/mf_extensions/outerbounds/plugins/kubernetes/__init__.pyi +1 -1
  102. metaflow-stubs/mf_extensions/outerbounds/plugins/kubernetes/pod_killer.pyi +1 -1
  103. metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/__init__.pyi +1 -1
  104. metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/constants.pyi +1 -1
  105. metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/exceptions.pyi +1 -1
  106. metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/ollama.pyi +1 -1
  107. metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/status_card.pyi +1 -1
  108. metaflow-stubs/mf_extensions/outerbounds/plugins/snowflake/__init__.pyi +1 -1
  109. metaflow-stubs/mf_extensions/outerbounds/plugins/snowflake/snowflake.pyi +1 -1
  110. metaflow-stubs/mf_extensions/outerbounds/profilers/__init__.pyi +1 -1
  111. metaflow-stubs/mf_extensions/outerbounds/profilers/gpu.pyi +1 -1
  112. metaflow-stubs/mf_extensions/outerbounds/remote_config.pyi +2 -2
  113. metaflow-stubs/mf_extensions/outerbounds/toplevel/__init__.pyi +1 -1
  114. metaflow-stubs/mf_extensions/outerbounds/toplevel/global_aliases_for_metaflow_package.pyi +1 -1
  115. metaflow-stubs/mf_extensions/outerbounds/toplevel/s3_proxy.pyi +1 -1
  116. metaflow-stubs/multicore_utils.pyi +1 -1
  117. metaflow-stubs/ob_internal.pyi +1 -1
  118. metaflow-stubs/packaging_sys/__init__.pyi +6 -6
  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 +1 -1
  122. metaflow-stubs/packaging_sys/utils.pyi +1 -1
  123. metaflow-stubs/packaging_sys/v1.pyi +1 -1
  124. metaflow-stubs/parameters.pyi +2 -2
  125. metaflow-stubs/plugins/__init__.pyi +13 -13
  126. metaflow-stubs/plugins/airflow/__init__.pyi +1 -1
  127. metaflow-stubs/plugins/airflow/airflow_utils.pyi +1 -1
  128. metaflow-stubs/plugins/airflow/exception.pyi +1 -1
  129. metaflow-stubs/plugins/airflow/sensors/__init__.pyi +1 -1
  130. metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +1 -1
  131. metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +1 -1
  132. metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +1 -1
  133. metaflow-stubs/plugins/argo/__init__.pyi +1 -1
  134. metaflow-stubs/plugins/argo/argo_client.pyi +1 -1
  135. metaflow-stubs/plugins/argo/argo_events.pyi +1 -1
  136. metaflow-stubs/plugins/argo/argo_workflows.pyi +2 -2
  137. metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +1 -1
  138. metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +2 -2
  139. metaflow-stubs/plugins/argo/argo_workflows_deployer_objects.pyi +1 -1
  140. metaflow-stubs/plugins/argo/exit_hooks.pyi +1 -1
  141. metaflow-stubs/plugins/aws/__init__.pyi +1 -1
  142. metaflow-stubs/plugins/aws/aws_client.pyi +1 -1
  143. metaflow-stubs/plugins/aws/aws_utils.pyi +1 -1
  144. metaflow-stubs/plugins/aws/batch/__init__.pyi +1 -1
  145. metaflow-stubs/plugins/aws/batch/batch.pyi +1 -1
  146. metaflow-stubs/plugins/aws/batch/batch_client.pyi +1 -1
  147. metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +1 -1
  148. metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +1 -1
  149. metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +3 -3
  150. metaflow-stubs/plugins/aws/step_functions/__init__.pyi +1 -1
  151. metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +1 -1
  152. metaflow-stubs/plugins/aws/step_functions/schedule_decorator.pyi +1 -1
  153. metaflow-stubs/plugins/aws/step_functions/step_functions.pyi +1 -1
  154. metaflow-stubs/plugins/aws/step_functions/step_functions_client.pyi +1 -1
  155. metaflow-stubs/plugins/aws/step_functions/step_functions_deployer.pyi +2 -2
  156. metaflow-stubs/plugins/aws/step_functions/step_functions_deployer_objects.pyi +1 -1
  157. metaflow-stubs/plugins/azure/__init__.pyi +1 -1
  158. metaflow-stubs/plugins/azure/azure_credential.pyi +1 -1
  159. metaflow-stubs/plugins/azure/azure_exceptions.pyi +1 -1
  160. metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +3 -3
  161. metaflow-stubs/plugins/azure/azure_utils.pyi +1 -1
  162. metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +1 -1
  163. metaflow-stubs/plugins/azure/includefile_support.pyi +1 -1
  164. metaflow-stubs/plugins/cards/__init__.pyi +1 -1
  165. metaflow-stubs/plugins/cards/card_client.pyi +1 -1
  166. metaflow-stubs/plugins/cards/card_creator.pyi +1 -1
  167. metaflow-stubs/plugins/cards/card_datastore.pyi +1 -1
  168. metaflow-stubs/plugins/cards/card_decorator.pyi +1 -1
  169. metaflow-stubs/plugins/cards/card_modules/__init__.pyi +1 -1
  170. metaflow-stubs/plugins/cards/card_modules/basic.pyi +2 -2
  171. metaflow-stubs/plugins/cards/card_modules/card.pyi +1 -1
  172. metaflow-stubs/plugins/cards/card_modules/components.pyi +2 -2
  173. metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +1 -1
  174. metaflow-stubs/plugins/cards/card_modules/renderer_tools.pyi +1 -1
  175. metaflow-stubs/plugins/cards/card_modules/test_cards.pyi +1 -1
  176. metaflow-stubs/plugins/cards/card_resolver.pyi +1 -1
  177. metaflow-stubs/plugins/cards/component_serializer.pyi +1 -1
  178. metaflow-stubs/plugins/cards/exception.pyi +1 -1
  179. metaflow-stubs/plugins/catch_decorator.pyi +1 -1
  180. metaflow-stubs/plugins/datatools/__init__.pyi +1 -1
  181. metaflow-stubs/plugins/datatools/local.pyi +1 -1
  182. metaflow-stubs/plugins/datatools/s3/__init__.pyi +1 -1
  183. metaflow-stubs/plugins/datatools/s3/s3.pyi +1 -1
  184. metaflow-stubs/plugins/datatools/s3/s3tail.pyi +1 -1
  185. metaflow-stubs/plugins/datatools/s3/s3util.pyi +1 -1
  186. metaflow-stubs/plugins/debug_logger.pyi +1 -1
  187. metaflow-stubs/plugins/debug_monitor.pyi +1 -1
  188. metaflow-stubs/plugins/environment_decorator.pyi +1 -1
  189. metaflow-stubs/plugins/events_decorator.pyi +1 -1
  190. metaflow-stubs/plugins/exit_hook/__init__.pyi +1 -1
  191. metaflow-stubs/plugins/exit_hook/exit_hook_decorator.pyi +1 -1
  192. metaflow-stubs/plugins/frameworks/__init__.pyi +1 -1
  193. metaflow-stubs/plugins/frameworks/pytorch.pyi +1 -1
  194. metaflow-stubs/plugins/gcp/__init__.pyi +1 -1
  195. metaflow-stubs/plugins/gcp/gcp_secret_manager_secrets_provider.pyi +3 -3
  196. metaflow-stubs/plugins/gcp/gs_exceptions.pyi +1 -1
  197. metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +1 -1
  198. metaflow-stubs/plugins/gcp/gs_utils.pyi +1 -1
  199. metaflow-stubs/plugins/gcp/includefile_support.pyi +1 -1
  200. metaflow-stubs/plugins/kubernetes/__init__.pyi +1 -1
  201. metaflow-stubs/plugins/kubernetes/kube_utils.pyi +1 -1
  202. metaflow-stubs/plugins/kubernetes/kubernetes.pyi +1 -1
  203. metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +1 -1
  204. metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +1 -1
  205. metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +1 -1
  206. metaflow-stubs/plugins/kubernetes/spot_monitor_sidecar.pyi +1 -1
  207. metaflow-stubs/plugins/ollama/__init__.pyi +1 -1
  208. metaflow-stubs/plugins/optuna/__init__.pyi +1 -1
  209. metaflow-stubs/plugins/parallel_decorator.pyi +1 -1
  210. metaflow-stubs/plugins/perimeters.pyi +1 -1
  211. metaflow-stubs/plugins/project_decorator.pyi +1 -1
  212. metaflow-stubs/plugins/pypi/__init__.pyi +1 -1
  213. metaflow-stubs/plugins/pypi/conda_decorator.pyi +1 -1
  214. metaflow-stubs/plugins/pypi/conda_environment.pyi +2 -2
  215. metaflow-stubs/plugins/pypi/parsers.pyi +1 -1
  216. metaflow-stubs/plugins/pypi/pypi_decorator.pyi +1 -1
  217. metaflow-stubs/plugins/pypi/pypi_environment.pyi +1 -1
  218. metaflow-stubs/plugins/pypi/utils.pyi +1 -1
  219. metaflow-stubs/plugins/resources_decorator.pyi +1 -1
  220. metaflow-stubs/plugins/retry_decorator.pyi +1 -1
  221. metaflow-stubs/plugins/secrets/__init__.pyi +2 -2
  222. metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +1 -1
  223. metaflow-stubs/plugins/secrets/secrets_decorator.pyi +1 -1
  224. metaflow-stubs/plugins/secrets/secrets_func.pyi +1 -1
  225. metaflow-stubs/plugins/secrets/secrets_spec.pyi +1 -1
  226. metaflow-stubs/plugins/secrets/utils.pyi +1 -1
  227. metaflow-stubs/plugins/snowflake/__init__.pyi +1 -1
  228. metaflow-stubs/plugins/storage_executor.pyi +1 -1
  229. metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +2 -2
  230. metaflow-stubs/plugins/timeout_decorator.pyi +1 -1
  231. metaflow-stubs/plugins/torchtune/__init__.pyi +1 -1
  232. metaflow-stubs/plugins/uv/__init__.pyi +1 -1
  233. metaflow-stubs/plugins/uv/uv_environment.pyi +2 -2
  234. metaflow-stubs/profilers/__init__.pyi +1 -1
  235. metaflow-stubs/pylint_wrapper.pyi +1 -1
  236. metaflow-stubs/runner/__init__.pyi +1 -1
  237. metaflow-stubs/runner/deployer.pyi +4 -4
  238. metaflow-stubs/runner/deployer_impl.pyi +1 -1
  239. metaflow-stubs/runner/metaflow_runner.pyi +2 -2
  240. metaflow-stubs/runner/nbdeploy.pyi +1 -1
  241. metaflow-stubs/runner/nbrun.pyi +1 -1
  242. metaflow-stubs/runner/subprocess_manager.pyi +1 -1
  243. metaflow-stubs/runner/utils.pyi +3 -3
  244. metaflow-stubs/system/__init__.pyi +1 -1
  245. metaflow-stubs/system/system_logger.pyi +2 -2
  246. metaflow-stubs/system/system_monitor.pyi +1 -1
  247. metaflow-stubs/tagging_util.pyi +1 -1
  248. metaflow-stubs/tuple_util.pyi +1 -1
  249. metaflow-stubs/user_configs/__init__.pyi +1 -1
  250. metaflow-stubs/user_configs/config_options.pyi +2 -2
  251. metaflow-stubs/user_configs/config_parameters.pyi +5 -5
  252. metaflow-stubs/user_decorators/__init__.pyi +1 -1
  253. metaflow-stubs/user_decorators/common.pyi +1 -1
  254. metaflow-stubs/user_decorators/mutable_flow.pyi +5 -5
  255. metaflow-stubs/user_decorators/mutable_step.pyi +4 -4
  256. metaflow-stubs/user_decorators/user_flow_decorator.pyi +3 -3
  257. metaflow-stubs/user_decorators/user_step_decorator.pyi +4 -4
  258. {ob_metaflow_stubs-6.0.7.4.dist-info → ob_metaflow_stubs-6.0.8.2.dist-info}/METADATA +1 -1
  259. ob_metaflow_stubs-6.0.8.2.dist-info/RECORD +262 -0
  260. ob_metaflow_stubs-6.0.7.4.dist-info/RECORD +0 -262
  261. {ob_metaflow_stubs-6.0.7.4.dist-info → ob_metaflow_stubs-6.0.8.2.dist-info}/WHEEL +0 -0
  262. {ob_metaflow_stubs-6.0.7.4.dist-info → ob_metaflow_stubs-6.0.8.2.dist-info}/top_level.txt +0 -0
@@ -1,15 +1,15 @@
1
1
  ######################################################################################################
2
2
  # Auto-generated Metaflow stub file #
3
3
  # MF version: 2.17.1.0+obcheckpoint(0.2.4);ob(v1) #
4
- # Generated on 2025-08-21T17:03:57.569240 #
4
+ # Generated on 2025-08-22T06:36:31.648602 #
5
5
  ######################################################################################################
6
6
 
7
7
  from __future__ import annotations
8
8
 
9
9
  import typing
10
10
  if typing.TYPE_CHECKING:
11
- import datetime
12
11
  import typing
12
+ import datetime
13
13
  FlowSpecDerived = typing.TypeVar("FlowSpecDerived", bound="FlowSpec", contravariant=False, covariant=False)
14
14
  StepFlag = typing.NewType("StepFlag", bool)
15
15
 
@@ -39,18 +39,18 @@ from .user_decorators.user_step_decorator import UserStepDecorator as UserStepDe
39
39
  from .user_decorators.user_step_decorator import StepMutator as StepMutator
40
40
  from .user_decorators.user_step_decorator import user_step_decorator as user_step_decorator
41
41
  from .user_decorators.user_flow_decorator import FlowMutator as FlowMutator
42
- from . import events as events
43
- from . import metaflow_git as metaflow_git
44
42
  from . import cards as cards
45
43
  from . import tuple_util as tuple_util
44
+ from . import metaflow_git as metaflow_git
45
+ from . import events as events
46
46
  from . import runner as runner
47
47
  from . import plugins as plugins
48
48
  from .mf_extensions.outerbounds.toplevel.global_aliases_for_metaflow_package import S3 as S3
49
49
  from . import includefile as includefile
50
50
  from .includefile import IncludeFile as IncludeFile
51
51
  from .plugins.pypi.parsers import pyproject_toml_parser as pyproject_toml_parser
52
- from .plugins.pypi.parsers import conda_environment_yml_parser as conda_environment_yml_parser
53
52
  from .plugins.pypi.parsers import requirements_txt_parser as requirements_txt_parser
53
+ from .plugins.pypi.parsers import conda_environment_yml_parser as conda_environment_yml_parser
54
54
  from . import client as client
55
55
  from .client.core import namespace as namespace
56
56
  from .client.core import get_namespace as get_namespace
@@ -167,214 +167,6 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
167
167
  """
168
168
  ...
169
169
 
170
- 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]]]:
171
- """
172
- Specifies that this step should execute on Kubernetes.
173
-
174
-
175
- Parameters
176
- ----------
177
- cpu : int, default 1
178
- Number of CPUs required for this step. If `@resources` is
179
- also present, the maximum value from all decorators is used.
180
- memory : int, default 4096
181
- Memory size (in MB) required for this step. If
182
- `@resources` is also present, the maximum value from all decorators is
183
- used.
184
- disk : int, default 10240
185
- Disk size (in MB) required for this step. If
186
- `@resources` is also present, the maximum value from all decorators is
187
- used.
188
- image : str, optional, default None
189
- Docker image to use when launching on Kubernetes. If not specified, and
190
- METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
191
- not, a default Docker image mapping to the current version of Python is used.
192
- image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
193
- If given, the imagePullPolicy to be applied to the Docker image of the step.
194
- image_pull_secrets: List[str], default []
195
- The default is extracted from METAFLOW_KUBERNETES_IMAGE_PULL_SECRETS.
196
- Kubernetes image pull secrets to use when pulling container images
197
- in Kubernetes.
198
- service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
199
- Kubernetes service account to use when launching pod in Kubernetes.
200
- secrets : List[str], optional, default None
201
- Kubernetes secrets to use when launching pod in Kubernetes. These
202
- secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
203
- in Metaflow configuration.
204
- node_selector: Union[Dict[str,str], str], optional, default None
205
- Kubernetes node selector(s) to apply to the pod running the task.
206
- Can be passed in as a comma separated string of values e.g.
207
- 'kubernetes.io/os=linux,kubernetes.io/arch=amd64' or as a dictionary
208
- {'kubernetes.io/os': 'linux', 'kubernetes.io/arch': 'amd64'}
209
- namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
210
- Kubernetes namespace to use when launching pod in Kubernetes.
211
- gpu : int, optional, default None
212
- Number of GPUs required for this step. A value of zero implies that
213
- the scheduled node should not have GPUs.
214
- gpu_vendor : str, default KUBERNETES_GPU_VENDOR
215
- The vendor of the GPUs to be used for this step.
216
- tolerations : List[Dict[str,str]], default []
217
- The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
218
- Kubernetes tolerations to use when launching pod in Kubernetes.
219
- labels: Dict[str, str], default: METAFLOW_KUBERNETES_LABELS
220
- Kubernetes labels to use when launching pod in Kubernetes.
221
- annotations: Dict[str, str], default: METAFLOW_KUBERNETES_ANNOTATIONS
222
- Kubernetes annotations to use when launching pod in Kubernetes.
223
- use_tmpfs : bool, default False
224
- This enables an explicit tmpfs mount for this step.
225
- tmpfs_tempdir : bool, default True
226
- sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
227
- tmpfs_size : int, optional, default: None
228
- The value for the size (in MiB) of the tmpfs mount for this step.
229
- This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
230
- memory allocated for this step.
231
- tmpfs_path : str, optional, default /metaflow_temp
232
- Path to tmpfs mount for this step.
233
- persistent_volume_claims : Dict[str, str], optional, default None
234
- A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
235
- volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
236
- shared_memory: int, optional
237
- Shared memory size (in MiB) required for this step
238
- port: int, optional
239
- Port number to specify in the Kubernetes job object
240
- compute_pool : str, optional, default None
241
- Compute pool to be used for for this step.
242
- If not specified, any accessible compute pool within the perimeter is used.
243
- hostname_resolution_timeout: int, default 10 * 60
244
- Timeout in seconds for the workers tasks in the gang scheduled cluster to resolve the hostname of control task.
245
- Only applicable when @parallel is used.
246
- qos: str, default: Burstable
247
- Quality of Service class to assign to the pod. Supported values are: Guaranteed, Burstable, BestEffort
248
-
249
- security_context: Dict[str, Any], optional, default None
250
- Container security context. Applies to the task container. Allows the following keys:
251
- - privileged: bool, optional, default None
252
- - allow_privilege_escalation: bool, optional, default None
253
- - run_as_user: int, optional, default None
254
- - run_as_group: int, optional, default None
255
- - run_as_non_root: bool, optional, default None
256
- """
257
- ...
258
-
259
- @typing.overload
260
- def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
261
- """
262
- Internal decorator to support Fast bakery
263
- """
264
- ...
265
-
266
- @typing.overload
267
- def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
268
- ...
269
-
270
- def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
271
- """
272
- Internal decorator to support Fast bakery
273
- """
274
- ...
275
-
276
- @typing.overload
277
- 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]]]:
278
- """
279
- Specifies the PyPI packages for the step.
280
-
281
- Information in this decorator will augment any
282
- attributes set in the `@pyi_base` flow-level decorator. Hence,
283
- you can use `@pypi_base` to set packages required by all
284
- steps and use `@pypi` to specify step-specific overrides.
285
-
286
-
287
- Parameters
288
- ----------
289
- packages : Dict[str, str], default: {}
290
- Packages to use for this step. The key is the name of the package
291
- and the value is the version to use.
292
- python : str, optional, default: None
293
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
294
- that the version used will correspond to the version of the Python interpreter used to start the run.
295
- """
296
- ...
297
-
298
- @typing.overload
299
- def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
300
- ...
301
-
302
- @typing.overload
303
- def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
304
- ...
305
-
306
- 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):
307
- """
308
- Specifies the PyPI packages for the step.
309
-
310
- Information in this decorator will augment any
311
- attributes set in the `@pyi_base` flow-level decorator. Hence,
312
- you can use `@pypi_base` to set packages required by all
313
- steps and use `@pypi` to specify step-specific overrides.
314
-
315
-
316
- Parameters
317
- ----------
318
- packages : Dict[str, str], default: {}
319
- Packages to use for this step. The key is the name of the package
320
- and the value is the version to use.
321
- python : str, optional, default: None
322
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
323
- that the version used will correspond to the version of the Python interpreter used to start the run.
324
- """
325
- ...
326
-
327
- @typing.overload
328
- def catch(*, var: typing.Optional[str] = None, print_exception: bool = True) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
329
- """
330
- Specifies that the step will success under all circumstances.
331
-
332
- The decorator will create an optional artifact, specified by `var`, which
333
- contains the exception raised. You can use it to detect the presence
334
- of errors, indicating that all happy-path artifacts produced by the step
335
- are missing.
336
-
337
-
338
- Parameters
339
- ----------
340
- var : str, optional, default None
341
- Name of the artifact in which to store the caught exception.
342
- If not specified, the exception is not stored.
343
- print_exception : bool, default True
344
- Determines whether or not the exception is printed to
345
- stdout when caught.
346
- """
347
- ...
348
-
349
- @typing.overload
350
- def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
351
- ...
352
-
353
- @typing.overload
354
- def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
355
- ...
356
-
357
- def catch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, var: typing.Optional[str] = None, print_exception: bool = True):
358
- """
359
- Specifies that the step will success under all circumstances.
360
-
361
- The decorator will create an optional artifact, specified by `var`, which
362
- contains the exception raised. You can use it to detect the presence
363
- of errors, indicating that all happy-path artifacts produced by the step
364
- are missing.
365
-
366
-
367
- Parameters
368
- ----------
369
- var : str, optional, default None
370
- Name of the artifact in which to store the caught exception.
371
- If not specified, the exception is not stored.
372
- print_exception : bool, default True
373
- Determines whether or not the exception is printed to
374
- stdout when caught.
375
- """
376
- ...
377
-
378
170
  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]]]:
379
171
  """
380
172
  This decorator is used to run vllm APIs as Metaflow task sidecars.
@@ -425,58 +217,119 @@ def vllm(*, model: str, backend: str, openai_api_server: bool, debug: bool, card
425
217
  """
426
218
  ...
427
219
 
428
- @typing.overload
429
- 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]]]:
220
+ def huggingface_hub(*, temp_dir_root: typing.Optional[str] = None, load: typing.Union[typing.List[str], typing.List[typing.Tuple[typing.Dict, str]], typing.List[typing.Tuple[str, str]], typing.List[typing.Dict], None]) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
430
221
  """
431
- Specifies the number of times the task corresponding
432
- to a step needs to be retried.
222
+ Decorator that helps cache, version and store models/datasets from huggingface hub.
433
223
 
434
- This decorator is useful for handling transient errors, such as networking issues.
435
- If your task contains operations that can't be retried safely, e.g. database updates,
436
- it is advisable to annotate it with `@retry(times=0)`.
224
+ > Examples
437
225
 
438
- This can be used in conjunction with the `@catch` decorator. The `@catch`
439
- decorator will execute a no-op task after all retries have been exhausted,
440
- ensuring that the flow execution can continue.
226
+ **Usage: creating references of models from huggingface that may be loaded in downstream steps**
227
+ ```python
228
+ @huggingface_hub
229
+ @step
230
+ def pull_model_from_huggingface(self):
231
+ # `current.huggingface_hub.snapshot_download` downloads the model from the Hugging Face Hub
232
+ # and saves it in the backend storage based on the model's `repo_id`. If there exists a model
233
+ # with the same `repo_id` in the backend storage, it will not download the model again. The return
234
+ # value of the function is a reference to the model in the backend storage.
235
+ # This reference can be used to load the model in the subsequent steps via `@model(load=["llama_model"])`
441
236
 
237
+ self.model_id = "mistralai/Mistral-7B-Instruct-v0.1"
238
+ self.llama_model = current.huggingface_hub.snapshot_download(
239
+ repo_id=self.model_id,
240
+ allow_patterns=["*.safetensors", "*.json", "tokenizer.*"],
241
+ )
242
+ self.next(self.train)
243
+ ```
442
244
 
443
- Parameters
444
- ----------
445
- times : int, default 3
446
- Number of times to retry this task.
447
- minutes_between_retries : int, default 2
448
- Number of minutes between retries.
449
- """
450
- ...
451
-
452
- @typing.overload
453
- def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
454
- ...
455
-
456
- @typing.overload
457
- def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
458
- ...
459
-
460
- 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):
461
- """
462
- Specifies the number of times the task corresponding
463
- to a step needs to be retried.
245
+ **Usage: loading models directly from huggingface hub or from cache (from metaflow's datastore)**
246
+ ```python
247
+ @huggingface_hub(load=["mistralai/Mistral-7B-Instruct-v0.1"])
248
+ @step
249
+ def pull_model_from_huggingface(self):
250
+ path_to_model = current.huggingface_hub.loaded["mistralai/Mistral-7B-Instruct-v0.1"]
251
+ ```
464
252
 
465
- This decorator is useful for handling transient errors, such as networking issues.
466
- If your task contains operations that can't be retried safely, e.g. database updates,
467
- it is advisable to annotate it with `@retry(times=0)`.
253
+ ```python
254
+ @huggingface_hub(load=[("mistralai/Mistral-7B-Instruct-v0.1", "/my-directory"), ("myorg/mistral-lora, "/my-lora-directory")])
255
+ @step
256
+ def finetune_model(self):
257
+ path_to_model = current.huggingface_hub.loaded["mistralai/Mistral-7B-Instruct-v0.1"]
258
+ # path_to_model will be /my-directory
259
+ ```
468
260
 
469
- This can be used in conjunction with the `@catch` decorator. The `@catch`
470
- decorator will execute a no-op task after all retries have been exhausted,
471
- ensuring that the flow execution can continue.
261
+ ```python
262
+ # Takes all the arguments passed to `snapshot_download`
263
+ # except for `local_dir`
264
+ @huggingface_hub(load=[
265
+ {
266
+ "repo_id": "mistralai/Mistral-7B-Instruct-v0.1",
267
+ },
268
+ {
269
+ "repo_id": "myorg/mistral-lora",
270
+ "repo_type": "model",
271
+ },
272
+ ])
273
+ @step
274
+ def finetune_model(self):
275
+ path_to_model = current.huggingface_hub.loaded["mistralai/Mistral-7B-Instruct-v0.1"]
276
+ # path_to_model will be /my-directory
277
+ ```
472
278
 
473
279
 
474
280
  Parameters
475
281
  ----------
476
- times : int, default 3
477
- Number of times to retry this task.
478
- minutes_between_retries : int, default 2
479
- Number of minutes between retries.
282
+ temp_dir_root : str, optional
283
+ The root directory that will hold the temporary directory where objects will be downloaded.
284
+
285
+ load: Union[List[str], List[Tuple[Dict, str]], List[Tuple[str, str]], List[Dict], None]
286
+ The list of repos (models/datasets) to load.
287
+
288
+ Loaded repos can be accessed via `current.huggingface_hub.loaded`. If load is set, then the following happens:
289
+
290
+ - If repo (model/dataset) is not found in the datastore:
291
+ - Downloads the repo from Hugging Face Hub to a temporary directory (or uses specified path) for local access
292
+ - Stores it in Metaflow's datastore (s3/gcs/azure etc.) with a unique name based on repo_type/repo_id
293
+ - All HF models loaded for a `@step` will be cached separately under flow/step/namespace.
294
+
295
+ - If repo is found in the datastore:
296
+ - Loads it directly from datastore to local path (can be temporary directory or specified path)
297
+ """
298
+ ...
299
+
300
+ @typing.overload
301
+ def app_deploy(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
302
+ """
303
+ Decorator prototype for all step decorators. This function gets specialized
304
+ and imported for all decorators types by _import_plugin_decorators().
305
+ """
306
+ ...
307
+
308
+ @typing.overload
309
+ def app_deploy(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
310
+ ...
311
+
312
+ def app_deploy(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
313
+ """
314
+ Decorator prototype for all step decorators. This function gets specialized
315
+ and imported for all decorators types by _import_plugin_decorators().
316
+ """
317
+ ...
318
+
319
+ @typing.overload
320
+ def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
321
+ """
322
+ Internal decorator to support Fast bakery
323
+ """
324
+ ...
325
+
326
+ @typing.overload
327
+ def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
328
+ ...
329
+
330
+ def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
331
+ """
332
+ Internal decorator to support Fast bakery
480
333
  """
481
334
  ...
482
335
 
@@ -513,71 +366,70 @@ def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], Non
513
366
  """
514
367
  ...
515
368
 
516
- @typing.overload
517
- def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
518
- """
519
- Decorator prototype for all step decorators. This function gets specialized
520
- and imported for all decorators types by _import_plugin_decorators().
521
- """
522
- ...
523
-
524
- @typing.overload
525
- def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
526
- ...
527
-
528
- def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
369
+ 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]]]:
529
370
  """
530
- Decorator prototype for all step decorators. This function gets specialized
531
- and imported for all decorators types by _import_plugin_decorators().
371
+ Specifies that this step should execute on DGX cloud.
372
+
373
+
374
+ Parameters
375
+ ----------
376
+ gpu : int
377
+ Number of GPUs to use.
378
+ gpu_type : str
379
+ Type of Nvidia GPU to use.
380
+ queue_timeout : int
381
+ Time to keep the job in NVCF's queue.
532
382
  """
533
383
  ...
534
384
 
535
385
  @typing.overload
536
- 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]]]:
386
+ 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]]]:
537
387
  """
538
- Creates a human-readable report, a Metaflow Card, after this step completes.
388
+ Specifies the PyPI packages for the step.
539
389
 
540
- Note that you may add multiple `@card` decorators in a step with different parameters.
390
+ Information in this decorator will augment any
391
+ attributes set in the `@pyi_base` flow-level decorator. Hence,
392
+ you can use `@pypi_base` to set packages required by all
393
+ steps and use `@pypi` to specify step-specific overrides.
541
394
 
542
395
 
543
396
  Parameters
544
397
  ----------
545
- type : str, default 'default'
546
- Card type.
547
- id : str, optional, default None
548
- If multiple cards are present, use this id to identify this card.
549
- options : Dict[str, Any], default {}
550
- Options passed to the card. The contents depend on the card type.
551
- timeout : int, default 45
552
- Interrupt reporting if it takes more than this many seconds.
398
+ packages : Dict[str, str], default: {}
399
+ Packages to use for this step. The key is the name of the package
400
+ and the value is the version to use.
401
+ python : str, optional, default: None
402
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
403
+ that the version used will correspond to the version of the Python interpreter used to start the run.
553
404
  """
554
405
  ...
555
406
 
556
407
  @typing.overload
557
- def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
408
+ def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
558
409
  ...
559
410
 
560
411
  @typing.overload
561
- def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
412
+ def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
562
413
  ...
563
414
 
564
- 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):
415
+ 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):
565
416
  """
566
- Creates a human-readable report, a Metaflow Card, after this step completes.
417
+ Specifies the PyPI packages for the step.
567
418
 
568
- Note that you may add multiple `@card` decorators in a step with different parameters.
419
+ Information in this decorator will augment any
420
+ attributes set in the `@pyi_base` flow-level decorator. Hence,
421
+ you can use `@pypi_base` to set packages required by all
422
+ steps and use `@pypi` to specify step-specific overrides.
569
423
 
570
424
 
571
425
  Parameters
572
426
  ----------
573
- type : str, default 'default'
574
- Card type.
575
- id : str, optional, default None
576
- If multiple cards are present, use this id to identify this card.
577
- options : Dict[str, Any], default {}
578
- Options passed to the card. The contents depend on the card type.
579
- timeout : int, default 45
580
- Interrupt reporting if it takes more than this many seconds.
427
+ packages : Dict[str, str], default: {}
428
+ Packages to use for this step. The key is the name of the package
429
+ and the value is the version to use.
430
+ python : str, optional, default: None
431
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
432
+ that the version used will correspond to the version of the Python interpreter used to start the run.
581
433
  """
582
434
  ...
583
435
 
@@ -710,22 +562,17 @@ def model(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
710
562
  """
711
563
  ...
712
564
 
713
- @typing.overload
714
- def app_deploy(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
715
- """
716
- Decorator prototype for all step decorators. This function gets specialized
717
- and imported for all decorators types by _import_plugin_decorators().
718
- """
719
- ...
720
-
721
- @typing.overload
722
- def app_deploy(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
723
- ...
724
-
725
- def app_deploy(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
565
+ def nvct(*, gpu: int, gpu_type: str) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
726
566
  """
727
- Decorator prototype for all step decorators. This function gets specialized
728
- and imported for all decorators types by _import_plugin_decorators().
567
+ Specifies that this step should execute on DGX cloud.
568
+
569
+
570
+ Parameters
571
+ ----------
572
+ gpu : int
573
+ Number of GPUs to use.
574
+ gpu_type : str
575
+ Type of Nvidia GPU to use.
729
576
  """
730
577
  ...
731
578
 
@@ -751,105 +598,92 @@ def s3_proxy(*, integration_name: typing.Optional[str] = None, write_mode: typin
751
598
  """
752
599
  ...
753
600
 
754
- @typing.overload
755
- 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]]]:
756
- """
757
- Specifies the Conda environment for the step.
758
-
759
- Information in this decorator will augment any
760
- attributes set in the `@conda_base` flow-level decorator. Hence,
761
- you can use `@conda_base` to set packages required by all
762
- steps and use `@conda` to specify step-specific overrides.
763
-
764
-
765
- Parameters
766
- ----------
767
- packages : Dict[str, str], default {}
768
- Packages to use for this step. The key is the name of the package
769
- and the value is the version to use.
770
- libraries : Dict[str, str], default {}
771
- Supported for backward compatibility. When used with packages, packages will take precedence.
772
- python : str, optional, default None
773
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
774
- that the version used will correspond to the version of the Python interpreter used to start the run.
775
- disabled : bool, default False
776
- If set to True, disables @conda.
777
- """
778
- ...
779
-
780
- @typing.overload
781
- def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
782
- ...
783
-
784
- @typing.overload
785
- def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
786
- ...
787
-
788
- 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):
601
+ 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]]]:
789
602
  """
790
- Specifies the Conda environment for the step.
791
-
792
- Information in this decorator will augment any
793
- attributes set in the `@conda_base` flow-level decorator. Hence,
794
- you can use `@conda_base` to set packages required by all
795
- steps and use `@conda` to specify step-specific overrides.
603
+ Specifies that this step should execute on Kubernetes.
796
604
 
797
605
 
798
606
  Parameters
799
607
  ----------
800
- packages : Dict[str, str], default {}
801
- Packages to use for this step. The key is the name of the package
802
- and the value is the version to use.
803
- libraries : Dict[str, str], default {}
804
- Supported for backward compatibility. When used with packages, packages will take precedence.
805
- python : str, optional, default None
806
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
807
- that the version used will correspond to the version of the Python interpreter used to start the run.
808
- disabled : bool, default False
809
- If set to True, disables @conda.
810
- """
811
- ...
812
-
813
- 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]]]:
814
- """
815
- This decorator is used to run Ollama APIs as Metaflow task sidecars.
816
-
817
- User code call
818
- --------------
819
- @ollama(
820
- models=[...],
821
- ...
822
- )
823
-
824
- Valid backend options
825
- ---------------------
826
- - 'local': Run as a separate process on the local task machine.
827
- - (TODO) 'managed': Outerbounds hosts and selects compute provider.
828
- - (TODO) 'remote': Spin up separate instance to serve Ollama models.
829
-
830
- Valid model options
831
- -------------------
832
- Any model here https://ollama.com/search, e.g. 'llama3.2', 'llama3.3'
833
-
608
+ cpu : int, default 1
609
+ Number of CPUs required for this step. If `@resources` is
610
+ also present, the maximum value from all decorators is used.
611
+ memory : int, default 4096
612
+ Memory size (in MB) required for this step. If
613
+ `@resources` is also present, the maximum value from all decorators is
614
+ used.
615
+ disk : int, default 10240
616
+ Disk size (in MB) required for this step. If
617
+ `@resources` is also present, the maximum value from all decorators is
618
+ used.
619
+ image : str, optional, default None
620
+ Docker image to use when launching on Kubernetes. If not specified, and
621
+ METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
622
+ not, a default Docker image mapping to the current version of Python is used.
623
+ image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
624
+ If given, the imagePullPolicy to be applied to the Docker image of the step.
625
+ image_pull_secrets: List[str], default []
626
+ The default is extracted from METAFLOW_KUBERNETES_IMAGE_PULL_SECRETS.
627
+ Kubernetes image pull secrets to use when pulling container images
628
+ in Kubernetes.
629
+ service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
630
+ Kubernetes service account to use when launching pod in Kubernetes.
631
+ secrets : List[str], optional, default None
632
+ Kubernetes secrets to use when launching pod in Kubernetes. These
633
+ secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
634
+ in Metaflow configuration.
635
+ node_selector: Union[Dict[str,str], str], optional, default None
636
+ Kubernetes node selector(s) to apply to the pod running the task.
637
+ Can be passed in as a comma separated string of values e.g.
638
+ 'kubernetes.io/os=linux,kubernetes.io/arch=amd64' or as a dictionary
639
+ {'kubernetes.io/os': 'linux', 'kubernetes.io/arch': 'amd64'}
640
+ namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
641
+ Kubernetes namespace to use when launching pod in Kubernetes.
642
+ gpu : int, optional, default None
643
+ Number of GPUs required for this step. A value of zero implies that
644
+ the scheduled node should not have GPUs.
645
+ gpu_vendor : str, default KUBERNETES_GPU_VENDOR
646
+ The vendor of the GPUs to be used for this step.
647
+ tolerations : List[Dict[str,str]], default []
648
+ The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
649
+ Kubernetes tolerations to use when launching pod in Kubernetes.
650
+ labels: Dict[str, str], default: METAFLOW_KUBERNETES_LABELS
651
+ Kubernetes labels to use when launching pod in Kubernetes.
652
+ annotations: Dict[str, str], default: METAFLOW_KUBERNETES_ANNOTATIONS
653
+ Kubernetes annotations to use when launching pod in Kubernetes.
654
+ use_tmpfs : bool, default False
655
+ This enables an explicit tmpfs mount for this step.
656
+ tmpfs_tempdir : bool, default True
657
+ sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
658
+ tmpfs_size : int, optional, default: None
659
+ The value for the size (in MiB) of the tmpfs mount for this step.
660
+ This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
661
+ memory allocated for this step.
662
+ tmpfs_path : str, optional, default /metaflow_temp
663
+ Path to tmpfs mount for this step.
664
+ persistent_volume_claims : Dict[str, str], optional, default None
665
+ A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
666
+ volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
667
+ shared_memory: int, optional
668
+ Shared memory size (in MiB) required for this step
669
+ port: int, optional
670
+ Port number to specify in the Kubernetes job object
671
+ compute_pool : str, optional, default None
672
+ Compute pool to be used for for this step.
673
+ If not specified, any accessible compute pool within the perimeter is used.
674
+ hostname_resolution_timeout: int, default 10 * 60
675
+ Timeout in seconds for the workers tasks in the gang scheduled cluster to resolve the hostname of control task.
676
+ Only applicable when @parallel is used.
677
+ qos: str, default: Burstable
678
+ Quality of Service class to assign to the pod. Supported values are: Guaranteed, Burstable, BestEffort
834
679
 
835
- Parameters
836
- ----------
837
- models: list[str]
838
- List of Ollama containers running models in sidecars.
839
- backend: str
840
- Determines where and how to run the Ollama process.
841
- force_pull: bool
842
- Whether to run `ollama pull` no matter what, or first check the remote cache in Metaflow datastore for this model key.
843
- cache_update_policy: str
844
- Cache update policy: "auto", "force", or "never".
845
- force_cache_update: bool
846
- Simple override for "force" cache update policy.
847
- debug: bool
848
- Whether to turn on verbose debugging logs.
849
- circuit_breaker_config: dict
850
- Configuration for circuit breaker protection. Keys: failure_threshold, recovery_timeout, reset_timeout.
851
- timeout_config: dict
852
- Configuration for various operation timeouts. Keys: pull, stop, health_check, install, server_startup.
680
+ security_context: Dict[str, Any], optional, default None
681
+ Container security context. Applies to the task container. Allows the following keys:
682
+ - privileged: bool, optional, default None
683
+ - allow_privilege_escalation: bool, optional, default None
684
+ - run_as_user: int, optional, default None
685
+ - run_as_group: int, optional, default None
686
+ - run_as_non_root: bool, optional, default None
853
687
  """
854
688
  ...
855
689
 
@@ -934,630 +768,583 @@ def timeout(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None],
934
768
  ...
935
769
 
936
770
  @typing.overload
937
- def coreweave_s3_proxy(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
938
- """
939
- CoreWeave-specific S3 Proxy decorator for routing S3 requests through a local proxy service.
940
- It exists to make it easier for users to know that this decorator should only be used with
941
- a Neo Cloud like CoreWeave.
942
- """
943
- ...
944
-
945
- @typing.overload
946
- def coreweave_s3_proxy(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
947
- ...
948
-
949
- def coreweave_s3_proxy(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
950
- """
951
- CoreWeave-specific S3 Proxy decorator for routing S3 requests through a local proxy service.
952
- It exists to make it easier for users to know that this decorator should only be used with
953
- a Neo Cloud like CoreWeave.
954
- """
955
- ...
956
-
957
- @typing.overload
958
- 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]]]:
771
+ def catch(*, var: typing.Optional[str] = None, print_exception: bool = True) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
959
772
  """
960
- Specifies the resources needed when executing this step.
961
-
962
- Use `@resources` to specify the resource requirements
963
- independently of the specific compute layer (`@batch`, `@kubernetes`).
773
+ Specifies that the step will success under all circumstances.
964
774
 
965
- You can choose the compute layer on the command line by executing e.g.
966
- ```
967
- python myflow.py run --with batch
968
- ```
969
- or
970
- ```
971
- python myflow.py run --with kubernetes
972
- ```
973
- which executes the flow on the desired system using the
974
- requirements specified in `@resources`.
775
+ The decorator will create an optional artifact, specified by `var`, which
776
+ contains the exception raised. You can use it to detect the presence
777
+ of errors, indicating that all happy-path artifacts produced by the step
778
+ are missing.
975
779
 
976
780
 
977
781
  Parameters
978
782
  ----------
979
- cpu : int, default 1
980
- Number of CPUs required for this step.
981
- gpu : int, optional, default None
982
- Number of GPUs required for this step.
983
- disk : int, optional, default None
984
- Disk size (in MB) required for this step. Only applies on Kubernetes.
985
- memory : int, default 4096
986
- Memory size (in MB) required for this step.
987
- shared_memory : int, optional, default None
988
- The value for the size (in MiB) of the /dev/shm volume for this step.
989
- This parameter maps to the `--shm-size` option in Docker.
783
+ var : str, optional, default None
784
+ Name of the artifact in which to store the caught exception.
785
+ If not specified, the exception is not stored.
786
+ print_exception : bool, default True
787
+ Determines whether or not the exception is printed to
788
+ stdout when caught.
990
789
  """
991
790
  ...
992
791
 
993
792
  @typing.overload
994
- def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
793
+ def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
995
794
  ...
996
795
 
997
796
  @typing.overload
998
- def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
797
+ def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
999
798
  ...
1000
799
 
1001
- 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):
800
+ def catch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, var: typing.Optional[str] = None, print_exception: bool = True):
1002
801
  """
1003
- Specifies the resources needed when executing this step.
1004
-
1005
- Use `@resources` to specify the resource requirements
1006
- independently of the specific compute layer (`@batch`, `@kubernetes`).
802
+ Specifies that the step will success under all circumstances.
1007
803
 
1008
- You can choose the compute layer on the command line by executing e.g.
1009
- ```
1010
- python myflow.py run --with batch
1011
- ```
1012
- or
1013
- ```
1014
- python myflow.py run --with kubernetes
1015
- ```
1016
- which executes the flow on the desired system using the
1017
- requirements specified in `@resources`.
804
+ The decorator will create an optional artifact, specified by `var`, which
805
+ contains the exception raised. You can use it to detect the presence
806
+ of errors, indicating that all happy-path artifacts produced by the step
807
+ are missing.
1018
808
 
1019
809
 
1020
810
  Parameters
1021
811
  ----------
1022
- cpu : int, default 1
1023
- Number of CPUs required for this step.
1024
- gpu : int, optional, default None
1025
- Number of GPUs required for this step.
1026
- disk : int, optional, default None
1027
- Disk size (in MB) required for this step. Only applies on Kubernetes.
1028
- memory : int, default 4096
1029
- Memory size (in MB) required for this step.
1030
- shared_memory : int, optional, default None
1031
- The value for the size (in MiB) of the /dev/shm volume for this step.
1032
- This parameter maps to the `--shm-size` option in Docker.
812
+ var : str, optional, default None
813
+ Name of the artifact in which to store the caught exception.
814
+ If not specified, the exception is not stored.
815
+ print_exception : bool, default True
816
+ Determines whether or not the exception is printed to
817
+ stdout when caught.
1033
818
  """
1034
819
  ...
1035
820
 
1036
- @typing.overload
1037
- 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]]]:
821
+ 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]]]:
1038
822
  """
1039
- Enables checkpointing for a step.
823
+ This decorator is used to run Ollama APIs as Metaflow task sidecars.
1040
824
 
1041
- > Examples
825
+ User code call
826
+ --------------
827
+ @ollama(
828
+ models=[...],
829
+ ...
830
+ )
1042
831
 
1043
- - Saving Checkpoints
832
+ Valid backend options
833
+ ---------------------
834
+ - 'local': Run as a separate process on the local task machine.
835
+ - (TODO) 'managed': Outerbounds hosts and selects compute provider.
836
+ - (TODO) 'remote': Spin up separate instance to serve Ollama models.
1044
837
 
1045
- ```python
1046
- @checkpoint
1047
- @step
1048
- def train(self):
1049
- model = create_model(self.parameters, checkpoint_path = None)
1050
- for i in range(self.epochs):
1051
- # some training logic
1052
- loss = model.train(self.dataset)
1053
- if i % 10 == 0:
1054
- model.save(
1055
- current.checkpoint.directory,
1056
- )
1057
- # saves the contents of the `current.checkpoint.directory` as a checkpoint
1058
- # and returns a reference dictionary to the checkpoint saved in the datastore
1059
- self.latest_checkpoint = current.checkpoint.save(
1060
- name="epoch_checkpoint",
1061
- metadata={
1062
- "epoch": i,
1063
- "loss": loss,
1064
- }
1065
- )
1066
- ```
838
+ Valid model options
839
+ -------------------
840
+ Any model here https://ollama.com/search, e.g. 'llama3.2', 'llama3.3'
1067
841
 
1068
- - Using Loaded Checkpoints
1069
842
 
1070
- ```python
1071
- @retry(times=3)
1072
- @checkpoint
1073
- @step
1074
- def train(self):
1075
- # Assume that the task has restarted and the previous attempt of the task
1076
- # saved a checkpoint
1077
- checkpoint_path = None
1078
- if current.checkpoint.is_loaded: # Check if a checkpoint is loaded
1079
- print("Loaded checkpoint from the previous attempt")
1080
- checkpoint_path = current.checkpoint.directory
843
+ Parameters
844
+ ----------
845
+ models: list[str]
846
+ List of Ollama containers running models in sidecars.
847
+ backend: str
848
+ Determines where and how to run the Ollama process.
849
+ force_pull: bool
850
+ Whether to run `ollama pull` no matter what, or first check the remote cache in Metaflow datastore for this model key.
851
+ cache_update_policy: str
852
+ Cache update policy: "auto", "force", or "never".
853
+ force_cache_update: bool
854
+ Simple override for "force" cache update policy.
855
+ debug: bool
856
+ Whether to turn on verbose debugging logs.
857
+ circuit_breaker_config: dict
858
+ Configuration for circuit breaker protection. Keys: failure_threshold, recovery_timeout, reset_timeout.
859
+ timeout_config: dict
860
+ Configuration for various operation timeouts. Keys: pull, stop, health_check, install, server_startup.
861
+ """
862
+ ...
863
+
864
+ @typing.overload
865
+ 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]]]:
866
+ """
867
+ Creates a human-readable report, a Metaflow Card, after this step completes.
1081
868
 
1082
- model = create_model(self.parameters, checkpoint_path = checkpoint_path)
1083
- for i in range(self.epochs):
1084
- ...
1085
- ```
869
+ Note that you may add multiple `@card` decorators in a step with different parameters.
1086
870
 
1087
871
 
1088
872
  Parameters
1089
873
  ----------
1090
- load_policy : str, default: "fresh"
1091
- The policy for loading the checkpoint. The following policies are supported:
1092
- - "eager": Loads the the latest available checkpoint within the namespace.
1093
- With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
1094
- will be loaded at the start of the task.
1095
- - "none": Do not load any checkpoint
1096
- - "fresh": Loads the lastest checkpoint created within the running Task.
1097
- This mode helps loading checkpoints across various retry attempts of the same task.
1098
- With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
1099
- created within the task will be loaded when the task is retries execution on failure.
1100
-
1101
- temp_dir_root : str, default: None
1102
- The root directory under which `current.checkpoint.directory` will be created.
874
+ type : str, default 'default'
875
+ Card type.
876
+ id : str, optional, default None
877
+ If multiple cards are present, use this id to identify this card.
878
+ options : Dict[str, Any], default {}
879
+ Options passed to the card. The contents depend on the card type.
880
+ timeout : int, default 45
881
+ Interrupt reporting if it takes more than this many seconds.
1103
882
  """
1104
883
  ...
1105
884
 
1106
885
  @typing.overload
1107
- def checkpoint(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
886
+ def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1108
887
  ...
1109
888
 
1110
889
  @typing.overload
1111
- def checkpoint(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
890
+ def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1112
891
  ...
1113
892
 
1114
- 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):
893
+ 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):
1115
894
  """
1116
- Enables checkpointing for a step.
1117
-
1118
- > Examples
1119
-
1120
- - Saving Checkpoints
1121
-
1122
- ```python
1123
- @checkpoint
1124
- @step
1125
- def train(self):
1126
- model = create_model(self.parameters, checkpoint_path = None)
1127
- for i in range(self.epochs):
1128
- # some training logic
1129
- loss = model.train(self.dataset)
1130
- if i % 10 == 0:
1131
- model.save(
1132
- current.checkpoint.directory,
1133
- )
1134
- # saves the contents of the `current.checkpoint.directory` as a checkpoint
1135
- # and returns a reference dictionary to the checkpoint saved in the datastore
1136
- self.latest_checkpoint = current.checkpoint.save(
1137
- name="epoch_checkpoint",
1138
- metadata={
1139
- "epoch": i,
1140
- "loss": loss,
1141
- }
1142
- )
1143
- ```
1144
-
1145
- - Using Loaded Checkpoints
1146
-
1147
- ```python
1148
- @retry(times=3)
1149
- @checkpoint
1150
- @step
1151
- def train(self):
1152
- # Assume that the task has restarted and the previous attempt of the task
1153
- # saved a checkpoint
1154
- checkpoint_path = None
1155
- if current.checkpoint.is_loaded: # Check if a checkpoint is loaded
1156
- print("Loaded checkpoint from the previous attempt")
1157
- checkpoint_path = current.checkpoint.directory
895
+ Creates a human-readable report, a Metaflow Card, after this step completes.
1158
896
 
1159
- model = create_model(self.parameters, checkpoint_path = checkpoint_path)
1160
- for i in range(self.epochs):
1161
- ...
1162
- ```
897
+ Note that you may add multiple `@card` decorators in a step with different parameters.
1163
898
 
1164
899
 
1165
900
  Parameters
1166
901
  ----------
1167
- load_policy : str, default: "fresh"
1168
- The policy for loading the checkpoint. The following policies are supported:
1169
- - "eager": Loads the the latest available checkpoint within the namespace.
1170
- With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
1171
- will be loaded at the start of the task.
1172
- - "none": Do not load any checkpoint
1173
- - "fresh": Loads the lastest checkpoint created within the running Task.
1174
- This mode helps loading checkpoints across various retry attempts of the same task.
1175
- With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
1176
- created within the task will be loaded when the task is retries execution on failure.
1177
-
1178
- temp_dir_root : str, default: None
1179
- The root directory under which `current.checkpoint.directory` will be created.
902
+ type : str, default 'default'
903
+ Card type.
904
+ id : str, optional, default None
905
+ If multiple cards are present, use this id to identify this card.
906
+ options : Dict[str, Any], default {}
907
+ Options passed to the card. The contents depend on the card type.
908
+ timeout : int, default 45
909
+ Interrupt reporting if it takes more than this many seconds.
1180
910
  """
1181
911
  ...
1182
912
 
1183
913
  @typing.overload
1184
- 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]]]:
914
+ def coreweave_s3_proxy(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1185
915
  """
1186
- Specifies secrets to be retrieved and injected as environment variables prior to
1187
- the execution of a step.
1188
-
1189
-
1190
- Parameters
1191
- ----------
1192
- sources : List[Union[str, Dict[str, Any]]], default: []
1193
- List of secret specs, defining how the secrets are to be retrieved
1194
- role : str, optional, default: None
1195
- Role to use for fetching secrets
916
+ CoreWeave-specific S3 Proxy decorator for routing S3 requests through a local proxy service.
917
+ It exists to make it easier for users to know that this decorator should only be used with
918
+ a Neo Cloud like CoreWeave.
1196
919
  """
1197
920
  ...
1198
921
 
1199
922
  @typing.overload
1200
- def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1201
- ...
1202
-
1203
- @typing.overload
1204
- def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
923
+ def coreweave_s3_proxy(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1205
924
  ...
1206
925
 
1207
- 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):
926
+ def coreweave_s3_proxy(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
1208
927
  """
1209
- Specifies secrets to be retrieved and injected as environment variables prior to
1210
- the execution of a step.
1211
-
1212
-
1213
- Parameters
1214
- ----------
1215
- sources : List[Union[str, Dict[str, Any]]], default: []
1216
- List of secret specs, defining how the secrets are to be retrieved
1217
- role : str, optional, default: None
1218
- Role to use for fetching secrets
928
+ CoreWeave-specific S3 Proxy decorator for routing S3 requests through a local proxy service.
929
+ It exists to make it easier for users to know that this decorator should only be used with
930
+ a Neo Cloud like CoreWeave.
1219
931
  """
1220
932
  ...
1221
933
 
1222
934
  @typing.overload
1223
- def test_append_card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
935
+ def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1224
936
  """
1225
- A simple decorator that demonstrates using CardDecoratorInjector
1226
- to inject a card and render simple markdown content.
937
+ Decorator prototype for all step decorators. This function gets specialized
938
+ and imported for all decorators types by _import_plugin_decorators().
1227
939
  """
1228
940
  ...
1229
941
 
1230
942
  @typing.overload
1231
- def test_append_card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
943
+ def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1232
944
  ...
1233
945
 
1234
- def test_append_card(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
946
+ def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
1235
947
  """
1236
- A simple decorator that demonstrates using CardDecoratorInjector
1237
- to inject a card and render simple markdown content.
948
+ Decorator prototype for all step decorators. This function gets specialized
949
+ and imported for all decorators types by _import_plugin_decorators().
1238
950
  """
1239
951
  ...
1240
952
 
1241
- 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]]]:
953
+ @typing.overload
954
+ 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]]]:
1242
955
  """
1243
- Specifies that this step should execute on DGX cloud.
956
+ Specifies the number of times the task corresponding
957
+ to a step needs to be retried.
958
+
959
+ This decorator is useful for handling transient errors, such as networking issues.
960
+ If your task contains operations that can't be retried safely, e.g. database updates,
961
+ it is advisable to annotate it with `@retry(times=0)`.
962
+
963
+ This can be used in conjunction with the `@catch` decorator. The `@catch`
964
+ decorator will execute a no-op task after all retries have been exhausted,
965
+ ensuring that the flow execution can continue.
1244
966
 
1245
967
 
1246
968
  Parameters
1247
969
  ----------
1248
- gpu : int
1249
- Number of GPUs to use.
1250
- gpu_type : str
1251
- Type of Nvidia GPU to use.
1252
- queue_timeout : int
1253
- Time to keep the job in NVCF's queue.
970
+ times : int, default 3
971
+ Number of times to retry this task.
972
+ minutes_between_retries : int, default 2
973
+ Number of minutes between retries.
1254
974
  """
1255
975
  ...
1256
976
 
1257
- def huggingface_hub(*, temp_dir_root: typing.Optional[str] = None, load: typing.Union[typing.List[str], typing.List[typing.Tuple[typing.Dict, str]], typing.List[typing.Tuple[str, str]], typing.List[typing.Dict], None]) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
977
+ @typing.overload
978
+ def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
979
+ ...
980
+
981
+ @typing.overload
982
+ def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
983
+ ...
984
+
985
+ 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):
1258
986
  """
1259
- Decorator that helps cache, version and store models/datasets from huggingface hub.
987
+ Specifies the number of times the task corresponding
988
+ to a step needs to be retried.
1260
989
 
1261
- > Examples
990
+ This decorator is useful for handling transient errors, such as networking issues.
991
+ If your task contains operations that can't be retried safely, e.g. database updates,
992
+ it is advisable to annotate it with `@retry(times=0)`.
1262
993
 
1263
- **Usage: creating references of models from huggingface that may be loaded in downstream steps**
1264
- ```python
1265
- @huggingface_hub
1266
- @step
1267
- def pull_model_from_huggingface(self):
1268
- # `current.huggingface_hub.snapshot_download` downloads the model from the Hugging Face Hub
1269
- # and saves it in the backend storage based on the model's `repo_id`. If there exists a model
1270
- # with the same `repo_id` in the backend storage, it will not download the model again. The return
1271
- # value of the function is a reference to the model in the backend storage.
1272
- # This reference can be used to load the model in the subsequent steps via `@model(load=["llama_model"])`
1273
-
1274
- self.model_id = "mistralai/Mistral-7B-Instruct-v0.1"
1275
- self.llama_model = current.huggingface_hub.snapshot_download(
1276
- repo_id=self.model_id,
1277
- allow_patterns=["*.safetensors", "*.json", "tokenizer.*"],
1278
- )
1279
- self.next(self.train)
1280
- ```
1281
-
1282
- **Usage: loading models directly from huggingface hub or from cache (from metaflow's datastore)**
1283
- ```python
1284
- @huggingface_hub(load=["mistralai/Mistral-7B-Instruct-v0.1"])
1285
- @step
1286
- def pull_model_from_huggingface(self):
1287
- path_to_model = current.huggingface_hub.loaded["mistralai/Mistral-7B-Instruct-v0.1"]
1288
- ```
1289
-
1290
- ```python
1291
- @huggingface_hub(load=[("mistralai/Mistral-7B-Instruct-v0.1", "/my-directory"), ("myorg/mistral-lora, "/my-lora-directory")])
1292
- @step
1293
- def finetune_model(self):
1294
- path_to_model = current.huggingface_hub.loaded["mistralai/Mistral-7B-Instruct-v0.1"]
1295
- # path_to_model will be /my-directory
1296
- ```
1297
-
1298
- ```python
1299
- # Takes all the arguments passed to `snapshot_download`
1300
- # except for `local_dir`
1301
- @huggingface_hub(load=[
1302
- {
1303
- "repo_id": "mistralai/Mistral-7B-Instruct-v0.1",
1304
- },
1305
- {
1306
- "repo_id": "myorg/mistral-lora",
1307
- "repo_type": "model",
1308
- },
1309
- ])
1310
- @step
1311
- def finetune_model(self):
1312
- path_to_model = current.huggingface_hub.loaded["mistralai/Mistral-7B-Instruct-v0.1"]
1313
- # path_to_model will be /my-directory
1314
- ```
994
+ This can be used in conjunction with the `@catch` decorator. The `@catch`
995
+ decorator will execute a no-op task after all retries have been exhausted,
996
+ ensuring that the flow execution can continue.
1315
997
 
1316
998
 
1317
999
  Parameters
1318
1000
  ----------
1319
- temp_dir_root : str, optional
1320
- The root directory that will hold the temporary directory where objects will be downloaded.
1321
-
1322
- load: Union[List[str], List[Tuple[Dict, str]], List[Tuple[str, str]], List[Dict], None]
1323
- The list of repos (models/datasets) to load.
1324
-
1325
- Loaded repos can be accessed via `current.huggingface_hub.loaded`. If load is set, then the following happens:
1326
-
1327
- - If repo (model/dataset) is not found in the datastore:
1328
- - Downloads the repo from Hugging Face Hub to a temporary directory (or uses specified path) for local access
1329
- - Stores it in Metaflow's datastore (s3/gcs/azure etc.) with a unique name based on repo_type/repo_id
1330
- - All HF models loaded for a `@step` will be cached separately under flow/step/namespace.
1331
-
1332
- - If repo is found in the datastore:
1333
- - Loads it directly from datastore to local path (can be temporary directory or specified path)
1001
+ times : int, default 3
1002
+ Number of times to retry this task.
1003
+ minutes_between_retries : int, default 2
1004
+ Number of minutes between retries.
1334
1005
  """
1335
1006
  ...
1336
1007
 
1337
- def nvct(*, gpu: int, gpu_type: str) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
1008
+ @typing.overload
1009
+ 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]]]:
1338
1010
  """
1339
- Specifies that this step should execute on DGX cloud.
1011
+ Specifies the Conda environment for the step.
1012
+
1013
+ Information in this decorator will augment any
1014
+ attributes set in the `@conda_base` flow-level decorator. Hence,
1015
+ you can use `@conda_base` to set packages required by all
1016
+ steps and use `@conda` to specify step-specific overrides.
1340
1017
 
1341
1018
 
1342
1019
  Parameters
1343
1020
  ----------
1344
- gpu : int
1345
- Number of GPUs to use.
1346
- gpu_type : str
1347
- Type of Nvidia GPU to use.
1021
+ packages : Dict[str, str], default {}
1022
+ Packages to use for this step. The key is the name of the package
1023
+ and the value is the version to use.
1024
+ libraries : Dict[str, str], default {}
1025
+ Supported for backward compatibility. When used with packages, packages will take precedence.
1026
+ python : str, optional, default None
1027
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1028
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1029
+ disabled : bool, default False
1030
+ If set to True, disables @conda.
1348
1031
  """
1349
1032
  ...
1350
1033
 
1351
- def airflow_s3_key_sensor(*, timeout: int, poke_interval: int, mode: str, exponential_backoff: bool, pool: str, soft_fail: bool, name: str, description: str, bucket_key: typing.Union[str, typing.List[str]], bucket_name: str, wildcard_match: bool, aws_conn_id: str, verify: bool) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1034
+ @typing.overload
1035
+ def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1036
+ ...
1037
+
1038
+ @typing.overload
1039
+ def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1040
+ ...
1041
+
1042
+ 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):
1352
1043
  """
1353
- The `@airflow_s3_key_sensor` decorator attaches a Airflow [S3KeySensor](https://airflow.apache.org/docs/apache-airflow-providers-amazon/stable/_api/airflow/providers/amazon/aws/sensors/s3/index.html#airflow.providers.amazon.aws.sensors.s3.S3KeySensor)
1354
- before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
1355
- and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
1356
- added as a flow decorators. Adding more than one decorator will ensure that `start` step
1357
- starts only after all sensors finish.
1044
+ Specifies the Conda environment for the step.
1045
+
1046
+ Information in this decorator will augment any
1047
+ attributes set in the `@conda_base` flow-level decorator. Hence,
1048
+ you can use `@conda_base` to set packages required by all
1049
+ steps and use `@conda` to specify step-specific overrides.
1358
1050
 
1359
1051
 
1360
1052
  Parameters
1361
1053
  ----------
1362
- timeout : int
1363
- Time, in seconds before the task times out and fails. (Default: 3600)
1364
- poke_interval : int
1365
- Time in seconds that the job should wait in between each try. (Default: 60)
1366
- mode : str
1367
- How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1368
- exponential_backoff : bool
1369
- allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1370
- pool : str
1371
- the slot pool this task should run in,
1372
- slot pools are a way to limit concurrency for certain tasks. (Default:None)
1373
- soft_fail : bool
1374
- Set to true to mark the task as SKIPPED on failure. (Default: False)
1375
- name : str
1376
- Name of the sensor on Airflow
1377
- description : str
1378
- Description of sensor in the Airflow UI
1379
- bucket_key : Union[str, List[str]]
1380
- The key(s) being waited on. Supports full s3:// style url or relative path from root level.
1381
- When it's specified as a full s3:// url, please leave `bucket_name` as None
1382
- bucket_name : str
1383
- Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
1384
- When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
1385
- wildcard_match : bool
1386
- whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
1387
- aws_conn_id : str
1388
- a reference to the s3 connection on Airflow. (Default: None)
1389
- verify : bool
1390
- Whether or not to verify SSL certificates for S3 connection. (Default: None)
1054
+ packages : Dict[str, str], default {}
1055
+ Packages to use for this step. The key is the name of the package
1056
+ and the value is the version to use.
1057
+ libraries : Dict[str, str], default {}
1058
+ Supported for backward compatibility. When used with packages, packages will take precedence.
1059
+ python : str, optional, default None
1060
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1061
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1062
+ disabled : bool, default False
1063
+ If set to True, disables @conda.
1391
1064
  """
1392
1065
  ...
1393
1066
 
1394
1067
  @typing.overload
1395
- def schedule(*, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: typing.Optional[str] = None, timezone: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1068
+ 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]]]:
1396
1069
  """
1397
- Specifies the times when the flow should be run when running on a
1398
- production scheduler.
1070
+ Specifies secrets to be retrieved and injected as environment variables prior to
1071
+ the execution of a step.
1399
1072
 
1400
1073
 
1401
1074
  Parameters
1402
1075
  ----------
1403
- hourly : bool, default False
1404
- Run the workflow hourly.
1405
- daily : bool, default True
1406
- Run the workflow daily.
1407
- weekly : bool, default False
1408
- Run the workflow weekly.
1409
- cron : str, optional, default None
1410
- Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1411
- specified by this expression.
1412
- timezone : str, optional, default None
1413
- Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1414
- which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1076
+ sources : List[Union[str, Dict[str, Any]]], default: []
1077
+ List of secret specs, defining how the secrets are to be retrieved
1078
+ role : str, optional, default: None
1079
+ Role to use for fetching secrets
1415
1080
  """
1416
1081
  ...
1417
1082
 
1418
1083
  @typing.overload
1419
- def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1084
+ def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1420
1085
  ...
1421
1086
 
1422
- def schedule(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: typing.Optional[str] = None, timezone: typing.Optional[str] = None):
1087
+ @typing.overload
1088
+ def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1089
+ ...
1090
+
1091
+ 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):
1423
1092
  """
1424
- Specifies the times when the flow should be run when running on a
1425
- production scheduler.
1093
+ Specifies secrets to be retrieved and injected as environment variables prior to
1094
+ the execution of a step.
1426
1095
 
1427
1096
 
1428
1097
  Parameters
1429
1098
  ----------
1430
- hourly : bool, default False
1431
- Run the workflow hourly.
1432
- daily : bool, default True
1433
- Run the workflow daily.
1434
- weekly : bool, default False
1435
- Run the workflow weekly.
1436
- cron : str, optional, default None
1437
- Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1438
- specified by this expression.
1439
- timezone : str, optional, default None
1440
- Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1441
- which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1099
+ sources : List[Union[str, Dict[str, Any]]], default: []
1100
+ List of secret specs, defining how the secrets are to be retrieved
1101
+ role : str, optional, default: None
1102
+ Role to use for fetching secrets
1442
1103
  """
1443
1104
  ...
1444
1105
 
1445
1106
  @typing.overload
1446
- def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1107
+ def test_append_card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1447
1108
  """
1448
- Specifies the PyPI packages for all steps of the flow.
1109
+ A simple decorator that demonstrates using CardDecoratorInjector
1110
+ to inject a card and render simple markdown content.
1111
+ """
1112
+ ...
1113
+
1114
+ @typing.overload
1115
+ def test_append_card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1116
+ ...
1117
+
1118
+ def test_append_card(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
1119
+ """
1120
+ A simple decorator that demonstrates using CardDecoratorInjector
1121
+ to inject a card and render simple markdown content.
1122
+ """
1123
+ ...
1124
+
1125
+ @typing.overload
1126
+ 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]]]:
1127
+ """
1128
+ Enables checkpointing for a step.
1129
+
1130
+ > Examples
1131
+
1132
+ - Saving Checkpoints
1133
+
1134
+ ```python
1135
+ @checkpoint
1136
+ @step
1137
+ def train(self):
1138
+ model = create_model(self.parameters, checkpoint_path = None)
1139
+ for i in range(self.epochs):
1140
+ # some training logic
1141
+ loss = model.train(self.dataset)
1142
+ if i % 10 == 0:
1143
+ model.save(
1144
+ current.checkpoint.directory,
1145
+ )
1146
+ # saves the contents of the `current.checkpoint.directory` as a checkpoint
1147
+ # and returns a reference dictionary to the checkpoint saved in the datastore
1148
+ self.latest_checkpoint = current.checkpoint.save(
1149
+ name="epoch_checkpoint",
1150
+ metadata={
1151
+ "epoch": i,
1152
+ "loss": loss,
1153
+ }
1154
+ )
1155
+ ```
1156
+
1157
+ - Using Loaded Checkpoints
1158
+
1159
+ ```python
1160
+ @retry(times=3)
1161
+ @checkpoint
1162
+ @step
1163
+ def train(self):
1164
+ # Assume that the task has restarted and the previous attempt of the task
1165
+ # saved a checkpoint
1166
+ checkpoint_path = None
1167
+ if current.checkpoint.is_loaded: # Check if a checkpoint is loaded
1168
+ print("Loaded checkpoint from the previous attempt")
1169
+ checkpoint_path = current.checkpoint.directory
1170
+
1171
+ model = create_model(self.parameters, checkpoint_path = checkpoint_path)
1172
+ for i in range(self.epochs):
1173
+ ...
1174
+ ```
1449
1175
 
1450
- Use `@pypi_base` to set common packages required by all
1451
- steps and use `@pypi` to specify step-specific overrides.
1452
1176
 
1453
1177
  Parameters
1454
1178
  ----------
1455
- packages : Dict[str, str], default: {}
1456
- Packages to use for this flow. The key is the name of the package
1457
- and the value is the version to use.
1458
- python : str, optional, default: None
1459
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1460
- that the version used will correspond to the version of the Python interpreter used to start the run.
1179
+ load_policy : str, default: "fresh"
1180
+ The policy for loading the checkpoint. The following policies are supported:
1181
+ - "eager": Loads the the latest available checkpoint within the namespace.
1182
+ With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
1183
+ will be loaded at the start of the task.
1184
+ - "none": Do not load any checkpoint
1185
+ - "fresh": Loads the lastest checkpoint created within the running Task.
1186
+ This mode helps loading checkpoints across various retry attempts of the same task.
1187
+ With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
1188
+ created within the task will be loaded when the task is retries execution on failure.
1189
+
1190
+ temp_dir_root : str, default: None
1191
+ The root directory under which `current.checkpoint.directory` will be created.
1461
1192
  """
1462
1193
  ...
1463
1194
 
1464
1195
  @typing.overload
1465
- def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1196
+ def checkpoint(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1466
1197
  ...
1467
1198
 
1468
- def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
1199
+ @typing.overload
1200
+ def checkpoint(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1201
+ ...
1202
+
1203
+ 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):
1469
1204
  """
1470
- Specifies the PyPI packages for all steps of the flow.
1205
+ Enables checkpointing for a step.
1206
+
1207
+ > Examples
1208
+
1209
+ - Saving Checkpoints
1210
+
1211
+ ```python
1212
+ @checkpoint
1213
+ @step
1214
+ def train(self):
1215
+ model = create_model(self.parameters, checkpoint_path = None)
1216
+ for i in range(self.epochs):
1217
+ # some training logic
1218
+ loss = model.train(self.dataset)
1219
+ if i % 10 == 0:
1220
+ model.save(
1221
+ current.checkpoint.directory,
1222
+ )
1223
+ # saves the contents of the `current.checkpoint.directory` as a checkpoint
1224
+ # and returns a reference dictionary to the checkpoint saved in the datastore
1225
+ self.latest_checkpoint = current.checkpoint.save(
1226
+ name="epoch_checkpoint",
1227
+ metadata={
1228
+ "epoch": i,
1229
+ "loss": loss,
1230
+ }
1231
+ )
1232
+ ```
1233
+
1234
+ - Using Loaded Checkpoints
1235
+
1236
+ ```python
1237
+ @retry(times=3)
1238
+ @checkpoint
1239
+ @step
1240
+ def train(self):
1241
+ # Assume that the task has restarted and the previous attempt of the task
1242
+ # saved a checkpoint
1243
+ checkpoint_path = None
1244
+ if current.checkpoint.is_loaded: # Check if a checkpoint is loaded
1245
+ print("Loaded checkpoint from the previous attempt")
1246
+ checkpoint_path = current.checkpoint.directory
1247
+
1248
+ model = create_model(self.parameters, checkpoint_path = checkpoint_path)
1249
+ for i in range(self.epochs):
1250
+ ...
1251
+ ```
1471
1252
 
1472
- Use `@pypi_base` to set common packages required by all
1473
- steps and use `@pypi` to specify step-specific overrides.
1474
1253
 
1475
1254
  Parameters
1476
1255
  ----------
1477
- packages : Dict[str, str], default: {}
1478
- Packages to use for this flow. The key is the name of the package
1479
- and the value is the version to use.
1480
- python : str, optional, default: None
1481
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1482
- that the version used will correspond to the version of the Python interpreter used to start the run.
1256
+ load_policy : str, default: "fresh"
1257
+ The policy for loading the checkpoint. The following policies are supported:
1258
+ - "eager": Loads the the latest available checkpoint within the namespace.
1259
+ With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
1260
+ will be loaded at the start of the task.
1261
+ - "none": Do not load any checkpoint
1262
+ - "fresh": Loads the lastest checkpoint created within the running Task.
1263
+ This mode helps loading checkpoints across various retry attempts of the same task.
1264
+ With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
1265
+ created within the task will be loaded when the task is retries execution on failure.
1266
+
1267
+ temp_dir_root : str, default: None
1268
+ The root directory under which `current.checkpoint.directory` will be created.
1483
1269
  """
1484
1270
  ...
1485
1271
 
1486
- 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]]:
1272
+ @typing.overload
1273
+ 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]]]:
1487
1274
  """
1488
- 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.
1489
- 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.
1275
+ Specifies the resources needed when executing this step.
1276
+
1277
+ Use `@resources` to specify the resource requirements
1278
+ independently of the specific compute layer (`@batch`, `@kubernetes`).
1279
+
1280
+ You can choose the compute layer on the command line by executing e.g.
1281
+ ```
1282
+ python myflow.py run --with batch
1283
+ ```
1284
+ or
1285
+ ```
1286
+ python myflow.py run --with kubernetes
1287
+ ```
1288
+ which executes the flow on the desired system using the
1289
+ requirements specified in `@resources`.
1490
1290
 
1491
1291
 
1492
1292
  Parameters
1493
1293
  ----------
1494
- timeout : int
1495
- Time, in seconds before the task times out and fails. (Default: 3600)
1496
- poke_interval : int
1497
- Time in seconds that the job should wait in between each try. (Default: 60)
1498
- mode : str
1499
- How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1500
- exponential_backoff : bool
1501
- allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1502
- pool : str
1503
- the slot pool this task should run in,
1504
- slot pools are a way to limit concurrency for certain tasks. (Default:None)
1505
- soft_fail : bool
1506
- Set to true to mark the task as SKIPPED on failure. (Default: False)
1507
- name : str
1508
- Name of the sensor on Airflow
1509
- description : str
1510
- Description of sensor in the Airflow UI
1511
- external_dag_id : str
1512
- The dag_id that contains the task you want to wait for.
1513
- external_task_ids : List[str]
1514
- The list of task_ids that you want to wait for.
1515
- If None (default value) the sensor waits for the DAG. (Default: None)
1516
- allowed_states : List[str]
1517
- Iterable of allowed states, (Default: ['success'])
1518
- failed_states : List[str]
1519
- Iterable of failed or dis-allowed states. (Default: None)
1520
- execution_delta : datetime.timedelta
1521
- time difference with the previous execution to look at,
1522
- the default is the same logical date as the current task or DAG. (Default: None)
1523
- check_existence: bool
1524
- Set to True to check if the external task exists or check if
1525
- the DAG to wait for exists. (Default: True)
1294
+ cpu : int, default 1
1295
+ Number of CPUs required for this step.
1296
+ gpu : int, optional, default None
1297
+ Number of GPUs required for this step.
1298
+ disk : int, optional, default None
1299
+ Disk size (in MB) required for this step. Only applies on Kubernetes.
1300
+ memory : int, default 4096
1301
+ Memory size (in MB) required for this step.
1302
+ shared_memory : int, optional, default None
1303
+ The value for the size (in MiB) of the /dev/shm volume for this step.
1304
+ This parameter maps to the `--shm-size` option in Docker.
1526
1305
  """
1527
1306
  ...
1528
1307
 
1529
- def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1308
+ @typing.overload
1309
+ def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1310
+ ...
1311
+
1312
+ @typing.overload
1313
+ def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1314
+ ...
1315
+
1316
+ 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):
1530
1317
  """
1531
- Specifies what flows belong to the same project.
1318
+ Specifies the resources needed when executing this step.
1532
1319
 
1533
- A project-specific namespace is created for all flows that
1534
- use the same `@project(name)`.
1320
+ Use `@resources` to specify the resource requirements
1321
+ independently of the specific compute layer (`@batch`, `@kubernetes`).
1322
+
1323
+ You can choose the compute layer on the command line by executing e.g.
1324
+ ```
1325
+ python myflow.py run --with batch
1326
+ ```
1327
+ or
1328
+ ```
1329
+ python myflow.py run --with kubernetes
1330
+ ```
1331
+ which executes the flow on the desired system using the
1332
+ requirements specified in `@resources`.
1535
1333
 
1536
1334
 
1537
1335
  Parameters
1538
1336
  ----------
1539
- name : str
1540
- Project name. Make sure that the name is unique amongst all
1541
- projects that use the same production scheduler. The name may
1542
- contain only lowercase alphanumeric characters and underscores.
1543
-
1544
- branch : Optional[str], default None
1545
- The branch to use. If not specified, the branch is set to
1546
- `user.<username>` unless `production` is set to `True`. This can
1547
- also be set on the command line using `--branch` as a top-level option.
1548
- It is an error to specify `branch` in the decorator and on the command line.
1549
-
1550
- production : bool, default False
1551
- Whether or not the branch is the production branch. This can also be set on the
1552
- command line using `--production` as a top-level option. It is an error to specify
1553
- `production` in the decorator and on the command line.
1554
- The project branch name will be:
1555
- - if `branch` is specified:
1556
- - if `production` is True: `prod.<branch>`
1557
- - if `production` is False: `test.<branch>`
1558
- - if `branch` is not specified:
1559
- - if `production` is True: `prod`
1560
- - if `production` is False: `user.<username>`
1337
+ cpu : int, default 1
1338
+ Number of CPUs required for this step.
1339
+ gpu : int, optional, default None
1340
+ Number of GPUs required for this step.
1341
+ disk : int, optional, default None
1342
+ Disk size (in MB) required for this step. Only applies on Kubernetes.
1343
+ memory : int, default 4096
1344
+ Memory size (in MB) required for this step.
1345
+ shared_memory : int, optional, default None
1346
+ The value for the size (in MiB) of the /dev/shm volume for this step.
1347
+ This parameter maps to the `--shm-size` option in Docker.
1561
1348
  """
1562
1349
  ...
1563
1350
 
@@ -1662,6 +1449,99 @@ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *
1662
1449
  """
1663
1450
  ...
1664
1451
 
1452
+ @typing.overload
1453
+ 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]]:
1454
+ """
1455
+ Specifies the event(s) that this flow depends on.
1456
+
1457
+ ```
1458
+ @trigger(event='foo')
1459
+ ```
1460
+ or
1461
+ ```
1462
+ @trigger(events=['foo', 'bar'])
1463
+ ```
1464
+
1465
+ Additionally, you can specify the parameter mappings
1466
+ to map event payload to Metaflow parameters for the flow.
1467
+ ```
1468
+ @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1469
+ ```
1470
+ or
1471
+ ```
1472
+ @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1473
+ {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1474
+ ```
1475
+
1476
+ 'parameters' can also be a list of strings and tuples like so:
1477
+ ```
1478
+ @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1479
+ ```
1480
+ This is equivalent to:
1481
+ ```
1482
+ @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1483
+ ```
1484
+
1485
+
1486
+ Parameters
1487
+ ----------
1488
+ event : Union[str, Dict[str, Any]], optional, default None
1489
+ Event dependency for this flow.
1490
+ events : List[Union[str, Dict[str, Any]]], default []
1491
+ Events dependency for this flow.
1492
+ options : Dict[str, Any], default {}
1493
+ Backend-specific configuration for tuning eventing behavior.
1494
+ """
1495
+ ...
1496
+
1497
+ @typing.overload
1498
+ def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1499
+ ...
1500
+
1501
+ def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, event: typing.Union[str, typing.Dict[str, typing.Any], None] = None, events: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = [], options: typing.Dict[str, typing.Any] = {}):
1502
+ """
1503
+ Specifies the event(s) that this flow depends on.
1504
+
1505
+ ```
1506
+ @trigger(event='foo')
1507
+ ```
1508
+ or
1509
+ ```
1510
+ @trigger(events=['foo', 'bar'])
1511
+ ```
1512
+
1513
+ Additionally, you can specify the parameter mappings
1514
+ to map event payload to Metaflow parameters for the flow.
1515
+ ```
1516
+ @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1517
+ ```
1518
+ or
1519
+ ```
1520
+ @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1521
+ {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1522
+ ```
1523
+
1524
+ 'parameters' can also be a list of strings and tuples like so:
1525
+ ```
1526
+ @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1527
+ ```
1528
+ This is equivalent to:
1529
+ ```
1530
+ @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1531
+ ```
1532
+
1533
+
1534
+ Parameters
1535
+ ----------
1536
+ event : Union[str, Dict[str, Any]], optional, default None
1537
+ Event dependency for this flow.
1538
+ events : List[Union[str, Dict[str, Any]]], default []
1539
+ Events dependency for this flow.
1540
+ options : Dict[str, Any], default {}
1541
+ Backend-specific configuration for tuning eventing behavior.
1542
+ """
1543
+ ...
1544
+
1665
1545
  def with_artifact_store(f: typing.Optional[typing.Type[FlowSpecDerived]] = None):
1666
1546
  """
1667
1547
  Allows setting external datastores to save data for the
@@ -1728,51 +1608,143 @@ def with_artifact_store(f: typing.Optional[typing.Type[FlowSpecDerived]] = None)
1728
1608
 
1729
1609
  - Accessing objects stored in external datastores after task execution.
1730
1610
 
1731
- ```python
1732
- run = Run("CheckpointsTestsFlow/8992")
1733
- with artifact_store_from(run=run, config={
1734
- "client_params": {
1735
- "aws_access_key_id": os.environ.get("MY_CUSTOM_ACCESS_KEY"),
1736
- "aws_secret_access_key": os.environ.get("MY_CUSTOM_SECRET_KEY"),
1737
- },
1738
- }):
1739
- with Checkpoint() as cp:
1740
- latest = cp.list(
1741
- task=run["start"].task
1742
- )[0]
1743
- print(latest)
1744
- cp.load(
1745
- latest,
1746
- "test-checkpoints"
1747
- )
1611
+ ```python
1612
+ run = Run("CheckpointsTestsFlow/8992")
1613
+ with artifact_store_from(run=run, config={
1614
+ "client_params": {
1615
+ "aws_access_key_id": os.environ.get("MY_CUSTOM_ACCESS_KEY"),
1616
+ "aws_secret_access_key": os.environ.get("MY_CUSTOM_SECRET_KEY"),
1617
+ },
1618
+ }):
1619
+ with Checkpoint() as cp:
1620
+ latest = cp.list(
1621
+ task=run["start"].task
1622
+ )[0]
1623
+ print(latest)
1624
+ cp.load(
1625
+ latest,
1626
+ "test-checkpoints"
1627
+ )
1628
+
1629
+ task = Task("TorchTuneFlow/8484/train/53673")
1630
+ with artifact_store_from(run=run, config={
1631
+ "client_params": {
1632
+ "aws_access_key_id": os.environ.get("MY_CUSTOM_ACCESS_KEY"),
1633
+ "aws_secret_access_key": os.environ.get("MY_CUSTOM_SECRET_KEY"),
1634
+ },
1635
+ }):
1636
+ load_model(
1637
+ task.data.model_ref,
1638
+ "test-models"
1639
+ )
1640
+ ```
1641
+ Parameters:
1642
+ ----------
1643
+
1644
+ type: str
1645
+ The type of the datastore. Can be one of 's3', 'gcs', 'azure' or any other supported metaflow Datastore.
1646
+
1647
+ config: dict or Callable
1648
+ Dictionary of configuration options for the datastore. The following keys are required:
1649
+ - root: The root path in the datastore where the data will be saved. (needs to be in the format expected by the datastore)
1650
+ - example: 's3://bucket-name/path/to/root'
1651
+ - example: 'gs://bucket-name/path/to/root'
1652
+ - example: 'https://myblockacc.blob.core.windows.net/metaflow/'
1653
+ - role_arn (optional): AWS IAM role to access s3 bucket (only when `type` is 's3')
1654
+ - session_vars (optional): AWS session variables to access s3 bucket (only when `type` is 's3')
1655
+ - client_params (optional): AWS client parameters to access s3 bucket (only when `type` is 's3')
1656
+ """
1657
+ ...
1658
+
1659
+ @typing.overload
1660
+ def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1661
+ """
1662
+ Specifies the PyPI packages for all steps of the flow.
1663
+
1664
+ Use `@pypi_base` to set common packages required by all
1665
+ steps and use `@pypi` to specify step-specific overrides.
1666
+
1667
+ Parameters
1668
+ ----------
1669
+ packages : Dict[str, str], default: {}
1670
+ Packages to use for this flow. The key is the name of the package
1671
+ and the value is the version to use.
1672
+ python : str, optional, default: None
1673
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1674
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1675
+ """
1676
+ ...
1677
+
1678
+ @typing.overload
1679
+ def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1680
+ ...
1681
+
1682
+ def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
1683
+ """
1684
+ Specifies the PyPI packages for all steps of the flow.
1685
+
1686
+ Use `@pypi_base` to set common packages required by all
1687
+ steps and use `@pypi` to specify step-specific overrides.
1688
+
1689
+ Parameters
1690
+ ----------
1691
+ packages : Dict[str, str], default: {}
1692
+ Packages to use for this flow. The key is the name of the package
1693
+ and the value is the version to use.
1694
+ python : str, optional, default: None
1695
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1696
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1697
+ """
1698
+ ...
1699
+
1700
+ @typing.overload
1701
+ def schedule(*, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: typing.Optional[str] = None, timezone: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1702
+ """
1703
+ Specifies the times when the flow should be run when running on a
1704
+ production scheduler.
1705
+
1748
1706
 
1749
- task = Task("TorchTuneFlow/8484/train/53673")
1750
- with artifact_store_from(run=run, config={
1751
- "client_params": {
1752
- "aws_access_key_id": os.environ.get("MY_CUSTOM_ACCESS_KEY"),
1753
- "aws_secret_access_key": os.environ.get("MY_CUSTOM_SECRET_KEY"),
1754
- },
1755
- }):
1756
- load_model(
1757
- task.data.model_ref,
1758
- "test-models"
1759
- )
1760
- ```
1761
- Parameters:
1707
+ Parameters
1762
1708
  ----------
1709
+ hourly : bool, default False
1710
+ Run the workflow hourly.
1711
+ daily : bool, default True
1712
+ Run the workflow daily.
1713
+ weekly : bool, default False
1714
+ Run the workflow weekly.
1715
+ cron : str, optional, default None
1716
+ Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1717
+ specified by this expression.
1718
+ timezone : str, optional, default None
1719
+ Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1720
+ which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1721
+ """
1722
+ ...
1723
+
1724
+ @typing.overload
1725
+ def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1726
+ ...
1727
+
1728
+ def schedule(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: typing.Optional[str] = None, timezone: typing.Optional[str] = None):
1729
+ """
1730
+ Specifies the times when the flow should be run when running on a
1731
+ production scheduler.
1763
1732
 
1764
- type: str
1765
- The type of the datastore. Can be one of 's3', 'gcs', 'azure' or any other supported metaflow Datastore.
1766
1733
 
1767
- config: dict or Callable
1768
- Dictionary of configuration options for the datastore. The following keys are required:
1769
- - root: The root path in the datastore where the data will be saved. (needs to be in the format expected by the datastore)
1770
- - example: 's3://bucket-name/path/to/root'
1771
- - example: 'gs://bucket-name/path/to/root'
1772
- - example: 'https://myblockacc.blob.core.windows.net/metaflow/'
1773
- - role_arn (optional): AWS IAM role to access s3 bucket (only when `type` is 's3')
1774
- - session_vars (optional): AWS session variables to access s3 bucket (only when `type` is 's3')
1775
- - client_params (optional): AWS client parameters to access s3 bucket (only when `type` is 's3')
1734
+ Parameters
1735
+ ----------
1736
+ hourly : bool, default False
1737
+ Run the workflow hourly.
1738
+ daily : bool, default True
1739
+ Run the workflow daily.
1740
+ weekly : bool, default False
1741
+ Run the workflow weekly.
1742
+ cron : str, optional, default None
1743
+ Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1744
+ specified by this expression.
1745
+ timezone : str, optional, default None
1746
+ Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1747
+ which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1776
1748
  """
1777
1749
  ...
1778
1750
 
@@ -1827,96 +1799,124 @@ def conda_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packa
1827
1799
  """
1828
1800
  ...
1829
1801
 
1830
- @typing.overload
1831
- def trigger(*, event: typing.Union[str, typing.Dict[str, typing.Any], None] = None, events: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = [], options: typing.Dict[str, typing.Any] = {}) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1802
+ 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]]:
1832
1803
  """
1833
- Specifies the event(s) that this flow depends on.
1834
-
1835
- ```
1836
- @trigger(event='foo')
1837
- ```
1838
- or
1839
- ```
1840
- @trigger(events=['foo', 'bar'])
1841
- ```
1842
-
1843
- Additionally, you can specify the parameter mappings
1844
- to map event payload to Metaflow parameters for the flow.
1845
- ```
1846
- @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1847
- ```
1848
- or
1849
- ```
1850
- @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1851
- {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1852
- ```
1853
-
1854
- 'parameters' can also be a list of strings and tuples like so:
1855
- ```
1856
- @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1857
- ```
1858
- This is equivalent to:
1859
- ```
1860
- @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1861
- ```
1804
+ 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.
1805
+ 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.
1862
1806
 
1863
1807
 
1864
1808
  Parameters
1865
1809
  ----------
1866
- event : Union[str, Dict[str, Any]], optional, default None
1867
- Event dependency for this flow.
1868
- events : List[Union[str, Dict[str, Any]]], default []
1869
- Events dependency for this flow.
1870
- options : Dict[str, Any], default {}
1871
- Backend-specific configuration for tuning eventing behavior.
1810
+ timeout : int
1811
+ Time, in seconds before the task times out and fails. (Default: 3600)
1812
+ poke_interval : int
1813
+ Time in seconds that the job should wait in between each try. (Default: 60)
1814
+ mode : str
1815
+ How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1816
+ exponential_backoff : bool
1817
+ allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1818
+ pool : str
1819
+ the slot pool this task should run in,
1820
+ slot pools are a way to limit concurrency for certain tasks. (Default:None)
1821
+ soft_fail : bool
1822
+ Set to true to mark the task as SKIPPED on failure. (Default: False)
1823
+ name : str
1824
+ Name of the sensor on Airflow
1825
+ description : str
1826
+ Description of sensor in the Airflow UI
1827
+ external_dag_id : str
1828
+ The dag_id that contains the task you want to wait for.
1829
+ external_task_ids : List[str]
1830
+ The list of task_ids that you want to wait for.
1831
+ If None (default value) the sensor waits for the DAG. (Default: None)
1832
+ allowed_states : List[str]
1833
+ Iterable of allowed states, (Default: ['success'])
1834
+ failed_states : List[str]
1835
+ Iterable of failed or dis-allowed states. (Default: None)
1836
+ execution_delta : datetime.timedelta
1837
+ time difference with the previous execution to look at,
1838
+ the default is the same logical date as the current task or DAG. (Default: None)
1839
+ check_existence: bool
1840
+ Set to True to check if the external task exists or check if
1841
+ the DAG to wait for exists. (Default: True)
1872
1842
  """
1873
1843
  ...
1874
1844
 
1875
- @typing.overload
1876
- def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1877
- ...
1878
-
1879
- def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, event: typing.Union[str, typing.Dict[str, typing.Any], None] = None, events: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = [], options: typing.Dict[str, typing.Any] = {}):
1845
+ 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]]:
1880
1846
  """
1881
- Specifies the event(s) that this flow depends on.
1847
+ 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)
1848
+ before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
1849
+ and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
1850
+ added as a flow decorators. Adding more than one decorator will ensure that `start` step
1851
+ starts only after all sensors finish.
1882
1852
 
1883
- ```
1884
- @trigger(event='foo')
1885
- ```
1886
- or
1887
- ```
1888
- @trigger(events=['foo', 'bar'])
1889
- ```
1890
1853
 
1891
- Additionally, you can specify the parameter mappings
1892
- to map event payload to Metaflow parameters for the flow.
1893
- ```
1894
- @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1895
- ```
1896
- or
1897
- ```
1898
- @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1899
- {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1900
- ```
1854
+ Parameters
1855
+ ----------
1856
+ timeout : int
1857
+ Time, in seconds before the task times out and fails. (Default: 3600)
1858
+ poke_interval : int
1859
+ Time in seconds that the job should wait in between each try. (Default: 60)
1860
+ mode : str
1861
+ How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1862
+ exponential_backoff : bool
1863
+ allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1864
+ pool : str
1865
+ the slot pool this task should run in,
1866
+ slot pools are a way to limit concurrency for certain tasks. (Default:None)
1867
+ soft_fail : bool
1868
+ Set to true to mark the task as SKIPPED on failure. (Default: False)
1869
+ name : str
1870
+ Name of the sensor on Airflow
1871
+ description : str
1872
+ Description of sensor in the Airflow UI
1873
+ bucket_key : Union[str, List[str]]
1874
+ The key(s) being waited on. Supports full s3:// style url or relative path from root level.
1875
+ When it's specified as a full s3:// url, please leave `bucket_name` as None
1876
+ bucket_name : str
1877
+ Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
1878
+ When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
1879
+ wildcard_match : bool
1880
+ whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
1881
+ aws_conn_id : str
1882
+ a reference to the s3 connection on Airflow. (Default: None)
1883
+ verify : bool
1884
+ Whether or not to verify SSL certificates for S3 connection. (Default: None)
1885
+ """
1886
+ ...
1887
+
1888
+ def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1889
+ """
1890
+ Specifies what flows belong to the same project.
1901
1891
 
1902
- 'parameters' can also be a list of strings and tuples like so:
1903
- ```
1904
- @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1905
- ```
1906
- This is equivalent to:
1907
- ```
1908
- @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1909
- ```
1892
+ A project-specific namespace is created for all flows that
1893
+ use the same `@project(name)`.
1910
1894
 
1911
1895
 
1912
1896
  Parameters
1913
1897
  ----------
1914
- event : Union[str, Dict[str, Any]], optional, default None
1915
- Event dependency for this flow.
1916
- events : List[Union[str, Dict[str, Any]]], default []
1917
- Events dependency for this flow.
1918
- options : Dict[str, Any], default {}
1919
- Backend-specific configuration for tuning eventing behavior.
1898
+ name : str
1899
+ Project name. Make sure that the name is unique amongst all
1900
+ projects that use the same production scheduler. The name may
1901
+ contain only lowercase alphanumeric characters and underscores.
1902
+
1903
+ branch : Optional[str], default None
1904
+ The branch to use. If not specified, the branch is set to
1905
+ `user.<username>` unless `production` is set to `True`. This can
1906
+ also be set on the command line using `--branch` as a top-level option.
1907
+ It is an error to specify `branch` in the decorator and on the command line.
1908
+
1909
+ production : bool, default False
1910
+ Whether or not the branch is the production branch. This can also be set on the
1911
+ command line using `--production` as a top-level option. It is an error to specify
1912
+ `production` in the decorator and on the command line.
1913
+ The project branch name will be:
1914
+ - if `branch` is specified:
1915
+ - if `production` is True: `prod.<branch>`
1916
+ - if `production` is False: `test.<branch>`
1917
+ - if `branch` is not specified:
1918
+ - if `production` is True: `prod`
1919
+ - if `production` is False: `user.<username>`
1920
1920
  """
1921
1921
  ...
1922
1922