zenml-nightly 0.62.0.dev20240729__py3-none-any.whl → 0.63.0.dev20240731__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 +1 -1
- RELEASE_NOTES.md +41 -0
- zenml/VERSION +1 -1
- zenml/actions/pipeline_run/pipeline_run_action.py +19 -17
- zenml/analytics/enums.py +4 -0
- zenml/cli/__init__.py +28 -15
- zenml/cli/base.py +1 -1
- zenml/cli/pipeline.py +54 -61
- zenml/cli/stack.py +6 -8
- zenml/client.py +232 -99
- zenml/config/compiler.py +14 -22
- zenml/config/pipeline_run_configuration.py +3 -0
- zenml/config/server_config.py +3 -0
- zenml/config/source.py +2 -1
- zenml/constants.py +2 -0
- zenml/enums.py +3 -0
- zenml/integrations/aws/orchestrators/sagemaker_orchestrator.py +13 -4
- zenml/integrations/databricks/flavors/databricks_orchestrator_flavor.py +11 -2
- zenml/integrations/databricks/orchestrators/databricks_orchestrator.py +19 -13
- zenml/models/__init__.py +26 -10
- zenml/models/v2/base/filter.py +32 -0
- zenml/models/v2/core/pipeline.py +73 -89
- zenml/models/v2/core/pipeline_build.py +15 -11
- zenml/models/v2/core/pipeline_deployment.py +56 -0
- zenml/models/v2/core/pipeline_run.py +52 -1
- zenml/models/v2/core/run_template.py +393 -0
- zenml/models/v2/misc/stack_deployment.py +5 -0
- zenml/new/pipelines/build_utils.py +34 -58
- zenml/new/pipelines/pipeline.py +17 -76
- zenml/new/pipelines/run_utils.py +12 -0
- zenml/post_execution/pipeline.py +1 -4
- zenml/service_connectors/service_connector_utils.py +4 -2
- zenml/stack_deployments/aws_stack_deployment.py +6 -5
- zenml/stack_deployments/azure_stack_deployment.py +118 -11
- zenml/stack_deployments/gcp_stack_deployment.py +12 -5
- zenml/stack_deployments/stack_deployment.py +6 -5
- zenml/steps/utils.py +0 -4
- zenml/utils/package_utils.py +39 -0
- zenml/zen_server/dashboard/assets/{404-B_YdvmwS.js → 404-CI13wQp4.js} +1 -1
- zenml/zen_server/dashboard/assets/{@reactflow-l_1hUr1S.js → @reactflow-DIYUhKYX.js} +1 -1
- zenml/zen_server/dashboard/assets/{@tanstack-DYiOyJUL.js → @tanstack-k96lU_C-.js} +4 -4
- zenml/zen_server/dashboard/assets/{AwarenessChannel-CFg5iX4Z.js → AwarenessChannel-BNg5uWgI.js} +1 -1
- zenml/zen_server/dashboard/assets/{CodeSnippet-Dvkx_82E.js → CodeSnippet-Cyp7f4dM.js} +2 -2
- zenml/zen_server/dashboard/assets/CollapsibleCard-Cu_A9W57.js +1 -0
- zenml/zen_server/dashboard/assets/{Commands-DoN1xrEq.js → Commands-DmQwTXjj.js} +1 -1
- zenml/zen_server/dashboard/assets/{CopyButton-Cr7xYEPb.js → CopyButton-B3sWVJ4Z.js} +1 -1
- zenml/zen_server/dashboard/assets/{CsvVizualization-Ck-nZ43m.js → CsvVizualization-BvqItd-O.js} +1 -1
- zenml/zen_server/dashboard/assets/{Error-kLtljEOM.js → Error-DbXCTGua.js} +1 -1
- zenml/zen_server/dashboard/assets/{ExecutionStatus-DguLLgTK.js → ExecutionStatus-9zM7eaLh.js} +1 -1
- zenml/zen_server/dashboard/assets/{Helpbox-BXUMP21n.js → Helpbox-BIiNc-uH.js} +1 -1
- zenml/zen_server/dashboard/assets/{Infobox-DSt0O-dm.js → Infobox-iv1Nu1A0.js} +1 -1
- zenml/zen_server/dashboard/assets/{InlineAvatar-xsrsIGE-.js → InlineAvatar-BvBtO2Dp.js} +1 -1
- zenml/zen_server/dashboard/assets/ProviderRadio-pSAvrGRS.js +1 -0
- zenml/zen_server/dashboard/assets/SearchField-CXoBknpt.js +1 -0
- zenml/zen_server/dashboard/assets/{SetPassword-BXGTWiwj.js → SetPassword-BOxpgh6N.js} +1 -1
- zenml/zen_server/dashboard/assets/{SuccessStep-DZC60t0x.js → SuccessStep-CTSKN2lp.js} +1 -1
- zenml/zen_server/dashboard/assets/Tick-Bnr2TpW6.js +1 -0
- zenml/zen_server/dashboard/assets/{UpdatePasswordSchemas-DGvwFWO1.js → UpdatePasswordSchemas-BeCeaRW5.js} +1 -1
- zenml/zen_server/dashboard/assets/chevron-down-D_ZlKMqH.js +1 -0
- zenml/zen_server/dashboard/assets/{cloud-only-C_yFCAkP.js → cloud-only-qelmY92E.js} +1 -1
- zenml/zen_server/dashboard/assets/components-DWe4cTjS.js +1 -0
- zenml/zen_server/dashboard/assets/dots-horizontal-BObFzD5l.js +1 -0
- zenml/zen_server/dashboard/assets/{index-BczVOqUf.js → index-KsTz2dHG.js} +5 -5
- zenml/zen_server/dashboard/assets/index-vfjX_fJV.css +1 -0
- zenml/zen_server/dashboard/assets/index.esm-CbHNSeVw.js +1 -0
- zenml/zen_server/dashboard/assets/{login-mutation-CrHrndTI.js → login-mutation-DRpbESS7.js} +1 -1
- zenml/zen_server/dashboard/assets/{not-found-DYa4pC-C.js → not-found-Dfx9hfkf.js} +1 -1
- zenml/zen_server/dashboard/assets/package-ClbU3KUi.js +1 -0
- zenml/zen_server/dashboard/assets/{page-uA5prJGY.js → page-399pVZHU.js} +1 -1
- zenml/zen_server/dashboard/assets/{page-1h_sD1jz.js → page-BoFtUD9H.js} +1 -1
- zenml/zen_server/dashboard/assets/{page-BDns21Iz.js → page-Btu39x7k.js} +1 -1
- zenml/zen_server/dashboard/assets/{page-BnaevhnB.js → page-BxiWdeyg.js} +1 -1
- zenml/zen_server/dashboard/assets/{page-1iL8aMqs.js → page-C176KxyB.js} +1 -1
- zenml/zen_server/dashboard/assets/page-C6tXXjnK.js +1 -0
- zenml/zen_server/dashboard/assets/{page-BkeAAYwp.js → page-CDgZmwxP.js} +1 -1
- zenml/zen_server/dashboard/assets/page-CP9obrnG.js +1 -0
- zenml/zen_server/dashboard/assets/{page-C6-UGEbH.js → page-CZe9GEBF.js} +1 -1
- zenml/zen_server/dashboard/assets/page-CaTOsNNw.js +1 -0
- zenml/zen_server/dashboard/assets/{page-CCNRIt_f.js → page-Cjn97HMv.js} +1 -1
- zenml/zen_server/dashboard/assets/page-CmXmB_5i.js +1 -0
- zenml/zen_server/dashboard/assets/page-CvGAOfad.js +1 -0
- zenml/zen_server/dashboard/assets/page-CzucfYPo.js +2 -0
- zenml/zen_server/dashboard/assets/{page-Bi-wtWiO.js → page-D0bbc-qr.js} +1 -1
- zenml/zen_server/dashboard/assets/page-DLEtD2ex.js +1 -0
- zenml/zen_server/dashboard/assets/{page-BhgCDInH.js → page-DVPxY5fT.js} +1 -1
- zenml/zen_server/dashboard/assets/{page-BkuQDIf-.js → page-DYBNGxJt.js} +1 -1
- zenml/zen_server/dashboard/assets/{page-8a4UMKXZ.js → page-DtpwnNXq.js} +1 -1
- zenml/zen_server/dashboard/assets/{page-B6h3iaHJ.js → page-DupV0aBd.js} +1 -1
- zenml/zen_server/dashboard/assets/page-EweAR81y.js +1 -0
- zenml/zen_server/dashboard/assets/{page-MFQyIJd3.js → page-f3jBVI5Z.js} +1 -1
- zenml/zen_server/dashboard/assets/{page-2grKx_MY.js → page-p2hLJdS2.js} +1 -1
- zenml/zen_server/dashboard/assets/page-w-YaL77M.js +9 -0
- zenml/zen_server/dashboard/assets/persist-BReKApOc.js +14 -0
- zenml/zen_server/dashboard/assets/plus-DOeLmm7C.js +1 -0
- zenml/zen_server/dashboard/assets/{stack-detail-query-Cficsl6d.js → stack-detail-query-Ck7j7BP_.js} +1 -1
- zenml/zen_server/dashboard/assets/{update-server-settings-mutation-7d8xi1tS.js → update-server-settings-mutation-f3ZT7psb.js} +1 -1
- zenml/zen_server/dashboard/assets/{url-D7mAQGUM.js → url-rGEp5Umh.js} +1 -1
- zenml/zen_server/dashboard/assets/{zod-BhoGpZ63.js → zod-BtSyGx4C.js} +1 -1
- zenml/zen_server/dashboard/index.html +5 -5
- 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.12246c7548e71e2c4438e496360de80c.js → precache-manifest.2fa6e528a6e7447caaf35dadfe7514bb.js} +4 -4
- zenml/zen_server/dashboard_legacy/service-worker.js +1 -1
- zenml/zen_server/dashboard_legacy/static/js/{main.3b27024b.chunk.js → main.4aab7e98.chunk.js} +2 -2
- zenml/zen_server/dashboard_legacy/static/js/{main.3b27024b.chunk.js.map → main.4aab7e98.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/rbac/models.py +1 -0
- zenml/zen_server/rbac/utils.py +4 -0
- zenml/zen_server/routers/pipeline_builds_endpoints.py +2 -66
- zenml/zen_server/routers/pipeline_deployments_endpoints.py +2 -53
- zenml/zen_server/routers/pipelines_endpoints.py +1 -74
- zenml/zen_server/routers/run_templates_endpoints.py +212 -0
- zenml/zen_server/routers/workspaces_endpoints.py +79 -0
- zenml/zen_server/{pipeline_deployment → template_execution}/runner_entrypoint_configuration.py +1 -8
- zenml/zen_server/{pipeline_deployment → template_execution}/utils.py +214 -92
- zenml/zen_server/utils.py +2 -2
- zenml/zen_server/zen_server_api.py +2 -1
- zenml/zen_stores/migrations/versions/0.63.0_release.py +23 -0
- zenml/zen_stores/migrations/versions/7d1919bb1ef0_add_run_templates.py +100 -0
- zenml/zen_stores/migrations/versions/b59aa68fdb1f_simplify_pipelines.py +139 -0
- zenml/zen_stores/rest_zen_store.py +107 -36
- zenml/zen_stores/schemas/__init__.py +2 -0
- zenml/zen_stores/schemas/pipeline_build_schemas.py +3 -3
- zenml/zen_stores/schemas/pipeline_deployment_schemas.py +29 -2
- zenml/zen_stores/schemas/pipeline_run_schemas.py +26 -3
- zenml/zen_stores/schemas/pipeline_schemas.py +29 -30
- zenml/zen_stores/schemas/run_template_schemas.py +264 -0
- zenml/zen_stores/schemas/step_run_schemas.py +11 -4
- zenml/zen_stores/sql_zen_store.py +364 -150
- zenml/zen_stores/template_utils.py +261 -0
- zenml/zen_stores/zen_store_interface.py +93 -20
- {zenml_nightly-0.62.0.dev20240729.dist-info → zenml_nightly-0.63.0.dev20240731.dist-info}/METADATA +2 -2
- {zenml_nightly-0.62.0.dev20240729.dist-info → zenml_nightly-0.63.0.dev20240731.dist-info}/RECORD +139 -129
- zenml/models/v2/core/pipeline_namespace.py +0 -113
- zenml/new/pipelines/deserialization_utils.py +0 -292
- zenml/zen_server/dashboard/assets/CollapsibleCard-opiuBHHc.js +0 -1
- zenml/zen_server/dashboard/assets/Pagination-C6X-mifw.js +0 -1
- zenml/zen_server/dashboard/assets/index-EpMIKgrI.css +0 -1
- zenml/zen_server/dashboard/assets/index-rK_Wuy2W.js +0 -1
- zenml/zen_server/dashboard/assets/index.esm-Corw4lXQ.js +0 -1
- zenml/zen_server/dashboard/assets/package-B3fWP-Dh.js +0 -1
- zenml/zen_server/dashboard/assets/page-5NCOHOsy.js +0 -1
- zenml/zen_server/dashboard/assets/page-Bq0YxkLV.js +0 -1
- zenml/zen_server/dashboard/assets/page-Bs2F4eoD.js +0 -2
- zenml/zen_server/dashboard/assets/page-CHNxpz3n.js +0 -1
- zenml/zen_server/dashboard/assets/page-DgorQFqi.js +0 -1
- zenml/zen_server/dashboard/assets/page-K8ebxVIs.js +0 -1
- zenml/zen_server/dashboard/assets/page-TgCF0P_U.js +0 -1
- zenml/zen_server/dashboard/assets/page-ZnCEe-eK.js +0 -9
- zenml/zen_server/dashboard/assets/persist-D7HJNBWx.js +0 -1
- zenml/zen_server/dashboard/assets/plus-C8WOyCzt.js +0 -1
- /zenml/zen_server/{pipeline_deployment → template_execution}/__init__.py +0 -0
- /zenml/zen_server/{pipeline_deployment → template_execution}/workload_manager_interface.py +0 -0
- {zenml_nightly-0.62.0.dev20240729.dist-info → zenml_nightly-0.63.0.dev20240731.dist-info}/LICENSE +0 -0
- {zenml_nightly-0.62.0.dev20240729.dist-info → zenml_nightly-0.63.0.dev20240731.dist-info}/WHEEL +0 -0
- {zenml_nightly-0.62.0.dev20240729.dist-info → zenml_nightly-0.63.0.dev20240731.dist-info}/entry_points.txt +0 -0
@@ -20,8 +20,8 @@ ZenML is an open-source MLOps framework designed to help you create robust, main
|
|
20
20
|
To install the ZenML chart directly from Amazon ECR, use the following command:
|
21
21
|
|
22
22
|
```bash
|
23
|
-
# example command for version 0.
|
24
|
-
helm install my-zenml oci://public.ecr.aws/zenml/zenml --version 0.
|
23
|
+
# example command for version 0.63.0
|
24
|
+
helm install my-zenml oci://public.ecr.aws/zenml/zenml --version 0.63.0
|
25
25
|
```
|
26
26
|
|
27
27
|
Note: Ensure you have OCI support enabled in your Helm client and that you are authenticated with Amazon ECR.
|
zenml/zen_server/rbac/models.py
CHANGED
zenml/zen_server/rbac/utils.py
CHANGED
@@ -405,6 +405,7 @@ def get_resource_type_for_model(
|
|
405
405
|
PipelineResponse,
|
406
406
|
PipelineRunResponse,
|
407
407
|
RunMetadataResponse,
|
408
|
+
RunTemplateResponse,
|
408
409
|
SecretResponse,
|
409
410
|
ServiceAccountResponse,
|
410
411
|
ServiceConnectorResponse,
|
@@ -440,6 +441,7 @@ def get_resource_type_for_model(
|
|
440
441
|
PipelineDeploymentResponse: ResourceType.PIPELINE_DEPLOYMENT,
|
441
442
|
PipelineBuildResponse: ResourceType.PIPELINE_BUILD,
|
442
443
|
PipelineRunResponse: ResourceType.PIPELINE_RUN,
|
444
|
+
RunTemplateResponse: ResourceType.RUN_TEMPLATE,
|
443
445
|
TagResponse: ResourceType.TAG,
|
444
446
|
TriggerResponse: ResourceType.TRIGGER,
|
445
447
|
TriggerExecutionResponse: ResourceType.TRIGGER_EXECUTION,
|
@@ -556,6 +558,7 @@ def get_schema_for_resource_type(
|
|
556
558
|
PipelineRunSchema,
|
557
559
|
PipelineSchema,
|
558
560
|
RunMetadataSchema,
|
561
|
+
RunTemplateSchema,
|
559
562
|
SecretSchema,
|
560
563
|
ServiceConnectorSchema,
|
561
564
|
ServiceSchema,
|
@@ -587,6 +590,7 @@ def get_schema_for_resource_type(
|
|
587
590
|
ResourceType.PIPELINE_RUN: PipelineRunSchema,
|
588
591
|
ResourceType.PIPELINE_DEPLOYMENT: PipelineDeploymentSchema,
|
589
592
|
ResourceType.PIPELINE_BUILD: PipelineBuildSchema,
|
593
|
+
ResourceType.RUN_TEMPLATE: RunTemplateSchema,
|
590
594
|
ResourceType.RUN_METADATA: RunMetadataSchema,
|
591
595
|
ResourceType.USER: UserSchema,
|
592
596
|
ResourceType.ACTION: ActionSchema,
|
@@ -13,18 +13,15 @@
|
|
13
13
|
# permissions and limitations under the License.
|
14
14
|
"""Endpoint definitions for builds."""
|
15
15
|
|
16
|
-
from typing import Optional
|
17
16
|
from uuid import UUID
|
18
17
|
|
19
|
-
from fastapi import APIRouter,
|
18
|
+
from fastapi import APIRouter, Depends, Security
|
20
19
|
|
21
|
-
from zenml.config.pipeline_run_configuration import PipelineRunConfiguration
|
22
20
|
from zenml.constants import API, PIPELINE_BUILDS, VERSION_1
|
23
21
|
from zenml.models import (
|
24
22
|
Page,
|
25
23
|
PipelineBuildFilter,
|
26
24
|
PipelineBuildResponse,
|
27
|
-
PipelineRunResponse,
|
28
25
|
)
|
29
26
|
from zenml.zen_server.auth import AuthContext, authorize
|
30
27
|
from zenml.zen_server.exceptions import error_response
|
@@ -33,12 +30,10 @@ from zenml.zen_server.rbac.endpoint_utils import (
|
|
33
30
|
verify_permissions_and_get_entity,
|
34
31
|
verify_permissions_and_list_entities,
|
35
32
|
)
|
36
|
-
from zenml.zen_server.rbac.models import
|
37
|
-
from zenml.zen_server.rbac.utils import verify_permission
|
33
|
+
from zenml.zen_server.rbac.models import ResourceType
|
38
34
|
from zenml.zen_server.utils import (
|
39
35
|
handle_exceptions,
|
40
36
|
make_dependable,
|
41
|
-
server_config,
|
42
37
|
zen_store,
|
43
38
|
)
|
44
39
|
|
@@ -126,62 +121,3 @@ def delete_build(
|
|
126
121
|
get_method=zen_store().get_build,
|
127
122
|
delete_method=zen_store().delete_build,
|
128
123
|
)
|
129
|
-
|
130
|
-
|
131
|
-
if server_config().workload_manager_enabled:
|
132
|
-
|
133
|
-
@router.post(
|
134
|
-
"/{build_id}/runs",
|
135
|
-
responses={
|
136
|
-
401: error_response,
|
137
|
-
404: error_response,
|
138
|
-
422: error_response,
|
139
|
-
},
|
140
|
-
)
|
141
|
-
@handle_exceptions
|
142
|
-
def run_build(
|
143
|
-
build_id: UUID,
|
144
|
-
background_tasks: BackgroundTasks,
|
145
|
-
config: Optional[PipelineRunConfiguration] = None,
|
146
|
-
auth_context: AuthContext = Security(authorize),
|
147
|
-
) -> PipelineRunResponse:
|
148
|
-
"""Run a pipeline from a pipeline build.
|
149
|
-
|
150
|
-
Args:
|
151
|
-
build_id: The ID of the build.
|
152
|
-
background_tasks: Background tasks.
|
153
|
-
config: Configuration for the pipeline run.
|
154
|
-
auth_context: Authentication context.
|
155
|
-
|
156
|
-
Raises:
|
157
|
-
ValueError: If the build does not have an associated deployment.
|
158
|
-
|
159
|
-
Returns:
|
160
|
-
The created run.
|
161
|
-
"""
|
162
|
-
from zenml.zen_server.pipeline_deployment.utils import (
|
163
|
-
run_pipeline,
|
164
|
-
)
|
165
|
-
|
166
|
-
build = verify_permissions_and_get_entity(
|
167
|
-
id=build_id, get_method=zen_store().get_build, hydrate=True
|
168
|
-
)
|
169
|
-
|
170
|
-
verify_permission(
|
171
|
-
resource_type=ResourceType.PIPELINE_RUN, action=Action.CREATE
|
172
|
-
)
|
173
|
-
|
174
|
-
if not build.template_deployment_id:
|
175
|
-
raise ValueError("Build does not have template deployment.")
|
176
|
-
|
177
|
-
deployment = zen_store().get_deployment(
|
178
|
-
deployment_id=build.template_deployment_id, hydrate=True
|
179
|
-
)
|
180
|
-
deployment.get_metadata().build = build
|
181
|
-
|
182
|
-
return run_pipeline(
|
183
|
-
deployment=deployment,
|
184
|
-
run_config=config,
|
185
|
-
background_tasks=background_tasks,
|
186
|
-
auth_context=auth_context,
|
187
|
-
)
|
@@ -13,18 +13,15 @@
|
|
13
13
|
# permissions and limitations under the License.
|
14
14
|
"""Endpoint definitions for deployments."""
|
15
15
|
|
16
|
-
from typing import Optional
|
17
16
|
from uuid import UUID
|
18
17
|
|
19
|
-
from fastapi import APIRouter,
|
18
|
+
from fastapi import APIRouter, Depends, Security
|
20
19
|
|
21
|
-
from zenml.config.pipeline_run_configuration import PipelineRunConfiguration
|
22
20
|
from zenml.constants import API, PIPELINE_DEPLOYMENTS, VERSION_1
|
23
21
|
from zenml.models import (
|
24
22
|
Page,
|
25
23
|
PipelineDeploymentFilter,
|
26
24
|
PipelineDeploymentResponse,
|
27
|
-
PipelineRunResponse,
|
28
25
|
)
|
29
26
|
from zenml.zen_server.auth import AuthContext, authorize
|
30
27
|
from zenml.zen_server.exceptions import error_response
|
@@ -33,8 +30,7 @@ from zenml.zen_server.rbac.endpoint_utils import (
|
|
33
30
|
verify_permissions_and_get_entity,
|
34
31
|
verify_permissions_and_list_entities,
|
35
32
|
)
|
36
|
-
from zenml.zen_server.rbac.models import
|
37
|
-
from zenml.zen_server.rbac.utils import verify_permission
|
33
|
+
from zenml.zen_server.rbac.models import ResourceType
|
38
34
|
from zenml.zen_server.utils import (
|
39
35
|
handle_exceptions,
|
40
36
|
make_dependable,
|
@@ -133,53 +129,6 @@ def delete_deployment(
|
|
133
129
|
|
134
130
|
if server_config().workload_manager_enabled:
|
135
131
|
|
136
|
-
@router.post(
|
137
|
-
"/{deployment_id}/runs",
|
138
|
-
responses={
|
139
|
-
401: error_response,
|
140
|
-
404: error_response,
|
141
|
-
422: error_response,
|
142
|
-
},
|
143
|
-
)
|
144
|
-
@handle_exceptions
|
145
|
-
def create_deployment_run(
|
146
|
-
deployment_id: UUID,
|
147
|
-
background_tasks: BackgroundTasks,
|
148
|
-
config: Optional[PipelineRunConfiguration] = None,
|
149
|
-
auth_context: AuthContext = Security(authorize),
|
150
|
-
) -> PipelineRunResponse:
|
151
|
-
"""Run a pipeline from a pipeline deployment.
|
152
|
-
|
153
|
-
Args:
|
154
|
-
deployment_id: The ID of the deployment.
|
155
|
-
background_tasks: Background tasks.
|
156
|
-
config: Configuration for the pipeline run.
|
157
|
-
auth_context: Authentication context.
|
158
|
-
|
159
|
-
Returns:
|
160
|
-
The created run.
|
161
|
-
"""
|
162
|
-
from zenml.zen_server.pipeline_deployment.utils import (
|
163
|
-
run_pipeline,
|
164
|
-
)
|
165
|
-
|
166
|
-
deployment = verify_permissions_and_get_entity(
|
167
|
-
id=deployment_id,
|
168
|
-
get_method=zen_store().get_deployment,
|
169
|
-
hydrate=True,
|
170
|
-
)
|
171
|
-
|
172
|
-
verify_permission(
|
173
|
-
resource_type=ResourceType.PIPELINE_RUN, action=Action.CREATE
|
174
|
-
)
|
175
|
-
|
176
|
-
return run_pipeline(
|
177
|
-
deployment=deployment,
|
178
|
-
run_config=config,
|
179
|
-
background_tasks=background_tasks,
|
180
|
-
auth_context=auth_context,
|
181
|
-
)
|
182
|
-
|
183
132
|
@router.get(
|
184
133
|
"/{deployment_id}/logs",
|
185
134
|
responses={
|
@@ -17,10 +17,8 @@ from uuid import UUID
|
|
17
17
|
|
18
18
|
from fastapi import APIRouter, Depends, Security
|
19
19
|
|
20
|
-
from zenml.config.pipeline_spec import PipelineSpec
|
21
20
|
from zenml.constants import (
|
22
21
|
API,
|
23
|
-
PIPELINE_SPEC,
|
24
22
|
PIPELINES,
|
25
23
|
REPORTABLE_RESOURCES,
|
26
24
|
RUNS,
|
@@ -29,8 +27,6 @@ from zenml.constants import (
|
|
29
27
|
from zenml.models import (
|
30
28
|
Page,
|
31
29
|
PipelineFilter,
|
32
|
-
PipelineNamespaceFilter,
|
33
|
-
PipelineNamespaceResponse,
|
34
30
|
PipelineResponse,
|
35
31
|
PipelineRunFilter,
|
36
32
|
PipelineRunResponse,
|
@@ -46,9 +42,6 @@ from zenml.zen_server.rbac.endpoint_utils import (
|
|
46
42
|
verify_permissions_and_update_entity,
|
47
43
|
)
|
48
44
|
from zenml.zen_server.rbac.models import ResourceType
|
49
|
-
from zenml.zen_server.rbac.utils import (
|
50
|
-
get_allowed_resource_ids,
|
51
|
-
)
|
52
45
|
from zenml.zen_server.utils import (
|
53
46
|
handle_exceptions,
|
54
47
|
make_dependable,
|
@@ -64,7 +57,6 @@ router = APIRouter(
|
|
64
57
|
|
65
58
|
@router.get(
|
66
59
|
"",
|
67
|
-
response_model=Page[PipelineResponse],
|
68
60
|
responses={401: error_response, 404: error_response, 422: error_response},
|
69
61
|
)
|
70
62
|
@handle_exceptions
|
@@ -96,7 +88,6 @@ def list_pipelines(
|
|
96
88
|
|
97
89
|
@router.get(
|
98
90
|
"/{pipeline_id}",
|
99
|
-
response_model=PipelineResponse,
|
100
91
|
responses={401: error_response, 404: error_response, 422: error_response},
|
101
92
|
)
|
102
93
|
@handle_exceptions
|
@@ -122,7 +113,6 @@ def get_pipeline(
|
|
122
113
|
|
123
114
|
@router.put(
|
124
115
|
"/{pipeline_id}",
|
125
|
-
response_model=PipelineResponse,
|
126
116
|
responses={401: error_response, 404: error_response, 422: error_response},
|
127
117
|
)
|
128
118
|
@handle_exceptions
|
@@ -179,7 +169,6 @@ def delete_pipeline(
|
|
179
169
|
|
180
170
|
@router.get(
|
181
171
|
"/{pipeline_id}" + RUNS,
|
182
|
-
response_model=Page[PipelineRunResponse],
|
183
172
|
responses={401: error_response, 404: error_response, 422: error_response},
|
184
173
|
)
|
185
174
|
@handle_exceptions
|
@@ -201,66 +190,4 @@ def list_pipeline_runs(
|
|
201
190
|
Returns:
|
202
191
|
The pipeline runs according to query filters.
|
203
192
|
"""
|
204
|
-
return zen_store().list_runs(pipeline_run_filter_model)
|
205
|
-
|
206
|
-
|
207
|
-
@router.get(
|
208
|
-
"/{pipeline_id}" + PIPELINE_SPEC,
|
209
|
-
response_model=PipelineSpec,
|
210
|
-
responses={401: error_response, 404: error_response, 422: error_response},
|
211
|
-
)
|
212
|
-
@handle_exceptions
|
213
|
-
def get_pipeline_spec(
|
214
|
-
pipeline_id: UUID,
|
215
|
-
_: AuthContext = Security(authorize),
|
216
|
-
) -> PipelineSpec:
|
217
|
-
"""Gets the spec of a specific pipeline using its unique id.
|
218
|
-
|
219
|
-
Args:
|
220
|
-
pipeline_id: ID of the pipeline to get.
|
221
|
-
|
222
|
-
Returns:
|
223
|
-
The spec of the pipeline.
|
224
|
-
"""
|
225
|
-
pipeline = verify_permissions_and_get_entity(
|
226
|
-
id=pipeline_id, get_method=zen_store().get_pipeline
|
227
|
-
)
|
228
|
-
return pipeline.spec
|
229
|
-
|
230
|
-
|
231
|
-
namespace_router = APIRouter(
|
232
|
-
prefix=API + VERSION_1 + "/pipeline_namespaces",
|
233
|
-
tags=["pipeline_namespaces"],
|
234
|
-
responses={401: error_response, 403: error_response},
|
235
|
-
)
|
236
|
-
|
237
|
-
|
238
|
-
@namespace_router.get(
|
239
|
-
"",
|
240
|
-
responses={401: error_response, 404: error_response, 422: error_response},
|
241
|
-
)
|
242
|
-
@handle_exceptions
|
243
|
-
def list_pipeline_namespaces(
|
244
|
-
filter_model: PipelineNamespaceFilter = Depends(
|
245
|
-
make_dependable(PipelineNamespaceFilter)
|
246
|
-
),
|
247
|
-
hydrate: bool = False,
|
248
|
-
auth_context: AuthContext = Security(authorize),
|
249
|
-
) -> Page[PipelineNamespaceResponse]:
|
250
|
-
"""Gets a list of pipeline namespaces.
|
251
|
-
|
252
|
-
Args:
|
253
|
-
filter_model: Filter model used for pagination, sorting,
|
254
|
-
filtering.
|
255
|
-
hydrate: Flag deciding whether to hydrate the output model(s)
|
256
|
-
by including metadata fields in the response.
|
257
|
-
auth_context: Authentication context.
|
258
|
-
|
259
|
-
Returns:
|
260
|
-
List of pipeline namespace objects.
|
261
|
-
"""
|
262
|
-
allowed_ids = get_allowed_resource_ids(resource_type=ResourceType.PIPELINE)
|
263
|
-
filter_model.configure_rbac(
|
264
|
-
authenticated_user_id=auth_context.user.id, id=allowed_ids
|
265
|
-
)
|
266
|
-
return zen_store().list_pipeline_namespaces(filter_model, hydrate=hydrate)
|
193
|
+
return zen_store().list_runs(pipeline_run_filter_model, hydrate=hydrate)
|
@@ -0,0 +1,212 @@
|
|
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
|
+
"""Endpoint definitions for run templates."""
|
15
|
+
|
16
|
+
from typing import Optional
|
17
|
+
from uuid import UUID
|
18
|
+
|
19
|
+
from fastapi import APIRouter, BackgroundTasks, Depends, Security
|
20
|
+
|
21
|
+
from zenml.analytics.enums import AnalyticsEvent
|
22
|
+
from zenml.analytics.utils import track_handler
|
23
|
+
from zenml.config.pipeline_run_configuration import PipelineRunConfiguration
|
24
|
+
from zenml.constants import API, RUN_TEMPLATES, VERSION_1
|
25
|
+
from zenml.models import (
|
26
|
+
Page,
|
27
|
+
PipelineRunResponse,
|
28
|
+
RunTemplateFilter,
|
29
|
+
RunTemplateResponse,
|
30
|
+
RunTemplateUpdate,
|
31
|
+
)
|
32
|
+
from zenml.zen_server.auth import AuthContext, authorize
|
33
|
+
from zenml.zen_server.exceptions import error_response
|
34
|
+
from zenml.zen_server.rbac.endpoint_utils import (
|
35
|
+
verify_permissions_and_delete_entity,
|
36
|
+
verify_permissions_and_get_entity,
|
37
|
+
verify_permissions_and_list_entities,
|
38
|
+
verify_permissions_and_update_entity,
|
39
|
+
)
|
40
|
+
from zenml.zen_server.rbac.models import Action, ResourceType
|
41
|
+
from zenml.zen_server.rbac.utils import verify_permission
|
42
|
+
from zenml.zen_server.utils import (
|
43
|
+
handle_exceptions,
|
44
|
+
make_dependable,
|
45
|
+
server_config,
|
46
|
+
zen_store,
|
47
|
+
)
|
48
|
+
|
49
|
+
router = APIRouter(
|
50
|
+
prefix=API + VERSION_1 + RUN_TEMPLATES,
|
51
|
+
tags=["run_templates"],
|
52
|
+
responses={401: error_response, 403: error_response},
|
53
|
+
)
|
54
|
+
|
55
|
+
|
56
|
+
@router.get(
|
57
|
+
"",
|
58
|
+
responses={401: error_response, 404: error_response, 422: error_response},
|
59
|
+
)
|
60
|
+
@handle_exceptions
|
61
|
+
def list_run_templates(
|
62
|
+
filter_model: RunTemplateFilter = Depends(
|
63
|
+
make_dependable(RunTemplateFilter)
|
64
|
+
),
|
65
|
+
hydrate: bool = False,
|
66
|
+
_: AuthContext = Security(authorize),
|
67
|
+
) -> Page[RunTemplateResponse]:
|
68
|
+
"""Get a page of run templates.
|
69
|
+
|
70
|
+
Args:
|
71
|
+
filter_model: Filter model used for pagination, sorting,
|
72
|
+
filtering.
|
73
|
+
hydrate: Flag deciding whether to hydrate the output model(s)
|
74
|
+
by including metadata fields in the response.
|
75
|
+
|
76
|
+
Returns:
|
77
|
+
Page of run templates.
|
78
|
+
"""
|
79
|
+
return verify_permissions_and_list_entities(
|
80
|
+
filter_model=filter_model,
|
81
|
+
resource_type=ResourceType.RUN_TEMPLATE,
|
82
|
+
list_method=zen_store().list_run_templates,
|
83
|
+
hydrate=hydrate,
|
84
|
+
)
|
85
|
+
|
86
|
+
|
87
|
+
@router.get(
|
88
|
+
"/{template_id}",
|
89
|
+
responses={401: error_response, 404: error_response, 422: error_response},
|
90
|
+
)
|
91
|
+
@handle_exceptions
|
92
|
+
def get_run_template(
|
93
|
+
template_id: UUID,
|
94
|
+
hydrate: bool = True,
|
95
|
+
_: AuthContext = Security(authorize),
|
96
|
+
) -> RunTemplateResponse:
|
97
|
+
"""Get a run template.
|
98
|
+
|
99
|
+
Args:
|
100
|
+
template_id: ID of the run template to get.
|
101
|
+
hydrate: Flag deciding whether to hydrate the output model(s)
|
102
|
+
by including metadata fields in the response.
|
103
|
+
|
104
|
+
Returns:
|
105
|
+
The run template.
|
106
|
+
"""
|
107
|
+
return verify_permissions_and_get_entity(
|
108
|
+
id=template_id,
|
109
|
+
get_method=zen_store().get_run_template,
|
110
|
+
hydrate=hydrate,
|
111
|
+
)
|
112
|
+
|
113
|
+
|
114
|
+
@router.put(
|
115
|
+
"/{template_id}",
|
116
|
+
responses={401: error_response, 404: error_response, 422: error_response},
|
117
|
+
)
|
118
|
+
@handle_exceptions
|
119
|
+
def update_run_template(
|
120
|
+
template_id: UUID,
|
121
|
+
update: RunTemplateUpdate,
|
122
|
+
_: AuthContext = Security(authorize),
|
123
|
+
) -> RunTemplateResponse:
|
124
|
+
"""Update a run template.
|
125
|
+
|
126
|
+
Args:
|
127
|
+
template_id: ID of the run template to get.
|
128
|
+
update: The updates to apply.
|
129
|
+
|
130
|
+
Returns:
|
131
|
+
The updated run template.
|
132
|
+
"""
|
133
|
+
return verify_permissions_and_update_entity(
|
134
|
+
id=template_id,
|
135
|
+
update_model=update,
|
136
|
+
get_method=zen_store().get_run_template,
|
137
|
+
update_method=zen_store().update_run_template,
|
138
|
+
)
|
139
|
+
|
140
|
+
|
141
|
+
@router.delete(
|
142
|
+
"/{template_id}",
|
143
|
+
responses={401: error_response, 404: error_response, 422: error_response},
|
144
|
+
)
|
145
|
+
@handle_exceptions
|
146
|
+
def delete_run_template(
|
147
|
+
template_id: UUID,
|
148
|
+
_: AuthContext = Security(authorize),
|
149
|
+
) -> None:
|
150
|
+
"""Delete a run template.
|
151
|
+
|
152
|
+
Args:
|
153
|
+
template_id: ID of the run template to delete.
|
154
|
+
"""
|
155
|
+
verify_permissions_and_delete_entity(
|
156
|
+
id=template_id,
|
157
|
+
get_method=zen_store().get_run_template,
|
158
|
+
delete_method=zen_store().delete_run_template,
|
159
|
+
)
|
160
|
+
|
161
|
+
|
162
|
+
if server_config().workload_manager_enabled:
|
163
|
+
|
164
|
+
@router.post(
|
165
|
+
"/{template_id}/runs",
|
166
|
+
responses={
|
167
|
+
401: error_response,
|
168
|
+
404: error_response,
|
169
|
+
422: error_response,
|
170
|
+
},
|
171
|
+
)
|
172
|
+
@handle_exceptions
|
173
|
+
def create_template_run(
|
174
|
+
template_id: UUID,
|
175
|
+
background_tasks: BackgroundTasks,
|
176
|
+
config: Optional[PipelineRunConfiguration] = None,
|
177
|
+
auth_context: AuthContext = Security(authorize),
|
178
|
+
) -> PipelineRunResponse:
|
179
|
+
"""Run a pipeline from a template.
|
180
|
+
|
181
|
+
Args:
|
182
|
+
template_id: The ID of the template.
|
183
|
+
background_tasks: Background tasks.
|
184
|
+
config: Configuration for the pipeline run.
|
185
|
+
auth_context: Authentication context.
|
186
|
+
|
187
|
+
Returns:
|
188
|
+
The created pipeline run.
|
189
|
+
"""
|
190
|
+
from zenml.zen_server.template_execution.utils import run_template
|
191
|
+
|
192
|
+
with track_handler(event=AnalyticsEvent.EXECUTED_RUN_TEMPLATE):
|
193
|
+
template = verify_permissions_and_get_entity(
|
194
|
+
id=template_id,
|
195
|
+
get_method=zen_store().get_run_template,
|
196
|
+
hydrate=True,
|
197
|
+
)
|
198
|
+
|
199
|
+
verify_permission(
|
200
|
+
resource_type=ResourceType.PIPELINE_DEPLOYMENT,
|
201
|
+
action=Action.CREATE,
|
202
|
+
)
|
203
|
+
verify_permission(
|
204
|
+
resource_type=ResourceType.PIPELINE_RUN, action=Action.CREATE
|
205
|
+
)
|
206
|
+
|
207
|
+
return run_template(
|
208
|
+
template=template,
|
209
|
+
auth_context=auth_context,
|
210
|
+
background_tasks=background_tasks,
|
211
|
+
run_config=config,
|
212
|
+
)
|
@@ -31,6 +31,7 @@ from zenml.constants import (
|
|
31
31
|
PIPELINES,
|
32
32
|
REPORTABLE_RESOURCES,
|
33
33
|
RUN_METADATA,
|
34
|
+
RUN_TEMPLATES,
|
34
35
|
RUNS,
|
35
36
|
SCHEDULES,
|
36
37
|
SECRETS,
|
@@ -76,6 +77,9 @@ from zenml.models import (
|
|
76
77
|
PipelineRunResponse,
|
77
78
|
RunMetadataRequest,
|
78
79
|
RunMetadataResponse,
|
80
|
+
RunTemplateFilter,
|
81
|
+
RunTemplateRequest,
|
82
|
+
RunTemplateResponse,
|
79
83
|
ScheduleRequest,
|
80
84
|
ScheduleResponse,
|
81
85
|
SecretRequest,
|
@@ -766,6 +770,81 @@ def create_deployment(
|
|
766
770
|
)
|
767
771
|
|
768
772
|
|
773
|
+
@router.get(
|
774
|
+
WORKSPACES + "/{workspace_name_or_id}" + RUN_TEMPLATES,
|
775
|
+
responses={401: error_response, 404: error_response, 422: error_response},
|
776
|
+
)
|
777
|
+
@handle_exceptions
|
778
|
+
def list_workspace_run_templates(
|
779
|
+
workspace_name_or_id: Union[str, UUID],
|
780
|
+
filter_model: RunTemplateFilter = Depends(
|
781
|
+
make_dependable(RunTemplateFilter)
|
782
|
+
),
|
783
|
+
hydrate: bool = False,
|
784
|
+
_: AuthContext = Security(authorize),
|
785
|
+
) -> Page[RunTemplateResponse]:
|
786
|
+
"""Get a page of run templates.
|
787
|
+
|
788
|
+
Args:
|
789
|
+
workspace_name_or_id: Name or ID of the workspace.
|
790
|
+
filter_model: Filter model used for pagination, sorting,
|
791
|
+
filtering.
|
792
|
+
hydrate: Flag deciding whether to hydrate the output model(s)
|
793
|
+
by including metadata fields in the response.
|
794
|
+
|
795
|
+
Returns:
|
796
|
+
Page of run templates.
|
797
|
+
"""
|
798
|
+
workspace = zen_store().get_workspace(workspace_name_or_id)
|
799
|
+
filter_model.set_scope_workspace(workspace.id)
|
800
|
+
|
801
|
+
return verify_permissions_and_list_entities(
|
802
|
+
filter_model=filter_model,
|
803
|
+
resource_type=ResourceType.RUN_TEMPLATE,
|
804
|
+
list_method=zen_store().list_run_templates,
|
805
|
+
hydrate=hydrate,
|
806
|
+
)
|
807
|
+
|
808
|
+
|
809
|
+
@router.post(
|
810
|
+
WORKSPACES + "/{workspace_name_or_id}" + RUN_TEMPLATES,
|
811
|
+
responses={401: error_response, 409: error_response, 422: error_response},
|
812
|
+
)
|
813
|
+
@handle_exceptions
|
814
|
+
def create_run_template(
|
815
|
+
workspace_name_or_id: Union[str, UUID],
|
816
|
+
run_template: RunTemplateRequest,
|
817
|
+
_: AuthContext = Security(authorize),
|
818
|
+
) -> RunTemplateResponse:
|
819
|
+
"""Create a run template.
|
820
|
+
|
821
|
+
Args:
|
822
|
+
workspace_name_or_id: Name or ID of the workspace.
|
823
|
+
run_template: Run template to create.
|
824
|
+
|
825
|
+
Returns:
|
826
|
+
The created run template.
|
827
|
+
|
828
|
+
Raises:
|
829
|
+
IllegalOperationError: If the workspace specified in the
|
830
|
+
run template does not match the current workspace.
|
831
|
+
"""
|
832
|
+
workspace = zen_store().get_workspace(workspace_name_or_id)
|
833
|
+
|
834
|
+
if run_template.workspace != workspace.id:
|
835
|
+
raise IllegalOperationError(
|
836
|
+
"Creating run templates outside of the workspace scope "
|
837
|
+
f"of this endpoint `{workspace_name_or_id}` is "
|
838
|
+
f"not supported."
|
839
|
+
)
|
840
|
+
|
841
|
+
return verify_permissions_and_create_entity(
|
842
|
+
request_model=run_template,
|
843
|
+
resource_type=ResourceType.RUN_TEMPLATE,
|
844
|
+
create_method=zen_store().create_run_template,
|
845
|
+
)
|
846
|
+
|
847
|
+
|
769
848
|
@router.get(
|
770
849
|
WORKSPACES + "/{workspace_name_or_id}" + RUNS,
|
771
850
|
response_model=Page[PipelineRunResponse],
|