zenml-nightly 0.58.2.dev20240623__py3-none-any.whl → 0.61.0.dev20240712__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 (249) hide show
  1. README.md +30 -9
  2. RELEASE_NOTES.md +240 -0
  3. zenml/VERSION +1 -1
  4. zenml/actions/base_action.py +177 -174
  5. zenml/actions/pipeline_run/pipeline_run_action.py +28 -23
  6. zenml/analytics/enums.py +3 -0
  7. zenml/artifact_stores/base_artifact_store.py +7 -1
  8. zenml/artifacts/utils.py +13 -10
  9. zenml/cli/__init__.py +28 -0
  10. zenml/cli/artifact.py +1 -2
  11. zenml/cli/integration.py +9 -8
  12. zenml/cli/server.py +6 -0
  13. zenml/cli/service_connectors.py +1 -0
  14. zenml/cli/stack.py +946 -39
  15. zenml/cli/stack_components.py +7 -0
  16. zenml/cli/text_utils.py +35 -1
  17. zenml/cli/utils.py +127 -10
  18. zenml/client.py +257 -72
  19. zenml/config/compiler.py +10 -9
  20. zenml/config/docker_settings.py +33 -14
  21. zenml/constants.py +11 -2
  22. zenml/container_registries/base_container_registry.py +1 -0
  23. zenml/enums.py +7 -0
  24. zenml/event_hub/base_event_hub.py +5 -5
  25. zenml/event_hub/event_hub.py +20 -14
  26. zenml/event_sources/base_event.py +0 -11
  27. zenml/event_sources/base_event_source.py +7 -0
  28. zenml/event_sources/webhooks/base_webhook_event_source.py +1 -4
  29. zenml/exceptions.py +4 -0
  30. zenml/hooks/hook_validators.py +2 -3
  31. zenml/integrations/aws/__init__.py +1 -0
  32. zenml/integrations/azure/__init__.py +1 -0
  33. zenml/integrations/bitbucket/plugins/event_sources/bitbucket_webhook_event_source.py +3 -3
  34. zenml/integrations/deepchecks/__init__.py +1 -0
  35. zenml/integrations/discord/__init__.py +1 -0
  36. zenml/integrations/evidently/__init__.py +1 -0
  37. zenml/integrations/facets/__init__.py +1 -0
  38. zenml/integrations/feast/__init__.py +1 -0
  39. zenml/integrations/gcp/__init__.py +3 -1
  40. zenml/integrations/gcp/google_credentials_mixin.py +1 -1
  41. zenml/integrations/gcp/service_connectors/gcp_service_connector.py +320 -64
  42. zenml/integrations/huggingface/__init__.py +1 -0
  43. zenml/integrations/integration.py +24 -0
  44. zenml/integrations/kubeflow/__init__.py +3 -0
  45. zenml/integrations/kubeflow/flavors/kubeflow_orchestrator_flavor.py +1 -1
  46. zenml/integrations/kubeflow/orchestrators/kubeflow_orchestrator.py +0 -1
  47. zenml/integrations/kubernetes/__init__.py +3 -1
  48. zenml/integrations/kubernetes/orchestrators/kube_utils.py +4 -1
  49. zenml/integrations/label_studio/annotators/label_studio_annotator.py +1 -0
  50. zenml/integrations/langchain/__init__.py +1 -0
  51. zenml/integrations/mlflow/__init__.py +4 -2
  52. zenml/integrations/neural_prophet/__init__.py +1 -0
  53. zenml/integrations/polars/__init__.py +1 -0
  54. zenml/integrations/prodigy/__init__.py +1 -0
  55. zenml/integrations/pycaret/__init__.py +6 -0
  56. zenml/integrations/registry.py +37 -0
  57. zenml/integrations/s3/artifact_stores/s3_artifact_store.py +93 -9
  58. zenml/integrations/seldon/__init__.py +1 -0
  59. zenml/integrations/seldon/model_deployers/seldon_model_deployer.py +1 -0
  60. zenml/integrations/skypilot/flavors/skypilot_orchestrator_base_vm_config.py +2 -2
  61. zenml/integrations/skypilot/orchestrators/skypilot_base_vm_orchestrator.py +1 -1
  62. zenml/integrations/skypilot/orchestrators/skypilot_orchestrator_entrypoint.py +2 -2
  63. zenml/integrations/skypilot_aws/__init__.py +2 -1
  64. zenml/integrations/skypilot_azure/__init__.py +1 -1
  65. zenml/integrations/skypilot_gcp/__init__.py +1 -1
  66. zenml/integrations/skypilot_lambda/__init__.py +1 -1
  67. zenml/integrations/skypilot_lambda/flavors/skypilot_orchestrator_lambda_vm_flavor.py +1 -1
  68. zenml/integrations/slack/__init__.py +1 -0
  69. zenml/integrations/tekton/__init__.py +1 -0
  70. zenml/integrations/tensorboard/__init__.py +0 -1
  71. zenml/integrations/tensorflow/__init__.py +18 -6
  72. zenml/integrations/wandb/__init__.py +1 -0
  73. zenml/logging/step_logging.py +54 -51
  74. zenml/models/__init__.py +28 -0
  75. zenml/models/v2/core/action.py +276 -0
  76. zenml/models/v2/core/component.py +18 -0
  77. zenml/models/v2/core/model.py +1 -2
  78. zenml/models/v2/core/service_connector.py +17 -0
  79. zenml/models/v2/core/stack.py +31 -0
  80. zenml/models/v2/core/trigger.py +182 -141
  81. zenml/models/v2/misc/full_stack.py +97 -0
  82. zenml/models/v2/misc/stack_deployment.py +86 -0
  83. zenml/new/pipelines/pipeline.py +14 -4
  84. zenml/new/pipelines/pipeline_decorator.py +1 -2
  85. zenml/new/pipelines/run_utils.py +1 -12
  86. zenml/new/steps/step_decorator.py +2 -3
  87. zenml/orchestrators/input_utils.py +3 -6
  88. zenml/pipelines/base_pipeline.py +0 -2
  89. zenml/pipelines/pipeline_decorator.py +1 -2
  90. zenml/stack/stack.py +3 -6
  91. zenml/stack/stack_component.py +4 -0
  92. zenml/stack_deployments/__init__.py +14 -0
  93. zenml/stack_deployments/aws_stack_deployment.py +254 -0
  94. zenml/stack_deployments/gcp_stack_deployment.py +260 -0
  95. zenml/stack_deployments/stack_deployment.py +208 -0
  96. zenml/stack_deployments/utils.py +44 -0
  97. zenml/steps/base_step.py +1 -2
  98. zenml/steps/step_decorator.py +1 -2
  99. zenml/types.py +10 -1
  100. zenml/utils/function_utils.py +1 -1
  101. zenml/utils/pagination_utils.py +7 -5
  102. zenml/utils/pipeline_docker_image_builder.py +117 -73
  103. zenml/utils/pydantic_utils.py +6 -5
  104. zenml/zen_server/cloud_utils.py +18 -3
  105. zenml/zen_server/dashboard/assets/{404-CDPQCl4D.js → 404-DpJaNHKF.js} +1 -1
  106. zenml/zen_server/dashboard/assets/@radix-CFOkMR_E.js +85 -0
  107. zenml/zen_server/dashboard/assets/{@react-router-DYovave8.js → @react-router-CO-OsFwI.js} +2 -2
  108. zenml/zen_server/dashboard/assets/{@reactflow-CHBapDaj.js → @reactflow-DJfzkHO1.js} +2 -2
  109. zenml/zen_server/dashboard/assets/@tanstack-DYiOyJUL.js +22 -0
  110. zenml/zen_server/dashboard/assets/AwarenessChannel-BYDLT2xC.js +1 -0
  111. zenml/zen_server/dashboard/assets/{CodeSnippet-BidtnWOi.js → CodeSnippet-BkOuRmyq.js} +2 -2
  112. zenml/zen_server/dashboard/assets/Commands-ZvWR1BRs.js +1 -0
  113. zenml/zen_server/dashboard/assets/CopyButton-DVwLkafa.js +2 -0
  114. zenml/zen_server/dashboard/assets/{CsvVizualization-BOuez-fG.js → CsvVizualization-C2IiqX4I.js} +7 -7
  115. zenml/zen_server/dashboard/assets/DisplayDate-DYgIjlDF.js +1 -0
  116. zenml/zen_server/dashboard/assets/EmptyState-BMLnFVlB.js +1 -0
  117. zenml/zen_server/dashboard/assets/Error-CqX0VqW_.js +1 -0
  118. zenml/zen_server/dashboard/assets/ExecutionStatus-BoLUXR9t.js +1 -0
  119. zenml/zen_server/dashboard/assets/Helpbox-LFydyVwh.js +1 -0
  120. zenml/zen_server/dashboard/assets/Infobox-DnENC0sh.js +1 -0
  121. zenml/zen_server/dashboard/assets/InlineAvatar-CbJtYr0t.js +1 -0
  122. zenml/zen_server/dashboard/assets/{MarkdownVisualization-DsB2QZiK.js → MarkdownVisualization-xp3hhULl.js} +2 -2
  123. zenml/zen_server/dashboard/assets/Pagination-DEbVUupy.js +1 -0
  124. zenml/zen_server/dashboard/assets/PasswordChecker-DUveqlva.js +1 -0
  125. zenml/zen_server/dashboard/assets/SetPassword-BYBdbQDo.js +1 -0
  126. zenml/zen_server/dashboard/assets/SuccessStep-Nx743hll.js +1 -0
  127. zenml/zen_server/dashboard/assets/{UpdatePasswordSchemas-DnM-c11H.js → UpdatePasswordSchemas-DF9gSzE0.js} +1 -1
  128. zenml/zen_server/dashboard/assets/{aws-t0gKCj_R.js → aws-BgKTfTfx.js} +1 -1
  129. zenml/zen_server/dashboard/assets/{check-circle-BVvhm5dy.js → check-circle-i56092KI.js} +1 -1
  130. zenml/zen_server/dashboard/assets/{chevron-down-zcvCWmyP.js → chevron-down-D_ZlKMqH.js} +1 -1
  131. zenml/zen_server/dashboard/assets/{chevron-right-double-CJ50E9Gr.js → chevron-right-double-BiEMg7rd.js} +1 -1
  132. zenml/zen_server/dashboard/assets/cloud-only-DVbIeckv.js +1 -0
  133. zenml/zen_server/dashboard/assets/{copy-BRhQz3j-.js → copy-BXNk6BjL.js} +1 -1
  134. zenml/zen_server/dashboard/assets/{database-CRRnyFWh.js → database-1xWSgZfO.js} +1 -1
  135. zenml/zen_server/dashboard/assets/{docker-BAonhm6G.js → docker-CQMVm_4d.js} +1 -1
  136. zenml/zen_server/dashboard/assets/{file-text-CbVERUON.js → file-text-CqD_iu6l.js} +1 -1
  137. zenml/zen_server/dashboard/assets/{help-B8rqCvqn.js → help-bu_DgLKI.js} +1 -1
  138. zenml/zen_server/dashboard/assets/index-C_CrU4vI.js +1 -0
  139. zenml/zen_server/dashboard/assets/index-DK1ynKjA.js +55 -0
  140. zenml/zen_server/dashboard/assets/index-inApY3KQ.css +1 -0
  141. zenml/zen_server/dashboard/assets/index-rK_Wuy2W.js +1 -0
  142. zenml/zen_server/dashboard/assets/index.esm-Corw4lXQ.js +1 -0
  143. zenml/zen_server/dashboard/assets/{login-mutation-wzzl23C6.js → login-mutation-BUnVASxp.js} +1 -1
  144. zenml/zen_server/dashboard/assets/not-found-B4VnX8gK.js +1 -0
  145. zenml/zen_server/dashboard/assets/package-CsUhPmou.js +1 -0
  146. zenml/zen_server/dashboard/assets/{page-BmkSiYeQ.js → page-3efNCDeb.js} +2 -2
  147. zenml/zen_server/dashboard/assets/page-7zTHbhhI.js +1 -0
  148. zenml/zen_server/dashboard/assets/page-BEs6jK71.js +1 -0
  149. zenml/zen_server/dashboard/assets/page-BpSqIf4B.js +1 -0
  150. zenml/zen_server/dashboard/assets/{page-AQKopn_4.js → page-Bx6o0ARS.js} +1 -1
  151. zenml/zen_server/dashboard/assets/page-C43QGHTt.js +9 -0
  152. zenml/zen_server/dashboard/assets/page-CR0OG7ss.js +1 -0
  153. zenml/zen_server/dashboard/assets/page-CRTJ0UuR.js +1 -0
  154. zenml/zen_server/dashboard/assets/page-CUZIGO-3.js +1 -0
  155. zenml/zen_server/dashboard/assets/page-CaopxiU1.js +1 -0
  156. zenml/zen_server/dashboard/assets/{page-CuT1SUik.js → page-Cx67M0QT.js} +1 -1
  157. zenml/zen_server/dashboard/assets/page-D7Z399xy.js +1 -0
  158. zenml/zen_server/dashboard/assets/page-D93kd7Xj.js +1 -0
  159. zenml/zen_server/dashboard/assets/{page-BzVZGExK.js → page-DKlIdAe5.js} +1 -1
  160. zenml/zen_server/dashboard/assets/{page-Bi5AI0S7.js → page-DMOYZppS.js} +1 -1
  161. zenml/zen_server/dashboard/assets/page-DMsSn3dv.js +2 -0
  162. zenml/zen_server/dashboard/assets/{page-BW6Ket3a.js → page-Dc_7KMQE.js} +1 -1
  163. zenml/zen_server/dashboard/assets/page-DvCvroOM.js +1 -0
  164. zenml/zen_server/dashboard/assets/page-Hus2pr9T.js +1 -0
  165. zenml/zen_server/dashboard/assets/page-JyfeDUfu.js +1 -0
  166. zenml/zen_server/dashboard/assets/{page-yN4rZ-ZS.js → page-Sxn82W-5.js} +1 -1
  167. zenml/zen_server/dashboard/assets/page-TKXERe16.js +1 -0
  168. zenml/zen_server/dashboard/assets/page-Xu8JEjSU.js +1 -0
  169. zenml/zen_server/dashboard/assets/{play-circle-DK5QMJyp.js → play-circle-CNtZKDnW.js} +1 -1
  170. zenml/zen_server/dashboard/assets/plus-DOeLmm7C.js +1 -0
  171. zenml/zen_server/dashboard/assets/{terminal-B2ovgWuz.js → terminal-By9cErXc.js} +1 -1
  172. zenml/zen_server/dashboard/assets/{update-server-settings-mutation-0Wgz8pUE.js → update-server-settings-mutation-CR8e3Sir.js} +1 -1
  173. zenml/zen_server/dashboard/assets/{url-6_xv0WJS.js → url-DuQMeqYA.js} +1 -1
  174. zenml/zen_server/dashboard/assets/{zod-DrZvVLjd.js → zod-BhoGpZ63.js} +1 -1
  175. zenml/zen_server/dashboard/index.html +7 -7
  176. zenml/zen_server/dashboard_legacy/asset-manifest.json +4 -4
  177. zenml/zen_server/dashboard_legacy/index.html +1 -1
  178. zenml/zen_server/dashboard_legacy/{precache-manifest.f4abc5b7cfa7d90c1caf5521918e29a8.js → precache-manifest.c8c57fb0d2132b1d3c2119e776b7dfb3.js} +4 -4
  179. zenml/zen_server/dashboard_legacy/service-worker.js +1 -1
  180. zenml/zen_server/dashboard_legacy/static/js/{main.ac2f17d0.chunk.js → main.382439a7.chunk.js} +2 -2
  181. zenml/zen_server/dashboard_legacy/static/js/{main.ac2f17d0.chunk.js.map → main.382439a7.chunk.js.map} +1 -1
  182. zenml/zen_server/deploy/helm/Chart.yaml +1 -1
  183. zenml/zen_server/deploy/helm/README.md +2 -2
  184. zenml/zen_server/feature_gate/zenml_cloud_feature_gate.py +11 -5
  185. zenml/zen_server/pipeline_deployment/utils.py +57 -44
  186. zenml/zen_server/rbac/models.py +1 -0
  187. zenml/zen_server/rbac/utils.py +22 -1
  188. zenml/zen_server/rbac/zenml_cloud_rbac.py +11 -5
  189. zenml/zen_server/routers/actions_endpoints.py +324 -0
  190. zenml/zen_server/routers/stack_deployment_endpoints.py +158 -0
  191. zenml/zen_server/routers/triggers_endpoints.py +30 -158
  192. zenml/zen_server/routers/workspaces_endpoints.py +64 -0
  193. zenml/zen_server/zen_server_api.py +4 -0
  194. zenml/zen_stores/migrations/utils.py +1 -1
  195. zenml/zen_stores/migrations/versions/0.60.0_release.py +23 -0
  196. zenml/zen_stores/migrations/versions/0.61.0_release.py +23 -0
  197. zenml/zen_stores/migrations/versions/0d707865f404_adding_labels_to_stacks.py +30 -0
  198. zenml/zen_stores/migrations/versions/25155145c545_separate_actions_and_triggers.py +228 -0
  199. zenml/zen_stores/rest_zen_store.py +248 -8
  200. zenml/zen_stores/schemas/__init__.py +2 -0
  201. zenml/zen_stores/schemas/action_schemas.py +192 -0
  202. zenml/zen_stores/schemas/stack_schemas.py +10 -0
  203. zenml/zen_stores/schemas/step_run_schemas.py +27 -11
  204. zenml/zen_stores/schemas/trigger_schemas.py +43 -50
  205. zenml/zen_stores/schemas/user_schemas.py +10 -2
  206. zenml/zen_stores/schemas/workspace_schemas.py +5 -0
  207. zenml/zen_stores/sql_zen_store.py +540 -36
  208. zenml/zen_stores/zen_store_interface.py +165 -0
  209. {zenml_nightly-0.58.2.dev20240623.dist-info → zenml_nightly-0.61.0.dev20240712.dist-info}/METADATA +33 -11
  210. {zenml_nightly-0.58.2.dev20240623.dist-info → zenml_nightly-0.61.0.dev20240712.dist-info}/RECORD +213 -193
  211. zenml/zen_server/dashboard/assets/@radix-C9DBgJhe.js +0 -77
  212. zenml/zen_server/dashboard/assets/@tanstack-CEbkxrhX.js +0 -30
  213. zenml/zen_server/dashboard/assets/AwarenessChannel-nXGpmj_f.js +0 -1
  214. zenml/zen_server/dashboard/assets/Cards-nwsvQLVS.js +0 -1
  215. zenml/zen_server/dashboard/assets/Commands-DuIWKg_Q.js +0 -1
  216. zenml/zen_server/dashboard/assets/CopyButton-B_YSm-Ds.js +0 -2
  217. zenml/zen_server/dashboard/assets/DisplayDate-BdguISQF.js +0 -1
  218. zenml/zen_server/dashboard/assets/EmptyState-BkooiGtL.js +0 -1
  219. zenml/zen_server/dashboard/assets/Error-B6M0dPph.js +0 -1
  220. zenml/zen_server/dashboard/assets/Helpbox-BQoqCm04.js +0 -1
  221. zenml/zen_server/dashboard/assets/Infobox-Ce9mefqU.js +0 -1
  222. zenml/zen_server/dashboard/assets/InlineAvatar-DGf3dVhV.js +0 -1
  223. zenml/zen_server/dashboard/assets/PageHeader-DGaemzjc.js +0 -1
  224. zenml/zen_server/dashboard/assets/Pagination-DVYfBCCc.js +0 -1
  225. zenml/zen_server/dashboard/assets/PasswordChecker-DSLBp7Vl.js +0 -1
  226. zenml/zen_server/dashboard/assets/SetPassword-B5s7DJug.js +0 -1
  227. zenml/zen_server/dashboard/assets/SuccessStep-ZzczaM7g.js +0 -1
  228. zenml/zen_server/dashboard/assets/cloud-only-Ba_ShBR5.js +0 -1
  229. zenml/zen_server/dashboard/assets/index-CWJ3xbIf.css +0 -1
  230. zenml/zen_server/dashboard/assets/index-QORVVTMN.js +0 -55
  231. zenml/zen_server/dashboard/assets/index.esm-F7nqy9zY.js +0 -1
  232. zenml/zen_server/dashboard/assets/not-found-Dh2la7kh.js +0 -1
  233. zenml/zen_server/dashboard/assets/page-B-5jAKoO.js +0 -1
  234. zenml/zen_server/dashboard/assets/page-B-vWk8a6.js +0 -1
  235. zenml/zen_server/dashboard/assets/page-B0BrqfS8.js +0 -1
  236. zenml/zen_server/dashboard/assets/page-BQxVFlUl.js +0 -1
  237. zenml/zen_server/dashboard/assets/page-ByrHy6Ss.js +0 -1
  238. zenml/zen_server/dashboard/assets/page-CPtY4Kv_.js +0 -1
  239. zenml/zen_server/dashboard/assets/page-CmmukLsl.js +0 -1
  240. zenml/zen_server/dashboard/assets/page-D2D-7qyr.js +0 -9
  241. zenml/zen_server/dashboard/assets/page-DAQQyLxT.js +0 -1
  242. zenml/zen_server/dashboard/assets/page-DHkUMl_E.js +0 -1
  243. zenml/zen_server/dashboard/assets/page-DZCbwOEs.js +0 -2
  244. zenml/zen_server/dashboard/assets/page-DdaIt20-.js +0 -1
  245. zenml/zen_server/dashboard/assets/page-LqLs24Ot.js +0 -1
  246. zenml/zen_server/dashboard/assets/page-lebv0c7C.js +0 -1
  247. {zenml_nightly-0.58.2.dev20240623.dist-info → zenml_nightly-0.61.0.dev20240712.dist-info}/LICENSE +0 -0
  248. {zenml_nightly-0.58.2.dev20240623.dist-info → zenml_nightly-0.61.0.dev20240712.dist-info}/WHEEL +0 -0
  249. {zenml_nightly-0.58.2.dev20240623.dist-info → zenml_nightly-0.61.0.dev20240712.dist-info}/entry_points.txt +0 -0
