Skip to content

Commit

Permalink
Include user of latest run in pipeline response
Browse files Browse the repository at this point in the history
  • Loading branch information
schustmi committed Dec 12, 2024
1 parent b73b567 commit f70cf7e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/zenml/models/v2/core/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
if TYPE_CHECKING:
from sqlalchemy.sql.elements import ColumnElement

from zenml.models.v2.core.pipeline_run import PipelineRunResponse
from zenml.models import PipelineRunResponse, UserResponse
from zenml.zen_stores.schemas import BaseSchema

AnySchema = TypeVar("AnySchema", bound=BaseSchema)
Expand Down Expand Up @@ -122,6 +122,10 @@ class PipelineResponseMetadata(WorkspaceScopedResponseMetadata):
class PipelineResponseResources(WorkspaceScopedResponseResources):
"""Class for all resource models associated with the pipeline entity."""

latest_run_user: Optional["UserResponse"] = Field(
default=None,
title="The user that created the latest run of this pipeline.",
)
tags: List[TagResponse] = Field(
title="Tags associated with the pipeline.",
)
Expand Down
3 changes: 3 additions & 0 deletions src/zenml/zen_stores/schemas/pipeline_schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,9 @@ def to_model(
resources = None
if include_resources:
resources = PipelineResponseResources(
latest_run_user=self.runs[-1].user.to_model()
if self.runs
else None,
tags=[t.tag.to_model() for t in self.tags],
)

Expand Down

0 comments on commit f70cf7e

Please sign in to comment.