zenml-nightly 0.62.0.dev20240729__py3-none-any.whl → 0.64.0.dev20240809__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 (240) hide show
  1. README.md +2 -2
  2. RELEASE_NOTES.md +120 -0
  3. zenml/VERSION +1 -1
  4. zenml/__init__.py +0 -4
  5. zenml/actions/pipeline_run/pipeline_run_action.py +19 -17
  6. zenml/analytics/enums.py +4 -6
  7. zenml/cli/__init__.py +28 -76
  8. zenml/cli/base.py +2 -2
  9. zenml/cli/pipeline.py +54 -61
  10. zenml/cli/stack.py +6 -8
  11. zenml/cli/web_login.py +8 -0
  12. zenml/client.py +232 -103
  13. zenml/config/build_configuration.py +43 -17
  14. zenml/config/compiler.py +14 -22
  15. zenml/config/docker_settings.py +80 -57
  16. zenml/config/pipeline_run_configuration.py +3 -0
  17. zenml/config/server_config.py +3 -0
  18. zenml/config/source.py +60 -1
  19. zenml/constants.py +11 -2
  20. zenml/entrypoints/base_entrypoint_configuration.py +53 -8
  21. zenml/enums.py +4 -1
  22. zenml/environment.py +25 -9
  23. zenml/image_builders/base_image_builder.py +1 -1
  24. zenml/image_builders/build_context.py +25 -72
  25. zenml/integrations/aws/orchestrators/sagemaker_orchestrator.py +13 -4
  26. zenml/integrations/azure/__init__.py +4 -0
  27. zenml/integrations/azure/flavors/__init__.py +11 -0
  28. zenml/integrations/azure/flavors/azureml_orchestrator_flavor.py +263 -0
  29. zenml/{_hub → integrations/azure/orchestrators}/__init__.py +7 -2
  30. zenml/integrations/azure/orchestrators/azureml_orchestrator.py +544 -0
  31. zenml/integrations/azure/orchestrators/azureml_orchestrator_entrypoint_config.py +86 -0
  32. zenml/integrations/azure/step_operators/azureml_step_operator.py +3 -0
  33. zenml/integrations/databricks/flavors/databricks_orchestrator_flavor.py +20 -2
  34. zenml/integrations/databricks/orchestrators/databricks_orchestrator.py +19 -13
  35. zenml/integrations/gcp/orchestrators/vertex_orchestrator.py +7 -2
  36. zenml/integrations/gcp/service_connectors/gcp_service_connector.py +123 -6
  37. zenml/integrations/kaniko/image_builders/kaniko_image_builder.py +1 -1
  38. zenml/integrations/mlflow/__init__.py +1 -1
  39. zenml/integrations/mlflow/experiment_trackers/mlflow_experiment_tracker.py +3 -1
  40. zenml/integrations/mlflow/flavors/mlflow_experiment_tracker_flavor.py +3 -0
  41. zenml/logger.py +13 -0
  42. zenml/models/__init__.py +26 -22
  43. zenml/models/v2/base/filter.py +32 -0
  44. zenml/models/v2/core/pipeline.py +73 -89
  45. zenml/models/v2/core/pipeline_build.py +15 -11
  46. zenml/models/v2/core/pipeline_deployment.py +72 -24
  47. zenml/models/v2/core/pipeline_run.py +65 -1
  48. zenml/models/v2/core/run_template.py +393 -0
  49. zenml/models/v2/core/server_settings.py +12 -0
  50. zenml/models/v2/core/user.py +0 -21
  51. zenml/models/v2/misc/server_models.py +7 -1
  52. zenml/models/v2/misc/stack_deployment.py +5 -0
  53. zenml/models/v2/misc/user_auth.py +0 -7
  54. zenml/new/pipelines/build_utils.py +220 -89
  55. zenml/new/pipelines/code_archive.py +157 -0
  56. zenml/new/pipelines/pipeline.py +46 -78
  57. zenml/new/pipelines/run_utils.py +79 -1
  58. zenml/post_execution/pipeline.py +1 -4
  59. zenml/service_connectors/service_connector_utils.py +18 -2
  60. zenml/stack_deployments/aws_stack_deployment.py +32 -8
  61. zenml/stack_deployments/azure_stack_deployment.py +122 -10
  62. zenml/stack_deployments/gcp_stack_deployment.py +36 -7
  63. zenml/stack_deployments/stack_deployment.py +23 -7
  64. zenml/steps/base_step.py +3 -0
  65. zenml/steps/utils.py +0 -4
  66. zenml/utils/archivable.py +149 -0
  67. zenml/utils/code_utils.py +244 -0
  68. zenml/utils/notebook_utils.py +122 -0
  69. zenml/utils/package_utils.py +39 -0
  70. zenml/utils/pipeline_docker_image_builder.py +3 -96
  71. zenml/utils/source_utils.py +109 -1
  72. zenml/zen_server/dashboard/assets/{404-B_YdvmwS.js → 404-CRAA_Lew.js} +1 -1
  73. zenml/zen_server/dashboard/assets/@radix-BXWm7HOa.js +85 -0
  74. zenml/zen_server/dashboard/assets/{@react-router-CO-OsFwI.js → @react-router-l3lMcXA2.js} +1 -1
  75. zenml/zen_server/dashboard/assets/{@reactflow-l_1hUr1S.js → @reactflow-CeVxyqYT.js} +2 -2
  76. zenml/zen_server/dashboard/assets/{@tanstack-DYiOyJUL.js → @tanstack-FmcYZMuX.js} +4 -4
  77. zenml/zen_server/dashboard/assets/AlertDialogDropdownItem-ErO9aOgK.js +1 -0
  78. zenml/zen_server/dashboard/assets/{AwarenessChannel-CFg5iX4Z.js → AwarenessChannel-CLXo5rKM.js} +1 -1
  79. zenml/zen_server/dashboard/assets/{CodeSnippet-Dvkx_82E.js → CodeSnippet-D0VLxT2A.js} +2 -2
  80. zenml/zen_server/dashboard/assets/CollapsibleCard-BaUPiVg0.js +1 -0
  81. zenml/zen_server/dashboard/assets/{Commands-DoN1xrEq.js → Commands-JrcZK-3j.js} +1 -1
  82. zenml/zen_server/dashboard/assets/CopyButton-Dbo52T1K.js +2 -0
  83. zenml/zen_server/dashboard/assets/{CsvVizualization-Ck-nZ43m.js → CsvVizualization-D3kAypDj.js} +3 -3
  84. zenml/zen_server/dashboard/assets/DisplayDate-DizbSeT-.js +1 -0
  85. zenml/zen_server/dashboard/assets/EditSecretDialog-Bd7mFLS4.js +1 -0
  86. zenml/zen_server/dashboard/assets/{EmptyState-BMLnFVlB.js → EmptyState-BHblM39I.js} +1 -1
  87. zenml/zen_server/dashboard/assets/{Error-kLtljEOM.js → Error-C6LeJSER.js} +1 -1
  88. zenml/zen_server/dashboard/assets/{ExecutionStatus-DguLLgTK.js → ExecutionStatus-jH4OrWBq.js} +1 -1
  89. zenml/zen_server/dashboard/assets/{Helpbox-BXUMP21n.js → Helpbox-aAB2XP-z.js} +1 -1
  90. zenml/zen_server/dashboard/assets/{Infobox-DSt0O-dm.js → Infobox-BQ0aty32.js} +1 -1
  91. zenml/zen_server/dashboard/assets/{InlineAvatar-xsrsIGE-.js → InlineAvatar-DpTLgM3Q.js} +1 -1
  92. zenml/zen_server/dashboard/assets/Lock-CNyJvf2r.js +1 -0
  93. zenml/zen_server/dashboard/assets/{MarkdownVisualization-xp3hhULl.js → MarkdownVisualization-Bajxn0HY.js} +1 -1
  94. zenml/zen_server/dashboard/assets/NumberBox-BmKE0qnO.js +1 -0
  95. zenml/zen_server/dashboard/assets/{PasswordChecker-DUveqlva.js → PasswordChecker-yGGoJSB-.js} +1 -1
  96. zenml/zen_server/dashboard/assets/ProviderRadio-BBqkIuTd.js +1 -0
  97. zenml/zen_server/dashboard/assets/RadioItem-xLhXoiFV.js +1 -0
  98. zenml/zen_server/dashboard/assets/SearchField-C9R0mdaX.js +1 -0
  99. zenml/zen_server/dashboard/assets/{SetPassword-BXGTWiwj.js → SetPassword-52sNxNiO.js} +1 -1
  100. zenml/zen_server/dashboard/assets/{SuccessStep-DZC60t0x.js → SuccessStep-DlkItqYG.js} +1 -1
  101. zenml/zen_server/dashboard/assets/Tick-uxv80Q6a.js +1 -0
  102. zenml/zen_server/dashboard/assets/{UpdatePasswordSchemas-DGvwFWO1.js → UpdatePasswordSchemas-oN4G3sKz.js} +1 -1
  103. zenml/zen_server/dashboard/assets/{aws-BgKTfTfx.js → aws-0_3UsPif.js} +1 -1
  104. zenml/zen_server/dashboard/assets/{check-circle-i56092KI.js → check-circle-1_I207rW.js} +1 -1
  105. zenml/zen_server/dashboard/assets/chevron-down-BpaF8JqM.js +1 -0
  106. zenml/zen_server/dashboard/assets/{chevron-right-double-CZBOf6JM.js → chevron-right-double-Dk8e2L99.js} +1 -1
  107. zenml/zen_server/dashboard/assets/{cloud-only-C_yFCAkP.js → cloud-only-BkUuI0lZ.js} +1 -1
  108. zenml/zen_server/dashboard/assets/components-Br2ezRib.js +1 -0
  109. zenml/zen_server/dashboard/assets/{copy-BXNk6BjL.js → copy-f3XGPPxt.js} +1 -1
  110. zenml/zen_server/dashboard/assets/{database-1xWSgZfO.js → database-cXYNX9tt.js} +1 -1
  111. zenml/zen_server/dashboard/assets/{docker-CQMVm_4d.js → docker-8uj__HHK.js} +1 -1
  112. zenml/zen_server/dashboard/assets/dots-horizontal-sKQlWEni.js +1 -0
  113. zenml/zen_server/dashboard/assets/edit-C0MVvPD2.js +1 -0
  114. zenml/zen_server/dashboard/assets/{file-text-CqD_iu6l.js → file-text-B9JibxTs.js} +1 -1
  115. zenml/zen_server/dashboard/assets/{help-bu_DgLKI.js → help-FuHlZwn0.js} +1 -1
  116. zenml/zen_server/dashboard/assets/{index-rK_Wuy2W.js → index-Bd1xgUQG.js} +1 -1
  117. zenml/zen_server/dashboard/assets/index-DaGknux4.css +1 -0
  118. zenml/zen_server/dashboard/assets/{index-BczVOqUf.js → index-DhIZtpxB.js} +5 -5
  119. zenml/zen_server/dashboard/assets/index.esm-DT4uyn2i.js +1 -0
  120. zenml/zen_server/dashboard/assets/layout-D6oiSbfd.js +1 -0
  121. zenml/zen_server/dashboard/assets/{login-mutation-CrHrndTI.js → login-mutation-13A_JSVA.js} +1 -1
  122. zenml/zen_server/dashboard/assets/{logs-D8k8BVFf.js → logs-CgeE2vZP.js} +1 -1
  123. zenml/zen_server/dashboard/assets/{not-found-DYa4pC-C.js → not-found-B0Mmb90p.js} +1 -1
  124. zenml/zen_server/dashboard/assets/package-DdkziX79.js +1 -0
  125. zenml/zen_server/dashboard/assets/page-7-v2OBm-.js +1 -0
  126. zenml/zen_server/dashboard/assets/{page-MFQyIJd3.js → page-B3ozwdD1.js} +1 -1
  127. zenml/zen_server/dashboard/assets/{page-BkuQDIf-.js → page-BGwA9B1M.js} +1 -1
  128. zenml/zen_server/dashboard/assets/{page-1iL8aMqs.js → page-BkjAUyTA.js} +1 -1
  129. zenml/zen_server/dashboard/assets/page-BnacgBiy.js +1 -0
  130. zenml/zen_server/dashboard/assets/page-BxF_KMQ3.js +2 -0
  131. zenml/zen_server/dashboard/assets/page-C4POHC0K.js +1 -0
  132. zenml/zen_server/dashboard/assets/page-C9kudd44.js +9 -0
  133. zenml/zen_server/dashboard/assets/page-CA1j3GpJ.js +1 -0
  134. zenml/zen_server/dashboard/assets/page-CCY6yfmu.js +1 -0
  135. zenml/zen_server/dashboard/assets/page-CgTe7Bme.js +1 -0
  136. zenml/zen_server/dashboard/assets/{page-8a4UMKXZ.js → page-Cgn-6v2Y.js} +1 -1
  137. zenml/zen_server/dashboard/assets/page-CxQmQqDw.js +1 -0
  138. zenml/zen_server/dashboard/assets/page-D2Goey3H.js +1 -0
  139. zenml/zen_server/dashboard/assets/page-DLpOnf7u.js +1 -0
  140. zenml/zen_server/dashboard/assets/{page-BhgCDInH.js → page-DSTQnBk-.js} +1 -1
  141. zenml/zen_server/dashboard/assets/{page-1h_sD1jz.js → page-DTysUGOy.js} +1 -1
  142. zenml/zen_server/dashboard/assets/{page-2grKx_MY.js → page-D_EXUFJb.js} +1 -1
  143. zenml/zen_server/dashboard/assets/page-Db15QzsM.js +1 -0
  144. zenml/zen_server/dashboard/assets/{page-BDns21Iz.js → page-DugsjcQ_.js} +1 -1
  145. zenml/zen_server/dashboard/assets/{page-C6-UGEbH.js → page-OFKSPyN7.js} +1 -1
  146. zenml/zen_server/dashboard/assets/{page-BkeAAYwp.js → page-RnG-qhv9.js} +1 -1
  147. zenml/zen_server/dashboard/assets/{page-CCNRIt_f.js → page-T2BtjwPl.js} +1 -1
  148. zenml/zen_server/dashboard/assets/page-TXe1Eo3Z.js +1 -0
  149. zenml/zen_server/dashboard/assets/{page-BnaevhnB.js → page-YiF_fNbe.js} +1 -1
  150. zenml/zen_server/dashboard/assets/{page-uA5prJGY.js → page-hQaiQXfg.js} +1 -1
  151. zenml/zen_server/dashboard/assets/persist-3-5nOJ6m.js +1 -0
  152. zenml/zen_server/dashboard/assets/{play-circle-CNtZKDnW.js → play-circle-XSkLR12B.js} +1 -1
  153. zenml/zen_server/dashboard/assets/plus-FB9-lEq_.js +1 -0
  154. zenml/zen_server/dashboard/assets/refresh-COb6KYDi.js +1 -0
  155. zenml/zen_server/dashboard/assets/sharedSchema-BoYx_B_L.js +14 -0
  156. zenml/zen_server/dashboard/assets/{stack-detail-query-Cficsl6d.js → stack-detail-query-B-US_-wa.js} +1 -1
  157. zenml/zen_server/dashboard/assets/{terminal-By9cErXc.js → terminal-grtjrIEJ.js} +1 -1
  158. zenml/zen_server/dashboard/assets/trash-Cd5CSFqA.js +1 -0
  159. zenml/zen_server/dashboard/assets/{update-server-settings-mutation-7d8xi1tS.js → update-server-settings-mutation-B8GB_ubU.js} +1 -1
  160. zenml/zen_server/dashboard/assets/{url-D7mAQGUM.js → url-hcMJkz8p.js} +1 -1
  161. zenml/zen_server/dashboard/assets/{zod-BhoGpZ63.js → zod-CnykDKJj.js} +1 -1
  162. zenml/zen_server/dashboard/index.html +7 -7
  163. zenml/zen_server/dashboard_legacy/asset-manifest.json +4 -4
  164. zenml/zen_server/dashboard_legacy/index.html +1 -1
  165. zenml/zen_server/dashboard_legacy/{precache-manifest.12246c7548e71e2c4438e496360de80c.js → precache-manifest.9c473c96a43298343a7ce1256183123b.js} +4 -4
  166. zenml/zen_server/dashboard_legacy/service-worker.js +1 -1
  167. zenml/zen_server/dashboard_legacy/static/js/{main.3b27024b.chunk.js → main.463c90b9.chunk.js} +2 -2
  168. zenml/zen_server/dashboard_legacy/static/js/{main.3b27024b.chunk.js.map → main.463c90b9.chunk.js.map} +1 -1
  169. zenml/zen_server/deploy/helm/Chart.yaml +1 -1
  170. zenml/zen_server/deploy/helm/README.md +2 -2
  171. zenml/zen_server/rbac/models.py +1 -0
  172. zenml/zen_server/rbac/utils.py +4 -0
  173. zenml/zen_server/routers/pipeline_builds_endpoints.py +2 -66
  174. zenml/zen_server/routers/pipeline_deployments_endpoints.py +2 -53
  175. zenml/zen_server/routers/pipelines_endpoints.py +1 -74
  176. zenml/zen_server/routers/run_templates_endpoints.py +212 -0
  177. zenml/zen_server/routers/stack_deployment_endpoints.py +6 -0
  178. zenml/zen_server/routers/users_endpoints.py +0 -7
  179. zenml/zen_server/routers/workspaces_endpoints.py +79 -0
  180. zenml/zen_server/{pipeline_deployment → template_execution}/runner_entrypoint_configuration.py +1 -8
  181. zenml/zen_server/{pipeline_deployment → template_execution}/utils.py +214 -92
  182. zenml/zen_server/utils.py +77 -2
  183. zenml/zen_server/zen_server_api.py +54 -2
  184. zenml/zen_stores/base_zen_store.py +7 -1
  185. zenml/zen_stores/migrations/versions/0.63.0_release.py +23 -0
  186. zenml/zen_stores/migrations/versions/0.64.0_release.py +23 -0
  187. zenml/zen_stores/migrations/versions/026d4577b6a0_add_code_path.py +39 -0
  188. zenml/zen_stores/migrations/versions/3dcc5d20e82f_add_last_user_activity.py +51 -0
  189. zenml/zen_stores/migrations/versions/7d1919bb1ef0_add_run_templates.py +100 -0
  190. zenml/zen_stores/migrations/versions/909550c7c4da_remove_user_hub_token.py +36 -0
  191. zenml/zen_stores/migrations/versions/b59aa68fdb1f_simplify_pipelines.py +139 -0
  192. zenml/zen_stores/rest_zen_store.py +112 -39
  193. zenml/zen_stores/schemas/__init__.py +2 -0
  194. zenml/zen_stores/schemas/pipeline_build_schemas.py +3 -3
  195. zenml/zen_stores/schemas/pipeline_deployment_schemas.py +32 -2
  196. zenml/zen_stores/schemas/pipeline_run_schemas.py +29 -3
  197. zenml/zen_stores/schemas/pipeline_schemas.py +29 -30
  198. zenml/zen_stores/schemas/run_template_schemas.py +264 -0
  199. zenml/zen_stores/schemas/server_settings_schemas.py +2 -0
  200. zenml/zen_stores/schemas/step_run_schemas.py +11 -4
  201. zenml/zen_stores/schemas/user_schemas.py +0 -2
  202. zenml/zen_stores/sql_zen_store.py +389 -151
  203. zenml/zen_stores/template_utils.py +261 -0
  204. zenml/zen_stores/zen_store_interface.py +93 -20
  205. {zenml_nightly-0.62.0.dev20240729.dist-info → zenml_nightly-0.64.0.dev20240809.dist-info}/METADATA +3 -3
  206. {zenml_nightly-0.62.0.dev20240729.dist-info → zenml_nightly-0.64.0.dev20240809.dist-info}/RECORD +211 -184
  207. zenml/_hub/client.py +0 -289
  208. zenml/_hub/constants.py +0 -21
  209. zenml/_hub/utils.py +0 -79
  210. zenml/cli/hub.py +0 -1116
  211. zenml/models/v2/core/pipeline_namespace.py +0 -113
  212. zenml/models/v2/misc/hub_plugin_models.py +0 -79
  213. zenml/new/pipelines/deserialization_utils.py +0 -292
  214. zenml/zen_server/dashboard/assets/@radix-CFOkMR_E.js +0 -85
  215. zenml/zen_server/dashboard/assets/CollapsibleCard-opiuBHHc.js +0 -1
  216. zenml/zen_server/dashboard/assets/CopyButton-Cr7xYEPb.js +0 -2
  217. zenml/zen_server/dashboard/assets/DisplayDate-DYgIjlDF.js +0 -1
  218. zenml/zen_server/dashboard/assets/Pagination-C6X-mifw.js +0 -1
  219. zenml/zen_server/dashboard/assets/index-EpMIKgrI.css +0 -1
  220. zenml/zen_server/dashboard/assets/index.esm-Corw4lXQ.js +0 -1
  221. zenml/zen_server/dashboard/assets/package-B3fWP-Dh.js +0 -1
  222. zenml/zen_server/dashboard/assets/page-5NCOHOsy.js +0 -1
  223. zenml/zen_server/dashboard/assets/page-B6h3iaHJ.js +0 -1
  224. zenml/zen_server/dashboard/assets/page-Bi-wtWiO.js +0 -5
  225. zenml/zen_server/dashboard/assets/page-Bq0YxkLV.js +0 -1
  226. zenml/zen_server/dashboard/assets/page-Bs2F4eoD.js +0 -2
  227. zenml/zen_server/dashboard/assets/page-CHNxpz3n.js +0 -1
  228. zenml/zen_server/dashboard/assets/page-DgorQFqi.js +0 -1
  229. zenml/zen_server/dashboard/assets/page-K8ebxVIs.js +0 -1
  230. zenml/zen_server/dashboard/assets/page-TgCF0P_U.js +0 -1
  231. zenml/zen_server/dashboard/assets/page-ZnCEe-eK.js +0 -9
  232. zenml/zen_server/dashboard/assets/persist-D7HJNBWx.js +0 -1
  233. zenml/zen_server/dashboard/assets/plus-C8WOyCzt.js +0 -1
  234. zenml/zen_server/dashboard/assets/secrets-video-OBJ6irhH.svg +0 -21
  235. zenml/zen_server/dashboard/assets/stacks-video-7gfxpAq4.svg +0 -21
  236. /zenml/zen_server/{pipeline_deployment → template_execution}/__init__.py +0 -0
  237. /zenml/zen_server/{pipeline_deployment → template_execution}/workload_manager_interface.py +0 -0
  238. {zenml_nightly-0.62.0.dev20240729.dist-info → zenml_nightly-0.64.0.dev20240809.dist-info}/LICENSE +0 -0
  239. {zenml_nightly-0.62.0.dev20240729.dist-info → zenml_nightly-0.64.0.dev20240809.dist-info}/WHEEL +0 -0
  240. {zenml_nightly-0.62.0.dev20240729.dist-info → zenml_nightly-0.64.0.dev20240809.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,393 @@
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
+ """Models representing pipeline templates."""
15
+
16
+ from typing import TYPE_CHECKING, Any, ClassVar, Dict, List, Optional, Union
17
+ from uuid import UUID
18
+
19
+ from pydantic import Field
20
+
21
+ from zenml.config.pipeline_spec import PipelineSpec
22
+ from zenml.constants import STR_FIELD_MAX_LENGTH, TEXT_FIELD_MAX_LENGTH
23
+ from zenml.enums import ExecutionStatus
24
+ from zenml.models.v2.base.base import BaseUpdate
25
+ from zenml.models.v2.base.scoped import (
26
+ WorkspaceScopedRequest,
27
+ WorkspaceScopedResponse,
28
+ WorkspaceScopedResponseBody,
29
+ WorkspaceScopedResponseMetadata,
30
+ WorkspaceScopedResponseResources,
31
+ WorkspaceScopedTaggableFilter,
32
+ )
33
+ from zenml.models.v2.core.code_reference import (
34
+ CodeReferenceResponse,
35
+ )
36
+ from zenml.models.v2.core.pipeline import PipelineResponse
37
+ from zenml.models.v2.core.pipeline_build import (
38
+ PipelineBuildResponse,
39
+ )
40
+ from zenml.models.v2.core.pipeline_deployment import (
41
+ PipelineDeploymentResponse,
42
+ )
43
+ from zenml.models.v2.core.tag import TagResponse
44
+
45
+ if TYPE_CHECKING:
46
+ from sqlalchemy.sql.elements import ColumnElement
47
+
48
+ # ------------------ Request Model ------------------
49
+
50
+
51
+ class RunTemplateRequest(WorkspaceScopedRequest):
52
+ """Request model for run templates."""
53
+
54
+ name: str = Field(
55
+ title="The name of the run template.",
56
+ max_length=STR_FIELD_MAX_LENGTH,
57
+ )
58
+ description: Optional[str] = Field(
59
+ default=None,
60
+ title="The description of the run template.",
61
+ max_length=TEXT_FIELD_MAX_LENGTH,
62
+ )
63
+ source_deployment_id: UUID = Field(
64
+ title="The deployment that should be the base of the created template."
65
+ )
66
+ tags: Optional[List[str]] = Field(
67
+ default=None,
68
+ title="Tags of the run template.",
69
+ )
70
+
71
+
72
+ # ------------------ Update Model ------------------
73
+
74
+
75
+ class RunTemplateUpdate(BaseUpdate):
76
+ """Run template update model."""
77
+
78
+ name: Optional[str] = Field(
79
+ default=None,
80
+ title="The name of the run template.",
81
+ max_length=STR_FIELD_MAX_LENGTH,
82
+ )
83
+ description: Optional[str] = Field(
84
+ default=None,
85
+ title="The description of the run template.",
86
+ max_length=TEXT_FIELD_MAX_LENGTH,
87
+ )
88
+ add_tags: Optional[List[str]] = Field(
89
+ default=None, title="New tags to add to the run template."
90
+ )
91
+ remove_tags: Optional[List[str]] = Field(
92
+ default=None, title="Tags to remove from the run template."
93
+ )
94
+
95
+
96
+ # ------------------ Response Model ------------------
97
+
98
+
99
+ class RunTemplateResponseBody(WorkspaceScopedResponseBody):
100
+ """Response body for run templates."""
101
+
102
+ runnable: bool = Field(
103
+ title="If a run can be started from the template.",
104
+ )
105
+ latest_run_id: Optional[UUID] = Field(
106
+ default=None,
107
+ title="The ID of the latest run of the run template.",
108
+ )
109
+ latest_run_status: Optional[ExecutionStatus] = Field(
110
+ default=None,
111
+ title="The status of the latest run of the run template.",
112
+ )
113
+
114
+
115
+ class RunTemplateResponseMetadata(WorkspaceScopedResponseMetadata):
116
+ """Response metadata for run templates."""
117
+
118
+ description: Optional[str] = Field(
119
+ default=None,
120
+ title="The description of the run template.",
121
+ )
122
+ pipeline_spec: Optional[PipelineSpec] = Field(
123
+ default=None, title="The spec of the pipeline."
124
+ )
125
+ config_template: Optional[Dict[str, Any]] = Field(
126
+ default=None, title="Run configuration template."
127
+ )
128
+ config_schema: Optional[Dict[str, Any]] = Field(
129
+ default=None, title="Run configuration schema."
130
+ )
131
+
132
+
133
+ class RunTemplateResponseResources(WorkspaceScopedResponseResources):
134
+ """All resource models associated with the run template."""
135
+
136
+ source_deployment: Optional[PipelineDeploymentResponse] = Field(
137
+ default=None,
138
+ title="The deployment that is the source of the template.",
139
+ )
140
+ pipeline: Optional[PipelineResponse] = Field(
141
+ default=None, title="The pipeline associated with the template."
142
+ )
143
+ build: Optional[PipelineBuildResponse] = Field(
144
+ default=None,
145
+ title="The pipeline build associated with the template.",
146
+ )
147
+ code_reference: Optional[CodeReferenceResponse] = Field(
148
+ default=None,
149
+ title="The code reference associated with the template.",
150
+ )
151
+ tags: List[TagResponse] = Field(
152
+ title="Tags associated with the run template.",
153
+ )
154
+
155
+
156
+ class RunTemplateResponse(
157
+ WorkspaceScopedResponse[
158
+ RunTemplateResponseBody,
159
+ RunTemplateResponseMetadata,
160
+ RunTemplateResponseResources,
161
+ ]
162
+ ):
163
+ """Response model for run templates."""
164
+
165
+ name: str = Field(
166
+ title="The name of the run template.",
167
+ max_length=STR_FIELD_MAX_LENGTH,
168
+ )
169
+
170
+ def get_hydrated_version(self) -> "RunTemplateResponse":
171
+ """Return the hydrated version of this run template.
172
+
173
+ Returns:
174
+ The hydrated run template.
175
+ """
176
+ from zenml.client import Client
177
+
178
+ return Client().zen_store.get_run_template(
179
+ template_id=self.id, hydrate=True
180
+ )
181
+
182
+ # Body and metadata properties
183
+ @property
184
+ def runnable(self) -> bool:
185
+ """The `runnable` property.
186
+
187
+ Returns:
188
+ the value of the property.
189
+ """
190
+ return self.get_body().runnable
191
+
192
+ @property
193
+ def latest_run_id(self) -> Optional[UUID]:
194
+ """The `latest_run_id` property.
195
+
196
+ Returns:
197
+ the value of the property.
198
+ """
199
+ return self.get_body().latest_run_id
200
+
201
+ @property
202
+ def latest_run_status(self) -> Optional[ExecutionStatus]:
203
+ """The `latest_run_status` property.
204
+
205
+ Returns:
206
+ the value of the property.
207
+ """
208
+ return self.get_body().latest_run_status
209
+
210
+ @property
211
+ def description(self) -> Optional[str]:
212
+ """The `description` property.
213
+
214
+ Returns:
215
+ the value of the property.
216
+ """
217
+ return self.get_metadata().description
218
+
219
+ @property
220
+ def pipeline_spec(self) -> Optional[PipelineSpec]:
221
+ """The `pipeline_spec` property.
222
+
223
+ Returns:
224
+ the value of the property.
225
+ """
226
+ return self.get_metadata().pipeline_spec
227
+
228
+ @property
229
+ def config_template(self) -> Optional[Dict[str, Any]]:
230
+ """The `config_template` property.
231
+
232
+ Returns:
233
+ the value of the property.
234
+ """
235
+ return self.get_metadata().config_template
236
+
237
+ @property
238
+ def config_schema(self) -> Optional[Dict[str, Any]]:
239
+ """The `config_schema` property.
240
+
241
+ Returns:
242
+ the value of the property.
243
+ """
244
+ return self.get_metadata().config_schema
245
+
246
+ @property
247
+ def source_deployment(self) -> Optional[PipelineDeploymentResponse]:
248
+ """The `source_deployment` property.
249
+
250
+ Returns:
251
+ the value of the property.
252
+ """
253
+ return self.get_resources().source_deployment
254
+
255
+ @property
256
+ def pipeline(self) -> Optional[PipelineResponse]:
257
+ """The `pipeline` property.
258
+
259
+ Returns:
260
+ the value of the property.
261
+ """
262
+ return self.get_resources().pipeline
263
+
264
+ @property
265
+ def build(self) -> Optional[PipelineBuildResponse]:
266
+ """The `build` property.
267
+
268
+ Returns:
269
+ the value of the property.
270
+ """
271
+ return self.get_resources().build
272
+
273
+ @property
274
+ def code_reference(self) -> Optional[CodeReferenceResponse]:
275
+ """The `code_reference` property.
276
+
277
+ Returns:
278
+ the value of the property.
279
+ """
280
+ return self.get_resources().code_reference
281
+
282
+ @property
283
+ def tags(self) -> List[TagResponse]:
284
+ """The `tags` property.
285
+
286
+ Returns:
287
+ the value of the property.
288
+ """
289
+ return self.get_resources().tags
290
+
291
+
292
+ # ------------------ Filter Model ------------------
293
+
294
+
295
+ class RunTemplateFilter(WorkspaceScopedTaggableFilter):
296
+ """Model for filtering of run templates."""
297
+
298
+ FILTER_EXCLUDE_FIELDS: ClassVar[List[str]] = [
299
+ *WorkspaceScopedTaggableFilter.FILTER_EXCLUDE_FIELDS,
300
+ "code_repository_id",
301
+ "stack_id",
302
+ "build_id" "pipeline_id",
303
+ ]
304
+
305
+ name: Optional[str] = Field(
306
+ default=None,
307
+ description="Name of the run template.",
308
+ )
309
+ workspace_id: Optional[Union[UUID, str]] = Field(
310
+ default=None,
311
+ description="Workspace associated with the template.",
312
+ union_mode="left_to_right",
313
+ )
314
+ user_id: Optional[Union[UUID, str]] = Field(
315
+ default=None,
316
+ description="User that created the template.",
317
+ union_mode="left_to_right",
318
+ )
319
+ pipeline_id: Optional[Union[UUID, str]] = Field(
320
+ default=None,
321
+ description="Pipeline associated with the template.",
322
+ union_mode="left_to_right",
323
+ )
324
+ build_id: Optional[Union[UUID, str]] = Field(
325
+ default=None,
326
+ description="Build associated with the template.",
327
+ union_mode="left_to_right",
328
+ )
329
+ stack_id: Optional[Union[UUID, str]] = Field(
330
+ default=None,
331
+ description="Stack associated with the template.",
332
+ union_mode="left_to_right",
333
+ )
334
+ code_repository_id: Optional[Union[UUID, str]] = Field(
335
+ default=None,
336
+ description="Code repository associated with the template.",
337
+ union_mode="left_to_right",
338
+ )
339
+
340
+ def get_custom_filters(
341
+ self,
342
+ ) -> List["ColumnElement[bool]"]:
343
+ """Get custom filters.
344
+
345
+ Returns:
346
+ A list of custom filters.
347
+ """
348
+ custom_filters = super().get_custom_filters()
349
+
350
+ from sqlmodel import and_
351
+
352
+ from zenml.zen_stores.schemas import (
353
+ CodeReferenceSchema,
354
+ PipelineDeploymentSchema,
355
+ RunTemplateSchema,
356
+ )
357
+
358
+ if self.code_repository_id:
359
+ code_repo_filter = and_(
360
+ RunTemplateSchema.source_deployment_id
361
+ == PipelineDeploymentSchema.id,
362
+ PipelineDeploymentSchema.code_reference_id
363
+ == CodeReferenceSchema.id,
364
+ CodeReferenceSchema.code_repository_id
365
+ == self.code_repository_id,
366
+ )
367
+ custom_filters.append(code_repo_filter)
368
+
369
+ if self.stack_id:
370
+ stack_filter = and_(
371
+ RunTemplateSchema.source_deployment_id
372
+ == PipelineDeploymentSchema.id,
373
+ PipelineDeploymentSchema.stack_id == self.stack_id,
374
+ )
375
+ custom_filters.append(stack_filter)
376
+
377
+ if self.build_id:
378
+ build_filter = and_(
379
+ RunTemplateSchema.source_deployment_id
380
+ == PipelineDeploymentSchema.id,
381
+ PipelineDeploymentSchema.build_id == self.build_id,
382
+ )
383
+ custom_filters.append(build_filter)
384
+
385
+ if self.pipeline_id:
386
+ pipeline_filter = and_(
387
+ RunTemplateSchema.source_deployment_id
388
+ == PipelineDeploymentSchema.id,
389
+ PipelineDeploymentSchema.pipeline_id == self.pipeline_id,
390
+ )
391
+ custom_filters.append(pipeline_filter)
392
+
393
+ return custom_filters
@@ -82,6 +82,9 @@ class ServerSettingsResponseBody(BaseResponseBody):
82
82
  display_updates: Optional[bool] = Field(
83
83
  title="Whether to display notifications about ZenML updates in the dashboard.",
84
84
  )
85
+ last_user_activity: datetime = Field(
86
+ title="The timestamp when the last user activity was detected.",
87
+ )
85
88
  updated: datetime = Field(
86
89
  title="The timestamp when this resource was last updated."
87
90
  )
@@ -179,6 +182,15 @@ class ServerSettingsResponse(
179
182
  """
180
183
  return self.get_body().active
181
184
 
185
+ @property
186
+ def last_user_activity(self) -> datetime:
187
+ """The `last_user_activity` property.
188
+
189
+ Returns:
190
+ the value of the property.
191
+ """
192
+ return self.get_body().last_user_activity
193
+
182
194
  @property
183
195
  def updated(self) -> datetime:
184
196
  """The `updated` property.
@@ -65,12 +65,6 @@ class UserBase(BaseModel):
65
65
  description="`null` if not answered, `true` if agreed, "
66
66
  "`false` if skipped.",
67
67
  )
68
- hub_token: Optional[str] = Field(
69
- default=None,
70
- title="JWT Token for the connected Hub account. Only relevant for user "
71
- "accounts.",
72
- max_length=STR_FIELD_MAX_LENGTH,
73
- )
74
68
  password: Optional[str] = Field(
75
69
  default=None,
76
70
  title="A password for the user.",
@@ -296,12 +290,6 @@ class UserResponseMetadata(BaseResponseMetadata):
296
290
  "for user accounts.",
297
291
  max_length=STR_FIELD_MAX_LENGTH,
298
292
  )
299
- hub_token: Optional[str] = Field(
300
- default=None,
301
- title="JWT Token for the connected Hub account. Only relevant for user "
302
- "accounts.",
303
- max_length=STR_FIELD_MAX_LENGTH,
304
- )
305
293
  external_user_id: Optional[UUID] = Field(
306
294
  default=None,
307
295
  title="The external user ID associated with the account. Only relevant "
@@ -416,15 +404,6 @@ class UserResponse(
416
404
  """
417
405
  return self.get_metadata().email
418
406
 
419
- @property
420
- def hub_token(self) -> Optional[str]:
421
- """The `hub_token` property.
422
-
423
- Returns:
424
- the value of the property.
425
- """
426
- return self.get_metadata().hub_token
427
-
428
407
  @property
429
408
  def external_user_id(self) -> Optional[UUID]:
430
409
  """The `external_user_id` property.
@@ -13,7 +13,8 @@
13
13
  # permissions and limitations under the License.
14
14
  """Model definitions for ZenML servers."""
15
15
 
16
- from typing import Dict
16
+ from datetime import datetime
17
+ from typing import Dict, Optional
17
18
  from uuid import UUID, uuid4
18
19
 
19
20
  from pydantic import BaseModel, Field
@@ -103,6 +104,11 @@ class ServerModel(BaseModel):
103
104
  title="Flag to indicate whether the server is using the legacy dashboard.",
104
105
  )
105
106
 
107
+ last_user_activity: Optional[datetime] = Field(
108
+ None,
109
+ title="Timestamp of latest user activity traced on the server.",
110
+ )
111
+
106
112
  def is_local(self) -> bool:
107
113
  """Return whether the server is running locally.
108
114
 
@@ -72,9 +72,14 @@ class StackDeploymentConfig(BaseModel):
72
72
  title="A textual description for the cloud provider console URL.",
73
73
  )
74
74
  configuration: Optional[str] = Field(
75
+ default=None,
75
76
  title="Configuration for the stack deployment that the user must "
76
77
  "manually configure into the cloud provider console.",
77
78
  )
79
+ instructions: Optional[str] = Field(
80
+ default=None,
81
+ title="Instructions for deploying the stack.",
82
+ )
78
83
 
79
84
 
80
85
  class DeployedStack(BaseModel):
@@ -73,13 +73,6 @@ class UserAuthModel(BaseZenModel):
73
73
  "`false` if skipped.",
74
74
  )
75
75
 
76
- hub_token: Optional[str] = Field(
77
- default=None,
78
- title="JWT Token for the connected Hub account. Only relevant for user "
79
- "accounts.",
80
- max_length=STR_FIELD_MAX_LENGTH,
81
- )
82
-
83
76
  @classmethod
84
77
  def _get_crypt_context(cls) -> "CryptContext":
85
78
  """Returns the password encryption context.