zenml-nightly 0.58.2.dev20240626__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.
- README.md +30 -9
- RELEASE_NOTES.md +240 -0
- zenml/VERSION +1 -1
- zenml/analytics/enums.py +3 -0
- zenml/cli/__init__.py +28 -0
- zenml/cli/artifact.py +1 -2
- zenml/cli/integration.py +9 -8
- zenml/cli/server.py +6 -0
- zenml/cli/stack.py +946 -39
- zenml/cli/stack_components.py +7 -0
- zenml/cli/text_utils.py +35 -1
- zenml/cli/utils.py +127 -10
- zenml/client.py +23 -14
- zenml/config/docker_settings.py +8 -5
- zenml/constants.py +10 -1
- zenml/container_registries/base_container_registry.py +1 -0
- zenml/enums.py +7 -0
- zenml/event_hub/event_hub.py +5 -8
- zenml/integrations/aws/__init__.py +1 -0
- zenml/integrations/azure/__init__.py +1 -0
- zenml/integrations/deepchecks/__init__.py +1 -0
- zenml/integrations/discord/__init__.py +1 -0
- zenml/integrations/evidently/__init__.py +1 -0
- zenml/integrations/facets/__init__.py +1 -0
- zenml/integrations/feast/__init__.py +1 -0
- zenml/integrations/gcp/__init__.py +3 -1
- zenml/integrations/gcp/google_credentials_mixin.py +1 -1
- zenml/integrations/gcp/service_connectors/gcp_service_connector.py +320 -64
- zenml/integrations/huggingface/__init__.py +1 -0
- zenml/integrations/integration.py +24 -0
- zenml/integrations/kubeflow/__init__.py +3 -0
- zenml/integrations/kubeflow/flavors/kubeflow_orchestrator_flavor.py +1 -1
- zenml/integrations/kubeflow/orchestrators/kubeflow_orchestrator.py +0 -1
- zenml/integrations/kubernetes/__init__.py +3 -1
- zenml/integrations/kubernetes/orchestrators/kube_utils.py +4 -1
- zenml/integrations/label_studio/annotators/label_studio_annotator.py +1 -0
- zenml/integrations/langchain/__init__.py +1 -0
- zenml/integrations/mlflow/__init__.py +3 -1
- zenml/integrations/neural_prophet/__init__.py +1 -0
- zenml/integrations/polars/__init__.py +1 -0
- zenml/integrations/prodigy/__init__.py +1 -0
- zenml/integrations/pycaret/__init__.py +6 -0
- zenml/integrations/registry.py +37 -0
- zenml/integrations/s3/artifact_stores/s3_artifact_store.py +17 -6
- zenml/integrations/seldon/__init__.py +1 -0
- zenml/integrations/seldon/model_deployers/seldon_model_deployer.py +1 -0
- zenml/integrations/skypilot/flavors/skypilot_orchestrator_base_vm_config.py +2 -2
- zenml/integrations/skypilot/orchestrators/skypilot_base_vm_orchestrator.py +1 -1
- zenml/integrations/skypilot/orchestrators/skypilot_orchestrator_entrypoint.py +2 -2
- zenml/integrations/skypilot_aws/__init__.py +2 -1
- zenml/integrations/skypilot_azure/__init__.py +1 -1
- zenml/integrations/skypilot_gcp/__init__.py +1 -1
- zenml/integrations/skypilot_lambda/__init__.py +1 -1
- zenml/integrations/skypilot_lambda/flavors/skypilot_orchestrator_lambda_vm_flavor.py +1 -1
- zenml/integrations/slack/__init__.py +1 -0
- zenml/integrations/tekton/__init__.py +1 -0
- zenml/integrations/tensorboard/__init__.py +0 -1
- zenml/integrations/tensorflow/__init__.py +18 -6
- zenml/integrations/wandb/__init__.py +1 -0
- zenml/models/__init__.py +11 -0
- zenml/models/v2/core/component.py +18 -0
- zenml/models/v2/core/model.py +1 -2
- zenml/models/v2/core/service_connector.py +17 -0
- zenml/models/v2/core/stack.py +31 -0
- zenml/models/v2/misc/full_stack.py +97 -0
- zenml/models/v2/misc/stack_deployment.py +86 -0
- zenml/new/pipelines/pipeline.py +1 -1
- zenml/orchestrators/input_utils.py +3 -6
- zenml/stack/stack.py +3 -6
- zenml/stack_deployments/__init__.py +14 -0
- zenml/stack_deployments/aws_stack_deployment.py +254 -0
- zenml/stack_deployments/gcp_stack_deployment.py +260 -0
- zenml/stack_deployments/stack_deployment.py +208 -0
- zenml/stack_deployments/utils.py +44 -0
- zenml/utils/function_utils.py +1 -1
- zenml/utils/pagination_utils.py +7 -5
- zenml/utils/pipeline_docker_image_builder.py +97 -68
- zenml/utils/pydantic_utils.py +6 -5
- zenml/zen_server/cloud_utils.py +18 -3
- zenml/zen_server/dashboard/assets/{404-CDPQCl4D.js → 404-DpJaNHKF.js} +1 -1
- zenml/zen_server/dashboard/assets/@radix-CFOkMR_E.js +85 -0
- zenml/zen_server/dashboard/assets/{@react-router-DYovave8.js → @react-router-CO-OsFwI.js} +2 -2
- zenml/zen_server/dashboard/assets/{@reactflow-CHBapDaj.js → @reactflow-DJfzkHO1.js} +2 -2
- zenml/zen_server/dashboard/assets/@tanstack-DYiOyJUL.js +22 -0
- zenml/zen_server/dashboard/assets/AwarenessChannel-BYDLT2xC.js +1 -0
- zenml/zen_server/dashboard/assets/{CodeSnippet-BidtnWOi.js → CodeSnippet-BkOuRmyq.js} +2 -2
- zenml/zen_server/dashboard/assets/Commands-ZvWR1BRs.js +1 -0
- zenml/zen_server/dashboard/assets/CopyButton-DVwLkafa.js +2 -0
- zenml/zen_server/dashboard/assets/{CsvVizualization-BOuez-fG.js → CsvVizualization-C2IiqX4I.js} +7 -7
- zenml/zen_server/dashboard/assets/DisplayDate-DYgIjlDF.js +1 -0
- zenml/zen_server/dashboard/assets/EmptyState-BMLnFVlB.js +1 -0
- zenml/zen_server/dashboard/assets/Error-CqX0VqW_.js +1 -0
- zenml/zen_server/dashboard/assets/ExecutionStatus-BoLUXR9t.js +1 -0
- zenml/zen_server/dashboard/assets/Helpbox-LFydyVwh.js +1 -0
- zenml/zen_server/dashboard/assets/Infobox-DnENC0sh.js +1 -0
- zenml/zen_server/dashboard/assets/InlineAvatar-CbJtYr0t.js +1 -0
- zenml/zen_server/dashboard/assets/{MarkdownVisualization-DsB2QZiK.js → MarkdownVisualization-xp3hhULl.js} +2 -2
- zenml/zen_server/dashboard/assets/Pagination-DEbVUupy.js +1 -0
- zenml/zen_server/dashboard/assets/PasswordChecker-DUveqlva.js +1 -0
- zenml/zen_server/dashboard/assets/SetPassword-BYBdbQDo.js +1 -0
- zenml/zen_server/dashboard/assets/SuccessStep-Nx743hll.js +1 -0
- zenml/zen_server/dashboard/assets/{UpdatePasswordSchemas-DnM-c11H.js → UpdatePasswordSchemas-DF9gSzE0.js} +1 -1
- zenml/zen_server/dashboard/assets/{aws-t0gKCj_R.js → aws-BgKTfTfx.js} +1 -1
- zenml/zen_server/dashboard/assets/{check-circle-BVvhm5dy.js → check-circle-i56092KI.js} +1 -1
- zenml/zen_server/dashboard/assets/{chevron-down-zcvCWmyP.js → chevron-down-D_ZlKMqH.js} +1 -1
- zenml/zen_server/dashboard/assets/{chevron-right-double-CJ50E9Gr.js → chevron-right-double-BiEMg7rd.js} +1 -1
- zenml/zen_server/dashboard/assets/cloud-only-DVbIeckv.js +1 -0
- zenml/zen_server/dashboard/assets/{copy-BRhQz3j-.js → copy-BXNk6BjL.js} +1 -1
- zenml/zen_server/dashboard/assets/{database-CRRnyFWh.js → database-1xWSgZfO.js} +1 -1
- zenml/zen_server/dashboard/assets/{docker-BAonhm6G.js → docker-CQMVm_4d.js} +1 -1
- zenml/zen_server/dashboard/assets/{file-text-CbVERUON.js → file-text-CqD_iu6l.js} +1 -1
- zenml/zen_server/dashboard/assets/{help-B8rqCvqn.js → help-bu_DgLKI.js} +1 -1
- zenml/zen_server/dashboard/assets/index-C_CrU4vI.js +1 -0
- zenml/zen_server/dashboard/assets/index-DK1ynKjA.js +55 -0
- zenml/zen_server/dashboard/assets/index-inApY3KQ.css +1 -0
- zenml/zen_server/dashboard/assets/index-rK_Wuy2W.js +1 -0
- zenml/zen_server/dashboard/assets/index.esm-Corw4lXQ.js +1 -0
- zenml/zen_server/dashboard/assets/{login-mutation-wzzl23C6.js → login-mutation-BUnVASxp.js} +1 -1
- zenml/zen_server/dashboard/assets/not-found-B4VnX8gK.js +1 -0
- zenml/zen_server/dashboard/assets/package-CsUhPmou.js +1 -0
- zenml/zen_server/dashboard/assets/{page-BmkSiYeQ.js → page-3efNCDeb.js} +2 -2
- zenml/zen_server/dashboard/assets/page-7zTHbhhI.js +1 -0
- zenml/zen_server/dashboard/assets/page-BEs6jK71.js +1 -0
- zenml/zen_server/dashboard/assets/page-BpSqIf4B.js +1 -0
- zenml/zen_server/dashboard/assets/{page-AQKopn_4.js → page-Bx6o0ARS.js} +1 -1
- zenml/zen_server/dashboard/assets/page-C43QGHTt.js +9 -0
- zenml/zen_server/dashboard/assets/page-CR0OG7ss.js +1 -0
- zenml/zen_server/dashboard/assets/page-CRTJ0UuR.js +1 -0
- zenml/zen_server/dashboard/assets/page-CUZIGO-3.js +1 -0
- zenml/zen_server/dashboard/assets/page-CaopxiU1.js +1 -0
- zenml/zen_server/dashboard/assets/{page-CuT1SUik.js → page-Cx67M0QT.js} +1 -1
- zenml/zen_server/dashboard/assets/page-D7Z399xy.js +1 -0
- zenml/zen_server/dashboard/assets/page-D93kd7Xj.js +1 -0
- zenml/zen_server/dashboard/assets/{page-BzVZGExK.js → page-DKlIdAe5.js} +1 -1
- zenml/zen_server/dashboard/assets/{page-Bi5AI0S7.js → page-DMOYZppS.js} +1 -1
- zenml/zen_server/dashboard/assets/page-DMsSn3dv.js +2 -0
- zenml/zen_server/dashboard/assets/{page-BW6Ket3a.js → page-Dc_7KMQE.js} +1 -1
- zenml/zen_server/dashboard/assets/page-DvCvroOM.js +1 -0
- zenml/zen_server/dashboard/assets/page-Hus2pr9T.js +1 -0
- zenml/zen_server/dashboard/assets/page-JyfeDUfu.js +1 -0
- zenml/zen_server/dashboard/assets/{page-yN4rZ-ZS.js → page-Sxn82W-5.js} +1 -1
- zenml/zen_server/dashboard/assets/page-TKXERe16.js +1 -0
- zenml/zen_server/dashboard/assets/page-Xu8JEjSU.js +1 -0
- zenml/zen_server/dashboard/assets/{play-circle-DK5QMJyp.js → play-circle-CNtZKDnW.js} +1 -1
- zenml/zen_server/dashboard/assets/plus-DOeLmm7C.js +1 -0
- zenml/zen_server/dashboard/assets/{terminal-B2ovgWuz.js → terminal-By9cErXc.js} +1 -1
- zenml/zen_server/dashboard/assets/{update-server-settings-mutation-0Wgz8pUE.js → update-server-settings-mutation-CR8e3Sir.js} +1 -1
- zenml/zen_server/dashboard/assets/{url-6_xv0WJS.js → url-DuQMeqYA.js} +1 -1
- zenml/zen_server/dashboard/assets/{zod-DrZvVLjd.js → zod-BhoGpZ63.js} +1 -1
- zenml/zen_server/dashboard/index.html +7 -7
- zenml/zen_server/dashboard_legacy/asset-manifest.json +4 -4
- zenml/zen_server/dashboard_legacy/index.html +1 -1
- zenml/zen_server/dashboard_legacy/{precache-manifest.f4abc5b7cfa7d90c1caf5521918e29a8.js → precache-manifest.c8c57fb0d2132b1d3c2119e776b7dfb3.js} +4 -4
- zenml/zen_server/dashboard_legacy/service-worker.js +1 -1
- zenml/zen_server/dashboard_legacy/static/js/{main.ac2f17d0.chunk.js → main.382439a7.chunk.js} +2 -2
- zenml/zen_server/dashboard_legacy/static/js/{main.ac2f17d0.chunk.js.map → main.382439a7.chunk.js.map} +1 -1
- zenml/zen_server/deploy/helm/Chart.yaml +1 -1
- zenml/zen_server/deploy/helm/README.md +2 -2
- zenml/zen_server/feature_gate/zenml_cloud_feature_gate.py +11 -5
- zenml/zen_server/pipeline_deployment/utils.py +57 -44
- zenml/zen_server/rbac/zenml_cloud_rbac.py +11 -5
- zenml/zen_server/routers/stack_deployment_endpoints.py +158 -0
- zenml/zen_server/routers/workspaces_endpoints.py +64 -0
- zenml/zen_server/zen_server_api.py +2 -0
- zenml/zen_stores/migrations/utils.py +1 -1
- zenml/zen_stores/migrations/versions/0.60.0_release.py +23 -0
- zenml/zen_stores/migrations/versions/0.61.0_release.py +23 -0
- zenml/zen_stores/migrations/versions/0d707865f404_adding_labels_to_stacks.py +30 -0
- zenml/zen_stores/rest_zen_store.py +145 -4
- zenml/zen_stores/schemas/stack_schemas.py +10 -0
- zenml/zen_stores/schemas/step_run_schemas.py +27 -11
- zenml/zen_stores/sql_zen_store.py +300 -6
- zenml/zen_stores/zen_store_interface.py +80 -0
- {zenml_nightly-0.58.2.dev20240626.dist-info → zenml_nightly-0.61.0.dev20240712.dist-info}/METADATA +32 -10
- {zenml_nightly-0.58.2.dev20240626.dist-info → zenml_nightly-0.61.0.dev20240712.dist-info}/RECORD +178 -162
- zenml/zen_server/dashboard/assets/@radix-C9DBgJhe.js +0 -77
- zenml/zen_server/dashboard/assets/@tanstack-CEbkxrhX.js +0 -30
- zenml/zen_server/dashboard/assets/AwarenessChannel-nXGpmj_f.js +0 -1
- zenml/zen_server/dashboard/assets/Cards-nwsvQLVS.js +0 -1
- zenml/zen_server/dashboard/assets/Commands-DuIWKg_Q.js +0 -1
- zenml/zen_server/dashboard/assets/CopyButton-B_YSm-Ds.js +0 -2
- zenml/zen_server/dashboard/assets/DisplayDate-BdguISQF.js +0 -1
- zenml/zen_server/dashboard/assets/EmptyState-BkooiGtL.js +0 -1
- zenml/zen_server/dashboard/assets/Error-B6M0dPph.js +0 -1
- zenml/zen_server/dashboard/assets/Helpbox-BQoqCm04.js +0 -1
- zenml/zen_server/dashboard/assets/Infobox-Ce9mefqU.js +0 -1
- zenml/zen_server/dashboard/assets/InlineAvatar-DGf3dVhV.js +0 -1
- zenml/zen_server/dashboard/assets/PageHeader-DGaemzjc.js +0 -1
- zenml/zen_server/dashboard/assets/Pagination-DVYfBCCc.js +0 -1
- zenml/zen_server/dashboard/assets/PasswordChecker-DSLBp7Vl.js +0 -1
- zenml/zen_server/dashboard/assets/SetPassword-B5s7DJug.js +0 -1
- zenml/zen_server/dashboard/assets/SuccessStep-ZzczaM7g.js +0 -1
- zenml/zen_server/dashboard/assets/cloud-only-Ba_ShBR5.js +0 -1
- zenml/zen_server/dashboard/assets/index-CWJ3xbIf.css +0 -1
- zenml/zen_server/dashboard/assets/index-QORVVTMN.js +0 -55
- zenml/zen_server/dashboard/assets/index.esm-F7nqy9zY.js +0 -1
- zenml/zen_server/dashboard/assets/not-found-Dh2la7kh.js +0 -1
- zenml/zen_server/dashboard/assets/page-B-5jAKoO.js +0 -1
- zenml/zen_server/dashboard/assets/page-B-vWk8a6.js +0 -1
- zenml/zen_server/dashboard/assets/page-B0BrqfS8.js +0 -1
- zenml/zen_server/dashboard/assets/page-BQxVFlUl.js +0 -1
- zenml/zen_server/dashboard/assets/page-ByrHy6Ss.js +0 -1
- zenml/zen_server/dashboard/assets/page-CPtY4Kv_.js +0 -1
- zenml/zen_server/dashboard/assets/page-CmmukLsl.js +0 -1
- zenml/zen_server/dashboard/assets/page-D2D-7qyr.js +0 -9
- zenml/zen_server/dashboard/assets/page-DAQQyLxT.js +0 -1
- zenml/zen_server/dashboard/assets/page-DHkUMl_E.js +0 -1
- zenml/zen_server/dashboard/assets/page-DZCbwOEs.js +0 -2
- zenml/zen_server/dashboard/assets/page-DdaIt20-.js +0 -1
- zenml/zen_server/dashboard/assets/page-LqLs24Ot.js +0 -1
- zenml/zen_server/dashboard/assets/page-lebv0c7C.js +0 -1
- {zenml_nightly-0.58.2.dev20240626.dist-info → zenml_nightly-0.61.0.dev20240712.dist-info}/LICENSE +0 -0
- {zenml_nightly-0.58.2.dev20240626.dist-info → zenml_nightly-0.61.0.dev20240712.dist-info}/WHEEL +0 -0
- {zenml_nightly-0.58.2.dev20240626.dist-info → zenml_nightly-0.61.0.dev20240712.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,260 @@
|
|
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 GCP."""
|
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
|
+
|
22
|
+
GCP_DEPLOYMENT_TYPE = "deployment-manager"
|
23
|
+
|
24
|
+
|
25
|
+
class GCPZenMLCloudStackDeployment(ZenMLCloudStackDeployment):
|
26
|
+
"""GCP ZenML Cloud Stack Deployment."""
|
27
|
+
|
28
|
+
provider: ClassVar[StackDeploymentProvider] = StackDeploymentProvider.GCP
|
29
|
+
deployment: ClassVar[str] = GCP_DEPLOYMENT_TYPE
|
30
|
+
|
31
|
+
@classmethod
|
32
|
+
def description(cls) -> str:
|
33
|
+
"""Return a description of the ZenML Cloud Stack Deployment.
|
34
|
+
|
35
|
+
This will be displayed when the user is prompted to deploy
|
36
|
+
the ZenML stack.
|
37
|
+
|
38
|
+
Returns:
|
39
|
+
A MarkDown description of the ZenML Cloud Stack Deployment.
|
40
|
+
"""
|
41
|
+
return """
|
42
|
+
Provision and register a basic GCP ZenML stack authenticated and connected to
|
43
|
+
all the necessary cloud infrastructure resources required to run pipelines in
|
44
|
+
GCP.
|
45
|
+
"""
|
46
|
+
|
47
|
+
@classmethod
|
48
|
+
def instructions(cls) -> str:
|
49
|
+
"""Return instructions on how to deploy the ZenML stack to the specified cloud provider.
|
50
|
+
|
51
|
+
This will be displayed before the user is prompted to deploy the ZenML
|
52
|
+
stack.
|
53
|
+
|
54
|
+
Returns:
|
55
|
+
MarkDown instructions on how to deploy the ZenML stack to the
|
56
|
+
specified cloud provider.
|
57
|
+
"""
|
58
|
+
return """
|
59
|
+
You will be redirected to a GCP Cloud Shell console in your browser where you'll
|
60
|
+
be asked to log into your GCP project and then create a Deployment Manager
|
61
|
+
deployment to provision the necessary cloud resources for ZenML.
|
62
|
+
|
63
|
+
**NOTE**: The Deployment Manager deployment will create the following new
|
64
|
+
resources in your GCP project. Please ensure you have the necessary permissions
|
65
|
+
and are aware of any potential costs:
|
66
|
+
|
67
|
+
- A GCS bucket registered as a [ZenML artifact store](https://docs.zenml.io/stack-components/artifact-stores/gcp).
|
68
|
+
- A Google Artifact Registry registered as a [ZenML container registry](https://docs.zenml.io/stack-components/container-registries/gcp).
|
69
|
+
- Vertex AI registered as a [ZenML orchestrator](https://docs.zenml.io/stack-components/orchestrators/vertex).
|
70
|
+
- GCP Cloud Build registered as a [ZenML image builder](https://docs.zenml.io/stack-components/image-builders/gcp).
|
71
|
+
- A GCP Service Account with the minimum necessary permissions to access the
|
72
|
+
above resources.
|
73
|
+
- An GCP Service Account access key used to give access to ZenML to connect to
|
74
|
+
the above resources through a [ZenML service connector](https://docs.zenml.io/how-to/auth-management/gcp-service-connector).
|
75
|
+
|
76
|
+
The Deployment Manager deployment will automatically create a GCP Service
|
77
|
+
Account secret key and will share it with ZenML to give it permission to access
|
78
|
+
the resources created by the stack. You can revoke these permissions at any time
|
79
|
+
by deleting the Deployment Manager deployment in the GCP Cloud Console.
|
80
|
+
|
81
|
+
**Estimated costs**
|
82
|
+
|
83
|
+
A small training job would cost around: $0.60
|
84
|
+
|
85
|
+
These are rough estimates and actual costs may vary based on your usage and specific GCP pricing.
|
86
|
+
Some services may be eligible for the GCP Free Tier. Use [the GCP Pricing Calculator](https://cloud.google.com/products/calculator)
|
87
|
+
for a detailed estimate based on your usage.
|
88
|
+
|
89
|
+
⚠️ **The Cloud Shell session will warn you that the ZenML GitHub repository is
|
90
|
+
untrusted. We recommend that you review [the contents of the repository](https://github.com/zenml-io/zenml/tree/main/infra/gcp)
|
91
|
+
and then check the `Trust repo` checkbox to proceed with the deployment,
|
92
|
+
otherwise the Cloud Shell session will not be authenticated to access your
|
93
|
+
GCP projects. You will also get a chance to review the scripts that will be
|
94
|
+
executed in the Cloud Shell session before proceeding.**
|
95
|
+
|
96
|
+
💡 **After the Deployment Manager deployment is complete, you can close the Cloud
|
97
|
+
Shell session and return to the CLI to view details about the associated ZenML
|
98
|
+
stack automatically registered with ZenML.**
|
99
|
+
"""
|
100
|
+
|
101
|
+
@classmethod
|
102
|
+
def post_deploy_instructions(cls) -> str:
|
103
|
+
"""Return instructions on what to do after the deployment is complete.
|
104
|
+
|
105
|
+
This will be displayed after the deployment is complete.
|
106
|
+
|
107
|
+
Returns:
|
108
|
+
MarkDown instructions on what to do after the deployment is
|
109
|
+
complete.
|
110
|
+
"""
|
111
|
+
return """
|
112
|
+
The ZenML stack has been successfully deployed and registered. You can delete
|
113
|
+
the Deployment Manager deployment at any time to revoke ZenML's access to your
|
114
|
+
GCP project and to clean up the resources created by the stack by using
|
115
|
+
[the GCP Cloud Console](https://console.cloud.google.com/dm/deployments).
|
116
|
+
"""
|
117
|
+
|
118
|
+
@classmethod
|
119
|
+
def integrations(cls) -> List[str]:
|
120
|
+
"""Return the ZenML integrations required for the stack.
|
121
|
+
|
122
|
+
Returns:
|
123
|
+
The list of ZenML integrations that need to be installed for the
|
124
|
+
stack to be usable.
|
125
|
+
"""
|
126
|
+
return [
|
127
|
+
"gcp",
|
128
|
+
]
|
129
|
+
|
130
|
+
@classmethod
|
131
|
+
def permissions(cls) -> Dict[str, List[str]]:
|
132
|
+
"""Return the permissions granted to ZenML to access the cloud resources.
|
133
|
+
|
134
|
+
Returns:
|
135
|
+
The permissions granted to ZenML to access the cloud resources, as
|
136
|
+
a dictionary grouping permissions by resource.
|
137
|
+
"""
|
138
|
+
return {
|
139
|
+
"GCS Bucket": [
|
140
|
+
"roles/storage.objectUser",
|
141
|
+
],
|
142
|
+
"GCP Artifact Registry": [
|
143
|
+
"roles/artifactregistry.createOnPushWriter",
|
144
|
+
],
|
145
|
+
"Vertex AI (Client)": [
|
146
|
+
"roles/aiplatform.user",
|
147
|
+
],
|
148
|
+
"Vertex AI (Jobs)": [
|
149
|
+
"roles/aiplatform.serviceAgent",
|
150
|
+
],
|
151
|
+
"Cloud Build (Client)": [
|
152
|
+
"roles/cloudbuild.builds.editor",
|
153
|
+
],
|
154
|
+
}
|
155
|
+
|
156
|
+
@classmethod
|
157
|
+
def locations(cls) -> Dict[str, str]:
|
158
|
+
"""Return the locations where the ZenML stack can be deployed.
|
159
|
+
|
160
|
+
Returns:
|
161
|
+
The regions where the ZenML stack can be deployed as a map of region
|
162
|
+
names to region descriptions.
|
163
|
+
"""
|
164
|
+
# Return a list of all possible GCP regions
|
165
|
+
|
166
|
+
# Based on the AWS regions listed at
|
167
|
+
# https://cloud.google.com/about/locations
|
168
|
+
return {
|
169
|
+
"Africa (Johannesburg)": "africa-south1",
|
170
|
+
"Asia Pacific (Taiwan)": "asia-east1",
|
171
|
+
"Asia Pacific (Hong Kong)": "asia-east2",
|
172
|
+
"Asia Pacific (Tokyo)": "asia-northeast1",
|
173
|
+
"Asia Pacific (Osaka)": "asia-northeast2",
|
174
|
+
"Asia Pacific (Seoul)": "asia-northeast3",
|
175
|
+
"Asia Pacific (Mumbai)": "asia-south1",
|
176
|
+
"Asia Pacific (Delhi)": "asia-south2",
|
177
|
+
"Asia Pacific (Singapore)": "asia-southeast1",
|
178
|
+
"Asia Pacific (Jakarta)": "asia-southeast2",
|
179
|
+
"Australia (Sydney)": "australia-southeast1",
|
180
|
+
"Australia (Melbourne)": "australia-southeast2",
|
181
|
+
"Europe (Belgium)": "europe-west1",
|
182
|
+
"Europe (London)": "europe-west2",
|
183
|
+
"Europe (Frankfurt)": "europe-west3",
|
184
|
+
"Europe (Netherlands)": "europe-west4",
|
185
|
+
"Europe (Zurich)": "europe-west6",
|
186
|
+
"Europe (Milan)": "europe-west8",
|
187
|
+
"Europe (Paris)": "europe-west9",
|
188
|
+
"Europe (Berlin)": "europe-west10",
|
189
|
+
"Europe (Turin)": "europe-west12",
|
190
|
+
"Europe (Warsaw)": "europe-central2",
|
191
|
+
"Europe (Finland)": "europe-north1",
|
192
|
+
"Europe (Madrid)": "europe-southwest1",
|
193
|
+
"Middle East (Doha)": "me-central1",
|
194
|
+
"Middle East (Dubai)": "me-central2",
|
195
|
+
"Middle East (Tel Aviv)": "me-west1",
|
196
|
+
"North America (Montreal)": "northamerica-northeast1",
|
197
|
+
"North America (Toronto)": "northamerica-northeast2",
|
198
|
+
"South America (Sao Paulo)": "southamerica-east1",
|
199
|
+
"South America (Santiago)": "southamerica-west1",
|
200
|
+
"US Central (Iowa)": "us-central1",
|
201
|
+
"US East (South Carolina)": "us-east1",
|
202
|
+
"US East (Northern Virginia)": "us-east4",
|
203
|
+
"US East (Columbus)": "us-east5",
|
204
|
+
"US South (Dallas)": "us-south1",
|
205
|
+
"US West (Oregon)": "us-west1",
|
206
|
+
"US West (Los Angeles)": "us-west2",
|
207
|
+
"US West (Salt Lake City)": "us-west3",
|
208
|
+
"US West (Las Vegas)": "us-west4",
|
209
|
+
}
|
210
|
+
|
211
|
+
def get_deployment_config(
|
212
|
+
self,
|
213
|
+
) -> StackDeploymentConfig:
|
214
|
+
"""Return the configuration to deploy the ZenML stack to the specified cloud provider.
|
215
|
+
|
216
|
+
The configuration should include:
|
217
|
+
|
218
|
+
* a cloud provider console URL where the user will be redirected to
|
219
|
+
deploy the ZenML stack. The URL should include as many pre-filled
|
220
|
+
URL query parameters as possible.
|
221
|
+
* a textual description of the URL
|
222
|
+
* some deployment providers may require additional configuration
|
223
|
+
parameters to be passed to the cloud provider in addition to the
|
224
|
+
deployment URL query parameters. Where that is the case, this method
|
225
|
+
should also return a string that the user can copy and paste into the
|
226
|
+
cloud provider console to deploy the ZenML stack (e.g. a set of
|
227
|
+
environment variables, or YAML configuration snippet etc.).
|
228
|
+
|
229
|
+
Returns:
|
230
|
+
The configuration to deploy the ZenML stack to the specified cloud
|
231
|
+
provider.
|
232
|
+
"""
|
233
|
+
params = dict(
|
234
|
+
cloudshell_git_repo="https://github.com/zenml-io/zenml",
|
235
|
+
cloudshell_workspace="infra/gcp",
|
236
|
+
cloudshell_open_in_editor="gcp-gar-gcs-vertex.jinja,gcp-gar-gcs-vertex-deploy.sh",
|
237
|
+
cloudshell_tutorial="gcp-gar-gcs-vertex.md",
|
238
|
+
ephemeral="true",
|
239
|
+
# TODO: remove this before the branch is merged
|
240
|
+
cloudshell_git_branch="feature/prd-482-gcp-stack-deployment",
|
241
|
+
)
|
242
|
+
# Encode the parameters as URL query parameters
|
243
|
+
query_params = "&".join([f"{k}={v}" for k, v in params.items()])
|
244
|
+
url = (
|
245
|
+
f"https://shell.cloud.google.com/cloudshell/editor?{query_params}"
|
246
|
+
)
|
247
|
+
|
248
|
+
config = f"""
|
249
|
+
### BEGIN CONFIGURATION ###
|
250
|
+
ZENML_STACK_NAME={self.stack_name}
|
251
|
+
ZENML_STACK_REGION={self.location or "europe-west3"}
|
252
|
+
ZENML_SERVER_URL={self.zenml_server_url}
|
253
|
+
ZENML_SERVER_API_TOKEN={self.zenml_server_api_token}
|
254
|
+
### END CONFIGURATION ###
|
255
|
+
"""
|
256
|
+
return StackDeploymentConfig(
|
257
|
+
deployment_url=url,
|
258
|
+
deployment_url_text="GCP Cloud Shell Console",
|
259
|
+
configuration=config,
|
260
|
+
)
|
@@ -0,0 +1,208 @@
|
|
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 a cloud provider."""
|
15
|
+
|
16
|
+
import datetime
|
17
|
+
from abc import abstractmethod
|
18
|
+
from typing import ClassVar, Dict, List, Optional
|
19
|
+
|
20
|
+
from pydantic import BaseModel
|
21
|
+
|
22
|
+
from zenml.client import Client
|
23
|
+
from zenml.enums import StackComponentType, StackDeploymentProvider
|
24
|
+
from zenml.models import (
|
25
|
+
DeployedStack,
|
26
|
+
StackDeploymentConfig,
|
27
|
+
StackDeploymentInfo,
|
28
|
+
)
|
29
|
+
|
30
|
+
|
31
|
+
class ZenMLCloudStackDeployment(BaseModel):
|
32
|
+
"""ZenML Cloud Stack CLI Deployment base class."""
|
33
|
+
|
34
|
+
provider: ClassVar[StackDeploymentProvider]
|
35
|
+
deployment: ClassVar[str]
|
36
|
+
stack_name: str
|
37
|
+
zenml_server_url: str
|
38
|
+
zenml_server_api_token: str
|
39
|
+
location: Optional[str] = None
|
40
|
+
|
41
|
+
@classmethod
|
42
|
+
@abstractmethod
|
43
|
+
def description(cls) -> str:
|
44
|
+
"""Return a description of the ZenML Cloud Stack Deployment.
|
45
|
+
|
46
|
+
This will be displayed when the user is prompted to deploy
|
47
|
+
the ZenML stack.
|
48
|
+
|
49
|
+
Returns:
|
50
|
+
A MarkDown description of the ZenML Cloud Stack Deployment.
|
51
|
+
"""
|
52
|
+
|
53
|
+
@classmethod
|
54
|
+
@abstractmethod
|
55
|
+
def instructions(cls) -> str:
|
56
|
+
"""Return instructions on how to deploy the ZenML stack to the specified cloud provider.
|
57
|
+
|
58
|
+
This will be displayed before the user is prompted to deploy the ZenML
|
59
|
+
stack.
|
60
|
+
|
61
|
+
Returns:
|
62
|
+
MarkDown instructions on how to deploy the ZenML stack to the
|
63
|
+
specified cloud provider.
|
64
|
+
"""
|
65
|
+
|
66
|
+
@classmethod
|
67
|
+
@abstractmethod
|
68
|
+
def post_deploy_instructions(cls) -> str:
|
69
|
+
"""Return instructions on what to do after the deployment is complete.
|
70
|
+
|
71
|
+
This will be displayed after the deployment is complete.
|
72
|
+
|
73
|
+
Returns:
|
74
|
+
MarkDown instructions on what to do after the deployment is
|
75
|
+
complete.
|
76
|
+
"""
|
77
|
+
|
78
|
+
@classmethod
|
79
|
+
@abstractmethod
|
80
|
+
def integrations(cls) -> List[str]:
|
81
|
+
"""Return the ZenML integrations required for the stack.
|
82
|
+
|
83
|
+
Returns:
|
84
|
+
The list of ZenML integrations that need to be installed for the
|
85
|
+
stack to be usable.
|
86
|
+
"""
|
87
|
+
|
88
|
+
@classmethod
|
89
|
+
@abstractmethod
|
90
|
+
def permissions(cls) -> Dict[str, List[str]]:
|
91
|
+
"""Return the permissions granted to ZenML to access the cloud resources.
|
92
|
+
|
93
|
+
Returns:
|
94
|
+
The permissions granted to ZenML to access the cloud resources, as
|
95
|
+
a dictionary grouping permissions by resource.
|
96
|
+
"""
|
97
|
+
|
98
|
+
@classmethod
|
99
|
+
@abstractmethod
|
100
|
+
def locations(cls) -> Dict[str, str]:
|
101
|
+
"""Return the locations where the ZenML stack can be deployed.
|
102
|
+
|
103
|
+
Returns:
|
104
|
+
The regions where the ZenML stack can be deployed as a map of region
|
105
|
+
names to region descriptions.
|
106
|
+
"""
|
107
|
+
|
108
|
+
@classmethod
|
109
|
+
def get_deployment_info(cls) -> StackDeploymentInfo:
|
110
|
+
"""Return information about the ZenML Cloud Stack Deployment.
|
111
|
+
|
112
|
+
Returns:
|
113
|
+
Information about the ZenML Cloud Stack Deployment.
|
114
|
+
"""
|
115
|
+
return StackDeploymentInfo(
|
116
|
+
provider=cls.provider,
|
117
|
+
description=cls.description(),
|
118
|
+
instructions=cls.instructions(),
|
119
|
+
post_deploy_instructions=cls.post_deploy_instructions(),
|
120
|
+
integrations=cls.integrations(),
|
121
|
+
permissions=cls.permissions(),
|
122
|
+
locations=cls.locations(),
|
123
|
+
)
|
124
|
+
|
125
|
+
@abstractmethod
|
126
|
+
def get_deployment_config(
|
127
|
+
self,
|
128
|
+
) -> StackDeploymentConfig:
|
129
|
+
"""Return the configuration to deploy the ZenML stack to the specified cloud provider.
|
130
|
+
|
131
|
+
The configuration should include:
|
132
|
+
|
133
|
+
* a cloud provider console URL where the user will be redirected to
|
134
|
+
deploy the ZenML stack. The URL should include as many pre-filled
|
135
|
+
URL query parameters as possible.
|
136
|
+
* a textual description of the URL
|
137
|
+
* some deployment providers may require additional configuration
|
138
|
+
parameters to be passed to the cloud provider in addition to the
|
139
|
+
deployment URL query parameters. Where that is the case, this method
|
140
|
+
should also return a string that the user can copy and paste into the
|
141
|
+
cloud provider console to deploy the ZenML stack (e.g. a set of
|
142
|
+
environment variables, or YAML configuration snippet etc.).
|
143
|
+
|
144
|
+
Returns:
|
145
|
+
The configuration to deploy the ZenML stack to the specified cloud
|
146
|
+
provider.
|
147
|
+
"""
|
148
|
+
|
149
|
+
def get_stack(
|
150
|
+
self, date_start: Optional[datetime.datetime] = None
|
151
|
+
) -> Optional[DeployedStack]:
|
152
|
+
"""Return the ZenML stack that was deployed and registered.
|
153
|
+
|
154
|
+
This method is called to retrieve a ZenML stack matching the deployment
|
155
|
+
provider.
|
156
|
+
|
157
|
+
Args:
|
158
|
+
date_start: The date when the deployment started.
|
159
|
+
|
160
|
+
Returns:
|
161
|
+
The ZenML stack that was deployed and registered or None if a
|
162
|
+
matching stack was not found.
|
163
|
+
"""
|
164
|
+
client = Client()
|
165
|
+
|
166
|
+
# It's difficult to find a stack that matches the CloudFormation
|
167
|
+
# deployment 100% because the user can change the stack name before they
|
168
|
+
# deploy the stack in GCP.
|
169
|
+
#
|
170
|
+
# We try to find a full GCP stack that matches the deployment provider
|
171
|
+
# that was registered after this deployment was created.
|
172
|
+
|
173
|
+
# Get all stacks created after the start date
|
174
|
+
stacks = client.list_stacks(
|
175
|
+
created=f"gt:{str(date_start.replace(microsecond=0))}"
|
176
|
+
if date_start
|
177
|
+
else None,
|
178
|
+
sort_by="desc:created",
|
179
|
+
size=50,
|
180
|
+
)
|
181
|
+
|
182
|
+
if not stacks.items:
|
183
|
+
return None
|
184
|
+
|
185
|
+
# Find a stack that best matches the deployment provider
|
186
|
+
for stack in stacks.items:
|
187
|
+
if not stack.labels:
|
188
|
+
continue
|
189
|
+
|
190
|
+
if stack.labels.get("zenml:provider") != self.provider.value:
|
191
|
+
continue
|
192
|
+
|
193
|
+
if stack.labels.get("zenml:deployment") != self.deployment:
|
194
|
+
continue
|
195
|
+
|
196
|
+
artifact_store = stack.components[
|
197
|
+
StackComponentType.ARTIFACT_STORE
|
198
|
+
][0]
|
199
|
+
|
200
|
+
if not artifact_store.connector:
|
201
|
+
continue
|
202
|
+
|
203
|
+
return DeployedStack(
|
204
|
+
stack=stack,
|
205
|
+
service_connector=artifact_store.connector,
|
206
|
+
)
|
207
|
+
|
208
|
+
return None
|
@@ -0,0 +1,44 @@
|
|
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 a cloud provider."""
|
15
|
+
|
16
|
+
from typing import Type
|
17
|
+
|
18
|
+
from zenml.enums import StackDeploymentProvider
|
19
|
+
from zenml.stack_deployments.aws_stack_deployment import (
|
20
|
+
AWSZenMLCloudStackDeployment,
|
21
|
+
)
|
22
|
+
from zenml.stack_deployments.gcp_stack_deployment import (
|
23
|
+
GCPZenMLCloudStackDeployment,
|
24
|
+
)
|
25
|
+
from zenml.stack_deployments.stack_deployment import ZenMLCloudStackDeployment
|
26
|
+
|
27
|
+
STACK_DEPLOYMENT_PROVIDERS = {
|
28
|
+
StackDeploymentProvider.AWS: AWSZenMLCloudStackDeployment,
|
29
|
+
StackDeploymentProvider.GCP: GCPZenMLCloudStackDeployment,
|
30
|
+
}
|
31
|
+
|
32
|
+
|
33
|
+
def get_stack_deployment_class(
|
34
|
+
provider: StackDeploymentProvider,
|
35
|
+
) -> Type[ZenMLCloudStackDeployment]:
|
36
|
+
"""Get the ZenML Cloud Stack Deployment class for the specified provider.
|
37
|
+
|
38
|
+
Args:
|
39
|
+
provider: The stack deployment provider.
|
40
|
+
|
41
|
+
Returns:
|
42
|
+
The ZenML Cloud Stack Deployment class for the specified provider.
|
43
|
+
"""
|
44
|
+
return STACK_DEPLOYMENT_PROVIDERS[provider]
|
zenml/utils/function_utils.py
CHANGED
@@ -146,7 +146,7 @@ def _cli_wrapped_function(func: F) -> F:
|
|
146
146
|
if _is_valid_optional_arg(arg_type):
|
147
147
|
arg_type = arg_type.__args__[0]
|
148
148
|
arg_name = _cli_arg_name(arg_name)
|
149
|
-
if arg_type
|
149
|
+
if arg_type is bool:
|
150
150
|
options.append(
|
151
151
|
click.option(
|
152
152
|
f"--{arg_name}",
|
zenml/utils/pagination_utils.py
CHANGED
@@ -13,7 +13,7 @@
|
|
13
13
|
# permissions and limitations under the License.
|
14
14
|
"""Pagination utilities."""
|
15
15
|
|
16
|
-
from typing import Callable, List, TypeVar
|
16
|
+
from typing import Any, Callable, List, TypeVar
|
17
17
|
|
18
18
|
from zenml.models import BaseIdentifiedResponse, Page
|
19
19
|
|
@@ -21,20 +21,22 @@ AnyResponse = TypeVar("AnyResponse", bound=BaseIdentifiedResponse) # type: igno
|
|
21
21
|
|
22
22
|
|
23
23
|
def depaginate(
|
24
|
-
list_method: Callable[..., Page[AnyResponse]],
|
24
|
+
list_method: Callable[..., Page[AnyResponse]], **kwargs: Any
|
25
25
|
) -> List[AnyResponse]:
|
26
26
|
"""Depaginate the results from a client or store method that returns pages.
|
27
27
|
|
28
28
|
Args:
|
29
|
-
list_method: The list method to
|
29
|
+
list_method: The list method to depaginate.
|
30
|
+
**kwargs: Arguments for the list method.
|
30
31
|
|
31
32
|
Returns:
|
32
33
|
A list of the corresponding Response Models.
|
33
34
|
"""
|
34
|
-
page = list_method()
|
35
|
+
page = list_method(**kwargs)
|
35
36
|
items = list(page.items)
|
36
37
|
while page.index < page.total_pages:
|
37
|
-
page =
|
38
|
+
kwargs["page"] = page.index + 1
|
39
|
+
page = list_method(**kwargs)
|
38
40
|
items += list(page.items)
|
39
41
|
|
40
42
|
return items
|