diff --git a/src/zenml/models/v2/core/pipeline.py b/src/zenml/models/v2/core/pipeline.py index 03a81fbb23c..199e9cce959 100644 --- a/src/zenml/models/v2/core/pipeline.py +++ b/src/zenml/models/v2/core/pipeline.py @@ -44,7 +44,7 @@ from zenml.models.v2.core.tag import TagResponse if TYPE_CHECKING: - 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) @@ -119,6 +119,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.", ) diff --git a/src/zenml/zen_stores/schemas/pipeline_schemas.py b/src/zenml/zen_stores/schemas/pipeline_schemas.py index 1f287720ee6..3719a64b207 100644 --- a/src/zenml/zen_stores/schemas/pipeline_schemas.py +++ b/src/zenml/zen_stores/schemas/pipeline_schemas.py @@ -156,7 +156,12 @@ def to_model( resources = None if include_resources: + latest_run_user = self.runs[-1].user if self.runs else None + resources = PipelineResponseResources( + latest_run_user=latest_run_user.to_model() + if latest_run_user + else None, tags=[t.tag.to_model() for t in self.tags], )