@@ -19,7 +19,6 @@ import inspect
19
19
  from contextlib import contextmanager
20
20
  from datetime import datetime
21
21
  from pathlib import Path
22
- from types import FunctionType
23
22
  from typing import (
24
23
  TYPE_CHECKING,
25
24
  Any,
@@ -98,11 +97,11 @@ if TYPE_CHECKING:
98
97
  from zenml.config.source import Source
99
98
  from zenml.model.lazy_load import ModelVersionDataLazyLoader
100
99
  from zenml.model.model import Model
100
+ from zenml.types import HookSpecification
101
101
 
102
102
  StepConfigurationUpdateOrDict = Union[
103
103
  Dict[str, Any], StepConfigurationUpdate
104
104
  ]
105
- HookSpecification = Union[str, "Source", FunctionType]
106
105
 
107
106
  logger = get_logger(__name__)
108
107
 
@@ -282,7 +281,7 @@ class Pipeline:
282
281
  raise RuntimeError(
283
282
  f"Cannot get the model of pipeline '{self.name}' because it has "
284
283
  f"not been registered yet. Please ensure that the pipeline has "
285
- f"been run and that at least one step has been executed."
284
+ f"been run or built and try again."
286
285
  )
287
286
 
288
287
  @contextmanager
@@ -1307,6 +1306,7 @@ To avoid this consider setting pipeline parameters only in one place (config or
1307
1306
  step_configurations: Optional[
1308
1307
  Mapping[str, "StepConfigurationUpdateOrDict"]
1309
1308
  ] = None,
1309
+ steps: Optional[Mapping[str, "StepConfigurationUpdateOrDict"]] = None,
1310
1310
  config_path: Optional[str] = None,
1311
1311
  unlisted: bool = False,
1312
1312
  prevent_build_reuse: bool = False,
@@ -1319,6 +1319,9 @@ To avoid this consider setting pipeline parameters only in one place (config or
1319
1319
  schedule: Optional schedule to use for the run.
1320
1320
  build: Optional build to use for the run.
1321
1321
  step_configurations: Configurations for steps of the pipeline.
1322
+ steps: Configurations for steps of the pipeline. This is equivalent
1323
+ to `step_configurations`, and will be ignored if
1324
+ `step_configurations` is set as well.
1322
1325
  config_path: Path to a yaml configuration file. This file will
1323
1326
  be parsed as a
1324
1327
  `zenml.config.pipeline_configurations.PipelineRunConfiguration`
@@ -1334,6 +1337,13 @@ To avoid this consider setting pipeline parameters only in one place (config or
1334
1337
  Returns:
1335
1338
  The copied pipeline instance.
1336
1339
  """
1340
+ if steps and step_configurations:
1341
+ logger.warning(
1342
+ "Step configurations were passed using both the "
1343
+ "`step_configurations` and `steps` keywords, ignoring the "
1344
+ "values passed using the `steps` keyword."
1345
+ )
1346
+
1337
1347
  pipeline_copy = self.copy()
1338
1348
 
1339
1349
  pipeline_copy._parse_config_file(
@@ -1353,7 +1363,7 @@ To avoid this consider setting pipeline parameters only in one place (config or
1353
1363
  "run_name": run_name,
1354
1364
  "schedule": schedule,
1355
1365
  "build": build,
1356
- "step_configurations": step_configurations,
1366
+ "step_configurations": step_configurations or steps,
1357
1367
  "config_path": config_path,
1358
1368
  "unlisted": unlisted,
1359
1369
  "prevent_build_reuse": prevent_build_reuse,
@@ -13,7 +13,6 @@
13
13
  # permissions and limitations under the License.
14
14
  """ZenML pipeline decorator definition."""
15
15
 
16
- from types import FunctionType
17
16
  from typing import (
18
17
  TYPE_CHECKING,
19
18
  Any,
@@ -31,8 +30,8 @@ if TYPE_CHECKING:
31
30
  from zenml.config.base_settings import SettingsOrDict
32
31
  from zenml.model.model import Model
33
32
  from zenml.new.pipelines.pipeline import Pipeline
33
+ from zenml.types import HookSpecification
34
34
 
35
- HookSpecification = Union[str, FunctionType]
36
35
  F = TypeVar("F", bound=Callable[..., None])
37
36
 
38
37
  logger = get_logger(__name__)
@@ -3,16 +3,7 @@
3
3
  import time
4
4
  from collections import defaultdict
5
5
  from datetime import datetime
6
- from types import FunctionType
7
- from typing import (
8
- TYPE_CHECKING,
9
- Any,
10
- Dict,
11
- Optional,
12
- Set,
13
- Tuple,
14
- Union,
15
- )
6
+ from typing import TYPE_CHECKING, Any, Dict, Optional, Set, Tuple, Union
16
7
  from uuid import UUID
17
8
 
18
9
  from zenml import constants
@@ -36,13 +27,11 @@ from zenml.utils import cloud_utils
36
27
  from zenml.zen_stores.base_zen_store import BaseZenStore
37
28
 
38
29
  if TYPE_CHECKING:
39
- from zenml.config.source import Source
40
30
  from zenml.model.model import Model
41
31
 
42
32
  StepConfigurationUpdateOrDict = Union[
43
33
  Dict[str, Any], StepConfigurationUpdate
44
34
  ]
45
- HookSpecification = Union[str, "Source", FunctionType]
46
35
 
47
36
  logger = get_logger(__name__)
48
37
 
@@ -30,17 +30,16 @@ from typing import (
30
30
  from zenml.logger import get_logger
31
31
 
32
32
  if TYPE_CHECKING:
33
- from types import FunctionType
34
-
35
33
  from zenml.config.base_settings import SettingsOrDict
36
34
  from zenml.config.retry_config import StepRetryConfig
37
35
  from zenml.config.source import Source
38
36
  from zenml.materializers.base_materializer import BaseMaterializer
39
37
  from zenml.model.model import Model
40
38
  from zenml.steps import BaseStep
39
+ from zenml.types import HookSpecification
41
40
 
42
41
  MaterializerClassOrSource = Union[str, Source, Type[BaseMaterializer]]
43
- HookSpecification = Union[str, Source, FunctionType]
42
+
44
43
  OutputMaterializersSpecification = Union[
45
44
  MaterializerClassOrSource,
46
45
  Sequence[MaterializerClassOrSource],
@@ -13,7 +13,6 @@
13
13
  # permissions and limitations under the License.
14
14
  """Utilities for inputs."""
15
15
 
16
- import functools
17
16
  from typing import TYPE_CHECKING, Dict, List, Tuple
18
17
  from uuid import UUID
19
18
 
@@ -48,13 +47,11 @@ def resolve_step_inputs(
48
47
  """
49
48
  from zenml.models import ArtifactVersionResponse, RunMetadataResponse
50
49
 
51
- list_run_steps = functools.partial(
52
- Client().list_run_steps, pipeline_run_id=run_id
53
- )
54
-
55
50
  current_run_steps = {
56
51
  run_step.name: run_step
57
- for run_step in pagination_utils.depaginate(list_run_steps)
52
+ for run_step in pagination_utils.depaginate(
53
+ Client().list_run_steps, pipeline_run_id=run_id
54
+ )
58
55
  }
59
56
 
60
57
  input_artifacts: Dict[str, "ArtifactVersionResponse"] = {}
@@ -15,7 +15,6 @@
15
15
 
16
16
  import inspect
17
17
  from abc import ABC, abstractmethod
18
- from types import FunctionType
19
18
  from typing import TYPE_CHECKING, Any, ClassVar, Dict, Mapping, Optional, Union
20
19
  from uuid import UUID
21
20
 
@@ -35,7 +34,6 @@ if TYPE_CHECKING:
35
34
  StepConfigurationUpdateOrDict = Union[
36
35
  Dict[str, Any], StepConfigurationUpdate
37
36
  ]
38
- HookSpecification = Union[str, FunctionType]
39
37
 
40
38
  logger = get_logger(__name__)
41
39
 
@@ -13,7 +13,6 @@
13
13
  # permissions and limitations under the License.
14
14
  """Legacy ZenML pipeline decorator definition."""
15
15
 
16
- from types import FunctionType
17
16
  from typing import (
18
17
  TYPE_CHECKING,
19
18
  Any,
@@ -46,8 +45,8 @@ from zenml.pipelines.base_pipeline import (
46
45
 
47
46
  if TYPE_CHECKING:
48
47
  from zenml.config.base_settings import SettingsOrDict
48
+ from zenml.types import HookSpecification
49
49
 
50
- HookSpecification = Union[str, FunctionType]
51
50
 
52
51
  logger = get_logger(__name__)
53
52
 
zenml/stack/stack.py CHANGED
@@ -13,7 +13,6 @@
13
13
  # permissions and limitations under the License.
14
14
  """Implementation of the ZenML Stack class."""
15
15
 
16
- import functools
17
16
  import itertools
18
17
  import json
19
18
  import os
@@ -155,11 +154,9 @@ class Stack:
155
154
 
156
155
  # Run a hydrated list call once to avoid one request per component
157
156
  component_models = pagination_utils.depaginate(
158
- list_method=functools.partial(
159
- Client().list_stack_components,
160
- stack_id=stack_model.id,
161
- hydrate=True,
162
- )
157
+ Client().list_stack_components,
158
+ stack_id=stack_model.id,
159
+ hydrate=True,
163
160
  )
164
161
 
165
162
  stack_components = {
@@ -827,6 +827,10 @@ class StackComponent:
827
827
  f"Suspending provisioned resources not implemented for {self}."
828
828
  )
829
829
 
830
+ def cleanup(self) -> None:
831
+ """Cleans up the component after it has been used."""
832
+ pass
833
+
830
834
  def __repr__(self) -> str:
831
835
  """String representation of the stack component.
832
836
 
@@ -0,0 +1,14 @@
1
+ # Copyright (c) ZenML GmbH 2024. All Rights Reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at:
6
+ #
7
+ # https://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
12
+ # or implied. See the License for the specific language governing
13
+ # permissions and limitations under the License.
14
+ """ZenML Stack Deployments."""
@@ -0,0 +1,254 @@
1
+ # Copyright (c) ZenML GmbH 2024. All Rights Reserved.
2
+
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at:
6
+
7
+ # https://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
12
+ # or implied. See the License for the specific language governing
13
+ # permissions and limitations under the License.
14
+ """Functionality to deploy a ZenML stack to AWS."""
15
+
16
+ from typing import ClassVar, Dict, List
17
+
18
+ from zenml.enums import StackDeploymentProvider
19
+ from zenml.models import StackDeploymentConfig
20
+ from zenml.stack_deployments.stack_deployment import ZenMLCloudStackDeployment
21
+ from zenml.utils.string_utils import random_str
22
+
23
+ AWS_DEPLOYMENT_TYPE = "cloud-formation"
24
+
25
+
26
+ class AWSZenMLCloudStackDeployment(ZenMLCloudStackDeployment):
27
+ """AWS ZenML Cloud Stack Deployment."""
28
+
29
+ provider: ClassVar[StackDeploymentProvider] = StackDeploymentProvider.AWS
30
+ deployment: ClassVar[str] = AWS_DEPLOYMENT_TYPE
31
+
32
+ @classmethod
33
+ def description(cls) -> str:
34
+ """Return a description of the ZenML Cloud Stack Deployment.
35
+
36
+ This will be displayed when the user is prompted to deploy
37
+ the ZenML stack.
38
+
39
+ Returns:
40
+ A MarkDown description of the ZenML Cloud Stack Deployment.
41
+ """
42
+ return """
43
+ Provision and register a basic AWS ZenML stack authenticated and connected to
44
+ all the necessary cloud infrastructure resources required to run pipelines in
45
+ AWS.
46
+ """
47
+
48
+ @classmethod
49
+ def instructions(cls) -> str:
50
+ """Return instructions on how to deploy the ZenML stack to the specified cloud provider.
51
+
52
+ This will be displayed before the user is prompted to deploy the ZenML
53
+ stack.
54
+
55
+ Returns:
56
+ MarkDown instructions on how to deploy the ZenML stack to the
57
+ specified cloud provider.
58
+ """
59
+ return """
60
+ You will be redirected to the AWS console in your browser where you'll be asked
61
+ to log into your AWS account and create a CloudFormation ZenML stack. The stack
62
+ parameters will be pre-filled with the necessary information to connect ZenML to
63
+ your AWS account, so you should only need to review and confirm the stack.
64
+
65
+ **NOTE**: The CloudFormation stack will create the following new resources in
66
+ your AWS account. Please ensure you have the necessary permissions and are aware
67
+ of any potential costs:
68
+
69
+ - An S3 bucket registered as a [ZenML artifact store](https://docs.zenml.io/stack-components/artifact-stores/s3).
70
+ - An ECR repository registered as a [ZenML container registry](https://docs.zenml.io/stack-components/container-registries/aws).
71
+ - Sagemaker registered as a [ZenML orchestrator](https://docs.zenml.io/stack-components/orchestrators/sagemaker).
72
+ - An IAM user and IAM role with the minimum necessary permissions to access the
73
+ above resources.
74
+ - An AWS access key used to give access to ZenML to connect to the above
75
+ resources through a [ZenML service connector](https://docs.zenml.io/how-to/auth-management/aws-service-connector).
76
+
77
+ The CloudFormation stack will automatically create an AWS secret key and
78
+ will share it with ZenML to give it permission to access the resources created
79
+ by the stack. You can revoke these permissions at any time by deleting the
80
+ CloudFormation stack.
81
+
82
+ **Estimated costs**
83
+
84
+ A small training job would cost around: $0.60
85
+
86
+ These are rough estimates and actual costs may vary based on your usage and specific AWS pricing.
87
+ Some services may be eligible for the AWS Free Tier. Use [the AWS Pricing Calculator](https://calculator.aws)
88
+ for a detailed estimate based on your usage.
89
+
90
+ 💡 **After the CloudFormation stack is deployed, you can return to the CLI to
91
+ view details about the associated ZenML stack automatically registered with
92
+ ZenML.**
93
+ """
94
+
95
+ @classmethod
96
+ def post_deploy_instructions(cls) -> str:
97
+ """Return instructions on what to do after the deployment is complete.
98
+
99
+ This will be displayed after the deployment is complete.
100
+
101
+ Returns:
102
+ MarkDown instructions on what to do after the deployment is
103
+ complete.
104
+ """
105
+ return """
106
+ The ZenML stack has been successfully deployed and registered. You can delete
107
+ the CloudFormation at any time to revoke ZenML's access to your AWS account and
108
+ to clean up the resources created by the stack by using the AWS CloudFormation
109
+ console.
110
+ """
111
+
112
+ @classmethod
113
+ def integrations(cls) -> List[str]:
114
+ """Return the ZenML integrations required for the stack.
115
+
116
+ Returns:
117
+ The list of ZenML integrations that need to be installed for the
118
+ stack to be usable.
119
+ """
120
+ return [
121
+ "aws",
122
+ "s3",
123
+ ]
124
+
125
+ @classmethod
126
+ def permissions(cls) -> Dict[str, List[str]]:
127
+ """Return the permissions granted to ZenML to access the cloud resources.
128
+
129
+ Returns:
130
+ The permissions granted to ZenML to access the cloud resources, as
131
+ a dictionary grouping permissions by resource.
132
+ """
133
+ return {
134
+ "S3 Bucket": [
135
+ "s3:ListBucket",
136
+ "s3:GetObject",
137
+ "s3:PutObject",
138
+ "s3:DeleteObject",
139
+ ],
140
+ "ECR Repository": [
141
+ "ecr:DescribeRepositories",
142
+ "ecr:ListRepositories",
143
+ "ecr:DescribeRegistry",
144
+ "ecr:BatchGetImage",
145
+ "ecr:DescribeImages",
146
+ "ecr:BatchCheckLayerAvailability",
147
+ "ecr:GetDownloadUrlForLayer",
148
+ "ecr:InitiateLayerUpload",
149
+ "ecr:UploadLayerPart",
150
+ "ecr:CompleteLayerUpload",
151
+ "ecr:PutImage",
152
+ "ecr:GetAuthorizationToken",
153
+ ],
154
+ "SageMaker (Client)": [
155
+ "sagemaker:CreatePipeline",
156
+ "sagemaker:StartPipelineExecution",
157
+ "sagemaker:DescribePipeline",
158
+ "sagemaker:DescribePipelineExecution",
159
+ ],
160
+ "SageMaker (Jobs)": [
161
+ "AmazonSageMakerFullAccess",
162
+ ],
163
+ }
164
+
165
+ @classmethod
166
+ def locations(cls) -> Dict[str, str]:
167
+ """Return the locations where the ZenML stack can be deployed.
168
+
169
+ Returns:
170
+ The regions where the ZenML stack can be deployed as a map of region
171
+ names to region descriptions.
172
+ """
173
+ # Return a list of all possible AWS regions
174
+
175
+ # Based on the AWS regions listed at
176
+ # https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-regions-availability-zones.html
177
+ return {
178
+ "US East (Ohio)": "us-east-2",
179
+ "US East (N. Virginia)": "us-east-1",
180
+ "US West (N. California)": "us-west-1",
181
+ "US West (Oregon)": "us-west-2",
182
+ "Africa (Cape Town)": "af-south-1",
183
+ "Asia Pacific (Hong Kong)": "ap-east-1",
184
+ "Asia Pacific (Hyderabad)": "ap-south-2",
185
+ "Asia Pacific (Jakarta)": "ap-southeast-3",
186
+ "Asia Pacific (Melbourne)": "ap-southeast-4",
187
+ "Asia Pacific (Mumbai)": "ap-south-1",
188
+ "Asia Pacific (Osaka)": "ap-northeast-3",
189
+ "Asia Pacific (Seoul)": "ap-northeast-2",
190
+ "Asia Pacific (Singapore)": "ap-southeast-1",
191
+ "Asia Pacific (Sydney)": "ap-southeast-2",
192
+ "Asia Pacific (Tokyo)": "ap-northeast-1",
193
+ "Canada (Central)": "ca-central-1",
194
+ "Canada West (Calgary)": "ca-west-1",
195
+ "Europe (Frankfurt)": "eu-central-1",
196
+ "Europe (Ireland)": "eu-west-1",
197
+ "Europe (London)": "eu-west-2",
198
+ "Europe (Milan)": "eu-south-1",
199
+ "Europe (Paris)": "eu-west-3",
200
+ "Europe (Spain)": "eu-south-2",
201
+ "Europe (Stockholm)": "eu-north-1",
202
+ "Europe (Zurich)": "eu-central-2",
203
+ "Israel (Tel Aviv)": "il-central-1",
204
+ "Middle East (Bahrain)": "me-south-1",
205
+ "Middle East (UAE)": "me-central-1",
206
+ "South America (São Paulo)": "sa-east-1",
207
+ }
208
+
209
+ def get_deployment_config(
210
+ self,
211
+ ) -> StackDeploymentConfig:
212
+ """Return the configuration to deploy the ZenML stack to the specified cloud provider.
213
+
214
+ The configuration should include:
215
+
216
+ * a cloud provider console URL where the user will be redirected to
217
+ deploy the ZenML stack. The URL should include as many pre-filled
218
+ URL query parameters as possible.
219
+ * a textual description of the URL
220
+ * some deployment providers may require additional configuration
221
+ parameters to be passed to the cloud provider in addition to the
222
+ deployment URL query parameters. Where that is the case, this method
223
+ should also return a string that the user can copy and paste into the
224
+ cloud provider console to deploy the ZenML stack (e.g. a set of
225
+ environment variables, or YAML configuration snippet etc.).
226
+
227
+ Returns:
228
+ The configuration to deploy the ZenML stack to the specified cloud
229
+ provider.
230
+ """
231
+ params = dict(
232
+ stackName=self.stack_name,
233
+ templateURL="https://zenml-cf-templates.s3.eu-central-1.amazonaws.com/aws-ecr-s3-sagemaker.yaml",
234
+ param_ResourceName=f"zenml-{random_str(6).lower()}",
235
+ param_ZenMLServerURL=self.zenml_server_url,
236
+ param_ZenMLServerAPIToken=self.zenml_server_api_token,
237
+ )
238
+ # Encode the parameters as URL query parameters
239
+ query_params = "&".join([f"{k}={v}" for k, v in params.items()])
240
+
241
+ region = ""
242
+ if self.location:
243
+ region = f"region={self.location}"
244
+
245
+ url = (
246
+ f"https://console.aws.amazon.com/cloudformation/home?"
247
+ f"{region}#/stacks/create/review?{query_params}"
248
+ )
249
+
250
+ return StackDeploymentConfig(
251
+ deployment_url=url,
252
+ deployment_url_text="AWS CloudFormation Console",
253
+ configuration=None,
254
+ )