Skip to content

Commit 6468a22

Browse files
avishniakovactions-userstefannica
authored
Endpoint artifacts rename to deployment artifacts (#2134)
* `endpoint_artifact`>`deployment_artifact` * migration * migration * updated template * Auto-update of E2E template * update test definition * branching * Auto-update of E2E template * Auto-update of NLP template * Apply suggestions from code review Co-authored-by: Stefan Nica <[email protected]> --------- Co-authored-by: GitHub Actions <[email protected]> Co-authored-by: Stefan Nica <[email protected]>
1 parent c0aba01 commit 6468a22

File tree

20 files changed

+125
-83
lines changed

20 files changed

+125
-83
lines changed

.github/workflows/update-templates-to-examples.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ jobs:
5757
python-version: ${{ inputs.python-version }}
5858
stack-name: local
5959
ref-zenml: ${{ github.ref }}
60-
ref-template: '2023.12.06' # Make sure it is aligned with ZENML_PROJECT_TEMPLATES from src/zenml/cli/base.py
61-
60+
ref-template: '2023.12.12' # Make sure it is aligned with ZENML_PROJECT_TEMPLATES from src/zenml/cli/base.py
61+
6262
- name: Clean-up
6363
run: |
6464
rm -rf ./local_checkout

docs/book/user-guide/advanced-guide/artifact-management/artifact-versioning.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ how artifacts are linked to models:
139139
- `model_name`: The name of the model to link the artifact to.
140140
- `model_version`: The version of the model to link the artifact to.
141141
- `is_model_artifact`: Whether the artifact is a model artifact.
142-
- `is_endpoint_artifact`: Whether the artifact is an endpoint artifact.
142+
- `is_deployment_artifact`: Whether the artifact is a deployment artifact.
143143

144144
<!-- For scarf -->
145145
<figure><img alt="ZenML Scarf" referrerpolicy="no-referrer-when-downgrade" src="https://static.scarf.sh/a.png?x-pxid=f0b4f458-0a54-4fcd-aa95-d5ee424815bc" /></figure>

examples/e2e/.copier-answers.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Changes here will be overwritten by Copier
2-
_commit: 2023.12.06
2+
_commit: 2023.12.06-4-g1e3edc6
33
_src_path: gh:zenml-io/template-e2e-batch
44
data_quality_checks: true
55
email: ''

examples/e2e/steps/deployment/deployment_deploy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
def deployment_deploy() -> (
3838
Annotated[
3939
Optional[MLFlowDeploymentService],
40-
ArtifactConfig(name="mlflow_deployment", is_endpoint_artifact=True),
40+
ArtifactConfig(name="mlflow_deployment", is_deployment_artifact=True),
4141
]
4242
):
4343
"""Predictions step.

src/zenml/artifacts/artifact_config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def my_step() -> Annotated[
5757
(42), stage (ModelStages.PRODUCTION or "production"), or
5858
(ModelStages.LATEST or None) for the latest version (default).
5959
is_model_artifact: Whether the artifact is a model artifact.
60-
is_endpoint_artifact: Whether the artifact is an endpoint artifact.
60+
is_deployment_artifact: Whether the artifact is a deployment artifact.
6161
"""
6262

6363
name: Optional[str] = None
@@ -67,7 +67,7 @@ def my_step() -> Annotated[
6767
model_name: Optional[str] = None
6868
model_version: Optional[Union[ModelStages, str, int]] = None
6969
is_model_artifact: bool = False
70-
is_endpoint_artifact: bool = False
70+
is_deployment_artifact: bool = False
7171

7272
@root_validator
7373
def _root_validator(cls, values: Dict[str, Any]) -> Dict[str, Any]:

src/zenml/cli/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def copier_github_url(self) -> str:
7373
ZENML_PROJECT_TEMPLATES = dict(
7474
e2e_batch=ZenMLProjectTemplateLocation(
7575
github_url="zenml-io/template-e2e-batch",
76-
github_tag="2023.12.06", # Make sure it is aligned with .github/workflows/update-templates-to-examples.yml
76+
github_tag="2023.12.12", # Make sure it is aligned with .github/workflows/update-templates-to-examples.yml
7777
),
7878
starter=ZenMLProjectTemplateLocation(
7979
github_url="zenml-io/template-starter",

src/zenml/cli/model.py

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,9 @@ def _model_version_to_print(
6464
"tags": [t.name for t in model_version.tags],
6565
"data_artifacts_count": len(model_version.data_artifact_ids),
6666
"model_artifacts_count": len(model_version.model_artifact_ids),
67-
"endpoint_artifacts_count": len(model_version.endpoint_artifact_ids),
67+
"deployment_artifacts_count": len(
68+
model_version.deployment_artifact_ids
69+
),
6870
"pipeline_runs_count": len(model_version.pipeline_run_ids),
6971
"updated": model_version.updated.date(),
7072
}
@@ -519,7 +521,7 @@ def _print_artifacts_links_generic(
519521
model_name_or_id: str,
520522
model_version_name_or_number_or_id: Optional[str] = None,
521523
only_data_artifacts: bool = False,
522-
only_endpoint_artifacts: bool = False,
524+
only_deployment_artifacts: bool = False,
523525
only_model_artifacts: bool = False,
524526
**kwargs: Any,
525527
) -> None:
@@ -529,7 +531,7 @@ def _print_artifacts_links_generic(
529531
model_name_or_id: The ID or name of the model containing version.
530532
model_version_name_or_number_or_id: The name, number or ID of the model version.
531533
only_data_artifacts: If set, only print data artifacts.
532-
only_endpoint_artifacts: If set, only print endpoint artifacts.
534+
only_deployment_artifacts: If set, only print deployment artifacts.
533535
only_model_artifacts: If set, only print model artifacts.
534536
**kwargs: Keyword arguments to filter models.
535537
"""
@@ -540,15 +542,16 @@ def _print_artifacts_links_generic(
540542
type_ = (
541543
"data artifacts"
542544
if only_data_artifacts
543-
else "endpoint artifacts"
544-
if only_endpoint_artifacts
545+
else "deployment artifacts"
546+
if only_deployment_artifacts
545547
else "model artifacts"
546548
)
547549

548550
if (
549551
(only_data_artifacts and not model_version.data_artifact_ids)
550552
or (
551-
only_endpoint_artifacts and not model_version.endpoint_artifact_ids
553+
only_deployment_artifacts
554+
and not model_version.deployment_artifact_ids
552555
)
553556
or (only_model_artifacts and not model_version.model_artifact_ids)
554557
):
@@ -562,7 +565,7 @@ def _print_artifacts_links_generic(
562565
links = Client().list_model_version_artifact_links(
563566
model_version_id=model_version.id,
564567
only_data_artifacts=only_data_artifacts,
565-
only_endpoint_artifacts=only_endpoint_artifacts,
568+
only_deployment_artifacts=only_deployment_artifacts,
566569
only_model_artifacts=only_model_artifacts,
567570
**kwargs,
568571
)
@@ -630,18 +633,18 @@ def list_model_version_model_artifacts(
630633

631634

632635
@model.command(
633-
"endpoint_artifacts",
634-
help="List endpoint artifacts linked to a model version.",
636+
"deployment_artifacts",
637+
help="List deployment artifacts linked to a model version.",
635638
)
636639
@click.argument("model_name")
637640
@click.option("--model_version", "-v", default=None)
638641
@cli_utils.list_options(ModelVersionArtifactFilter)
639-
def list_model_version_endpoint_artifacts(
642+
def list_model_version_deployment_artifacts(
640643
model_name: str,
641644
model_version: Optional[str] = None,
642645
**kwargs: Any,
643646
) -> None:
644-
"""List endpoint artifacts linked to a model version in the Model Control Plane.
647+
"""List deployment artifacts linked to a model version in the Model Control Plane.
645648
646649
Args:
647650
model_name: The ID or name of the model containing version.
@@ -652,7 +655,7 @@ def list_model_version_endpoint_artifacts(
652655
_print_artifacts_links_generic(
653656
model_name_or_id=model_name,
654657
model_version_name_or_number_or_id=model_version,
655-
only_endpoint_artifacts=True,
658+
only_deployment_artifacts=True,
656659
**kwargs,
657660
)
658661

src/zenml/client.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4816,7 +4816,7 @@ def list_model_version_artifact_links(
48164816
artifact_name: Optional[str] = None,
48174817
only_data_artifacts: Optional[bool] = None,
48184818
only_model_artifacts: Optional[bool] = None,
4819-
only_endpoint_artifacts: Optional[bool] = None,
4819+
only_deployment_artifacts: Optional[bool] = None,
48204820
) -> Page[ModelVersionArtifactResponse]:
48214821
"""Get model version to artifact links by filter in Model Control Plane.
48224822
@@ -4835,7 +4835,7 @@ def list_model_version_artifact_links(
48354835
artifact_name: Use the artifact name for filtering
48364836
only_data_artifacts: Use to filter by data artifacts
48374837
only_model_artifacts: Use to filter by model artifacts
4838-
only_endpoint_artifacts: Use to filter by endpoint artifacts
4838+
only_deployment_artifacts: Use to filter by deployment artifacts
48394839
48404840
Returns:
48414841
A page of all model version to artifact links.
@@ -4856,7 +4856,7 @@ def list_model_version_artifact_links(
48564856
artifact_name=artifact_name,
48574857
only_data_artifacts=only_data_artifacts,
48584858
only_model_artifacts=only_model_artifacts,
4859-
only_endpoint_artifacts=only_endpoint_artifacts,
4859+
only_deployment_artifacts=only_deployment_artifacts,
48604860
)
48614861
)
48624862

src/zenml/model/model_version.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -263,24 +263,24 @@ def get_data_artifact(
263263
version=version,
264264
)
265265

266-
def get_endpoint_artifact(
266+
def get_deployment_artifact(
267267
self,
268268
name: str,
269269
version: Optional[str] = None,
270270
) -> Optional[Union["ArtifactVersionResponse", "ExternalArtifact"]]:
271-
"""Get the endpoint artifact linked to this model version.
271+
"""Get the deployment artifact linked to this model version.
272272
273273
Args:
274-
name: The name of the endpoint artifact to retrieve.
275-
version: The version of the endpoint artifact to retrieve (None for latest/non-versioned)
274+
name: The name of the deployment artifact to retrieve.
275+
version: The version of the deployment artifact to retrieve (None for latest/non-versioned)
276276
277277
Returns:
278278
Inside pipeline context: ExternalArtifact object as a lazy loader
279-
Outside of pipeline context: Specific version of the endpoint artifact or None
279+
Outside of pipeline context: Specific version of the deployment artifact or None
280280
"""
281281
if response := self._try_get_as_external_artifact(name, version):
282282
return response
283-
return self._get_or_create_model_version().get_endpoint_artifact(
283+
return self._get_or_create_model_version().get_deployment_artifact(
284284
name=name,
285285
version=version,
286286
)

src/zenml/model/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def link_artifact_config_to_model_version(
111111
model=model_version_response.model.id,
112112
model_version=model_version_response.id,
113113
is_model_artifact=artifact_config.is_model_artifact,
114-
is_endpoint_artifact=artifact_config.is_endpoint_artifact,
114+
is_deployment_artifact=artifact_config.is_deployment_artifact,
115115
)
116116
client.zen_store.create_model_version_artifact_link(request)
117117

src/zenml/models/v2/core/model_version.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,8 @@ class ModelVersionResponseBody(WorkspaceScopedResponseBody):
142142
description="Data artifacts linked to the model version",
143143
default={},
144144
)
145-
endpoint_artifact_ids: Dict[str, Dict[str, UUID]] = Field(
146-
description="Endpoint artifacts linked to the model version",
145+
deployment_artifact_ids: Dict[str, Dict[str, UUID]] = Field(
146+
description="Deployment artifacts linked to the model version",
147147
default={},
148148
)
149149
pipeline_run_ids: Dict[str, UUID] = Field(
@@ -238,13 +238,13 @@ def data_artifact_ids(self) -> Dict[str, Dict[str, UUID]]:
238238
return self.get_body().data_artifact_ids
239239

240240
@property
241-
def endpoint_artifact_ids(self) -> Dict[str, Dict[str, UUID]]:
242-
"""The `endpoint_artifact_ids` property.
241+
def deployment_artifact_ids(self) -> Dict[str, Dict[str, UUID]]:
242+
"""The `deployment_artifact_ids` property.
243243
244244
Returns:
245245
the value of the property.
246246
"""
247-
return self.get_body().endpoint_artifact_ids
247+
return self.get_body().deployment_artifact_ids
248248

249249
@property
250250
def pipeline_run_ids(self) -> Dict[str, UUID]:
@@ -391,20 +391,20 @@ def data_artifacts(
391391
def endpoint_artifacts(
392392
self,
393393
) -> Dict[str, Dict[str, "ArtifactVersionResponse"]]:
394-
"""Get all endpoint artifacts linked to this model version.
394+
"""Get all deployment artifacts linked to this model version.
395395
396396
Returns:
397-
Dictionary of endpoint artifacts with versions as
397+
Dictionary of deployment artifacts with versions as
398398
Dict[str, Dict[str, ArtifactResponse]]
399399
"""
400400
from zenml.client import Client
401401

402402
return {
403403
name: {
404404
version: Client().get_artifact_version(a)
405-
for version, a in self.endpoint_artifact_ids[name].items()
405+
for version, a in self.deployment_artifact_ids[name].items()
406406
}
407-
for name in self.endpoint_artifact_ids
407+
for name in self.deployment_artifact_ids
408408
}
409409

410410
@property
@@ -432,7 +432,7 @@ def _get_linked_object(
432432
Args:
433433
collection: The collection to search in (one of
434434
self.model_artifact_ids, self.data_artifact_ids,
435-
self.endpoint_artifact_ids)
435+
self.deployment_artifact_ids)
436436
name: The name of the artifact to retrieve.
437437
version: The version of the artifact to retrieve (None for
438438
latest/non-versioned)
@@ -468,7 +468,7 @@ def get_artifact(
468468
all_artifact_ids = {
469469
**self.model_artifact_ids,
470470
**self.data_artifact_ids,
471-
**self.endpoint_artifact_ids,
471+
**self.deployment_artifact_ids,
472472
}
473473
return self._get_linked_object(all_artifact_ids, name, version)
474474

@@ -510,23 +510,23 @@ def get_data_artifact(
510510
version,
511511
)
512512

513-
def get_endpoint_artifact(
513+
def get_deployment_artifact(
514514
self,
515515
name: str,
516516
version: Optional[str] = None,
517517
) -> Optional["ArtifactVersionResponse"]:
518-
"""Get the endpoint artifact linked to this model version.
518+
"""Get the deployment artifact linked to this model version.
519519
520520
Args:
521-
name: The name of the endpoint artifact to retrieve.
522-
version: The version of the endpoint artifact to retrieve (None for
521+
name: The name of the deployment artifact to retrieve.
522+
version: The version of the deployment artifact to retrieve (None for
523523
latest/non-versioned)
524524
525525
Returns:
526-
Specific version of the endpoint artifact or None
526+
Specific version of the deployment artifact or None
527527
"""
528528
return self._get_linked_object(
529-
self.endpoint_artifact_ids,
529+
self.deployment_artifact_ids,
530530
name,
531531
version,
532532
)

src/zenml/models/v2/core/model_version_artifact.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -42,19 +42,19 @@ class ModelVersionArtifactRequest(WorkspaceScopedRequest):
4242
model_version: UUID
4343
artifact_version: UUID
4444
is_model_artifact: bool = False
45-
is_endpoint_artifact: bool = False
45+
is_deployment_artifact: bool = False
4646

47-
@validator("is_endpoint_artifact")
47+
@validator("is_deployment_artifact")
4848
def _validate_is_endpoint_artifact(
49-
cls, is_endpoint_artifact: bool, values: Dict[str, Any]
49+
cls, is_deployment_artifact: bool, values: Dict[str, Any]
5050
) -> bool:
5151
is_model_artifact = values.get("is_model_artifact", False)
52-
if is_model_artifact and is_endpoint_artifact:
52+
if is_model_artifact and is_deployment_artifact:
5353
raise ValueError(
54-
"Artifact cannot be a model artifact and endpoint artifact "
54+
"Artifact cannot be a model artifact and deployment artifact "
5555
"at the same time."
5656
)
57-
return is_endpoint_artifact
57+
return is_deployment_artifact
5858

5959

6060
# ------------------ Update Model ------------------
@@ -71,7 +71,7 @@ class ModelVersionArtifactResponseBody(BaseResponseBody):
7171
model_version: UUID
7272
artifact_version: "ArtifactVersionResponse"
7373
is_model_artifact: bool = False
74-
is_endpoint_artifact: bool = False
74+
is_deployment_artifact: bool = False
7575

7676

7777
class ModelVersionArtifactResponse(
@@ -117,13 +117,13 @@ def is_model_artifact(self) -> bool:
117117
return self.get_body().is_model_artifact
118118

119119
@property
120-
def is_endpoint_artifact(self) -> bool:
121-
"""The `is_endpoint_artifact` property.
120+
def is_deployment_artifact(self) -> bool:
121+
"""The `is_deployment_artifact` property.
122122
123123
Returns:
124124
the value of the property.
125125
"""
126-
return self.get_body().is_endpoint_artifact
126+
return self.get_body().is_deployment_artifact
127127

128128

129129
# ------------------ Filter Model ------------------
@@ -138,7 +138,7 @@ class ModelVersionArtifactFilter(WorkspaceScopedFilter):
138138
"artifact_name",
139139
"only_data_artifacts",
140140
"only_model_artifacts",
141-
"only_endpoint_artifacts",
141+
"only_deployment_artifacts",
142142
]
143143

144144
workspace_id: Optional[Union[UUID, str]] = Field(
@@ -162,13 +162,13 @@ class ModelVersionArtifactFilter(WorkspaceScopedFilter):
162162
)
163163
only_data_artifacts: Optional[bool] = False
164164
only_model_artifacts: Optional[bool] = False
165-
only_endpoint_artifacts: Optional[bool] = False
165+
only_deployment_artifacts: Optional[bool] = False
166166

167167
CLI_EXCLUDE_FIELDS = [
168168
*WorkspaceScopedFilter.CLI_EXCLUDE_FIELDS,
169169
"only_data_artifacts",
170170
"only_model_artifacts",
171-
"only_endpoint_artifacts",
171+
"only_deployment_artifacts",
172172
"model_id",
173173
"model_version_id",
174174
"user_id",

0 commit comments

Comments
 (0)