zenml-nightly 0.71.0.dev20241212__py3-none-any.whl → 0.71.0.dev20241214__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/artifacts/artifact_config.py +8 -5
- zenml/artifacts/utils.py +3 -1
- zenml/client.py +54 -2
- zenml/integrations/kubernetes/step_operators/kubernetes_step_operator.py +0 -1
- zenml/model/model.py +12 -16
- zenml/model/utils.py +3 -1
- zenml/models/v2/base/filter.py +26 -30
- zenml/models/v2/base/scoped.py +258 -5
- zenml/models/v2/core/artifact_version.py +15 -26
- zenml/models/v2/core/code_repository.py +1 -12
- zenml/models/v2/core/component.py +5 -46
- zenml/models/v2/core/flavor.py +1 -11
- zenml/models/v2/core/model.py +1 -57
- zenml/models/v2/core/model_version.py +5 -33
- zenml/models/v2/core/model_version_artifact.py +11 -3
- zenml/models/v2/core/model_version_pipeline_run.py +14 -3
- zenml/models/v2/core/pipeline.py +47 -55
- zenml/models/v2/core/pipeline_build.py +67 -12
- zenml/models/v2/core/pipeline_deployment.py +0 -10
- zenml/models/v2/core/pipeline_run.py +91 -29
- zenml/models/v2/core/run_template.py +21 -29
- zenml/models/v2/core/schedule.py +0 -10
- zenml/models/v2/core/secret.py +0 -14
- zenml/models/v2/core/service.py +9 -16
- zenml/models/v2/core/service_connector.py +0 -11
- zenml/models/v2/core/stack.py +21 -30
- zenml/models/v2/core/step_run.py +18 -14
- zenml/models/v2/core/trigger.py +19 -3
- zenml/orchestrators/step_launcher.py +9 -13
- zenml/orchestrators/step_run_utils.py +8 -204
- zenml/pipelines/build_utils.py +12 -0
- zenml/zen_server/rbac/rbac_sql_zen_store.py +173 -0
- zenml/zen_server/utils.py +4 -3
- zenml/zen_stores/base_zen_store.py +10 -2
- zenml/zen_stores/migrations/versions/26351d482b9e_add_step_run_unique_constraint.py +37 -0
- zenml/zen_stores/migrations/versions/a1237ba94fd8_add_model_version_producer_run_unique_.py +68 -0
- zenml/zen_stores/schemas/model_schemas.py +42 -6
- zenml/zen_stores/schemas/pipeline_deployment_schemas.py +7 -7
- zenml/zen_stores/schemas/pipeline_schemas.py +5 -0
- zenml/zen_stores/schemas/step_run_schemas.py +8 -1
- zenml/zen_stores/sql_zen_store.py +327 -99
- {zenml_nightly-0.71.0.dev20241212.dist-info → zenml_nightly-0.71.0.dev20241214.dist-info}/METADATA +1 -1
- {zenml_nightly-0.71.0.dev20241212.dist-info → zenml_nightly-0.71.0.dev20241214.dist-info}/RECORD +47 -44
- {zenml_nightly-0.71.0.dev20241212.dist-info → zenml_nightly-0.71.0.dev20241214.dist-info}/LICENSE +0 -0
- {zenml_nightly-0.71.0.dev20241212.dist-info → zenml_nightly-0.71.0.dev20241214.dist-info}/WHEEL +0 -0
- {zenml_nightly-0.71.0.dev20241212.dist-info → zenml_nightly-0.71.0.dev20241214.dist-info}/entry_points.txt +0 -0
zenml/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.71.0.
|
1
|
+
0.71.0.dev20241214
|
@@ -104,15 +104,18 @@ class ArtifactConfig(BaseModel):
|
|
104
104
|
)
|
105
105
|
elif is_model_artifact:
|
106
106
|
logger.warning(
|
107
|
-
"`ArtifactConfig
|
108
|
-
"removed soon. Use `ArtifactConfig
|
107
|
+
"`ArtifactConfig(..., is_model_artifact=True)` is deprecated "
|
108
|
+
"and will be removed soon. Use `ArtifactConfig(..., "
|
109
|
+
"artifact_type=ArtifactType.MODEL)` instead. For more info: "
|
110
|
+
"https://docs.zenml.io/user-guide/starter-guide/manage-artifacts"
|
109
111
|
)
|
110
112
|
data.setdefault("artifact_type", ArtifactType.MODEL)
|
111
113
|
elif is_deployment_artifact:
|
112
114
|
logger.warning(
|
113
|
-
"`ArtifactConfig
|
114
|
-
"will be removed soon. Use `ArtifactConfig
|
115
|
-
"instead."
|
115
|
+
"`ArtifactConfig(..., is_deployment_artifact=True)` is "
|
116
|
+
"deprecated and will be removed soon. Use `ArtifactConfig(..., "
|
117
|
+
"artifact_type=ArtifactType.SERVICE)` instead. For more info: "
|
118
|
+
"https://docs.zenml.io/user-guide/starter-guide/manage-artifacts"
|
116
119
|
)
|
117
120
|
data.setdefault("artifact_type", ArtifactType.SERVICE)
|
118
121
|
|
zenml/artifacts/utils.py
CHANGED
@@ -414,7 +414,9 @@ def log_artifact_metadata(
|
|
414
414
|
"""
|
415
415
|
logger.warning(
|
416
416
|
"The `log_artifact_metadata` function is deprecated and will soon be "
|
417
|
-
"removed.
|
417
|
+
"removed. Instead, you can consider using: "
|
418
|
+
"`log_metadata(metadata={...}, infer_artifact=True, ...)` instead. For more "
|
419
|
+
"info: https://docs.zenml.io/how-to/model-management-metrics/track-metrics-metadata/attach-metadata-to-an-artifact"
|
418
420
|
)
|
419
421
|
|
420
422
|
from zenml import log_metadata
|
zenml/client.py
CHANGED
@@ -1702,6 +1702,7 @@ class Client(metaclass=ClientMetaClass):
|
|
1702
1702
|
updated: Optional[datetime] = None,
|
1703
1703
|
type: Optional[str] = None,
|
1704
1704
|
flavor: Optional[str] = None,
|
1705
|
+
user: Optional[Union[UUID, str]] = None,
|
1705
1706
|
workspace_id: Optional[Union[str, UUID]] = None,
|
1706
1707
|
user_id: Optional[Union[str, UUID]] = None,
|
1707
1708
|
hydrate: bool = False,
|
@@ -1727,6 +1728,7 @@ class Client(metaclass=ClientMetaClass):
|
|
1727
1728
|
flavor: Use the service flavor for filtering
|
1728
1729
|
workspace_id: The id of the workspace to filter by.
|
1729
1730
|
user_id: The id of the user to filter by.
|
1731
|
+
user: Filter by user name/ID.
|
1730
1732
|
hydrate: Flag deciding whether to hydrate the output model(s)
|
1731
1733
|
by including metadata fields in the response.
|
1732
1734
|
running: Use the running status for filtering
|
@@ -1753,6 +1755,7 @@ class Client(metaclass=ClientMetaClass):
|
|
1753
1755
|
flavor=flavor,
|
1754
1756
|
workspace_id=workspace_id,
|
1755
1757
|
user_id=user_id,
|
1758
|
+
user=user,
|
1756
1759
|
running=running,
|
1757
1760
|
name=service_name,
|
1758
1761
|
pipeline_name=pipeline_name,
|
@@ -2249,6 +2252,7 @@ class Client(metaclass=ClientMetaClass):
|
|
2249
2252
|
type: Optional[str] = None,
|
2250
2253
|
integration: Optional[str] = None,
|
2251
2254
|
user_id: Optional[Union[str, UUID]] = None,
|
2255
|
+
user: Optional[Union[UUID, str]] = None,
|
2252
2256
|
hydrate: bool = False,
|
2253
2257
|
) -> Page[FlavorResponse]:
|
2254
2258
|
"""Fetches all the flavor models.
|
@@ -2262,6 +2266,7 @@ class Client(metaclass=ClientMetaClass):
|
|
2262
2266
|
created: Use to flavors by time of creation
|
2263
2267
|
updated: Use the last updated date for filtering
|
2264
2268
|
user_id: The id of the user to filter by.
|
2269
|
+
user: Filter by user name/ID.
|
2265
2270
|
name: The name of the flavor to filter by.
|
2266
2271
|
type: The type of the flavor to filter by.
|
2267
2272
|
integration: The integration of the flavor to filter by.
|
@@ -2277,6 +2282,7 @@ class Client(metaclass=ClientMetaClass):
|
|
2277
2282
|
sort_by=sort_by,
|
2278
2283
|
logical_operator=logical_operator,
|
2279
2284
|
user_id=user_id,
|
2285
|
+
user=user,
|
2280
2286
|
name=name,
|
2281
2287
|
type=type,
|
2282
2288
|
integration=integration,
|
@@ -2661,13 +2667,16 @@ class Client(metaclass=ClientMetaClass):
|
|
2661
2667
|
updated: Optional[Union[datetime, str]] = None,
|
2662
2668
|
workspace_id: Optional[Union[str, UUID]] = None,
|
2663
2669
|
user_id: Optional[Union[str, UUID]] = None,
|
2670
|
+
user: Optional[Union[UUID, str]] = None,
|
2664
2671
|
pipeline_id: Optional[Union[str, UUID]] = None,
|
2665
2672
|
stack_id: Optional[Union[str, UUID]] = None,
|
2673
|
+
container_registry_id: Optional[Union[UUID, str]] = None,
|
2666
2674
|
is_local: Optional[bool] = None,
|
2667
2675
|
contains_code: Optional[bool] = None,
|
2668
2676
|
zenml_version: Optional[str] = None,
|
2669
2677
|
python_version: Optional[str] = None,
|
2670
2678
|
checksum: Optional[str] = None,
|
2679
|
+
stack_checksum: Optional[str] = None,
|
2671
2680
|
hydrate: bool = False,
|
2672
2681
|
) -> Page[PipelineBuildResponse]:
|
2673
2682
|
"""List all builds.
|
@@ -2682,13 +2691,17 @@ class Client(metaclass=ClientMetaClass):
|
|
2682
2691
|
updated: Use the last updated date for filtering
|
2683
2692
|
workspace_id: The id of the workspace to filter by.
|
2684
2693
|
user_id: The id of the user to filter by.
|
2694
|
+
user: Filter by user name/ID.
|
2685
2695
|
pipeline_id: The id of the pipeline to filter by.
|
2686
2696
|
stack_id: The id of the stack to filter by.
|
2697
|
+
container_registry_id: The id of the container registry to
|
2698
|
+
filter by.
|
2687
2699
|
is_local: Use to filter local builds.
|
2688
2700
|
contains_code: Use to filter builds that contain code.
|
2689
2701
|
zenml_version: The version of ZenML to filter by.
|
2690
2702
|
python_version: The Python version to filter by.
|
2691
2703
|
checksum: The build checksum to filter by.
|
2704
|
+
stack_checksum: The stack checksum to filter by.
|
2692
2705
|
hydrate: Flag deciding whether to hydrate the output model(s)
|
2693
2706
|
by including metadata fields in the response.
|
2694
2707
|
|
@@ -2705,13 +2718,16 @@ class Client(metaclass=ClientMetaClass):
|
|
2705
2718
|
updated=updated,
|
2706
2719
|
workspace_id=workspace_id,
|
2707
2720
|
user_id=user_id,
|
2721
|
+
user=user,
|
2708
2722
|
pipeline_id=pipeline_id,
|
2709
2723
|
stack_id=stack_id,
|
2724
|
+
container_registry_id=container_registry_id,
|
2710
2725
|
is_local=is_local,
|
2711
2726
|
contains_code=contains_code,
|
2712
2727
|
zenml_version=zenml_version,
|
2713
2728
|
python_version=python_version,
|
2714
2729
|
checksum=checksum,
|
2730
|
+
stack_checksum=stack_checksum,
|
2715
2731
|
)
|
2716
2732
|
build_filter_model.set_scope_workspace(self.active_workspace.id)
|
2717
2733
|
return self.zen_store.list_builds(
|
@@ -2771,7 +2787,7 @@ class Client(metaclass=ClientMetaClass):
|
|
2771
2787
|
allow_name_prefix_match: bool = True,
|
2772
2788
|
hydrate: bool = True,
|
2773
2789
|
) -> EventSourceResponse:
|
2774
|
-
"""Get
|
2790
|
+
"""Get an event source by name, ID or prefix.
|
2775
2791
|
|
2776
2792
|
Args:
|
2777
2793
|
name_id_or_prefix: The name, ID or prefix of the stack.
|
@@ -2804,6 +2820,7 @@ class Client(metaclass=ClientMetaClass):
|
|
2804
2820
|
event_source_type: Optional[str] = None,
|
2805
2821
|
workspace_id: Optional[Union[str, UUID]] = None,
|
2806
2822
|
user_id: Optional[Union[str, UUID]] = None,
|
2823
|
+
user: Optional[Union[UUID, str]] = None,
|
2807
2824
|
hydrate: bool = False,
|
2808
2825
|
) -> Page[EventSourceResponse]:
|
2809
2826
|
"""Lists all event_sources.
|
@@ -2818,6 +2835,7 @@ class Client(metaclass=ClientMetaClass):
|
|
2818
2835
|
updated: Use the last updated date for filtering
|
2819
2836
|
workspace_id: The id of the workspace to filter by.
|
2820
2837
|
user_id: The id of the user to filter by.
|
2838
|
+
user: Filter by user name/ID.
|
2821
2839
|
name: The name of the event_source to filter by.
|
2822
2840
|
flavor: The flavor of the event_source to filter by.
|
2823
2841
|
event_source_type: The subtype of the event_source to filter by.
|
@@ -2834,6 +2852,7 @@ class Client(metaclass=ClientMetaClass):
|
|
2834
2852
|
logical_operator=logical_operator,
|
2835
2853
|
workspace_id=workspace_id,
|
2836
2854
|
user_id=user_id,
|
2855
|
+
user=user,
|
2837
2856
|
name=name,
|
2838
2857
|
flavor=flavor,
|
2839
2858
|
plugin_subtype=event_source_type,
|
@@ -3001,6 +3020,7 @@ class Client(metaclass=ClientMetaClass):
|
|
3001
3020
|
action_type: Optional[str] = None,
|
3002
3021
|
workspace_id: Optional[Union[str, UUID]] = None,
|
3003
3022
|
user_id: Optional[Union[str, UUID]] = None,
|
3023
|
+
user: Optional[Union[UUID, str]] = None,
|
3004
3024
|
hydrate: bool = False,
|
3005
3025
|
) -> Page[ActionResponse]:
|
3006
3026
|
"""List actions.
|
@@ -3015,6 +3035,7 @@ class Client(metaclass=ClientMetaClass):
|
|
3015
3035
|
updated: Use the last updated date for filtering
|
3016
3036
|
workspace_id: The id of the workspace to filter by.
|
3017
3037
|
user_id: The id of the user to filter by.
|
3038
|
+
user: Filter by user name/ID.
|
3018
3039
|
name: The name of the action to filter by.
|
3019
3040
|
flavor: The flavor of the action to filter by.
|
3020
3041
|
action_type: The type of the action to filter by.
|
@@ -3031,6 +3052,7 @@ class Client(metaclass=ClientMetaClass):
|
|
3031
3052
|
logical_operator=logical_operator,
|
3032
3053
|
workspace_id=workspace_id,
|
3033
3054
|
user_id=user_id,
|
3055
|
+
user=user,
|
3034
3056
|
name=name,
|
3035
3057
|
id=id,
|
3036
3058
|
flavor=flavor,
|
@@ -3179,6 +3201,7 @@ class Client(metaclass=ClientMetaClass):
|
|
3179
3201
|
action_subtype: Optional[str] = None,
|
3180
3202
|
workspace_id: Optional[Union[str, UUID]] = None,
|
3181
3203
|
user_id: Optional[Union[str, UUID]] = None,
|
3204
|
+
user: Optional[Union[UUID, str]] = None,
|
3182
3205
|
hydrate: bool = False,
|
3183
3206
|
) -> Page[TriggerResponse]:
|
3184
3207
|
"""Lists all triggers.
|
@@ -3193,6 +3216,7 @@ class Client(metaclass=ClientMetaClass):
|
|
3193
3216
|
updated: Use the last updated date for filtering
|
3194
3217
|
workspace_id: The id of the workspace to filter by.
|
3195
3218
|
user_id: The id of the user to filter by.
|
3219
|
+
user: Filter by user name/ID.
|
3196
3220
|
name: The name of the trigger to filter by.
|
3197
3221
|
event_source_id: The event source associated with the trigger.
|
3198
3222
|
action_id: The action associated with the trigger.
|
@@ -3215,6 +3239,7 @@ class Client(metaclass=ClientMetaClass):
|
|
3215
3239
|
logical_operator=logical_operator,
|
3216
3240
|
workspace_id=workspace_id,
|
3217
3241
|
user_id=user_id,
|
3242
|
+
user=user,
|
3218
3243
|
name=name,
|
3219
3244
|
event_source_id=event_source_id,
|
3220
3245
|
action_id=action_id,
|
@@ -3365,6 +3390,7 @@ class Client(metaclass=ClientMetaClass):
|
|
3365
3390
|
updated: Optional[Union[datetime, str]] = None,
|
3366
3391
|
workspace_id: Optional[Union[str, UUID]] = None,
|
3367
3392
|
user_id: Optional[Union[str, UUID]] = None,
|
3393
|
+
user: Optional[Union[UUID, str]] = None,
|
3368
3394
|
pipeline_id: Optional[Union[str, UUID]] = None,
|
3369
3395
|
stack_id: Optional[Union[str, UUID]] = None,
|
3370
3396
|
build_id: Optional[Union[str, UUID]] = None,
|
@@ -3383,6 +3409,7 @@ class Client(metaclass=ClientMetaClass):
|
|
3383
3409
|
updated: Use the last updated date for filtering
|
3384
3410
|
workspace_id: The id of the workspace to filter by.
|
3385
3411
|
user_id: The id of the user to filter by.
|
3412
|
+
user: Filter by user name/ID.
|
3386
3413
|
pipeline_id: The id of the pipeline to filter by.
|
3387
3414
|
stack_id: The id of the stack to filter by.
|
3388
3415
|
build_id: The id of the build to filter by.
|
@@ -3403,6 +3430,7 @@ class Client(metaclass=ClientMetaClass):
|
|
3403
3430
|
updated=updated,
|
3404
3431
|
workspace_id=workspace_id,
|
3405
3432
|
user_id=user_id,
|
3433
|
+
user=user,
|
3406
3434
|
pipeline_id=pipeline_id,
|
3407
3435
|
stack_id=stack_id,
|
3408
3436
|
build_id=build_id,
|
@@ -3488,6 +3516,7 @@ class Client(metaclass=ClientMetaClass):
|
|
3488
3516
|
logical_operator: LogicalOperators = LogicalOperators.AND,
|
3489
3517
|
created: Optional[Union[datetime, str]] = None,
|
3490
3518
|
updated: Optional[Union[datetime, str]] = None,
|
3519
|
+
id: Optional[Union[UUID, str]] = None,
|
3491
3520
|
name: Optional[str] = None,
|
3492
3521
|
tag: Optional[str] = None,
|
3493
3522
|
workspace_id: Optional[Union[str, UUID]] = None,
|
@@ -3510,6 +3539,7 @@ class Client(metaclass=ClientMetaClass):
|
|
3510
3539
|
logical_operator: Which logical operator to use [and, or].
|
3511
3540
|
created: Filter by the creation date.
|
3512
3541
|
updated: Filter by the last updated date.
|
3542
|
+
id: Filter by run template ID.
|
3513
3543
|
name: Filter by run template name.
|
3514
3544
|
tag: Filter by run template tags.
|
3515
3545
|
workspace_id: Filter by workspace ID.
|
@@ -3534,6 +3564,7 @@ class Client(metaclass=ClientMetaClass):
|
|
3534
3564
|
logical_operator=logical_operator,
|
3535
3565
|
created=created,
|
3536
3566
|
updated=updated,
|
3567
|
+
id=id,
|
3537
3568
|
name=name,
|
3538
3569
|
tag=tag,
|
3539
3570
|
workspace_id=workspace_id,
|
@@ -3650,6 +3681,7 @@ class Client(metaclass=ClientMetaClass):
|
|
3650
3681
|
name: Optional[str] = None,
|
3651
3682
|
workspace_id: Optional[Union[str, UUID]] = None,
|
3652
3683
|
user_id: Optional[Union[str, UUID]] = None,
|
3684
|
+
user: Optional[Union[UUID, str]] = None,
|
3653
3685
|
pipeline_id: Optional[Union[str, UUID]] = None,
|
3654
3686
|
orchestrator_id: Optional[Union[str, UUID]] = None,
|
3655
3687
|
active: Optional[Union[str, bool]] = None,
|
@@ -3674,6 +3706,7 @@ class Client(metaclass=ClientMetaClass):
|
|
3674
3706
|
name: The name of the stack to filter by.
|
3675
3707
|
workspace_id: The id of the workspace to filter by.
|
3676
3708
|
user_id: The id of the user to filter by.
|
3709
|
+
user: Filter by user name/ID.
|
3677
3710
|
pipeline_id: The id of the pipeline to filter by.
|
3678
3711
|
orchestrator_id: The id of the orchestrator to filter by.
|
3679
3712
|
active: Use to filter by active status.
|
@@ -3700,6 +3733,7 @@ class Client(metaclass=ClientMetaClass):
|
|
3700
3733
|
name=name,
|
3701
3734
|
workspace_id=workspace_id,
|
3702
3735
|
user_id=user_id,
|
3736
|
+
user=user,
|
3703
3737
|
pipeline_id=pipeline_id,
|
3704
3738
|
orchestrator_id=orchestrator_id,
|
3705
3739
|
active=active,
|
@@ -3940,6 +3974,7 @@ class Client(metaclass=ClientMetaClass):
|
|
3940
3974
|
original_step_run_id: Optional[Union[str, UUID]] = None,
|
3941
3975
|
workspace_id: Optional[Union[str, UUID]] = None,
|
3942
3976
|
user_id: Optional[Union[str, UUID]] = None,
|
3977
|
+
user: Optional[Union[UUID, str]] = None,
|
3943
3978
|
model_version_id: Optional[Union[str, UUID]] = None,
|
3944
3979
|
model: Optional[Union[UUID, str]] = None,
|
3945
3980
|
hydrate: bool = False,
|
@@ -3958,6 +3993,7 @@ class Client(metaclass=ClientMetaClass):
|
|
3958
3993
|
end_time: Use to filter by the time when the step finished running
|
3959
3994
|
workspace_id: The id of the workspace to filter by.
|
3960
3995
|
user_id: The id of the user to filter by.
|
3996
|
+
user: Filter by user name/ID.
|
3961
3997
|
pipeline_run_id: The id of the pipeline run to filter by.
|
3962
3998
|
deployment_id: The id of the deployment to filter by.
|
3963
3999
|
original_step_run_id: The id of the original step run to filter by.
|
@@ -3992,6 +4028,7 @@ class Client(metaclass=ClientMetaClass):
|
|
3992
4028
|
name=name,
|
3993
4029
|
workspace_id=workspace_id,
|
3994
4030
|
user_id=user_id,
|
4031
|
+
user=user,
|
3995
4032
|
model_version_id=model_version_id,
|
3996
4033
|
model=model,
|
3997
4034
|
)
|
@@ -4664,6 +4701,7 @@ class Client(metaclass=ClientMetaClass):
|
|
4664
4701
|
scope: Optional[SecretScope] = None,
|
4665
4702
|
workspace_id: Optional[Union[str, UUID]] = None,
|
4666
4703
|
user_id: Optional[Union[str, UUID]] = None,
|
4704
|
+
user: Optional[Union[UUID, str]] = None,
|
4667
4705
|
hydrate: bool = False,
|
4668
4706
|
) -> Page[SecretResponse]:
|
4669
4707
|
"""Fetches all the secret models.
|
@@ -4683,6 +4721,7 @@ class Client(metaclass=ClientMetaClass):
|
|
4683
4721
|
scope: The scope of the secret to filter by.
|
4684
4722
|
workspace_id: The id of the workspace to filter by.
|
4685
4723
|
user_id: The id of the user to filter by.
|
4724
|
+
user: Filter by user name/ID.
|
4686
4725
|
hydrate: Flag deciding whether to hydrate the output model(s)
|
4687
4726
|
by including metadata fields in the response.
|
4688
4727
|
|
@@ -4699,6 +4738,7 @@ class Client(metaclass=ClientMetaClass):
|
|
4699
4738
|
sort_by=sort_by,
|
4700
4739
|
logical_operator=logical_operator,
|
4701
4740
|
user_id=user_id,
|
4741
|
+
user=user,
|
4702
4742
|
workspace_id=workspace_id,
|
4703
4743
|
name=name,
|
4704
4744
|
scope=scope,
|
@@ -5013,6 +5053,7 @@ class Client(metaclass=ClientMetaClass):
|
|
5013
5053
|
name: Optional[str] = None,
|
5014
5054
|
workspace_id: Optional[Union[str, UUID]] = None,
|
5015
5055
|
user_id: Optional[Union[str, UUID]] = None,
|
5056
|
+
user: Optional[Union[UUID, str]] = None,
|
5016
5057
|
hydrate: bool = False,
|
5017
5058
|
) -> Page[CodeRepositoryResponse]:
|
5018
5059
|
"""List all code repositories.
|
@@ -5028,6 +5069,7 @@ class Client(metaclass=ClientMetaClass):
|
|
5028
5069
|
name: The name of the code repository to filter by.
|
5029
5070
|
workspace_id: The id of the workspace to filter by.
|
5030
5071
|
user_id: The id of the user to filter by.
|
5072
|
+
user: Filter by user name/ID.
|
5031
5073
|
hydrate: Flag deciding whether to hydrate the output model(s)
|
5032
5074
|
by including metadata fields in the response.
|
5033
5075
|
|
@@ -5045,6 +5087,7 @@ class Client(metaclass=ClientMetaClass):
|
|
5045
5087
|
name=name,
|
5046
5088
|
workspace_id=workspace_id,
|
5047
5089
|
user_id=user_id,
|
5090
|
+
user=user,
|
5048
5091
|
)
|
5049
5092
|
filter_model.set_scope_workspace(self.active_workspace.id)
|
5050
5093
|
return self.zen_store.list_code_repositories(
|
@@ -5405,6 +5448,7 @@ class Client(metaclass=ClientMetaClass):
|
|
5405
5448
|
resource_id: Optional[str] = None,
|
5406
5449
|
workspace_id: Optional[Union[str, UUID]] = None,
|
5407
5450
|
user_id: Optional[Union[str, UUID]] = None,
|
5451
|
+
user: Optional[Union[UUID, str]] = None,
|
5408
5452
|
labels: Optional[Dict[str, Optional[str]]] = None,
|
5409
5453
|
secret_id: Optional[Union[str, UUID]] = None,
|
5410
5454
|
hydrate: bool = False,
|
@@ -5427,6 +5471,7 @@ class Client(metaclass=ClientMetaClass):
|
|
5427
5471
|
they can give access to.
|
5428
5472
|
workspace_id: The id of the workspace to filter by.
|
5429
5473
|
user_id: The id of the user to filter by.
|
5474
|
+
user: Filter by user name/ID.
|
5430
5475
|
name: The name of the service connector to filter by.
|
5431
5476
|
labels: The labels of the service connector to filter by.
|
5432
5477
|
secret_id: Filter by the id of the secret that is referenced by the
|
@@ -5444,6 +5489,7 @@ class Client(metaclass=ClientMetaClass):
|
|
5444
5489
|
logical_operator=logical_operator,
|
5445
5490
|
workspace_id=workspace_id or self.active_workspace.id,
|
5446
5491
|
user_id=user_id,
|
5492
|
+
user=user,
|
5447
5493
|
name=name,
|
5448
5494
|
connector_type=connector_type,
|
5449
5495
|
auth_method=auth_method,
|
@@ -6596,6 +6642,7 @@ class Client(metaclass=ClientMetaClass):
|
|
6596
6642
|
client_id: Union[UUID, str, None] = None,
|
6597
6643
|
status: Union[OAuthDeviceStatus, str, None] = None,
|
6598
6644
|
trusted_device: Union[bool, str, None] = None,
|
6645
|
+
user: Optional[Union[UUID, str]] = None,
|
6599
6646
|
failed_auth_attempts: Union[int, str, None] = None,
|
6600
6647
|
last_login: Optional[Union[datetime, str, None]] = None,
|
6601
6648
|
hydrate: bool = False,
|
@@ -6613,6 +6660,7 @@ class Client(metaclass=ClientMetaClass):
|
|
6613
6660
|
expires: Use the expiration date for filtering.
|
6614
6661
|
client_id: Use the client id for filtering.
|
6615
6662
|
status: Use the status for filtering.
|
6663
|
+
user: Filter by user name/ID.
|
6616
6664
|
trusted_device: Use the trusted device flag for filtering.
|
6617
6665
|
failed_auth_attempts: Use the failed auth attempts for filtering.
|
6618
6666
|
last_login: Use the last login date for filtering.
|
@@ -6632,6 +6680,7 @@ class Client(metaclass=ClientMetaClass):
|
|
6632
6680
|
updated=updated,
|
6633
6681
|
expires=expires,
|
6634
6682
|
client_id=client_id,
|
6683
|
+
user=user,
|
6635
6684
|
status=status,
|
6636
6685
|
trusted_device=trusted_device,
|
6637
6686
|
failed_auth_attempts=failed_auth_attempts,
|
@@ -6730,7 +6779,7 @@ class Client(metaclass=ClientMetaClass):
|
|
6730
6779
|
trigger_execution_id: UUID,
|
6731
6780
|
hydrate: bool = True,
|
6732
6781
|
) -> TriggerExecutionResponse:
|
6733
|
-
"""Get
|
6782
|
+
"""Get a trigger execution by ID.
|
6734
6783
|
|
6735
6784
|
Args:
|
6736
6785
|
trigger_execution_id: The ID of the trigger execution to get.
|
@@ -6751,6 +6800,7 @@ class Client(metaclass=ClientMetaClass):
|
|
6751
6800
|
size: int = PAGE_SIZE_DEFAULT,
|
6752
6801
|
logical_operator: LogicalOperators = LogicalOperators.AND,
|
6753
6802
|
trigger_id: Optional[UUID] = None,
|
6803
|
+
user: Optional[Union[UUID, str]] = None,
|
6754
6804
|
hydrate: bool = False,
|
6755
6805
|
) -> Page[TriggerExecutionResponse]:
|
6756
6806
|
"""List all trigger executions matching the given filter criteria.
|
@@ -6761,6 +6811,7 @@ class Client(metaclass=ClientMetaClass):
|
|
6761
6811
|
size: The maximum size of all pages.
|
6762
6812
|
logical_operator: Which logical operator to use [and, or].
|
6763
6813
|
trigger_id: ID of the trigger to filter by.
|
6814
|
+
user: Filter by user name/ID.
|
6764
6815
|
hydrate: Flag deciding whether to hydrate the output model(s)
|
6765
6816
|
by including metadata fields in the response.
|
6766
6817
|
|
@@ -6772,6 +6823,7 @@ class Client(metaclass=ClientMetaClass):
|
|
6772
6823
|
sort_by=sort_by,
|
6773
6824
|
page=page,
|
6774
6825
|
size=size,
|
6826
|
+
user=user,
|
6775
6827
|
logical_operator=logical_operator,
|
6776
6828
|
)
|
6777
6829
|
filter_model.set_scope_workspace(self.active_workspace.id)
|
@@ -33,7 +33,6 @@ from zenml.stack import Stack, StackValidator
|
|
33
33
|
from zenml.step_operators import BaseStepOperator
|
34
34
|
|
35
35
|
if TYPE_CHECKING:
|
36
|
-
from zenml.config.base_settings import BaseSettings
|
37
36
|
from zenml.config.step_run_info import StepRunInfo
|
38
37
|
from zenml.models import PipelineDeploymentBase
|
39
38
|
|
zenml/model/model.py
CHANGED
@@ -509,22 +509,6 @@ class Model(BaseModel):
|
|
509
509
|
raise ValueError(
|
510
510
|
"`model_version_id` field is for internal use only"
|
511
511
|
)
|
512
|
-
|
513
|
-
version = data.get("version", None)
|
514
|
-
|
515
|
-
if (
|
516
|
-
version in [stage.value for stage in ModelStages]
|
517
|
-
and not suppress_class_validation_warnings
|
518
|
-
):
|
519
|
-
logger.info(
|
520
|
-
f"Version `{version}` matches one of the possible "
|
521
|
-
"`ModelStages` and will be fetched using stage."
|
522
|
-
)
|
523
|
-
if str(version).isnumeric() and not suppress_class_validation_warnings:
|
524
|
-
logger.info(
|
525
|
-
f"`version` `{version}` is numeric and will be fetched "
|
526
|
-
"using version number."
|
527
|
-
)
|
528
512
|
data["suppress_class_validation_warnings"] = True
|
529
513
|
return data
|
530
514
|
|
@@ -603,6 +587,18 @@ class Model(BaseModel):
|
|
603
587
|
hydrate=hydrate,
|
604
588
|
)
|
605
589
|
else:
|
590
|
+
if self.version in ModelStages.values():
|
591
|
+
logger.info(
|
592
|
+
f"Version `{self.version}` for model {self.name} matches "
|
593
|
+
"one of the possible `ModelStages` and will be fetched "
|
594
|
+
"using stage."
|
595
|
+
)
|
596
|
+
if str(self.version).isnumeric():
|
597
|
+
logger.info(
|
598
|
+
f"Version `{self.version}` for model {self.name} is "
|
599
|
+
"numeric and will be fetched using version number."
|
600
|
+
)
|
601
|
+
|
606
602
|
mv = zenml_client.get_model_version(
|
607
603
|
model_name_or_id=self.name,
|
608
604
|
model_version_name_or_number_or_id=self.version,
|
zenml/model/utils.py
CHANGED
@@ -56,7 +56,9 @@ def log_model_metadata(
|
|
56
56
|
"""
|
57
57
|
logger.warning(
|
58
58
|
"The `log_model_metadata` function is deprecated and will soon be "
|
59
|
-
"removed.
|
59
|
+
"removed. Instead, you can consider using: "
|
60
|
+
"`log_metadata(metadata={...}, infer_model=True)` instead. For more "
|
61
|
+
"info: https://docs.zenml.io/how-to/model-management-metrics/track-metrics-metadata/attach-metadata-to-a-model"
|
60
62
|
)
|
61
63
|
|
62
64
|
from zenml import log_metadata
|
zenml/models/v2/base/filter.py
CHANGED
@@ -113,7 +113,7 @@ class Filter(BaseModel, ABC):
|
|
113
113
|
def generate_query_conditions(
|
114
114
|
self,
|
115
115
|
table: Type[SQLModel],
|
116
|
-
) ->
|
116
|
+
) -> "ColumnElement[bool]":
|
117
117
|
"""Generate the query conditions for the database.
|
118
118
|
|
119
119
|
This method converts the Filter class into an appropriate SQLModel
|
@@ -291,11 +291,19 @@ class UUIDFilter(StrFilter):
|
|
291
291
|
import sqlalchemy
|
292
292
|
from sqlalchemy_utils.functions import cast_if
|
293
293
|
|
294
|
+
from zenml.utils import uuid_utils
|
295
|
+
|
294
296
|
# For equality checks, compare the UUID directly
|
295
297
|
if self.operation == GenericFilterOps.EQUALS:
|
298
|
+
if not uuid_utils.is_valid_uuid(self.value):
|
299
|
+
return False
|
300
|
+
|
296
301
|
return column == self.value
|
297
302
|
|
298
303
|
if self.operation == GenericFilterOps.NOT_EQUALS:
|
304
|
+
if not uuid_utils.is_valid_uuid(self.value):
|
305
|
+
return True
|
306
|
+
|
299
307
|
return column != self.value
|
300
308
|
|
301
309
|
# For all other operations, cast and handle the column as string
|
@@ -436,7 +444,6 @@ class BaseFilter(BaseModel):
|
|
436
444
|
le=PAGE_SIZE_MAXIMUM,
|
437
445
|
description="Page size",
|
438
446
|
)
|
439
|
-
|
440
447
|
id: Optional[Union[UUID, str]] = Field(
|
441
448
|
default=None,
|
442
449
|
description="Id for this resource",
|
@@ -491,13 +498,13 @@ class BaseFilter(BaseModel):
|
|
491
498
|
)
|
492
499
|
value = column
|
493
500
|
|
494
|
-
if column in cls.
|
501
|
+
if column in cls.CUSTOM_SORTING_OPTIONS:
|
502
|
+
return value
|
503
|
+
elif column in cls.FILTER_EXCLUDE_FIELDS:
|
495
504
|
raise ValueError(
|
496
505
|
f"This resource can not be sorted by this field: '{value}'"
|
497
506
|
)
|
498
|
-
|
499
|
-
return value
|
500
|
-
elif column in cls.CUSTOM_SORTING_OPTIONS:
|
507
|
+
if column in cls.model_fields:
|
501
508
|
return value
|
502
509
|
else:
|
503
510
|
raise ValueError(
|
@@ -703,16 +710,10 @@ class BaseFilter(BaseModel):
|
|
703
710
|
|
704
711
|
conditions = []
|
705
712
|
|
706
|
-
|
707
|
-
|
708
|
-
|
709
|
-
|
710
|
-
conditions.append(filter_.generate_query_conditions(table=table))
|
711
|
-
except ValueError:
|
712
|
-
# UUID filter with equal operators and no full UUID fail with
|
713
|
-
# a ValueError. In this case, we already know that the filter
|
714
|
-
# will not produce any result and can simply ignore it.
|
715
|
-
pass
|
713
|
+
filter_ = FilterGenerator(table).define_filter(
|
714
|
+
column="id", value=value, operator=operator
|
715
|
+
)
|
716
|
+
conditions.append(filter_.generate_query_conditions(table=table))
|
716
717
|
|
717
718
|
filter_ = FilterGenerator(table).define_filter(
|
718
719
|
column="name", value=value, operator=operator
|
@@ -759,7 +760,7 @@ class BaseFilter(BaseModel):
|
|
759
760
|
return self.size * (self.page - 1)
|
760
761
|
|
761
762
|
def generate_filter(
|
762
|
-
self, table: Type[
|
763
|
+
self, table: Type["AnySchema"]
|
763
764
|
) -> Union["ColumnElement[bool]"]:
|
764
765
|
"""Generate the filter for the query.
|
765
766
|
|
@@ -779,7 +780,7 @@ class BaseFilter(BaseModel):
|
|
779
780
|
filters.append(
|
780
781
|
column_filter.generate_query_conditions(table=table)
|
781
782
|
)
|
782
|
-
for custom_filter in self.get_custom_filters():
|
783
|
+
for custom_filter in self.get_custom_filters(table):
|
783
784
|
filters.append(custom_filter)
|
784
785
|
if self.logical_operator == LogicalOperators.OR:
|
785
786
|
return or_(False, *filters)
|
@@ -788,12 +789,17 @@ class BaseFilter(BaseModel):
|
|
788
789
|
else:
|
789
790
|
raise RuntimeError("No valid logical operator was supplied.")
|
790
791
|
|
791
|
-
def get_custom_filters(
|
792
|
+
def get_custom_filters(
|
793
|
+
self, table: Type["AnySchema"]
|
794
|
+
) -> List["ColumnElement[bool]"]:
|
792
795
|
"""Get custom filters.
|
793
796
|
|
794
797
|
This can be overridden by subclasses to define custom filters that are
|
795
798
|
not based on the columns of the underlying table.
|
796
799
|
|
800
|
+
Args:
|
801
|
+
table: The query table.
|
802
|
+
|
797
803
|
Returns:
|
798
804
|
A list of custom filters.
|
799
805
|
"""
|
@@ -1101,18 +1107,8 @@ class FilterGenerator:
|
|
1101
1107
|
A Filter object.
|
1102
1108
|
|
1103
1109
|
Raises:
|
1104
|
-
ValueError: If the value is not a
|
1110
|
+
ValueError: If the value for a oneof filter is not a list.
|
1105
1111
|
"""
|
1106
|
-
# For equality checks, ensure that the value is a valid UUID.
|
1107
|
-
if operator == GenericFilterOps.EQUALS and not isinstance(value, UUID):
|
1108
|
-
try:
|
1109
|
-
UUID(value)
|
1110
|
-
except ValueError as e:
|
1111
|
-
raise ValueError(
|
1112
|
-
"Invalid value passed as UUID query parameter."
|
1113
|
-
) from e
|
1114
|
-
|
1115
|
-
# For equality checks, ensure that the value is a valid UUID.
|
1116
1112
|
if operator == GenericFilterOps.ONEOF and not isinstance(value, list):
|
1117
1113
|
raise ValueError(ONEOF_ERROR)
|
1118
1114
|
|