zenml-nightly 0.75.0.dev20250313__py3-none-any.whl → 0.75.0.dev20250315__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- zenml/VERSION +1 -1
- zenml/analytics/context.py +4 -4
- zenml/analytics/enums.py +2 -2
- zenml/artifacts/utils.py +2 -2
- zenml/cli/__init__.py +8 -9
- zenml/cli/base.py +2 -2
- zenml/cli/code_repository.py +1 -1
- zenml/cli/login.py +21 -18
- zenml/cli/pipeline.py +3 -3
- zenml/cli/project.py +172 -0
- zenml/cli/server.py +5 -5
- zenml/cli/service_accounts.py +0 -1
- zenml/cli/service_connectors.py +15 -16
- zenml/cli/stack.py +0 -2
- zenml/cli/stack_components.py +2 -2
- zenml/cli/utils.py +3 -3
- zenml/client.py +352 -341
- zenml/config/global_config.py +41 -43
- zenml/config/server_config.py +9 -9
- zenml/constants.py +5 -3
- zenml/event_hub/event_hub.py +1 -1
- zenml/integrations/gcp/__init__.py +1 -0
- zenml/integrations/gcp/flavors/vertex_orchestrator_flavor.py +5 -0
- zenml/integrations/gcp/flavors/vertex_step_operator_flavor.py +5 -28
- zenml/integrations/gcp/orchestrators/vertex_orchestrator.py +125 -78
- zenml/integrations/gcp/service_connectors/gcp_service_connector.py +7 -6
- zenml/integrations/gcp/vertex_custom_job_parameters.py +50 -0
- zenml/integrations/mlflow/steps/mlflow_registry.py +3 -3
- zenml/integrations/wandb/__init__.py +1 -1
- zenml/integrations/wandb/experiment_trackers/wandb_experiment_tracker.py +29 -9
- zenml/integrations/wandb/flavors/wandb_experiment_tracker_flavor.py +2 -0
- zenml/login/credentials.py +26 -27
- zenml/login/credentials_store.py +5 -5
- zenml/login/pro/client.py +9 -9
- zenml/login/pro/utils.py +8 -8
- zenml/login/pro/{tenant → workspace}/__init__.py +1 -1
- zenml/login/pro/{tenant → workspace}/client.py +25 -25
- zenml/login/pro/{tenant → workspace}/models.py +27 -28
- zenml/model/model.py +2 -2
- zenml/model_registries/base_model_registry.py +1 -1
- zenml/models/__init__.py +29 -29
- zenml/models/v2/base/filter.py +1 -1
- zenml/models/v2/base/scoped.py +49 -53
- zenml/models/v2/core/action.py +12 -12
- zenml/models/v2/core/artifact.py +15 -15
- zenml/models/v2/core/artifact_version.py +15 -15
- zenml/models/v2/core/code_repository.py +12 -12
- zenml/models/v2/core/event_source.py +12 -12
- zenml/models/v2/core/model.py +26 -18
- zenml/models/v2/core/model_version.py +15 -15
- zenml/models/v2/core/pipeline.py +15 -15
- zenml/models/v2/core/pipeline_build.py +14 -14
- zenml/models/v2/core/pipeline_deployment.py +12 -14
- zenml/models/v2/core/pipeline_run.py +16 -16
- zenml/models/v2/core/project.py +203 -0
- zenml/models/v2/core/run_metadata.py +2 -2
- zenml/models/v2/core/run_template.py +15 -15
- zenml/models/v2/core/schedule.py +12 -12
- zenml/models/v2/core/secret.py +1 -1
- zenml/models/v2/core/service.py +14 -14
- zenml/models/v2/core/step_run.py +13 -13
- zenml/models/v2/core/tag.py +96 -3
- zenml/models/v2/core/trigger.py +13 -13
- zenml/models/v2/core/trigger_execution.py +2 -2
- zenml/models/v2/core/user.py +0 -17
- zenml/models/v2/misc/server_models.py +6 -6
- zenml/models/v2/misc/statistics.py +4 -4
- zenml/orchestrators/cache_utils.py +7 -7
- zenml/orchestrators/input_utils.py +1 -1
- zenml/orchestrators/step_launcher.py +1 -1
- zenml/orchestrators/step_run_utils.py +3 -3
- zenml/orchestrators/utils.py +4 -4
- zenml/pipelines/build_utils.py +2 -2
- zenml/pipelines/pipeline_definition.py +5 -5
- zenml/pipelines/run_utils.py +1 -1
- zenml/service_connectors/service_connector.py +0 -3
- zenml/service_connectors/service_connector_utils.py +0 -1
- zenml/stack/stack.py +0 -1
- zenml/steps/base_step.py +10 -2
- zenml/utils/dashboard_utils.py +1 -1
- zenml/utils/tag_utils.py +0 -12
- zenml/zen_server/cloud_utils.py +3 -3
- zenml/zen_server/feature_gate/endpoint_utils.py +1 -1
- zenml/zen_server/feature_gate/zenml_cloud_feature_gate.py +1 -1
- zenml/zen_server/rbac/endpoint_utils.py +17 -17
- zenml/zen_server/rbac/models.py +47 -22
- zenml/zen_server/rbac/rbac_sql_zen_store.py +3 -3
- zenml/zen_server/rbac/utils.py +23 -25
- zenml/zen_server/rbac/zenml_cloud_rbac.py +7 -74
- zenml/zen_server/routers/artifact_version_endpoints.py +10 -10
- zenml/zen_server/routers/auth_endpoints.py +6 -6
- zenml/zen_server/routers/code_repositories_endpoints.py +12 -14
- zenml/zen_server/routers/model_versions_endpoints.py +13 -15
- zenml/zen_server/routers/models_endpoints.py +7 -9
- zenml/zen_server/routers/pipeline_builds_endpoints.py +14 -16
- zenml/zen_server/routers/pipeline_deployments_endpoints.py +13 -15
- zenml/zen_server/routers/pipelines_endpoints.py +16 -18
- zenml/zen_server/routers/{workspaces_endpoints.py → projects_endpoints.py} +111 -68
- zenml/zen_server/routers/run_metadata_endpoints.py +7 -9
- zenml/zen_server/routers/run_templates_endpoints.py +15 -17
- zenml/zen_server/routers/runs_endpoints.py +12 -14
- zenml/zen_server/routers/schedule_endpoints.py +12 -14
- zenml/zen_server/routers/secrets_endpoints.py +1 -3
- zenml/zen_server/routers/server_endpoints.py +7 -7
- zenml/zen_server/routers/service_connectors_endpoints.py +11 -13
- zenml/zen_server/routers/service_endpoints.py +7 -9
- zenml/zen_server/routers/stack_components_endpoints.py +9 -11
- zenml/zen_server/routers/stacks_endpoints.py +9 -11
- zenml/zen_server/routers/steps_endpoints.py +6 -6
- zenml/zen_server/routers/users_endpoints.py +5 -43
- zenml/zen_server/template_execution/utils.py +4 -4
- zenml/zen_server/utils.py +10 -10
- zenml/zen_server/zen_server_api.py +6 -5
- zenml/zen_stores/base_zen_store.py +38 -42
- zenml/zen_stores/migrations/versions/12eff0206201_rename_workspace_to_project.py +768 -0
- zenml/zen_stores/migrations/versions/41b28cae31ce_make_artifacts_workspace_scoped.py +3 -3
- zenml/zen_stores/migrations/versions/cbc6acd71f92_add_workspace_display_name.py +58 -0
- zenml/zen_stores/rest_zen_store.py +55 -63
- zenml/zen_stores/schemas/__init__.py +2 -2
- zenml/zen_stores/schemas/action_schemas.py +9 -9
- zenml/zen_stores/schemas/artifact_schemas.py +15 -17
- zenml/zen_stores/schemas/code_repository_schemas.py +16 -18
- zenml/zen_stores/schemas/event_source_schemas.py +9 -9
- zenml/zen_stores/schemas/model_schemas.py +15 -17
- zenml/zen_stores/schemas/pipeline_build_schemas.py +7 -7
- zenml/zen_stores/schemas/pipeline_deployment_schemas.py +7 -7
- zenml/zen_stores/schemas/pipeline_run_schemas.py +9 -9
- zenml/zen_stores/schemas/pipeline_schemas.py +9 -9
- zenml/zen_stores/schemas/{workspace_schemas.py → project_schemas.py} +47 -41
- zenml/zen_stores/schemas/run_metadata_schemas.py +5 -5
- zenml/zen_stores/schemas/run_template_schemas.py +9 -9
- zenml/zen_stores/schemas/schedule_schema.py +9 -9
- zenml/zen_stores/schemas/service_schemas.py +7 -7
- zenml/zen_stores/schemas/step_run_schemas.py +7 -7
- zenml/zen_stores/schemas/trigger_schemas.py +9 -9
- zenml/zen_stores/schemas/user_schemas.py +0 -12
- zenml/zen_stores/sql_zen_store.py +318 -275
- zenml/zen_stores/zen_store_interface.py +56 -70
- {zenml_nightly-0.75.0.dev20250313.dist-info → zenml_nightly-0.75.0.dev20250315.dist-info}/METADATA +1 -1
- {zenml_nightly-0.75.0.dev20250313.dist-info → zenml_nightly-0.75.0.dev20250315.dist-info}/RECORD +143 -140
- zenml/cli/workspace.py +0 -160
- zenml/models/v2/core/workspace.py +0 -131
- {zenml_nightly-0.75.0.dev20250313.dist-info → zenml_nightly-0.75.0.dev20250315.dist-info}/LICENSE +0 -0
- {zenml_nightly-0.75.0.dev20250313.dist-info → zenml_nightly-0.75.0.dev20250315.dist-info}/WHEEL +0 -0
- {zenml_nightly-0.75.0.dev20250313.dist-info → zenml_nightly-0.75.0.dev20250315.dist-info}/entry_points.txt +0 -0
@@ -57,6 +57,7 @@ from zenml.zen_stores.schemas.artifact_schemas import ArtifactVersionSchema
|
|
57
57
|
from zenml.zen_stores.schemas.base_schemas import BaseSchema, NamedSchema
|
58
58
|
from zenml.zen_stores.schemas.constants import MODEL_VERSION_TABLENAME
|
59
59
|
from zenml.zen_stores.schemas.pipeline_run_schemas import PipelineRunSchema
|
60
|
+
from zenml.zen_stores.schemas.project_schemas import ProjectSchema
|
60
61
|
from zenml.zen_stores.schemas.run_metadata_schemas import RunMetadataSchema
|
61
62
|
from zenml.zen_stores.schemas.schema_utils import build_foreign_key_field
|
62
63
|
from zenml.zen_stores.schemas.tag_schemas import TagSchema
|
@@ -65,7 +66,6 @@ from zenml.zen_stores.schemas.utils import (
|
|
65
66
|
RunMetadataInterface,
|
66
67
|
get_page_from_list,
|
67
68
|
)
|
68
|
-
from zenml.zen_stores.schemas.workspace_schemas import WorkspaceSchema
|
69
69
|
|
70
70
|
if TYPE_CHECKING:
|
71
71
|
from zenml.zen_stores.schemas import ServiceSchema, StepRunSchema
|
@@ -78,20 +78,20 @@ class ModelSchema(NamedSchema, table=True):
|
|
78
78
|
__table_args__ = (
|
79
79
|
UniqueConstraint(
|
80
80
|
"name",
|
81
|
-
"
|
82
|
-
name="
|
81
|
+
"project_id",
|
82
|
+
name="unique_model_name_in_project",
|
83
83
|
),
|
84
84
|
)
|
85
85
|
|
86
|
-
|
86
|
+
project_id: UUID = build_foreign_key_field(
|
87
87
|
source=__tablename__,
|
88
|
-
target=
|
89
|
-
source_column="
|
88
|
+
target=ProjectSchema.__tablename__,
|
89
|
+
source_column="project_id",
|
90
90
|
target_column="id",
|
91
91
|
ondelete="CASCADE",
|
92
92
|
nullable=False,
|
93
93
|
)
|
94
|
-
|
94
|
+
project: "ProjectSchema" = Relationship(back_populates="models")
|
95
95
|
|
96
96
|
user_id: Optional[UUID] = build_foreign_key_field(
|
97
97
|
source=__tablename__,
|
@@ -165,7 +165,7 @@ class ModelSchema(NamedSchema, table=True):
|
|
165
165
|
"""
|
166
166
|
return cls(
|
167
167
|
name=model_request.name,
|
168
|
-
|
168
|
+
project_id=model_request.project,
|
169
169
|
user_id=model_request.user,
|
170
170
|
license=model_request.license,
|
171
171
|
description=model_request.description,
|
@@ -206,7 +206,7 @@ class ModelSchema(NamedSchema, table=True):
|
|
206
206
|
metadata = None
|
207
207
|
if include_metadata:
|
208
208
|
metadata = ModelResponseMetadata(
|
209
|
-
|
209
|
+
project=self.project.to_model(),
|
210
210
|
license=self.license,
|
211
211
|
description=self.description,
|
212
212
|
audience=self.audience,
|
@@ -285,17 +285,15 @@ class ModelVersionSchema(NamedSchema, RunMetadataInterface, table=True):
|
|
285
285
|
),
|
286
286
|
)
|
287
287
|
|
288
|
-
|
288
|
+
project_id: UUID = build_foreign_key_field(
|
289
289
|
source=__tablename__,
|
290
|
-
target=
|
291
|
-
source_column="
|
290
|
+
target=ProjectSchema.__tablename__,
|
291
|
+
source_column="project_id",
|
292
292
|
target_column="id",
|
293
293
|
ondelete="CASCADE",
|
294
294
|
nullable=False,
|
295
295
|
)
|
296
|
-
|
297
|
-
back_populates="model_versions"
|
298
|
-
)
|
296
|
+
project: "ProjectSchema" = Relationship(back_populates="model_versions")
|
299
297
|
|
300
298
|
user_id: Optional[UUID] = build_foreign_key_field(
|
301
299
|
source=__tablename__,
|
@@ -400,7 +398,7 @@ class ModelVersionSchema(NamedSchema, RunMetadataInterface, table=True):
|
|
400
398
|
|
401
399
|
return cls(
|
402
400
|
id=id_,
|
403
|
-
|
401
|
+
project_id=model_version_request.project,
|
404
402
|
user_id=model_version_request.user,
|
405
403
|
model_id=model_version_request.model,
|
406
404
|
name=model_version_request.name,
|
@@ -468,7 +466,7 @@ class ModelVersionSchema(NamedSchema, RunMetadataInterface, table=True):
|
|
468
466
|
metadata = None
|
469
467
|
if include_metadata:
|
470
468
|
metadata = ModelVersionResponseMetadata(
|
471
|
-
|
469
|
+
project=self.project.to_model(),
|
472
470
|
description=self.description,
|
473
471
|
run_metadata=self.fetch_metadata(),
|
474
472
|
)
|
@@ -31,10 +31,10 @@ from zenml.models import (
|
|
31
31
|
from zenml.utils.json_utils import pydantic_encoder
|
32
32
|
from zenml.zen_stores.schemas.base_schemas import BaseSchema
|
33
33
|
from zenml.zen_stores.schemas.pipeline_schemas import PipelineSchema
|
34
|
+
from zenml.zen_stores.schemas.project_schemas import ProjectSchema
|
34
35
|
from zenml.zen_stores.schemas.schema_utils import build_foreign_key_field
|
35
36
|
from zenml.zen_stores.schemas.stack_schemas import StackSchema
|
36
37
|
from zenml.zen_stores.schemas.user_schemas import UserSchema
|
37
|
-
from zenml.zen_stores.schemas.workspace_schemas import WorkspaceSchema
|
38
38
|
|
39
39
|
|
40
40
|
class PipelineBuildSchema(BaseSchema, table=True):
|
@@ -52,15 +52,15 @@ class PipelineBuildSchema(BaseSchema, table=True):
|
|
52
52
|
)
|
53
53
|
user: Optional["UserSchema"] = Relationship(back_populates="builds")
|
54
54
|
|
55
|
-
|
55
|
+
project_id: UUID = build_foreign_key_field(
|
56
56
|
source=__tablename__,
|
57
|
-
target=
|
58
|
-
source_column="
|
57
|
+
target=ProjectSchema.__tablename__,
|
58
|
+
source_column="project_id",
|
59
59
|
target_column="id",
|
60
60
|
ondelete="CASCADE",
|
61
61
|
nullable=False,
|
62
62
|
)
|
63
|
-
|
63
|
+
project: "ProjectSchema" = Relationship(back_populates="builds")
|
64
64
|
|
65
65
|
stack_id: Optional[UUID] = build_foreign_key_field(
|
66
66
|
source=__tablename__,
|
@@ -117,7 +117,7 @@ class PipelineBuildSchema(BaseSchema, table=True):
|
|
117
117
|
"""
|
118
118
|
return cls(
|
119
119
|
stack_id=request.stack,
|
120
|
-
|
120
|
+
project_id=request.project,
|
121
121
|
user_id=request.user,
|
122
122
|
pipeline_id=request.pipeline,
|
123
123
|
images=json.dumps(request.images, default=pydantic_encoder),
|
@@ -155,7 +155,7 @@ class PipelineBuildSchema(BaseSchema, table=True):
|
|
155
155
|
metadata = None
|
156
156
|
if include_metadata:
|
157
157
|
metadata = PipelineBuildResponseMetadata(
|
158
|
-
|
158
|
+
project=self.project.to_model(),
|
159
159
|
pipeline=self.pipeline.to_model() if self.pipeline else None,
|
160
160
|
stack=self.stack.to_model() if self.stack else None,
|
161
161
|
images=json.loads(self.images),
|
@@ -38,11 +38,11 @@ from zenml.zen_stores.schemas.code_repository_schemas import (
|
|
38
38
|
)
|
39
39
|
from zenml.zen_stores.schemas.pipeline_build_schemas import PipelineBuildSchema
|
40
40
|
from zenml.zen_stores.schemas.pipeline_schemas import PipelineSchema
|
41
|
+
from zenml.zen_stores.schemas.project_schemas import ProjectSchema
|
41
42
|
from zenml.zen_stores.schemas.schedule_schema import ScheduleSchema
|
42
43
|
from zenml.zen_stores.schemas.schema_utils import build_foreign_key_field
|
43
44
|
from zenml.zen_stores.schemas.stack_schemas import StackSchema
|
44
45
|
from zenml.zen_stores.schemas.user_schemas import UserSchema
|
45
|
-
from zenml.zen_stores.schemas.workspace_schemas import WorkspaceSchema
|
46
46
|
|
47
47
|
if TYPE_CHECKING:
|
48
48
|
from zenml.zen_stores.schemas.pipeline_run_schemas import PipelineRunSchema
|
@@ -95,10 +95,10 @@ class PipelineDeploymentSchema(BaseSchema, table=True):
|
|
95
95
|
ondelete="SET NULL",
|
96
96
|
nullable=True,
|
97
97
|
)
|
98
|
-
|
98
|
+
project_id: UUID = build_foreign_key_field(
|
99
99
|
source=__tablename__,
|
100
|
-
target=
|
101
|
-
source_column="
|
100
|
+
target=ProjectSchema.__tablename__,
|
101
|
+
source_column="project_id",
|
102
102
|
target_column="id",
|
103
103
|
ondelete="CASCADE",
|
104
104
|
nullable=False,
|
@@ -151,7 +151,7 @@ class PipelineDeploymentSchema(BaseSchema, table=True):
|
|
151
151
|
user: Optional["UserSchema"] = Relationship(
|
152
152
|
back_populates="deployments",
|
153
153
|
)
|
154
|
-
|
154
|
+
project: "ProjectSchema" = Relationship()
|
155
155
|
stack: Optional["StackSchema"] = Relationship()
|
156
156
|
pipeline: Optional["PipelineSchema"] = Relationship()
|
157
157
|
schedule: Optional["ScheduleSchema"] = Relationship()
|
@@ -187,7 +187,7 @@ class PipelineDeploymentSchema(BaseSchema, table=True):
|
|
187
187
|
"""
|
188
188
|
return cls(
|
189
189
|
stack_id=request.stack,
|
190
|
-
|
190
|
+
project_id=request.project,
|
191
191
|
pipeline_id=request.pipeline,
|
192
192
|
build_id=request.build,
|
193
193
|
user_id=request.user,
|
@@ -245,7 +245,7 @@ class PipelineDeploymentSchema(BaseSchema, table=True):
|
|
245
245
|
step_configurations[s] = Step.model_validate(c)
|
246
246
|
|
247
247
|
metadata = PipelineDeploymentResponseMetadata(
|
248
|
-
|
248
|
+
project=self.project.to_model(),
|
249
249
|
run_name_template=self.run_name_template,
|
250
250
|
pipeline_configuration=pipeline_configuration,
|
251
251
|
step_configurations=step_configurations,
|
@@ -45,13 +45,13 @@ from zenml.zen_stores.schemas.pipeline_deployment_schemas import (
|
|
45
45
|
PipelineDeploymentSchema,
|
46
46
|
)
|
47
47
|
from zenml.zen_stores.schemas.pipeline_schemas import PipelineSchema
|
48
|
+
from zenml.zen_stores.schemas.project_schemas import ProjectSchema
|
48
49
|
from zenml.zen_stores.schemas.schedule_schema import ScheduleSchema
|
49
50
|
from zenml.zen_stores.schemas.schema_utils import build_foreign_key_field
|
50
51
|
from zenml.zen_stores.schemas.stack_schemas import StackSchema
|
51
52
|
from zenml.zen_stores.schemas.trigger_schemas import TriggerExecutionSchema
|
52
53
|
from zenml.zen_stores.schemas.user_schemas import UserSchema
|
53
54
|
from zenml.zen_stores.schemas.utils import RunMetadataInterface
|
54
|
-
from zenml.zen_stores.schemas.workspace_schemas import WorkspaceSchema
|
55
55
|
|
56
56
|
if TYPE_CHECKING:
|
57
57
|
from zenml.zen_stores.schemas.logs_schemas import LogsSchema
|
@@ -77,8 +77,8 @@ class PipelineRunSchema(NamedSchema, RunMetadataInterface, table=True):
|
|
77
77
|
),
|
78
78
|
UniqueConstraint(
|
79
79
|
"name",
|
80
|
-
"
|
81
|
-
name="
|
80
|
+
"project_id",
|
81
|
+
name="unique_run_name_in_project",
|
82
82
|
),
|
83
83
|
)
|
84
84
|
|
@@ -108,10 +108,10 @@ class PipelineRunSchema(NamedSchema, RunMetadataInterface, table=True):
|
|
108
108
|
ondelete="SET NULL",
|
109
109
|
nullable=True,
|
110
110
|
)
|
111
|
-
|
111
|
+
project_id: UUID = build_foreign_key_field(
|
112
112
|
source=__tablename__,
|
113
|
-
target=
|
114
|
-
source_column="
|
113
|
+
target=ProjectSchema.__tablename__,
|
114
|
+
source_column="project_id",
|
115
115
|
target_column="id",
|
116
116
|
ondelete="CASCADE",
|
117
117
|
nullable=False,
|
@@ -137,7 +137,7 @@ class PipelineRunSchema(NamedSchema, RunMetadataInterface, table=True):
|
|
137
137
|
deployment: Optional["PipelineDeploymentSchema"] = Relationship(
|
138
138
|
back_populates="pipeline_runs"
|
139
139
|
)
|
140
|
-
|
140
|
+
project: "ProjectSchema" = Relationship(back_populates="runs")
|
141
141
|
user: Optional["UserSchema"] = Relationship(back_populates="runs")
|
142
142
|
run_metadata: List["RunMetadataSchema"] = Relationship(
|
143
143
|
sa_relationship_kwargs=dict(
|
@@ -241,7 +241,7 @@ class PipelineRunSchema(NamedSchema, RunMetadataInterface, table=True):
|
|
241
241
|
orchestrator_environment = json.dumps(request.orchestrator_environment)
|
242
242
|
|
243
243
|
return cls(
|
244
|
-
|
244
|
+
project_id=request.project,
|
245
245
|
user_id=request.user,
|
246
246
|
name=request.name,
|
247
247
|
orchestrator_run_id=request.orchestrator_run_id,
|
@@ -384,7 +384,7 @@ class PipelineRunSchema(NamedSchema, RunMetadataInterface, table=True):
|
|
384
384
|
else {}
|
385
385
|
)
|
386
386
|
metadata = PipelineRunResponseMetadata(
|
387
|
-
|
387
|
+
project=self.project.to_model(),
|
388
388
|
run_metadata=self.fetch_metadata(),
|
389
389
|
config=config,
|
390
390
|
steps=steps,
|
@@ -31,9 +31,9 @@ from zenml.models import (
|
|
31
31
|
)
|
32
32
|
from zenml.utils.time_utils import utc_now
|
33
33
|
from zenml.zen_stores.schemas.base_schemas import NamedSchema
|
34
|
+
from zenml.zen_stores.schemas.project_schemas import ProjectSchema
|
34
35
|
from zenml.zen_stores.schemas.schema_utils import build_foreign_key_field
|
35
36
|
from zenml.zen_stores.schemas.user_schemas import UserSchema
|
36
|
-
from zenml.zen_stores.schemas.workspace_schemas import WorkspaceSchema
|
37
37
|
|
38
38
|
if TYPE_CHECKING:
|
39
39
|
from zenml.zen_stores.schemas.pipeline_build_schemas import (
|
@@ -54,18 +54,18 @@ class PipelineSchema(NamedSchema, table=True):
|
|
54
54
|
__table_args__ = (
|
55
55
|
UniqueConstraint(
|
56
56
|
"name",
|
57
|
-
"
|
58
|
-
name="
|
57
|
+
"project_id",
|
58
|
+
name="unique_pipeline_name_in_project",
|
59
59
|
),
|
60
60
|
)
|
61
61
|
# Fields
|
62
62
|
description: Optional[str] = Field(sa_column=Column(TEXT, nullable=True))
|
63
63
|
|
64
64
|
# Foreign keys
|
65
|
-
|
65
|
+
project_id: UUID = build_foreign_key_field(
|
66
66
|
source=__tablename__,
|
67
|
-
target=
|
68
|
-
source_column="
|
67
|
+
target=ProjectSchema.__tablename__,
|
68
|
+
source_column="project_id",
|
69
69
|
target_column="id",
|
70
70
|
ondelete="CASCADE",
|
71
71
|
nullable=False,
|
@@ -81,7 +81,7 @@ class PipelineSchema(NamedSchema, table=True):
|
|
81
81
|
|
82
82
|
# Relationships
|
83
83
|
user: Optional["UserSchema"] = Relationship(back_populates="pipelines")
|
84
|
-
|
84
|
+
project: "ProjectSchema" = Relationship(back_populates="pipelines")
|
85
85
|
|
86
86
|
schedules: List["ScheduleSchema"] = Relationship(
|
87
87
|
back_populates="pipeline",
|
@@ -146,7 +146,7 @@ class PipelineSchema(NamedSchema, table=True):
|
|
146
146
|
return cls(
|
147
147
|
name=pipeline_request.name,
|
148
148
|
description=pipeline_request.description,
|
149
|
-
|
149
|
+
project_id=pipeline_request.project,
|
150
150
|
user_id=pipeline_request.user,
|
151
151
|
)
|
152
152
|
|
@@ -179,7 +179,7 @@ class PipelineSchema(NamedSchema, table=True):
|
|
179
179
|
metadata = None
|
180
180
|
if include_metadata:
|
181
181
|
metadata = PipelineResponseMetadata(
|
182
|
-
|
182
|
+
project=self.project.to_model(),
|
183
183
|
description=self.description,
|
184
184
|
)
|
185
185
|
|
@@ -11,7 +11,7 @@
|
|
11
11
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
12
12
|
# or implied. See the License for the specific language governing
|
13
13
|
# permissions and limitations under the License.
|
14
|
-
"""SQL Model Implementations for
|
14
|
+
"""SQL Model Implementations for projects."""
|
15
15
|
|
16
16
|
from typing import TYPE_CHECKING, Any, List
|
17
17
|
|
@@ -19,11 +19,11 @@ from sqlalchemy import UniqueConstraint
|
|
19
19
|
from sqlmodel import Relationship
|
20
20
|
|
21
21
|
from zenml.models import (
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
22
|
+
ProjectRequest,
|
23
|
+
ProjectResponse,
|
24
|
+
ProjectResponseBody,
|
25
|
+
ProjectResponseMetadata,
|
26
|
+
ProjectUpdate,
|
27
27
|
)
|
28
28
|
from zenml.utils.time_utils import utc_now
|
29
29
|
from zenml.zen_stores.schemas.base_schemas import NamedSchema
|
@@ -48,104 +48,109 @@ if TYPE_CHECKING:
|
|
48
48
|
)
|
49
49
|
|
50
50
|
|
51
|
-
class
|
52
|
-
"""SQL Model for
|
51
|
+
class ProjectSchema(NamedSchema, table=True):
|
52
|
+
"""SQL Model for projects."""
|
53
53
|
|
54
|
-
__tablename__ = "
|
54
|
+
__tablename__ = "project"
|
55
55
|
__table_args__ = (
|
56
56
|
UniqueConstraint(
|
57
57
|
"name",
|
58
|
-
name="
|
58
|
+
name="unique_project_name",
|
59
59
|
),
|
60
60
|
)
|
61
61
|
|
62
|
+
display_name: str
|
62
63
|
description: str
|
63
64
|
|
64
65
|
pipelines: List["PipelineSchema"] = Relationship(
|
65
|
-
back_populates="
|
66
|
+
back_populates="project",
|
66
67
|
sa_relationship_kwargs={"cascade": "delete"},
|
67
68
|
)
|
68
69
|
schedules: List["ScheduleSchema"] = Relationship(
|
69
|
-
back_populates="
|
70
|
+
back_populates="project",
|
70
71
|
sa_relationship_kwargs={"cascade": "delete"},
|
71
72
|
)
|
72
73
|
runs: List["PipelineRunSchema"] = Relationship(
|
73
|
-
back_populates="
|
74
|
+
back_populates="project",
|
74
75
|
sa_relationship_kwargs={"cascade": "delete"},
|
75
76
|
)
|
76
77
|
step_runs: List["StepRunSchema"] = Relationship(
|
77
|
-
back_populates="
|
78
|
+
back_populates="project",
|
78
79
|
sa_relationship_kwargs={"cascade": "delete"},
|
79
80
|
)
|
80
81
|
builds: List["PipelineBuildSchema"] = Relationship(
|
81
|
-
back_populates="
|
82
|
+
back_populates="project",
|
82
83
|
sa_relationship_kwargs={"cascade": "delete"},
|
83
84
|
)
|
84
85
|
artifact_versions: List["ArtifactVersionSchema"] = Relationship(
|
85
|
-
back_populates="
|
86
|
+
back_populates="project",
|
86
87
|
sa_relationship_kwargs={"cascade": "delete"},
|
87
88
|
)
|
88
89
|
run_metadata: List["RunMetadataSchema"] = Relationship(
|
89
|
-
back_populates="
|
90
|
+
back_populates="project",
|
90
91
|
sa_relationship_kwargs={"cascade": "delete"},
|
91
92
|
)
|
92
93
|
actions: List["ActionSchema"] = Relationship(
|
93
|
-
back_populates="
|
94
|
+
back_populates="project",
|
94
95
|
sa_relationship_kwargs={"cascade": "delete"},
|
95
96
|
)
|
96
97
|
triggers: List["TriggerSchema"] = Relationship(
|
97
|
-
back_populates="
|
98
|
+
back_populates="project",
|
98
99
|
sa_relationship_kwargs={"cascade": "delete"},
|
99
100
|
)
|
100
101
|
event_sources: List["EventSourceSchema"] = Relationship(
|
101
|
-
back_populates="
|
102
|
+
back_populates="project",
|
102
103
|
sa_relationship_kwargs={"cascade": "delete"},
|
103
104
|
)
|
104
105
|
|
105
106
|
deployments: List["PipelineDeploymentSchema"] = Relationship(
|
106
|
-
back_populates="
|
107
|
+
back_populates="project",
|
107
108
|
sa_relationship_kwargs={"cascade": "delete"},
|
108
109
|
)
|
109
110
|
code_repositories: List["CodeRepositorySchema"] = Relationship(
|
110
|
-
back_populates="
|
111
|
+
back_populates="project",
|
111
112
|
sa_relationship_kwargs={"cascade": "delete"},
|
112
113
|
)
|
113
114
|
services: List["ServiceSchema"] = Relationship(
|
114
|
-
back_populates="
|
115
|
+
back_populates="project",
|
115
116
|
sa_relationship_kwargs={"cascade": "delete"},
|
116
117
|
)
|
117
118
|
models: List["ModelSchema"] = Relationship(
|
118
|
-
back_populates="
|
119
|
+
back_populates="project",
|
119
120
|
sa_relationship_kwargs={"cascade": "delete"},
|
120
121
|
)
|
121
122
|
model_versions: List["ModelVersionSchema"] = Relationship(
|
122
|
-
back_populates="
|
123
|
+
back_populates="project",
|
123
124
|
sa_relationship_kwargs={"cascade": "delete"},
|
124
125
|
)
|
125
126
|
|
126
127
|
@classmethod
|
127
|
-
def from_request(cls,
|
128
|
-
"""Create a `
|
128
|
+
def from_request(cls, project: ProjectRequest) -> "ProjectSchema":
|
129
|
+
"""Create a `ProjectSchema` from a `ProjectResponse`.
|
129
130
|
|
130
131
|
Args:
|
131
|
-
|
132
|
+
project: The `ProjectResponse` from which to create the schema.
|
132
133
|
|
133
134
|
Returns:
|
134
|
-
The created `
|
135
|
+
The created `ProjectSchema`.
|
135
136
|
"""
|
136
|
-
return cls(
|
137
|
+
return cls(
|
138
|
+
name=project.name,
|
139
|
+
description=project.description,
|
140
|
+
display_name=project.display_name,
|
141
|
+
)
|
137
142
|
|
138
|
-
def update(self,
|
139
|
-
"""Update a `
|
143
|
+
def update(self, project_update: ProjectUpdate) -> "ProjectSchema":
|
144
|
+
"""Update a `ProjectSchema` from a `ProjectUpdate`.
|
140
145
|
|
141
146
|
Args:
|
142
|
-
|
147
|
+
project_update: The `ProjectUpdate` from which to update the
|
143
148
|
schema.
|
144
149
|
|
145
150
|
Returns:
|
146
|
-
The updated `
|
151
|
+
The updated `ProjectSchema`.
|
147
152
|
"""
|
148
|
-
for field, value in
|
153
|
+
for field, value in project_update.model_dump(
|
149
154
|
exclude_unset=True
|
150
155
|
).items():
|
151
156
|
setattr(self, field, value)
|
@@ -158,8 +163,8 @@ class WorkspaceSchema(NamedSchema, table=True):
|
|
158
163
|
include_metadata: bool = False,
|
159
164
|
include_resources: bool = False,
|
160
165
|
**kwargs: Any,
|
161
|
-
) ->
|
162
|
-
"""Convert a `
|
166
|
+
) -> ProjectResponse:
|
167
|
+
"""Convert a `ProjectSchema` to a `ProjectResponse`.
|
163
168
|
|
164
169
|
Args:
|
165
170
|
include_metadata: Whether the metadata will be filled.
|
@@ -168,17 +173,18 @@ class WorkspaceSchema(NamedSchema, table=True):
|
|
168
173
|
|
169
174
|
|
170
175
|
Returns:
|
171
|
-
The converted `
|
176
|
+
The converted `ProjectResponseModel`.
|
172
177
|
"""
|
173
178
|
metadata = None
|
174
179
|
if include_metadata:
|
175
|
-
metadata =
|
180
|
+
metadata = ProjectResponseMetadata(
|
176
181
|
description=self.description,
|
177
182
|
)
|
178
|
-
return
|
183
|
+
return ProjectResponse(
|
179
184
|
id=self.id,
|
180
185
|
name=self.name,
|
181
|
-
body=
|
186
|
+
body=ProjectResponseBody(
|
187
|
+
display_name=self.display_name,
|
182
188
|
created=self.created,
|
183
189
|
updated=self.updated,
|
184
190
|
),
|
@@ -21,13 +21,13 @@ from sqlmodel import Field, Relationship, SQLModel
|
|
21
21
|
|
22
22
|
from zenml.zen_stores.schemas.base_schemas import BaseSchema
|
23
23
|
from zenml.zen_stores.schemas.component_schemas import StackComponentSchema
|
24
|
+
from zenml.zen_stores.schemas.project_schemas import ProjectSchema
|
24
25
|
from zenml.zen_stores.schemas.schema_utils import (
|
25
26
|
build_foreign_key_field,
|
26
27
|
build_index,
|
27
28
|
)
|
28
29
|
from zenml.zen_stores.schemas.step_run_schemas import StepRunSchema
|
29
30
|
from zenml.zen_stores.schemas.user_schemas import UserSchema
|
30
|
-
from zenml.zen_stores.schemas.workspace_schemas import WorkspaceSchema
|
31
31
|
|
32
32
|
|
33
33
|
class RunMetadataSchema(BaseSchema, table=True):
|
@@ -57,15 +57,15 @@ class RunMetadataSchema(BaseSchema, table=True):
|
|
57
57
|
)
|
58
58
|
user: Optional["UserSchema"] = Relationship(back_populates="run_metadata")
|
59
59
|
|
60
|
-
|
60
|
+
project_id: UUID = build_foreign_key_field(
|
61
61
|
source=__tablename__,
|
62
|
-
target=
|
63
|
-
source_column="
|
62
|
+
target=ProjectSchema.__tablename__,
|
63
|
+
source_column="project_id",
|
64
64
|
target_column="id",
|
65
65
|
ondelete="CASCADE",
|
66
66
|
nullable=False,
|
67
67
|
)
|
68
|
-
|
68
|
+
project: "ProjectSchema" = Relationship(back_populates="run_metadata")
|
69
69
|
|
70
70
|
key: str
|
71
71
|
value: str = Field(sa_column=Column(TEXT, nullable=False))
|
@@ -33,9 +33,9 @@ from zenml.models import (
|
|
33
33
|
)
|
34
34
|
from zenml.utils.time_utils import utc_now
|
35
35
|
from zenml.zen_stores.schemas.base_schemas import NamedSchema
|
36
|
+
from zenml.zen_stores.schemas.project_schemas import ProjectSchema
|
36
37
|
from zenml.zen_stores.schemas.schema_utils import build_foreign_key_field
|
37
38
|
from zenml.zen_stores.schemas.user_schemas import UserSchema
|
38
|
-
from zenml.zen_stores.schemas.workspace_schemas import WorkspaceSchema
|
39
39
|
|
40
40
|
if TYPE_CHECKING:
|
41
41
|
from zenml.zen_stores.schemas.pipeline_deployment_schemas import (
|
@@ -52,8 +52,8 @@ class RunTemplateSchema(NamedSchema, table=True):
|
|
52
52
|
__table_args__ = (
|
53
53
|
UniqueConstraint(
|
54
54
|
"name",
|
55
|
-
"
|
56
|
-
name="
|
55
|
+
"project_id",
|
56
|
+
name="unique_template_name_in_project",
|
57
57
|
),
|
58
58
|
)
|
59
59
|
|
@@ -74,10 +74,10 @@ class RunTemplateSchema(NamedSchema, table=True):
|
|
74
74
|
ondelete="SET NULL",
|
75
75
|
nullable=True,
|
76
76
|
)
|
77
|
-
|
77
|
+
project_id: UUID = build_foreign_key_field(
|
78
78
|
source=__tablename__,
|
79
|
-
target=
|
80
|
-
source_column="
|
79
|
+
target=ProjectSchema.__tablename__,
|
80
|
+
source_column="project_id",
|
81
81
|
target_column="id",
|
82
82
|
ondelete="CASCADE",
|
83
83
|
nullable=False,
|
@@ -94,7 +94,7 @@ class RunTemplateSchema(NamedSchema, table=True):
|
|
94
94
|
user: Optional["UserSchema"] = Relationship(
|
95
95
|
back_populates="run_templates",
|
96
96
|
)
|
97
|
-
|
97
|
+
project: "ProjectSchema" = Relationship()
|
98
98
|
source_deployment: Optional["PipelineDeploymentSchema"] = Relationship(
|
99
99
|
sa_relationship_kwargs={
|
100
100
|
"foreign_keys": "RunTemplateSchema.source_deployment_id",
|
@@ -163,7 +163,7 @@ class RunTemplateSchema(NamedSchema, table=True):
|
|
163
163
|
"""
|
164
164
|
return cls(
|
165
165
|
user_id=request.user,
|
166
|
-
|
166
|
+
project_id=request.project,
|
167
167
|
name=request.name,
|
168
168
|
description=request.description,
|
169
169
|
source_deployment_id=request.source_deployment_id,
|
@@ -250,7 +250,7 @@ class RunTemplateSchema(NamedSchema, table=True):
|
|
250
250
|
)
|
251
251
|
|
252
252
|
metadata = RunTemplateResponseMetadata(
|
253
|
-
|
253
|
+
project=self.project.to_model(),
|
254
254
|
description=self.description,
|
255
255
|
pipeline_spec=pipeline_spec,
|
256
256
|
config_template=config_template,
|