zenml-nightly 0.73.0.dev20250123__py3-none-any.whl → 0.73.0.dev20250125__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 +2 -6
- zenml/cli/annotator.py +1 -1
- zenml/cli/login.py +17 -6
- zenml/cli/server.py +1 -0
- zenml/cli/service_connectors.py +5 -5
- zenml/cli/stack.py +2 -2
- zenml/cli/utils.py +2 -54
- zenml/config/pipeline_configurations.py +3 -2
- zenml/config/schedule.py +0 -24
- zenml/enums.py +1 -0
- zenml/event_hub/base_event_hub.py +3 -4
- zenml/integrations/airflow/orchestrators/airflow_orchestrator.py +3 -4
- zenml/integrations/aws/__init__.py +2 -1
- zenml/integrations/aws/flavors/sagemaker_orchestrator_flavor.py +15 -0
- zenml/integrations/aws/orchestrators/sagemaker_orchestrator.py +310 -70
- zenml/integrations/aws/service_connectors/aws_service_connector.py +8 -13
- zenml/integrations/azure/service_connectors/azure_service_connector.py +4 -10
- zenml/integrations/gcp/service_connectors/gcp_service_connector.py +3 -3
- zenml/integrations/huggingface/__init__.py +1 -6
- zenml/integrations/kubernetes/orchestrators/kube_utils.py +3 -3
- zenml/integrations/kubernetes/service_connectors/kubernetes_service_connector.py +6 -2
- zenml/integrations/whylogs/data_validators/whylogs_data_validator.py +2 -3
- zenml/logging/step_logging.py +7 -7
- zenml/login/credentials.py +6 -5
- zenml/login/credentials_store.py +4 -3
- zenml/models/v2/core/api_key.py +5 -2
- zenml/models/v2/core/schedule.py +19 -3
- zenml/orchestrators/publish_utils.py +4 -4
- zenml/orchestrators/step_launcher.py +3 -3
- zenml/orchestrators/step_run_utils.py +2 -2
- zenml/pipelines/run_utils.py +2 -2
- zenml/service_connectors/service_connector.py +7 -4
- zenml/stack/stack.py +5 -4
- zenml/stack/stack_component.py +10 -2
- zenml/stack_deployments/stack_deployment.py +2 -3
- zenml/utils/string_utils.py +2 -2
- zenml/utils/time_utils.py +138 -0
- zenml/zen_server/auth.py +8 -9
- zenml/zen_server/cloud_utils.py +4 -6
- zenml/zen_server/routers/devices_endpoints.py +2 -4
- zenml/zen_server/routers/workspaces_endpoints.py +2 -0
- zenml/zen_server/zen_server_api.py +9 -8
- zenml/zen_stores/migrations/versions/25155145c545_separate_actions_and_triggers.py +3 -2
- zenml/zen_stores/migrations/versions/3dcc5d20e82f_add_last_user_activity.py +3 -3
- zenml/zen_stores/migrations/versions/46506f72f0ed_add_server_settings.py +3 -2
- zenml/zen_stores/migrations/versions/5994f9ad0489_introduce_role_permissions.py +10 -7
- zenml/zen_stores/migrations/versions/7500f434b71c_remove_shared_columns.py +3 -2
- zenml/zen_stores/migrations/versions/a91762e6be36_artifact_version_table.py +5 -3
- zenml/zen_stores/schemas/action_schemas.py +2 -2
- zenml/zen_stores/schemas/api_key_schemas.py +5 -4
- zenml/zen_stores/schemas/artifact_schemas.py +3 -3
- zenml/zen_stores/schemas/base_schemas.py +5 -7
- zenml/zen_stores/schemas/code_repository_schemas.py +2 -2
- zenml/zen_stores/schemas/component_schemas.py +2 -2
- zenml/zen_stores/schemas/device_schemas.py +5 -4
- zenml/zen_stores/schemas/event_source_schemas.py +2 -2
- zenml/zen_stores/schemas/flavor_schemas.py +2 -2
- zenml/zen_stores/schemas/model_schemas.py +3 -3
- zenml/zen_stores/schemas/pipeline_run_schemas.py +11 -3
- zenml/zen_stores/schemas/pipeline_schemas.py +2 -2
- zenml/zen_stores/schemas/run_template_schemas.py +2 -2
- zenml/zen_stores/schemas/schedule_schema.py +20 -4
- zenml/zen_stores/schemas/secret_schemas.py +2 -2
- zenml/zen_stores/schemas/server_settings_schemas.py +6 -9
- zenml/zen_stores/schemas/service_connector_schemas.py +3 -2
- zenml/zen_stores/schemas/service_schemas.py +2 -2
- zenml/zen_stores/schemas/stack_schemas.py +2 -2
- zenml/zen_stores/schemas/step_run_schemas.py +3 -2
- zenml/zen_stores/schemas/tag_schemas.py +2 -2
- zenml/zen_stores/schemas/trigger_schemas.py +2 -2
- zenml/zen_stores/schemas/user_schemas.py +3 -3
- zenml/zen_stores/schemas/workspace_schemas.py +2 -2
- zenml/zen_stores/sql_zen_store.py +6 -14
- {zenml_nightly-0.73.0.dev20250123.dist-info → zenml_nightly-0.73.0.dev20250125.dist-info}/METADATA +2 -2
- {zenml_nightly-0.73.0.dev20250123.dist-info → zenml_nightly-0.73.0.dev20250125.dist-info}/RECORD +79 -78
- {zenml_nightly-0.73.0.dev20250123.dist-info → zenml_nightly-0.73.0.dev20250125.dist-info}/LICENSE +0 -0
- {zenml_nightly-0.73.0.dev20250123.dist-info → zenml_nightly-0.73.0.dev20250125.dist-info}/WHEEL +0 -0
- {zenml_nightly-0.73.0.dev20250123.dist-info → zenml_nightly-0.73.0.dev20250125.dist-info}/entry_points.txt +0 -0
@@ -15,7 +15,6 @@
|
|
15
15
|
|
16
16
|
import base64
|
17
17
|
import json
|
18
|
-
from datetime import datetime, timezone
|
19
18
|
from typing import TYPE_CHECKING, Any, List, Optional
|
20
19
|
from uuid import UUID
|
21
20
|
|
@@ -30,6 +29,7 @@ from zenml.models import (
|
|
30
29
|
ComponentResponseResources,
|
31
30
|
ComponentUpdate,
|
32
31
|
)
|
32
|
+
from zenml.utils.time_utils import utc_now
|
33
33
|
from zenml.zen_stores.schemas.base_schemas import NamedSchema
|
34
34
|
from zenml.zen_stores.schemas.schema_utils import build_foreign_key_field
|
35
35
|
from zenml.zen_stores.schemas.service_connector_schemas import (
|
@@ -171,7 +171,7 @@ class StackComponentSchema(NamedSchema, table=True):
|
|
171
171
|
else:
|
172
172
|
setattr(self, field, value)
|
173
173
|
|
174
|
-
self.updated =
|
174
|
+
self.updated = utc_now()
|
175
175
|
return self
|
176
176
|
|
177
177
|
def to_model(
|
@@ -13,7 +13,7 @@
|
|
13
13
|
# permissions and limitations under the License.
|
14
14
|
"""SQLModel implementation for authorized OAuth2 devices."""
|
15
15
|
|
16
|
-
from datetime import datetime, timedelta
|
16
|
+
from datetime import datetime, timedelta
|
17
17
|
from secrets import token_hex
|
18
18
|
from typing import Any, Optional, Tuple
|
19
19
|
from uuid import UUID
|
@@ -31,6 +31,7 @@ from zenml.models import (
|
|
31
31
|
OAuthDeviceResponseMetadata,
|
32
32
|
OAuthDeviceUpdate,
|
33
33
|
)
|
34
|
+
from zenml.utils.time_utils import utc_now
|
34
35
|
from zenml.zen_stores.schemas.base_schemas import BaseSchema
|
35
36
|
from zenml.zen_stores.schemas.schema_utils import build_foreign_key_field
|
36
37
|
from zenml.zen_stores.schemas.user_schemas import UserSchema
|
@@ -115,7 +116,7 @@ class OAuthDeviceSchema(BaseSchema, table=True):
|
|
115
116
|
device_code = cls._generate_device_code()
|
116
117
|
hashed_user_code = cls._get_hashed_code(user_code)
|
117
118
|
hashed_device_code = cls._get_hashed_code(device_code)
|
118
|
-
now =
|
119
|
+
now = utc_now()
|
119
120
|
return (
|
120
121
|
cls(
|
121
122
|
client_id=request.client_id,
|
@@ -159,7 +160,7 @@ class OAuthDeviceSchema(BaseSchema, table=True):
|
|
159
160
|
elif device_update.locked is False:
|
160
161
|
self.status = OAuthDeviceStatus.ACTIVE.value
|
161
162
|
|
162
|
-
self.updated =
|
163
|
+
self.updated = utc_now()
|
163
164
|
return self
|
164
165
|
|
165
166
|
def internal_update(
|
@@ -174,7 +175,7 @@ class OAuthDeviceSchema(BaseSchema, table=True):
|
|
174
175
|
The updated `OAuthDeviceSchema` and the new user code and device
|
175
176
|
code, if they were generated.
|
176
177
|
"""
|
177
|
-
now =
|
178
|
+
now = utc_now()
|
178
179
|
user_code: Optional[str] = None
|
179
180
|
device_code: Optional[str] = None
|
180
181
|
|
@@ -15,7 +15,6 @@
|
|
15
15
|
|
16
16
|
import base64
|
17
17
|
import json
|
18
|
-
from datetime import datetime, timezone
|
19
18
|
from typing import TYPE_CHECKING, Any, List, Optional, cast
|
20
19
|
from uuid import UUID
|
21
20
|
|
@@ -32,6 +31,7 @@ from zenml.models import (
|
|
32
31
|
Page,
|
33
32
|
)
|
34
33
|
from zenml.utils.json_utils import pydantic_encoder
|
34
|
+
from zenml.utils.time_utils import utc_now
|
35
35
|
from zenml.zen_stores.schemas.base_schemas import NamedSchema
|
36
36
|
from zenml.zen_stores.schemas.schema_utils import build_foreign_key_field
|
37
37
|
from zenml.zen_stores.schemas.user_schemas import UserSchema
|
@@ -184,5 +184,5 @@ class EventSourceSchema(NamedSchema, table=True):
|
|
184
184
|
)
|
185
185
|
else:
|
186
186
|
setattr(self, field, value)
|
187
|
-
self.updated =
|
187
|
+
self.updated = utc_now()
|
188
188
|
return self
|
@@ -14,7 +14,6 @@
|
|
14
14
|
"""SQL Model Implementations for Flavors."""
|
15
15
|
|
16
16
|
import json
|
17
|
-
from datetime import datetime, timezone
|
18
17
|
from typing import Any, Optional
|
19
18
|
from uuid import UUID
|
20
19
|
|
@@ -28,6 +27,7 @@ from zenml.models import (
|
|
28
27
|
FlavorResponseMetadata,
|
29
28
|
FlavorUpdate,
|
30
29
|
)
|
30
|
+
from zenml.utils.time_utils import utc_now
|
31
31
|
from zenml.zen_stores.schemas.base_schemas import NamedSchema
|
32
32
|
from zenml.zen_stores.schemas.schema_utils import build_foreign_key_field
|
33
33
|
from zenml.zen_stores.schemas.user_schemas import UserSchema
|
@@ -103,7 +103,7 @@ class FlavorSchema(NamedSchema, table=True):
|
|
103
103
|
else:
|
104
104
|
setattr(self, field, value)
|
105
105
|
|
106
|
-
self.updated =
|
106
|
+
self.updated = utc_now()
|
107
107
|
return self
|
108
108
|
|
109
109
|
def to_model(
|
@@ -13,7 +13,6 @@
|
|
13
13
|
# permissions and limitations under the License.
|
14
14
|
"""SQLModel implementation of model tables."""
|
15
15
|
|
16
|
-
from datetime import datetime, timezone
|
17
16
|
from typing import TYPE_CHECKING, Any, Dict, List, Optional, cast
|
18
17
|
from uuid import UUID, uuid4
|
19
18
|
|
@@ -52,6 +51,7 @@ from zenml.models import (
|
|
52
51
|
ModelVersionResponseResources,
|
53
52
|
Page,
|
54
53
|
)
|
54
|
+
from zenml.utils.time_utils import utc_now
|
55
55
|
from zenml.zen_stores.schemas.artifact_schemas import ArtifactVersionSchema
|
56
56
|
from zenml.zen_stores.schemas.base_schemas import BaseSchema, NamedSchema
|
57
57
|
from zenml.zen_stores.schemas.constants import MODEL_VERSION_TABLENAME
|
@@ -224,7 +224,7 @@ class ModelSchema(NamedSchema, table=True):
|
|
224
224
|
exclude_unset=True, exclude_none=True
|
225
225
|
).items():
|
226
226
|
setattr(self, field, value)
|
227
|
-
self.updated =
|
227
|
+
self.updated = utc_now()
|
228
228
|
return self
|
229
229
|
|
230
230
|
|
@@ -504,7 +504,7 @@ class ModelVersionSchema(NamedSchema, RunMetadataInterface, table=True):
|
|
504
504
|
self.name = target_name
|
505
505
|
if target_description is not None:
|
506
506
|
self.description = target_description
|
507
|
-
self.updated =
|
507
|
+
self.updated = utc_now()
|
508
508
|
return self
|
509
509
|
|
510
510
|
|
@@ -14,7 +14,7 @@
|
|
14
14
|
"""SQLModel implementation of pipeline run tables."""
|
15
15
|
|
16
16
|
import json
|
17
|
-
from datetime import datetime
|
17
|
+
from datetime import datetime
|
18
18
|
from typing import TYPE_CHECKING, Any, Dict, List, Optional
|
19
19
|
from uuid import UUID
|
20
20
|
|
@@ -37,6 +37,7 @@ from zenml.models import (
|
|
37
37
|
RunMetadataEntry,
|
38
38
|
)
|
39
39
|
from zenml.models.v2.core.pipeline_run import PipelineRunResponseResources
|
40
|
+
from zenml.utils.time_utils import utc_now
|
40
41
|
from zenml.zen_stores.schemas.base_schemas import NamedSchema
|
41
42
|
from zenml.zen_stores.schemas.constants import MODEL_VERSION_TABLENAME
|
42
43
|
from zenml.zen_stores.schemas.pipeline_build_schemas import PipelineBuildSchema
|
@@ -269,6 +270,13 @@ class PipelineRunSchema(NamedSchema, RunMetadataInterface, table=True):
|
|
269
270
|
for k, v in step_metadata.items():
|
270
271
|
metadata_collection[f"{s.name}::{k}"] = v
|
271
272
|
|
273
|
+
# Fetch the metadata related to the schedule of this run
|
274
|
+
if self.deployment is not None:
|
275
|
+
if schedule := self.deployment.schedule:
|
276
|
+
schedule_metadata = schedule.fetch_metadata_collection()
|
277
|
+
for k, v in schedule_metadata.items():
|
278
|
+
metadata_collection[f"schedule:{k}"] = v
|
279
|
+
|
272
280
|
return metadata_collection
|
273
281
|
|
274
282
|
def to_model(
|
@@ -430,7 +438,7 @@ class PipelineRunSchema(NamedSchema, RunMetadataInterface, table=True):
|
|
430
438
|
if run_update.model_version_id and self.model_version_id is None:
|
431
439
|
self.model_version_id = run_update.model_version_id
|
432
440
|
|
433
|
-
self.updated =
|
441
|
+
self.updated = utc_now()
|
434
442
|
return self
|
435
443
|
|
436
444
|
def update_placeholder(
|
@@ -471,7 +479,7 @@ class PipelineRunSchema(NamedSchema, RunMetadataInterface, table=True):
|
|
471
479
|
self.orchestrator_environment = orchestrator_environment
|
472
480
|
self.status = request.status.value
|
473
481
|
|
474
|
-
self.updated =
|
482
|
+
self.updated = utc_now()
|
475
483
|
|
476
484
|
return self
|
477
485
|
|
@@ -13,7 +13,6 @@
|
|
13
13
|
# permissions and limitations under the License.
|
14
14
|
"""SQL Model Implementations for Pipelines and Pipeline Runs."""
|
15
15
|
|
16
|
-
from datetime import datetime, timezone
|
17
16
|
from typing import TYPE_CHECKING, Any, List, Optional
|
18
17
|
from uuid import UUID
|
19
18
|
|
@@ -29,6 +28,7 @@ from zenml.models import (
|
|
29
28
|
PipelineResponseResources,
|
30
29
|
PipelineUpdate,
|
31
30
|
)
|
31
|
+
from zenml.utils.time_utils import utc_now
|
32
32
|
from zenml.zen_stores.schemas.base_schemas import NamedSchema
|
33
33
|
from zenml.zen_stores.schemas.schema_utils import build_foreign_key_field
|
34
34
|
from zenml.zen_stores.schemas.user_schemas import UserSchema
|
@@ -185,5 +185,5 @@ class PipelineSchema(NamedSchema, table=True):
|
|
185
185
|
The updated `PipelineSchema`.
|
186
186
|
"""
|
187
187
|
self.description = pipeline_update.description
|
188
|
-
self.updated =
|
188
|
+
self.updated = utc_now()
|
189
189
|
return self
|
@@ -13,7 +13,6 @@
|
|
13
13
|
# permissions and limitations under the License.
|
14
14
|
"""SQLModel implementation of run template tables."""
|
15
15
|
|
16
|
-
from datetime import datetime, timezone
|
17
16
|
from typing import TYPE_CHECKING, Any, List, Optional
|
18
17
|
from uuid import UUID
|
19
18
|
|
@@ -31,6 +30,7 @@ from zenml.models import (
|
|
31
30
|
RunTemplateResponseResources,
|
32
31
|
RunTemplateUpdate,
|
33
32
|
)
|
33
|
+
from zenml.utils.time_utils import utc_now
|
34
34
|
from zenml.zen_stores.schemas.base_schemas import BaseSchema
|
35
35
|
from zenml.zen_stores.schemas.schema_utils import build_foreign_key_field
|
36
36
|
from zenml.zen_stores.schemas.user_schemas import UserSchema
|
@@ -156,7 +156,7 @@ class RunTemplateSchema(BaseSchema, table=True):
|
|
156
156
|
).items():
|
157
157
|
setattr(self, field, value)
|
158
158
|
|
159
|
-
self.updated =
|
159
|
+
self.updated = utc_now()
|
160
160
|
return self
|
161
161
|
|
162
162
|
def to_model(
|
@@ -13,12 +13,13 @@
|
|
13
13
|
# permissions and limitations under the License.
|
14
14
|
"""SQL Model Implementations for Pipeline Schedules."""
|
15
15
|
|
16
|
-
from datetime import datetime, timedelta
|
17
|
-
from typing import TYPE_CHECKING, Any, Optional
|
16
|
+
from datetime import datetime, timedelta
|
17
|
+
from typing import TYPE_CHECKING, Any, List, Optional
|
18
18
|
from uuid import UUID
|
19
19
|
|
20
20
|
from sqlmodel import Field, Relationship
|
21
21
|
|
22
|
+
from zenml.enums import MetadataResourceTypes
|
22
23
|
from zenml.models import (
|
23
24
|
ScheduleRequest,
|
24
25
|
ScheduleResponse,
|
@@ -26,20 +27,25 @@ from zenml.models import (
|
|
26
27
|
ScheduleResponseMetadata,
|
27
28
|
ScheduleUpdate,
|
28
29
|
)
|
30
|
+
from zenml.utils.time_utils import utc_now
|
29
31
|
from zenml.zen_stores.schemas.base_schemas import NamedSchema
|
30
32
|
from zenml.zen_stores.schemas.component_schemas import StackComponentSchema
|
31
33
|
from zenml.zen_stores.schemas.pipeline_schemas import PipelineSchema
|
32
34
|
from zenml.zen_stores.schemas.schema_utils import build_foreign_key_field
|
33
35
|
from zenml.zen_stores.schemas.user_schemas import UserSchema
|
36
|
+
from zenml.zen_stores.schemas.utils import RunMetadataInterface
|
34
37
|
from zenml.zen_stores.schemas.workspace_schemas import WorkspaceSchema
|
35
38
|
|
36
39
|
if TYPE_CHECKING:
|
37
40
|
from zenml.zen_stores.schemas.pipeline_deployment_schemas import (
|
38
41
|
PipelineDeploymentSchema,
|
39
42
|
)
|
43
|
+
from zenml.zen_stores.schemas.run_metadata_schemas import (
|
44
|
+
RunMetadataSchema,
|
45
|
+
)
|
40
46
|
|
41
47
|
|
42
|
-
class ScheduleSchema(NamedSchema, table=True):
|
48
|
+
class ScheduleSchema(NamedSchema, RunMetadataInterface, table=True):
|
43
49
|
"""SQL Model for schedules."""
|
44
50
|
|
45
51
|
__tablename__ = "schedule"
|
@@ -89,6 +95,15 @@ class ScheduleSchema(NamedSchema, table=True):
|
|
89
95
|
back_populates="schedules"
|
90
96
|
)
|
91
97
|
|
98
|
+
run_metadata: List["RunMetadataSchema"] = Relationship(
|
99
|
+
sa_relationship_kwargs=dict(
|
100
|
+
secondary="run_metadata_resource",
|
101
|
+
primaryjoin=f"and_(foreign(RunMetadataResourceSchema.resource_type)=='{MetadataResourceTypes.SCHEDULE.value}', foreign(RunMetadataResourceSchema.resource_id)==ScheduleSchema.id)",
|
102
|
+
secondaryjoin="RunMetadataSchema.id==foreign(RunMetadataResourceSchema.run_metadata_id)",
|
103
|
+
overlaps="run_metadata",
|
104
|
+
),
|
105
|
+
)
|
106
|
+
|
92
107
|
active: bool
|
93
108
|
cron_expression: Optional[str] = Field(nullable=True)
|
94
109
|
start_time: Optional[datetime] = Field(nullable=True)
|
@@ -153,7 +168,7 @@ class ScheduleSchema(NamedSchema, table=True):
|
|
153
168
|
)
|
154
169
|
if schedule_update.catchup is not None:
|
155
170
|
self.catchup = schedule_update.catchup
|
156
|
-
self.updated =
|
171
|
+
self.updated = utc_now()
|
157
172
|
return self
|
158
173
|
|
159
174
|
def to_model(
|
@@ -196,6 +211,7 @@ class ScheduleSchema(NamedSchema, table=True):
|
|
196
211
|
workspace=self.workspace.to_model(),
|
197
212
|
pipeline_id=self.pipeline_id,
|
198
213
|
orchestrator_id=self.orchestrator_id,
|
214
|
+
run_metadata=self.fetch_metadata(),
|
199
215
|
)
|
200
216
|
|
201
217
|
return ScheduleResponse(
|
@@ -15,7 +15,6 @@
|
|
15
15
|
|
16
16
|
import base64
|
17
17
|
import json
|
18
|
-
from datetime import datetime, timezone
|
19
18
|
from typing import Any, Dict, Optional, cast
|
20
19
|
from uuid import UUID
|
21
20
|
|
@@ -35,6 +34,7 @@ from zenml.models import (
|
|
35
34
|
SecretResponseMetadata,
|
36
35
|
SecretUpdate,
|
37
36
|
)
|
37
|
+
from zenml.utils.time_utils import utc_now
|
38
38
|
from zenml.zen_stores.schemas.base_schemas import NamedSchema
|
39
39
|
from zenml.zen_stores.schemas.schema_utils import build_foreign_key_field
|
40
40
|
from zenml.zen_stores.schemas.user_schemas import UserSchema
|
@@ -209,7 +209,7 @@ class SecretSchema(NamedSchema, table=True):
|
|
209
209
|
else:
|
210
210
|
setattr(self, field, value)
|
211
211
|
|
212
|
-
self.updated =
|
212
|
+
self.updated = utc_now()
|
213
213
|
return self
|
214
214
|
|
215
215
|
def to_model(
|
@@ -14,7 +14,7 @@
|
|
14
14
|
"""SQLModel implementation for the server settings table."""
|
15
15
|
|
16
16
|
import json
|
17
|
-
from datetime import datetime
|
17
|
+
from datetime import datetime
|
18
18
|
from typing import Any, Optional, Set
|
19
19
|
from uuid import UUID
|
20
20
|
|
@@ -27,6 +27,7 @@ from zenml.models import (
|
|
27
27
|
ServerSettingsResponseResources,
|
28
28
|
ServerSettingsUpdate,
|
29
29
|
)
|
30
|
+
from zenml.utils.time_utils import utc_now
|
30
31
|
|
31
32
|
|
32
33
|
class ServerSettingsSchema(SQLModel, table=True):
|
@@ -42,12 +43,8 @@ class ServerSettingsSchema(SQLModel, table=True):
|
|
42
43
|
display_announcements: Optional[bool] = Field(nullable=True)
|
43
44
|
display_updates: Optional[bool] = Field(nullable=True)
|
44
45
|
onboarding_state: Optional[str] = Field(nullable=True)
|
45
|
-
last_user_activity: datetime = Field(
|
46
|
-
|
47
|
-
)
|
48
|
-
updated: datetime = Field(
|
49
|
-
default_factory=lambda: datetime.now(timezone.utc)
|
50
|
-
)
|
46
|
+
last_user_activity: datetime = Field(default_factory=utc_now)
|
47
|
+
updated: datetime = Field(default_factory=utc_now)
|
51
48
|
|
52
49
|
def update(
|
53
50
|
self, settings_update: ServerSettingsUpdate
|
@@ -67,7 +64,7 @@ class ServerSettingsSchema(SQLModel, table=True):
|
|
67
64
|
if hasattr(self, field):
|
68
65
|
setattr(self, field, value)
|
69
66
|
|
70
|
-
self.updated =
|
67
|
+
self.updated = utc_now()
|
71
68
|
|
72
69
|
return self
|
73
70
|
|
@@ -87,7 +84,7 @@ class ServerSettingsSchema(SQLModel, table=True):
|
|
87
84
|
)
|
88
85
|
new_state = old_state.union(completed_steps)
|
89
86
|
self.onboarding_state = json.dumps(list(new_state))
|
90
|
-
self.updated =
|
87
|
+
self.updated = utc_now()
|
91
88
|
|
92
89
|
return self
|
93
90
|
|
@@ -15,7 +15,7 @@
|
|
15
15
|
|
16
16
|
import base64
|
17
17
|
import json
|
18
|
-
from datetime import datetime
|
18
|
+
from datetime import datetime
|
19
19
|
from typing import TYPE_CHECKING, Any, Dict, List, Optional, cast
|
20
20
|
from uuid import UUID
|
21
21
|
|
@@ -29,6 +29,7 @@ from zenml.models import (
|
|
29
29
|
ServiceConnectorResponseMetadata,
|
30
30
|
ServiceConnectorUpdate,
|
31
31
|
)
|
32
|
+
from zenml.utils.time_utils import utc_now
|
32
33
|
from zenml.zen_stores.schemas.base_schemas import NamedSchema
|
33
34
|
from zenml.zen_stores.schemas.schema_utils import build_foreign_key_field
|
34
35
|
from zenml.zen_stores.schemas.user_schemas import UserSchema
|
@@ -227,7 +228,7 @@ class ServiceConnectorSchema(NamedSchema, table=True):
|
|
227
228
|
else:
|
228
229
|
setattr(self, field, value)
|
229
230
|
self.secret_id = secret_id
|
230
|
-
self.updated =
|
231
|
+
self.updated = utc_now()
|
231
232
|
return self
|
232
233
|
|
233
234
|
def to_model(
|
@@ -15,7 +15,6 @@
|
|
15
15
|
|
16
16
|
import base64
|
17
17
|
import json
|
18
|
-
from datetime import datetime, timezone
|
19
18
|
from typing import Any, Optional
|
20
19
|
from uuid import UUID
|
21
20
|
|
@@ -32,6 +31,7 @@ from zenml.models.v2.core.service import (
|
|
32
31
|
ServiceUpdate,
|
33
32
|
)
|
34
33
|
from zenml.utils.dict_utils import dict_to_bytes
|
34
|
+
from zenml.utils.time_utils import utc_now
|
35
35
|
from zenml.zen_stores.schemas.base_schemas import NamedSchema
|
36
36
|
from zenml.zen_stores.schemas.model_schemas import ModelVersionSchema
|
37
37
|
from zenml.zen_stores.schemas.pipeline_run_schemas import PipelineRunSchema
|
@@ -210,7 +210,7 @@ class ServiceSchema(NamedSchema, table=True):
|
|
210
210
|
)
|
211
211
|
else:
|
212
212
|
setattr(self, field, value)
|
213
|
-
self.updated =
|
213
|
+
self.updated = utc_now()
|
214
214
|
return self
|
215
215
|
|
216
216
|
@classmethod
|
@@ -15,7 +15,6 @@
|
|
15
15
|
|
16
16
|
import base64
|
17
17
|
import json
|
18
|
-
from datetime import datetime, timezone
|
19
18
|
from typing import TYPE_CHECKING, Any, List, Optional
|
20
19
|
from uuid import UUID
|
21
20
|
|
@@ -27,6 +26,7 @@ from zenml.models import (
|
|
27
26
|
StackResponseMetadata,
|
28
27
|
StackUpdate,
|
29
28
|
)
|
29
|
+
from zenml.utils.time_utils import utc_now
|
30
30
|
from zenml.zen_stores.schemas.base_schemas import NamedSchema
|
31
31
|
from zenml.zen_stores.schemas.schema_utils import build_foreign_key_field
|
32
32
|
from zenml.zen_stores.schemas.user_schemas import UserSchema
|
@@ -134,7 +134,7 @@ class StackSchema(NamedSchema, table=True):
|
|
134
134
|
else:
|
135
135
|
setattr(self, field, value)
|
136
136
|
|
137
|
-
self.updated =
|
137
|
+
self.updated = utc_now()
|
138
138
|
return self
|
139
139
|
|
140
140
|
def to_model(
|
@@ -14,7 +14,7 @@
|
|
14
14
|
"""SQLModel implementation of step run tables."""
|
15
15
|
|
16
16
|
import json
|
17
|
-
from datetime import datetime
|
17
|
+
from datetime import datetime
|
18
18
|
from typing import TYPE_CHECKING, Any, Dict, List, Optional
|
19
19
|
from uuid import UUID
|
20
20
|
|
@@ -43,6 +43,7 @@ from zenml.models.v2.core.step_run import (
|
|
43
43
|
StepRunInputResponse,
|
44
44
|
StepRunResponseResources,
|
45
45
|
)
|
46
|
+
from zenml.utils.time_utils import utc_now
|
46
47
|
from zenml.zen_stores.schemas.base_schemas import NamedSchema
|
47
48
|
from zenml.zen_stores.schemas.constants import MODEL_VERSION_TABLENAME
|
48
49
|
from zenml.zen_stores.schemas.pipeline_deployment_schemas import (
|
@@ -358,7 +359,7 @@ class StepRunSchema(NamedSchema, RunMetadataInterface, table=True):
|
|
358
359
|
if value and self.model_version_id is None:
|
359
360
|
self.model_version_id = value
|
360
361
|
|
361
|
-
self.updated =
|
362
|
+
self.updated = utc_now()
|
362
363
|
|
363
364
|
return self
|
364
365
|
|
@@ -13,7 +13,6 @@
|
|
13
13
|
# permissions and limitations under the License.
|
14
14
|
"""SQLModel implementation of tag tables."""
|
15
15
|
|
16
|
-
from datetime import datetime, timezone
|
17
16
|
from typing import Any, List
|
18
17
|
from uuid import UUID
|
19
18
|
|
@@ -30,6 +29,7 @@ from zenml.models import (
|
|
30
29
|
TagResponseBody,
|
31
30
|
TagUpdate,
|
32
31
|
)
|
32
|
+
from zenml.utils.time_utils import utc_now
|
33
33
|
from zenml.zen_stores.schemas.base_schemas import BaseSchema, NamedSchema
|
34
34
|
from zenml.zen_stores.schemas.schema_utils import build_foreign_key_field
|
35
35
|
|
@@ -103,7 +103,7 @@ class TagSchema(NamedSchema, table=True):
|
|
103
103
|
else:
|
104
104
|
setattr(self, field, value)
|
105
105
|
|
106
|
-
self.updated =
|
106
|
+
self.updated = utc_now()
|
107
107
|
return self
|
108
108
|
|
109
109
|
|
@@ -15,7 +15,6 @@
|
|
15
15
|
|
16
16
|
import base64
|
17
17
|
import json
|
18
|
-
from datetime import datetime, timezone
|
19
18
|
from typing import Any, List, Optional, cast
|
20
19
|
from uuid import UUID
|
21
20
|
|
@@ -38,6 +37,7 @@ from zenml.models import (
|
|
38
37
|
TriggerUpdate,
|
39
38
|
)
|
40
39
|
from zenml.utils.json_utils import pydantic_encoder
|
40
|
+
from zenml.utils.time_utils import utc_now
|
41
41
|
from zenml.zen_stores.schemas.action_schemas import ActionSchema
|
42
42
|
from zenml.zen_stores.schemas.base_schemas import BaseSchema, NamedSchema
|
43
43
|
from zenml.zen_stores.schemas.event_source_schemas import EventSourceSchema
|
@@ -133,7 +133,7 @@ class TriggerSchema(NamedSchema, table=True):
|
|
133
133
|
else:
|
134
134
|
setattr(self, field, value)
|
135
135
|
|
136
|
-
self.updated =
|
136
|
+
self.updated = utc_now()
|
137
137
|
return self
|
138
138
|
|
139
139
|
@classmethod
|
@@ -14,7 +14,6 @@
|
|
14
14
|
"""SQLModel implementation of user tables."""
|
15
15
|
|
16
16
|
import json
|
17
|
-
from datetime import datetime, timezone
|
18
17
|
from typing import TYPE_CHECKING, Any, List, Optional
|
19
18
|
from uuid import UUID
|
20
19
|
|
@@ -33,6 +32,7 @@ from zenml.models import (
|
|
33
32
|
UserResponseMetadata,
|
34
33
|
UserUpdate,
|
35
34
|
)
|
35
|
+
from zenml.utils.time_utils import utc_now
|
36
36
|
from zenml.zen_stores.schemas.base_schemas import NamedSchema
|
37
37
|
|
38
38
|
if TYPE_CHECKING:
|
@@ -225,7 +225,7 @@ class UserSchema(NamedSchema, table=True):
|
|
225
225
|
else:
|
226
226
|
setattr(self, field, value)
|
227
227
|
|
228
|
-
self.updated =
|
228
|
+
self.updated = utc_now()
|
229
229
|
return self
|
230
230
|
|
231
231
|
def update_service_account(
|
@@ -245,7 +245,7 @@ class UserSchema(NamedSchema, table=True):
|
|
245
245
|
).items():
|
246
246
|
setattr(self, field, value)
|
247
247
|
|
248
|
-
self.updated =
|
248
|
+
self.updated = utc_now()
|
249
249
|
return self
|
250
250
|
|
251
251
|
def to_model(
|
@@ -13,7 +13,6 @@
|
|
13
13
|
# permissions and limitations under the License.
|
14
14
|
"""SQL Model Implementations for Workspaces."""
|
15
15
|
|
16
|
-
from datetime import datetime, timezone
|
17
16
|
from typing import TYPE_CHECKING, Any, List
|
18
17
|
|
19
18
|
from sqlmodel import Relationship
|
@@ -25,6 +24,7 @@ from zenml.models import (
|
|
25
24
|
WorkspaceResponseMetadata,
|
26
25
|
WorkspaceUpdate,
|
27
26
|
)
|
27
|
+
from zenml.utils.time_utils import utc_now
|
28
28
|
from zenml.zen_stores.schemas.base_schemas import NamedSchema
|
29
29
|
|
30
30
|
if TYPE_CHECKING:
|
@@ -168,7 +168,7 @@ class WorkspaceSchema(NamedSchema, table=True):
|
|
168
168
|
).items():
|
169
169
|
setattr(self, field, value)
|
170
170
|
|
171
|
-
self.updated =
|
171
|
+
self.updated = utc_now()
|
172
172
|
return self
|
173
173
|
|
174
174
|
def to_model(
|
@@ -22,7 +22,7 @@ import random
|
|
22
22
|
import re
|
23
23
|
import sys
|
24
24
|
import time
|
25
|
-
from datetime import datetime
|
25
|
+
from datetime import datetime
|
26
26
|
from functools import lru_cache
|
27
27
|
from pathlib import Path
|
28
28
|
from typing import (
|
@@ -309,6 +309,7 @@ from zenml.utils.string_utils import (
|
|
309
309
|
random_str,
|
310
310
|
validate_name,
|
311
311
|
)
|
312
|
+
from zenml.utils.time_utils import utc_now
|
312
313
|
from zenml.zen_stores import template_utils
|
313
314
|
from zenml.zen_stores.base_zen_store import (
|
314
315
|
BaseZenStore,
|
@@ -795,7 +796,7 @@ class SqlZenStoreConfiguration(StoreConfiguration):
|
|
795
796
|
logger.warning(
|
796
797
|
f"Database SSL setting `{key}` is not a file. "
|
797
798
|
)
|
798
|
-
sqlalchemy_ssl_args[key.
|
799
|
+
sqlalchemy_ssl_args[key.removeprefix("ssl_")] = ssl_setting
|
799
800
|
if len(sqlalchemy_ssl_args) > 0:
|
800
801
|
sqlalchemy_ssl_args["check_hostname"] = (
|
801
802
|
self.ssl_verify_server_cert
|
@@ -1743,7 +1744,7 @@ class SqlZenStore(BaseZenStore):
|
|
1743
1744
|
settings = self._get_server_settings(session=session)
|
1744
1745
|
|
1745
1746
|
if last_user_activity < settings.last_user_activity.replace(
|
1746
|
-
tzinfo=
|
1747
|
+
tzinfo=None
|
1747
1748
|
):
|
1748
1749
|
return
|
1749
1750
|
|
@@ -4048,7 +4049,7 @@ class SqlZenStore(BaseZenStore):
|
|
4048
4049
|
# Delete devices that have expired
|
4049
4050
|
if (
|
4050
4051
|
device.expires is not None
|
4051
|
-
and device.expires <
|
4052
|
+
and device.expires < utc_now()
|
4052
4053
|
and device.user_id is None
|
4053
4054
|
):
|
4054
4055
|
session.delete(device)
|
@@ -8634,19 +8635,10 @@ class SqlZenStore(BaseZenStore):
|
|
8634
8635
|
ExecutionStatus.COMPLETED,
|
8635
8636
|
ExecutionStatus.FAILED,
|
8636
8637
|
}:
|
8637
|
-
run_update.end_time =
|
8638
|
+
run_update.end_time = utc_now()
|
8638
8639
|
if pipeline_run.start_time and isinstance(
|
8639
8640
|
pipeline_run.start_time, datetime
|
8640
8641
|
):
|
8641
|
-
# We need to ensure both datetimes are timezone-aware to avoid TypeError when subtracting
|
8642
|
-
# Now calculate the duration time
|
8643
|
-
if pipeline_run.start_time.tzinfo is None:
|
8644
|
-
pipeline_run.start_time = (
|
8645
|
-
pipeline_run.start_time.replace(
|
8646
|
-
tzinfo=timezone.utc
|
8647
|
-
)
|
8648
|
-
)
|
8649
|
-
|
8650
8642
|
duration_time = (
|
8651
8643
|
run_update.end_time - pipeline_run.start_time
|
8652
8644
|
)
|