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
@@ -0,0 +1,261 @@
|
|
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
|
+
"""Utilities for run templates."""
|
15
|
+
|
16
|
+
from enum import Enum
|
17
|
+
from typing import Any, Dict, Optional
|
18
|
+
|
19
|
+
from pydantic import create_model
|
20
|
+
from pydantic.fields import FieldInfo
|
21
|
+
|
22
|
+
from zenml.config import ResourceSettings
|
23
|
+
from zenml.config.base_settings import BaseSettings
|
24
|
+
from zenml.config.pipeline_run_configuration import PipelineRunConfiguration
|
25
|
+
from zenml.config.source import SourceWithValidator
|
26
|
+
from zenml.config.step_configurations import StepConfigurationUpdate
|
27
|
+
from zenml.enums import StackComponentType
|
28
|
+
from zenml.logger import get_logger
|
29
|
+
from zenml.stack import Flavor
|
30
|
+
from zenml.zen_stores.schemas import PipelineDeploymentSchema
|
31
|
+
|
32
|
+
logger = get_logger(__name__)
|
33
|
+
|
34
|
+
|
35
|
+
def validate_deployment_is_templatable(
|
36
|
+
deployment: PipelineDeploymentSchema,
|
37
|
+
) -> None:
|
38
|
+
"""Validate that a deployment is templatable.
|
39
|
+
|
40
|
+
Args:
|
41
|
+
deployment: The deployment to validate.
|
42
|
+
|
43
|
+
Raises:
|
44
|
+
ValueError: If the deployment is not templatable.
|
45
|
+
"""
|
46
|
+
if not deployment.build:
|
47
|
+
raise ValueError(
|
48
|
+
"Unable to create run template as there is no associated build."
|
49
|
+
)
|
50
|
+
|
51
|
+
if not deployment.build.stack:
|
52
|
+
raise ValueError(
|
53
|
+
"Unable to create run template as the associated build has no "
|
54
|
+
"stack reference."
|
55
|
+
)
|
56
|
+
|
57
|
+
for component in deployment.build.stack.components:
|
58
|
+
if not component.flavor_schema:
|
59
|
+
raise ValueError(
|
60
|
+
"Unable to create run template as a component of the "
|
61
|
+
"associated stack has no flavor."
|
62
|
+
)
|
63
|
+
|
64
|
+
if component.flavor_schema.workspace_id:
|
65
|
+
raise ValueError(
|
66
|
+
"Unable to create run template as a component of the "
|
67
|
+
"associated stack has a custom flavor."
|
68
|
+
)
|
69
|
+
|
70
|
+
flavor_model = component.flavor_schema.to_model()
|
71
|
+
flavor = Flavor.from_model(flavor_model)
|
72
|
+
component_config = flavor.config_class(
|
73
|
+
**component.to_model(include_metadata=True).configuration
|
74
|
+
)
|
75
|
+
|
76
|
+
if component_config.is_local:
|
77
|
+
raise ValueError(
|
78
|
+
"Unable to create run template as the associated stack "
|
79
|
+
"contains local components."
|
80
|
+
)
|
81
|
+
|
82
|
+
|
83
|
+
def generate_config_template(
|
84
|
+
deployment: PipelineDeploymentSchema,
|
85
|
+
) -> Dict[str, Any]:
|
86
|
+
"""Generate a run configuration template for a deployment.
|
87
|
+
|
88
|
+
Args:
|
89
|
+
deployment: The deployment.
|
90
|
+
|
91
|
+
Returns:
|
92
|
+
The run configuration template.
|
93
|
+
"""
|
94
|
+
deployment_model = deployment.to_model(include_metadata=True)
|
95
|
+
|
96
|
+
steps_configs = {
|
97
|
+
name: step.config.model_dump(
|
98
|
+
include=set(StepConfigurationUpdate.model_fields),
|
99
|
+
exclude={"name", "outputs"},
|
100
|
+
)
|
101
|
+
for name, step in deployment_model.step_configurations.items()
|
102
|
+
}
|
103
|
+
|
104
|
+
for config in steps_configs.values():
|
105
|
+
config["settings"].pop("docker", None)
|
106
|
+
|
107
|
+
pipeline_config = deployment_model.pipeline_configuration.model_dump(
|
108
|
+
include=set(PipelineRunConfiguration.model_fields),
|
109
|
+
exclude={"schedule", "build", "parameters"},
|
110
|
+
)
|
111
|
+
|
112
|
+
pipeline_config["settings"].pop("docker", None)
|
113
|
+
|
114
|
+
config_template = {
|
115
|
+
"run_name": deployment_model.run_name_template,
|
116
|
+
"steps": steps_configs,
|
117
|
+
**pipeline_config,
|
118
|
+
}
|
119
|
+
return config_template
|
120
|
+
|
121
|
+
|
122
|
+
def generate_config_schema(
|
123
|
+
deployment: PipelineDeploymentSchema,
|
124
|
+
) -> Dict[str, Any]:
|
125
|
+
"""Generate a run configuration schema for the deployment and stack.
|
126
|
+
|
127
|
+
Args:
|
128
|
+
deployment: The deployment schema.
|
129
|
+
|
130
|
+
Returns:
|
131
|
+
The generated schema dictionary.
|
132
|
+
"""
|
133
|
+
# Config schema can only be generated for a runnable template, so this is
|
134
|
+
# guaranteed by checks in the run template schema
|
135
|
+
assert deployment.build
|
136
|
+
assert deployment.build.stack
|
137
|
+
|
138
|
+
stack = deployment.build.stack
|
139
|
+
experiment_trackers = []
|
140
|
+
step_operators = []
|
141
|
+
|
142
|
+
settings_fields: Dict[str, Any] = {"resources": (ResourceSettings, None)}
|
143
|
+
for component in stack.components:
|
144
|
+
if not component.flavor_schema:
|
145
|
+
continue
|
146
|
+
|
147
|
+
flavor_model = component.flavor_schema.to_model()
|
148
|
+
flavor = Flavor.from_model(flavor_model)
|
149
|
+
|
150
|
+
for class_ in flavor.config_class.__mro__[1:]:
|
151
|
+
# Ugly hack to get the settings class of a flavor without having
|
152
|
+
# the integration installed. This is based on the convention that
|
153
|
+
# the static config of a stack component should always inherit
|
154
|
+
# from the dynamic settings.
|
155
|
+
if issubclass(class_, BaseSettings):
|
156
|
+
if len(class_.model_fields) > 0:
|
157
|
+
settings_key = f"{component.type}.{component.flavor}"
|
158
|
+
settings_fields[settings_key] = (
|
159
|
+
Optional[class_],
|
160
|
+
None,
|
161
|
+
)
|
162
|
+
|
163
|
+
break
|
164
|
+
|
165
|
+
if component.type == StackComponentType.EXPERIMENT_TRACKER:
|
166
|
+
experiment_trackers.append(component.name)
|
167
|
+
if component.type == StackComponentType.STEP_OPERATOR:
|
168
|
+
step_operators.append(component.name)
|
169
|
+
|
170
|
+
settings_model = create_model("Settings", **settings_fields)
|
171
|
+
|
172
|
+
generic_step_fields: Dict[str, Any] = {}
|
173
|
+
|
174
|
+
for key, field_info in StepConfigurationUpdate.model_fields.items():
|
175
|
+
if key in [
|
176
|
+
"name",
|
177
|
+
"outputs",
|
178
|
+
"step_operator",
|
179
|
+
"experiment_tracker",
|
180
|
+
"parameters",
|
181
|
+
]:
|
182
|
+
continue
|
183
|
+
|
184
|
+
if field_info.annotation == Optional[SourceWithValidator]:
|
185
|
+
generic_step_fields[key] = (Optional[str], None)
|
186
|
+
else:
|
187
|
+
generic_step_fields[key] = (field_info.annotation, field_info)
|
188
|
+
|
189
|
+
if experiment_trackers:
|
190
|
+
experiment_tracker_enum = Enum( # type: ignore[misc]
|
191
|
+
"ExperimentTrackers", {e: e for e in experiment_trackers}
|
192
|
+
)
|
193
|
+
generic_step_fields["experiment_tracker"] = (
|
194
|
+
Optional[experiment_tracker_enum],
|
195
|
+
None,
|
196
|
+
)
|
197
|
+
if step_operators:
|
198
|
+
step_operator_enum = Enum( # type: ignore[misc]
|
199
|
+
"StepOperators", {s: s for s in step_operators}
|
200
|
+
)
|
201
|
+
generic_step_fields["step_operator"] = (
|
202
|
+
Optional[step_operator_enum],
|
203
|
+
None,
|
204
|
+
)
|
205
|
+
|
206
|
+
generic_step_fields["settings"] = (Optional[settings_model], None)
|
207
|
+
|
208
|
+
all_steps: Dict[str, Any] = {}
|
209
|
+
all_steps_required = False
|
210
|
+
for name, step in deployment.to_model(
|
211
|
+
include_metadata=True
|
212
|
+
).step_configurations.items():
|
213
|
+
step_fields = generic_step_fields.copy()
|
214
|
+
if step.config.parameters:
|
215
|
+
parameter_fields: Dict[str, Any] = {
|
216
|
+
name: (Any, FieldInfo(default=...))
|
217
|
+
for name in step.config.parameters
|
218
|
+
}
|
219
|
+
parameters_class = create_model(
|
220
|
+
f"{name}_parameters", **parameter_fields
|
221
|
+
)
|
222
|
+
step_fields["parameters"] = (
|
223
|
+
parameters_class,
|
224
|
+
FieldInfo(default=...),
|
225
|
+
)
|
226
|
+
|
227
|
+
step_model = create_model(name, **step_fields)
|
228
|
+
|
229
|
+
if step.config.parameters:
|
230
|
+
# This step has required parameters -> we make this attribute
|
231
|
+
# required and also the parent attribute so these parameters must
|
232
|
+
# always be included
|
233
|
+
all_steps_required = True
|
234
|
+
all_steps[name] = (step_model, FieldInfo(default=...))
|
235
|
+
else:
|
236
|
+
all_steps[name] = (Optional[step_model], FieldInfo(default=None))
|
237
|
+
|
238
|
+
all_steps_model = create_model("Steps", **all_steps)
|
239
|
+
|
240
|
+
top_level_fields: Dict[str, Any] = {}
|
241
|
+
|
242
|
+
for key, field_info in PipelineRunConfiguration.model_fields.items():
|
243
|
+
if key in ["schedule", "build", "steps", "settings", "parameters"]:
|
244
|
+
continue
|
245
|
+
|
246
|
+
if field_info.annotation == Optional[SourceWithValidator]:
|
247
|
+
top_level_fields[key] = (Optional[str], None)
|
248
|
+
else:
|
249
|
+
top_level_fields[key] = (field_info.annotation, field_info)
|
250
|
+
|
251
|
+
top_level_fields["settings"] = (Optional[settings_model], None)
|
252
|
+
|
253
|
+
if all_steps_required:
|
254
|
+
top_level_fields["steps"] = (all_steps_model, FieldInfo(default=...))
|
255
|
+
else:
|
256
|
+
top_level_fields["steps"] = (
|
257
|
+
Optional[all_steps_model],
|
258
|
+
FieldInfo(default=None),
|
259
|
+
)
|
260
|
+
|
261
|
+
return create_model("Result", **top_level_fields).model_json_schema() # type: ignore[no-any-return]
|
@@ -94,6 +94,10 @@ from zenml.models import (
|
|
94
94
|
RunMetadataFilter,
|
95
95
|
RunMetadataRequest,
|
96
96
|
RunMetadataResponse,
|
97
|
+
RunTemplateFilter,
|
98
|
+
RunTemplateRequest,
|
99
|
+
RunTemplateResponse,
|
100
|
+
RunTemplateUpdate,
|
97
101
|
ScheduleFilter,
|
98
102
|
ScheduleRequest,
|
99
103
|
ScheduleResponse,
|
@@ -1263,22 +1267,6 @@ class ZenStoreInterface(ABC):
|
|
1263
1267
|
KeyError: if the build doesn't exist.
|
1264
1268
|
"""
|
1265
1269
|
|
1266
|
-
@abstractmethod
|
1267
|
-
def run_build(
|
1268
|
-
self,
|
1269
|
-
build_id: UUID,
|
1270
|
-
run_configuration: Optional[PipelineRunConfiguration] = None,
|
1271
|
-
) -> PipelineRunResponse:
|
1272
|
-
"""Run a pipeline from a build.
|
1273
|
-
|
1274
|
-
Args:
|
1275
|
-
build_id: The ID of the build to run.
|
1276
|
-
run_configuration: Configuration for the run.
|
1277
|
-
|
1278
|
-
Returns:
|
1279
|
-
Model of the pipeline run.
|
1280
|
-
"""
|
1281
|
-
|
1282
1270
|
# -------------------- Pipeline deployments --------------------
|
1283
1271
|
|
1284
1272
|
@abstractmethod
|
@@ -1346,16 +1334,101 @@ class ZenStoreInterface(ABC):
|
|
1346
1334
|
KeyError: If the deployment doesn't exist.
|
1347
1335
|
"""
|
1348
1336
|
|
1337
|
+
# -------------------- Run templates --------------------
|
1338
|
+
|
1339
|
+
@abstractmethod
|
1340
|
+
def create_run_template(
|
1341
|
+
self,
|
1342
|
+
template: RunTemplateRequest,
|
1343
|
+
) -> RunTemplateResponse:
|
1344
|
+
"""Create a new run template.
|
1345
|
+
|
1346
|
+
Args:
|
1347
|
+
template: The template to create.
|
1348
|
+
|
1349
|
+
Returns:
|
1350
|
+
The newly created template.
|
1351
|
+
|
1352
|
+
Raises:
|
1353
|
+
EntityExistsError: If a template with the same name already exists.
|
1354
|
+
"""
|
1355
|
+
|
1356
|
+
@abstractmethod
|
1357
|
+
def get_run_template(
|
1358
|
+
self, template_id: UUID, hydrate: bool = True
|
1359
|
+
) -> RunTemplateResponse:
|
1360
|
+
"""Get a run template with a given ID.
|
1361
|
+
|
1362
|
+
Args:
|
1363
|
+
template_id: ID of the template.
|
1364
|
+
hydrate: Flag deciding whether to hydrate the output model(s)
|
1365
|
+
by including metadata fields in the response.
|
1366
|
+
|
1367
|
+
Returns:
|
1368
|
+
The template.
|
1369
|
+
|
1370
|
+
Raises:
|
1371
|
+
KeyError: If the template does not exist.
|
1372
|
+
"""
|
1373
|
+
|
1374
|
+
@abstractmethod
|
1375
|
+
def list_run_templates(
|
1376
|
+
self,
|
1377
|
+
template_filter_model: RunTemplateFilter,
|
1378
|
+
hydrate: bool = False,
|
1379
|
+
) -> Page[RunTemplateResponse]:
|
1380
|
+
"""List all run templates matching the given filter criteria.
|
1381
|
+
|
1382
|
+
Args:
|
1383
|
+
template_filter_model: All filter parameters including pagination
|
1384
|
+
params.
|
1385
|
+
hydrate: Flag deciding whether to hydrate the output model(s)
|
1386
|
+
by including metadata fields in the response.
|
1387
|
+
|
1388
|
+
Returns:
|
1389
|
+
A list of all templates matching the filter criteria.
|
1390
|
+
"""
|
1391
|
+
|
1392
|
+
@abstractmethod
|
1393
|
+
def update_run_template(
|
1394
|
+
self,
|
1395
|
+
template_id: UUID,
|
1396
|
+
template_update: RunTemplateUpdate,
|
1397
|
+
) -> RunTemplateResponse:
|
1398
|
+
"""Updates a run template.
|
1399
|
+
|
1400
|
+
Args:
|
1401
|
+
template_id: The ID of the template to update.
|
1402
|
+
template_update: The update to apply.
|
1403
|
+
|
1404
|
+
Returns:
|
1405
|
+
The updated template.
|
1406
|
+
|
1407
|
+
Raises:
|
1408
|
+
KeyError: If the template does not exist.
|
1409
|
+
"""
|
1410
|
+
|
1411
|
+
@abstractmethod
|
1412
|
+
def delete_run_template(self, template_id: UUID) -> None:
|
1413
|
+
"""Delete a run template.
|
1414
|
+
|
1415
|
+
Args:
|
1416
|
+
template_id: The ID of the template to delete.
|
1417
|
+
|
1418
|
+
Raises:
|
1419
|
+
KeyError: If the template does not exist.
|
1420
|
+
"""
|
1421
|
+
|
1349
1422
|
@abstractmethod
|
1350
|
-
def
|
1423
|
+
def run_template(
|
1351
1424
|
self,
|
1352
|
-
|
1425
|
+
template_id: UUID,
|
1353
1426
|
run_configuration: Optional[PipelineRunConfiguration] = None,
|
1354
1427
|
) -> PipelineRunResponse:
|
1355
|
-
"""Run a
|
1428
|
+
"""Run a template.
|
1356
1429
|
|
1357
1430
|
Args:
|
1358
|
-
|
1431
|
+
template_id: The ID of the template to run.
|
1359
1432
|
run_configuration: Configuration for the run.
|
1360
1433
|
|
1361
1434
|
Returns:
|
{zenml_nightly-0.62.0.dev20240729.dist-info → zenml_nightly-0.63.0.dev20240731.dist-info}/METADATA
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: zenml-nightly
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.63.0.dev20240731
|
4
4
|
Summary: ZenML: Write production-ready ML code.
|
5
5
|
Home-page: https://zenml.io
|
6
6
|
License: Apache-2.0
|
@@ -467,7 +467,7 @@ the Apache License Version 2.0.
|
|
467
467
|
<a href="https://github.com/zenml-io/zenml-projects">Projects Showcase</a>
|
468
468
|
<br />
|
469
469
|
<br />
|
470
|
-
🎉 Version 0.
|
470
|
+
🎉 Version 0.63.0 is out. Check out the release notes
|
471
471
|
<a href="https://github.com/zenml-io/zenml/releases">here</a>.
|
472
472
|
<br />
|
473
473
|
🖥️ Download our VS Code Extension <a href="https://marketplace.visualstudio.com/items?itemName=ZenML.zenml-vscode">here</a>.
|