zenml-nightly 0.71.0.dev20241213__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/client.py +44 -2
- zenml/integrations/kubernetes/step_operators/kubernetes_step_operator.py +0 -1
- zenml/model/model.py +12 -16
- 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 +19 -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/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/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/sql_zen_store.py +322 -86
- {zenml_nightly-0.71.0.dev20241213.dist-info → zenml_nightly-0.71.0.dev20241214.dist-info}/METADATA +1 -1
- {zenml_nightly-0.71.0.dev20241213.dist-info → zenml_nightly-0.71.0.dev20241214.dist-info}/RECORD +41 -39
- {zenml_nightly-0.71.0.dev20241213.dist-info → zenml_nightly-0.71.0.dev20241214.dist-info}/LICENSE +0 -0
- {zenml_nightly-0.71.0.dev20241213.dist-info → zenml_nightly-0.71.0.dev20241214.dist-info}/WHEEL +0 -0
- {zenml_nightly-0.71.0.dev20241213.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
|
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,6 +2667,7 @@ 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,
|
2666
2673
|
container_registry_id: Optional[Union[UUID, str]] = None,
|
@@ -2684,6 +2691,7 @@ class Client(metaclass=ClientMetaClass):
|
|
2684
2691
|
updated: Use the last updated date for filtering
|
2685
2692
|
workspace_id: The id of the workspace to filter by.
|
2686
2693
|
user_id: The id of the user to filter by.
|
2694
|
+
user: Filter by user name/ID.
|
2687
2695
|
pipeline_id: The id of the pipeline to filter by.
|
2688
2696
|
stack_id: The id of the stack to filter by.
|
2689
2697
|
container_registry_id: The id of the container registry to
|
@@ -2710,6 +2718,7 @@ class Client(metaclass=ClientMetaClass):
|
|
2710
2718
|
updated=updated,
|
2711
2719
|
workspace_id=workspace_id,
|
2712
2720
|
user_id=user_id,
|
2721
|
+
user=user,
|
2713
2722
|
pipeline_id=pipeline_id,
|
2714
2723
|
stack_id=stack_id,
|
2715
2724
|
container_registry_id=container_registry_id,
|
@@ -2778,7 +2787,7 @@ class Client(metaclass=ClientMetaClass):
|
|
2778
2787
|
allow_name_prefix_match: bool = True,
|
2779
2788
|
hydrate: bool = True,
|
2780
2789
|
) -> EventSourceResponse:
|
2781
|
-
"""Get
|
2790
|
+
"""Get an event source by name, ID or prefix.
|
2782
2791
|
|
2783
2792
|
Args:
|
2784
2793
|
name_id_or_prefix: The name, ID or prefix of the stack.
|
@@ -2811,6 +2820,7 @@ class Client(metaclass=ClientMetaClass):
|
|
2811
2820
|
event_source_type: Optional[str] = None,
|
2812
2821
|
workspace_id: Optional[Union[str, UUID]] = None,
|
2813
2822
|
user_id: Optional[Union[str, UUID]] = None,
|
2823
|
+
user: Optional[Union[UUID, str]] = None,
|
2814
2824
|
hydrate: bool = False,
|
2815
2825
|
) -> Page[EventSourceResponse]:
|
2816
2826
|
"""Lists all event_sources.
|
@@ -2825,6 +2835,7 @@ class Client(metaclass=ClientMetaClass):
|
|
2825
2835
|
updated: Use the last updated date for filtering
|
2826
2836
|
workspace_id: The id of the workspace to filter by.
|
2827
2837
|
user_id: The id of the user to filter by.
|
2838
|
+
user: Filter by user name/ID.
|
2828
2839
|
name: The name of the event_source to filter by.
|
2829
2840
|
flavor: The flavor of the event_source to filter by.
|
2830
2841
|
event_source_type: The subtype of the event_source to filter by.
|
@@ -2841,6 +2852,7 @@ class Client(metaclass=ClientMetaClass):
|
|
2841
2852
|
logical_operator=logical_operator,
|
2842
2853
|
workspace_id=workspace_id,
|
2843
2854
|
user_id=user_id,
|
2855
|
+
user=user,
|
2844
2856
|
name=name,
|
2845
2857
|
flavor=flavor,
|
2846
2858
|
plugin_subtype=event_source_type,
|
@@ -3008,6 +3020,7 @@ class Client(metaclass=ClientMetaClass):
|
|
3008
3020
|
action_type: Optional[str] = None,
|
3009
3021
|
workspace_id: Optional[Union[str, UUID]] = None,
|
3010
3022
|
user_id: Optional[Union[str, UUID]] = None,
|
3023
|
+
user: Optional[Union[UUID, str]] = None,
|
3011
3024
|
hydrate: bool = False,
|
3012
3025
|
) -> Page[ActionResponse]:
|
3013
3026
|
"""List actions.
|
@@ -3022,6 +3035,7 @@ class Client(metaclass=ClientMetaClass):
|
|
3022
3035
|
updated: Use the last updated date for filtering
|
3023
3036
|
workspace_id: The id of the workspace to filter by.
|
3024
3037
|
user_id: The id of the user to filter by.
|
3038
|
+
user: Filter by user name/ID.
|
3025
3039
|
name: The name of the action to filter by.
|
3026
3040
|
flavor: The flavor of the action to filter by.
|
3027
3041
|
action_type: The type of the action to filter by.
|
@@ -3038,6 +3052,7 @@ class Client(metaclass=ClientMetaClass):
|
|
3038
3052
|
logical_operator=logical_operator,
|
3039
3053
|
workspace_id=workspace_id,
|
3040
3054
|
user_id=user_id,
|
3055
|
+
user=user,
|
3041
3056
|
name=name,
|
3042
3057
|
id=id,
|
3043
3058
|
flavor=flavor,
|
@@ -3186,6 +3201,7 @@ class Client(metaclass=ClientMetaClass):
|
|
3186
3201
|
action_subtype: Optional[str] = None,
|
3187
3202
|
workspace_id: Optional[Union[str, UUID]] = None,
|
3188
3203
|
user_id: Optional[Union[str, UUID]] = None,
|
3204
|
+
user: Optional[Union[UUID, str]] = None,
|
3189
3205
|
hydrate: bool = False,
|
3190
3206
|
) -> Page[TriggerResponse]:
|
3191
3207
|
"""Lists all triggers.
|
@@ -3200,6 +3216,7 @@ class Client(metaclass=ClientMetaClass):
|
|
3200
3216
|
updated: Use the last updated date for filtering
|
3201
3217
|
workspace_id: The id of the workspace to filter by.
|
3202
3218
|
user_id: The id of the user to filter by.
|
3219
|
+
user: Filter by user name/ID.
|
3203
3220
|
name: The name of the trigger to filter by.
|
3204
3221
|
event_source_id: The event source associated with the trigger.
|
3205
3222
|
action_id: The action associated with the trigger.
|
@@ -3222,6 +3239,7 @@ class Client(metaclass=ClientMetaClass):
|
|
3222
3239
|
logical_operator=logical_operator,
|
3223
3240
|
workspace_id=workspace_id,
|
3224
3241
|
user_id=user_id,
|
3242
|
+
user=user,
|
3225
3243
|
name=name,
|
3226
3244
|
event_source_id=event_source_id,
|
3227
3245
|
action_id=action_id,
|
@@ -3372,6 +3390,7 @@ class Client(metaclass=ClientMetaClass):
|
|
3372
3390
|
updated: Optional[Union[datetime, str]] = None,
|
3373
3391
|
workspace_id: Optional[Union[str, UUID]] = None,
|
3374
3392
|
user_id: Optional[Union[str, UUID]] = None,
|
3393
|
+
user: Optional[Union[UUID, str]] = None,
|
3375
3394
|
pipeline_id: Optional[Union[str, UUID]] = None,
|
3376
3395
|
stack_id: Optional[Union[str, UUID]] = None,
|
3377
3396
|
build_id: Optional[Union[str, UUID]] = None,
|
@@ -3390,6 +3409,7 @@ class Client(metaclass=ClientMetaClass):
|
|
3390
3409
|
updated: Use the last updated date for filtering
|
3391
3410
|
workspace_id: The id of the workspace to filter by.
|
3392
3411
|
user_id: The id of the user to filter by.
|
3412
|
+
user: Filter by user name/ID.
|
3393
3413
|
pipeline_id: The id of the pipeline to filter by.
|
3394
3414
|
stack_id: The id of the stack to filter by.
|
3395
3415
|
build_id: The id of the build to filter by.
|
@@ -3410,6 +3430,7 @@ class Client(metaclass=ClientMetaClass):
|
|
3410
3430
|
updated=updated,
|
3411
3431
|
workspace_id=workspace_id,
|
3412
3432
|
user_id=user_id,
|
3433
|
+
user=user,
|
3413
3434
|
pipeline_id=pipeline_id,
|
3414
3435
|
stack_id=stack_id,
|
3415
3436
|
build_id=build_id,
|
@@ -3660,6 +3681,7 @@ class Client(metaclass=ClientMetaClass):
|
|
3660
3681
|
name: Optional[str] = None,
|
3661
3682
|
workspace_id: Optional[Union[str, UUID]] = None,
|
3662
3683
|
user_id: Optional[Union[str, UUID]] = None,
|
3684
|
+
user: Optional[Union[UUID, str]] = None,
|
3663
3685
|
pipeline_id: Optional[Union[str, UUID]] = None,
|
3664
3686
|
orchestrator_id: Optional[Union[str, UUID]] = None,
|
3665
3687
|
active: Optional[Union[str, bool]] = None,
|
@@ -3684,6 +3706,7 @@ class Client(metaclass=ClientMetaClass):
|
|
3684
3706
|
name: The name of the stack to filter by.
|
3685
3707
|
workspace_id: The id of the workspace to filter by.
|
3686
3708
|
user_id: The id of the user to filter by.
|
3709
|
+
user: Filter by user name/ID.
|
3687
3710
|
pipeline_id: The id of the pipeline to filter by.
|
3688
3711
|
orchestrator_id: The id of the orchestrator to filter by.
|
3689
3712
|
active: Use to filter by active status.
|
@@ -3710,6 +3733,7 @@ class Client(metaclass=ClientMetaClass):
|
|
3710
3733
|
name=name,
|
3711
3734
|
workspace_id=workspace_id,
|
3712
3735
|
user_id=user_id,
|
3736
|
+
user=user,
|
3713
3737
|
pipeline_id=pipeline_id,
|
3714
3738
|
orchestrator_id=orchestrator_id,
|
3715
3739
|
active=active,
|
@@ -3950,6 +3974,7 @@ class Client(metaclass=ClientMetaClass):
|
|
3950
3974
|
original_step_run_id: Optional[Union[str, UUID]] = None,
|
3951
3975
|
workspace_id: Optional[Union[str, UUID]] = None,
|
3952
3976
|
user_id: Optional[Union[str, UUID]] = None,
|
3977
|
+
user: Optional[Union[UUID, str]] = None,
|
3953
3978
|
model_version_id: Optional[Union[str, UUID]] = None,
|
3954
3979
|
model: Optional[Union[UUID, str]] = None,
|
3955
3980
|
hydrate: bool = False,
|
@@ -3968,6 +3993,7 @@ class Client(metaclass=ClientMetaClass):
|
|
3968
3993
|
end_time: Use to filter by the time when the step finished running
|
3969
3994
|
workspace_id: The id of the workspace to filter by.
|
3970
3995
|
user_id: The id of the user to filter by.
|
3996
|
+
user: Filter by user name/ID.
|
3971
3997
|
pipeline_run_id: The id of the pipeline run to filter by.
|
3972
3998
|
deployment_id: The id of the deployment to filter by.
|
3973
3999
|
original_step_run_id: The id of the original step run to filter by.
|
@@ -4002,6 +4028,7 @@ class Client(metaclass=ClientMetaClass):
|
|
4002
4028
|
name=name,
|
4003
4029
|
workspace_id=workspace_id,
|
4004
4030
|
user_id=user_id,
|
4031
|
+
user=user,
|
4005
4032
|
model_version_id=model_version_id,
|
4006
4033
|
model=model,
|
4007
4034
|
)
|
@@ -4674,6 +4701,7 @@ class Client(metaclass=ClientMetaClass):
|
|
4674
4701
|
scope: Optional[SecretScope] = None,
|
4675
4702
|
workspace_id: Optional[Union[str, UUID]] = None,
|
4676
4703
|
user_id: Optional[Union[str, UUID]] = None,
|
4704
|
+
user: Optional[Union[UUID, str]] = None,
|
4677
4705
|
hydrate: bool = False,
|
4678
4706
|
) -> Page[SecretResponse]:
|
4679
4707
|
"""Fetches all the secret models.
|
@@ -4693,6 +4721,7 @@ class Client(metaclass=ClientMetaClass):
|
|
4693
4721
|
scope: The scope of the secret to filter by.
|
4694
4722
|
workspace_id: The id of the workspace to filter by.
|
4695
4723
|
user_id: The id of the user to filter by.
|
4724
|
+
user: Filter by user name/ID.
|
4696
4725
|
hydrate: Flag deciding whether to hydrate the output model(s)
|
4697
4726
|
by including metadata fields in the response.
|
4698
4727
|
|
@@ -4709,6 +4738,7 @@ class Client(metaclass=ClientMetaClass):
|
|
4709
4738
|
sort_by=sort_by,
|
4710
4739
|
logical_operator=logical_operator,
|
4711
4740
|
user_id=user_id,
|
4741
|
+
user=user,
|
4712
4742
|
workspace_id=workspace_id,
|
4713
4743
|
name=name,
|
4714
4744
|
scope=scope,
|
@@ -5023,6 +5053,7 @@ class Client(metaclass=ClientMetaClass):
|
|
5023
5053
|
name: Optional[str] = None,
|
5024
5054
|
workspace_id: Optional[Union[str, UUID]] = None,
|
5025
5055
|
user_id: Optional[Union[str, UUID]] = None,
|
5056
|
+
user: Optional[Union[UUID, str]] = None,
|
5026
5057
|
hydrate: bool = False,
|
5027
5058
|
) -> Page[CodeRepositoryResponse]:
|
5028
5059
|
"""List all code repositories.
|
@@ -5038,6 +5069,7 @@ class Client(metaclass=ClientMetaClass):
|
|
5038
5069
|
name: The name of the code repository to filter by.
|
5039
5070
|
workspace_id: The id of the workspace to filter by.
|
5040
5071
|
user_id: The id of the user to filter by.
|
5072
|
+
user: Filter by user name/ID.
|
5041
5073
|
hydrate: Flag deciding whether to hydrate the output model(s)
|
5042
5074
|
by including metadata fields in the response.
|
5043
5075
|
|
@@ -5055,6 +5087,7 @@ class Client(metaclass=ClientMetaClass):
|
|
5055
5087
|
name=name,
|
5056
5088
|
workspace_id=workspace_id,
|
5057
5089
|
user_id=user_id,
|
5090
|
+
user=user,
|
5058
5091
|
)
|
5059
5092
|
filter_model.set_scope_workspace(self.active_workspace.id)
|
5060
5093
|
return self.zen_store.list_code_repositories(
|
@@ -5415,6 +5448,7 @@ class Client(metaclass=ClientMetaClass):
|
|
5415
5448
|
resource_id: Optional[str] = None,
|
5416
5449
|
workspace_id: Optional[Union[str, UUID]] = None,
|
5417
5450
|
user_id: Optional[Union[str, UUID]] = None,
|
5451
|
+
user: Optional[Union[UUID, str]] = None,
|
5418
5452
|
labels: Optional[Dict[str, Optional[str]]] = None,
|
5419
5453
|
secret_id: Optional[Union[str, UUID]] = None,
|
5420
5454
|
hydrate: bool = False,
|
@@ -5437,6 +5471,7 @@ class Client(metaclass=ClientMetaClass):
|
|
5437
5471
|
they can give access to.
|
5438
5472
|
workspace_id: The id of the workspace to filter by.
|
5439
5473
|
user_id: The id of the user to filter by.
|
5474
|
+
user: Filter by user name/ID.
|
5440
5475
|
name: The name of the service connector to filter by.
|
5441
5476
|
labels: The labels of the service connector to filter by.
|
5442
5477
|
secret_id: Filter by the id of the secret that is referenced by the
|
@@ -5454,6 +5489,7 @@ class Client(metaclass=ClientMetaClass):
|
|
5454
5489
|
logical_operator=logical_operator,
|
5455
5490
|
workspace_id=workspace_id or self.active_workspace.id,
|
5456
5491
|
user_id=user_id,
|
5492
|
+
user=user,
|
5457
5493
|
name=name,
|
5458
5494
|
connector_type=connector_type,
|
5459
5495
|
auth_method=auth_method,
|
@@ -6606,6 +6642,7 @@ class Client(metaclass=ClientMetaClass):
|
|
6606
6642
|
client_id: Union[UUID, str, None] = None,
|
6607
6643
|
status: Union[OAuthDeviceStatus, str, None] = None,
|
6608
6644
|
trusted_device: Union[bool, str, None] = None,
|
6645
|
+
user: Optional[Union[UUID, str]] = None,
|
6609
6646
|
failed_auth_attempts: Union[int, str, None] = None,
|
6610
6647
|
last_login: Optional[Union[datetime, str, None]] = None,
|
6611
6648
|
hydrate: bool = False,
|
@@ -6623,6 +6660,7 @@ class Client(metaclass=ClientMetaClass):
|
|
6623
6660
|
expires: Use the expiration date for filtering.
|
6624
6661
|
client_id: Use the client id for filtering.
|
6625
6662
|
status: Use the status for filtering.
|
6663
|
+
user: Filter by user name/ID.
|
6626
6664
|
trusted_device: Use the trusted device flag for filtering.
|
6627
6665
|
failed_auth_attempts: Use the failed auth attempts for filtering.
|
6628
6666
|
last_login: Use the last login date for filtering.
|
@@ -6642,6 +6680,7 @@ class Client(metaclass=ClientMetaClass):
|
|
6642
6680
|
updated=updated,
|
6643
6681
|
expires=expires,
|
6644
6682
|
client_id=client_id,
|
6683
|
+
user=user,
|
6645
6684
|
status=status,
|
6646
6685
|
trusted_device=trusted_device,
|
6647
6686
|
failed_auth_attempts=failed_auth_attempts,
|
@@ -6740,7 +6779,7 @@ class Client(metaclass=ClientMetaClass):
|
|
6740
6779
|
trigger_execution_id: UUID,
|
6741
6780
|
hydrate: bool = True,
|
6742
6781
|
) -> TriggerExecutionResponse:
|
6743
|
-
"""Get
|
6782
|
+
"""Get a trigger execution by ID.
|
6744
6783
|
|
6745
6784
|
Args:
|
6746
6785
|
trigger_execution_id: The ID of the trigger execution to get.
|
@@ -6761,6 +6800,7 @@ class Client(metaclass=ClientMetaClass):
|
|
6761
6800
|
size: int = PAGE_SIZE_DEFAULT,
|
6762
6801
|
logical_operator: LogicalOperators = LogicalOperators.AND,
|
6763
6802
|
trigger_id: Optional[UUID] = None,
|
6803
|
+
user: Optional[Union[UUID, str]] = None,
|
6764
6804
|
hydrate: bool = False,
|
6765
6805
|
) -> Page[TriggerExecutionResponse]:
|
6766
6806
|
"""List all trigger executions matching the given filter criteria.
|
@@ -6771,6 +6811,7 @@ class Client(metaclass=ClientMetaClass):
|
|
6771
6811
|
size: The maximum size of all pages.
|
6772
6812
|
logical_operator: Which logical operator to use [and, or].
|
6773
6813
|
trigger_id: ID of the trigger to filter by.
|
6814
|
+
user: Filter by user name/ID.
|
6774
6815
|
hydrate: Flag deciding whether to hydrate the output model(s)
|
6775
6816
|
by including metadata fields in the response.
|
6776
6817
|
|
@@ -6782,6 +6823,7 @@ class Client(metaclass=ClientMetaClass):
|
|
6782
6823
|
sort_by=sort_by,
|
6783
6824
|
page=page,
|
6784
6825
|
size=size,
|
6826
|
+
user=user,
|
6785
6827
|
logical_operator=logical_operator,
|
6786
6828
|
)
|
6787
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/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
|
|