Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/zenml/models/v2/core/deployment.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
from zenml.models.v2.core.pipeline_snapshot import (
PipelineSnapshotResponse,
)
from zenml.models.v2.core.stack import StackResponse
from zenml.models.v2.core.tag import TagResponse
from zenml.zen_stores.schemas.base_schemas import BaseSchema

Expand Down Expand Up @@ -212,6 +213,11 @@ class DeploymentResponseResources(ProjectScopedResponseResources):
default_factory=list,
title="Curated deployment visualizations.",
)
stack: Optional["StackResponse"] = Field(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this for the frontend? Otherwise, in code it would also be quite easy to just fetch it from the snapshot that is already passed as part of the resources.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is mainly for front-end

default=None,
title="The stack that was deployed.",
description="The stack that was deployed.",
)


class DeploymentResponse(
Expand Down Expand Up @@ -321,6 +327,15 @@ def visualizations(self) -> List["CuratedVisualizationResponse"]:
"""
return self.get_resources().visualizations

@property
def stack(self) -> Optional["StackResponse"]:
"""The stack.

Returns:
The stack.
"""
return self.get_resources().stack

@property
def snapshot_id(self) -> Optional[UUID]:
"""The pipeline snapshot ID.
Expand Down
6 changes: 6 additions & 0 deletions src/zenml/zen_stores/schemas/deployment_schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,9 @@ def get_query_options(
selectinload(jl_arg(DeploymentSchema.snapshot)).joinedload(
jl_arg(PipelineSnapshotSchema.pipeline)
),
selectinload(jl_arg(DeploymentSchema.snapshot)).joinedload(
jl_arg(PipelineSnapshotSchema.stack)
),
selectinload(jl_arg(DeploymentSchema.visualizations)),
]
)
Expand Down Expand Up @@ -241,6 +244,9 @@ def to_model(
pipeline=self.snapshot.pipeline.to_model()
if self.snapshot and self.snapshot.pipeline
else None,
stack=self.snapshot.stack.to_model()
if self.snapshot and self.snapshot.stack
else None,
visualizations=[
visualization.to_model(
include_metadata=False,
Expand Down
Loading