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

0 commit comments

Comments
 (0)