zenml-nightly 0.73.0.dev20250204__py3-none-any.whl → 0.73.0.dev20250206__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.
Files changed (46) hide show
  1. zenml/VERSION +1 -1
  2. zenml/cli/utils.py +42 -53
  3. zenml/client.py +6 -2
  4. zenml/constants.py +1 -0
  5. zenml/integrations/gcp/image_builders/gcp_image_builder.py +5 -8
  6. zenml/models/__init__.py +4 -2
  7. zenml/models/v2/base/filter.py +34 -11
  8. zenml/models/v2/base/scoped.py +4 -4
  9. zenml/models/v2/core/artifact.py +3 -3
  10. zenml/models/v2/core/artifact_version.py +22 -5
  11. zenml/models/v2/core/model.py +13 -3
  12. zenml/models/v2/core/model_version.py +13 -3
  13. zenml/models/v2/core/pipeline.py +11 -4
  14. zenml/models/v2/core/pipeline_run.py +20 -7
  15. zenml/models/v2/core/run_template.py +13 -3
  16. zenml/models/v2/core/step_run.py +9 -2
  17. zenml/pipelines/pipeline_definition.py +28 -12
  18. zenml/stack/stack.py +5 -0
  19. zenml/zen_stores/schemas/artifact_schemas.py +31 -4
  20. zenml/zen_stores/schemas/model_schemas.py +31 -6
  21. zenml/zen_stores/schemas/pipeline_run_schemas.py +1 -1
  22. zenml/zen_stores/schemas/pipeline_schemas.py +35 -8
  23. zenml/zen_stores/schemas/run_template_schemas.py +42 -14
  24. zenml/zen_stores/sql_zen_store.py +22 -56
  25. {zenml_nightly-0.73.0.dev20250204.dist-info → zenml_nightly-0.73.0.dev20250206.dist-info}/METADATA +1 -1
  26. {zenml_nightly-0.73.0.dev20250204.dist-info → zenml_nightly-0.73.0.dev20250206.dist-info}/RECORD +29 -46
  27. zenml/zen_server/deploy/helm/.helmignore +0 -23
  28. zenml/zen_server/deploy/helm/Chart.yaml +0 -12
  29. zenml/zen_server/deploy/helm/README.md +0 -50
  30. zenml/zen_server/deploy/helm/templates/NOTES.txt +0 -52
  31. zenml/zen_server/deploy/helm/templates/_environment.tpl +0 -511
  32. zenml/zen_server/deploy/helm/templates/_helpers.tpl +0 -70
  33. zenml/zen_server/deploy/helm/templates/cert-secret.yaml +0 -45
  34. zenml/zen_server/deploy/helm/templates/hpa.yaml +0 -32
  35. zenml/zen_server/deploy/helm/templates/server-db-job.yaml +0 -121
  36. zenml/zen_server/deploy/helm/templates/server-db-pvc.yaml +0 -25
  37. zenml/zen_server/deploy/helm/templates/server-deployment.yaml +0 -132
  38. zenml/zen_server/deploy/helm/templates/server-ingress.yaml +0 -59
  39. zenml/zen_server/deploy/helm/templates/server-secret.yaml +0 -60
  40. zenml/zen_server/deploy/helm/templates/server-service.yaml +0 -15
  41. zenml/zen_server/deploy/helm/templates/serviceaccount.yaml +0 -27
  42. zenml/zen_server/deploy/helm/templates/tests/test-connection.yaml +0 -15
  43. zenml/zen_server/deploy/helm/values.yaml +0 -1008
  44. {zenml_nightly-0.73.0.dev20250204.dist-info → zenml_nightly-0.73.0.dev20250206.dist-info}/LICENSE +0 -0
  45. {zenml_nightly-0.73.0.dev20250204.dist-info → zenml_nightly-0.73.0.dev20250206.dist-info}/WHEEL +0 -0
  46. {zenml_nightly-0.73.0.dev20250204.dist-info → zenml_nightly-0.73.0.dev20250206.dist-info}/entry_points.txt +0 -0
zenml/VERSION CHANGED
@@ -1 +1 @@
1
- 0.73.0.dev20250204
1
+ 0.73.0.dev20250206
zenml/cli/utils.py CHANGED
@@ -18,6 +18,7 @@ import json
18
18
  import os
19
19
  import platform
20
20
  import re
21
+ import shutil
21
22
  import subprocess
22
23
  import sys
23
24
  from typing import (
@@ -1048,22 +1049,18 @@ def install_packages(
1048
1049
  # just return without doing anything
1049
1050
  return
1050
1051
 
1051
- pip_command = ["uv", "pip"] if use_uv else ["pip"]
1052
- if upgrade:
1053
- command = (
1054
- [
1055
- sys.executable,
1056
- "-m",
1057
- ]
1058
- + pip_command
1059
- + [
1060
- "install",
1061
- "--upgrade",
1062
- ]
1063
- + packages
1064
- )
1052
+ if use_uv and not is_installed_in_python_environment("uv"):
1053
+ # If uv is installed globally, don't run as a python module
1054
+ command = []
1065
1055
  else:
1066
- command = [sys.executable, "-m"] + pip_command + ["install"] + packages
1056
+ command = [sys.executable, "-m"]
1057
+
1058
+ command += ["uv", "pip", "install"] if use_uv else ["pip", "install"]
1059
+
1060
+ if upgrade:
1061
+ command += ["--upgrade"]
1062
+
1063
+ command += packages
1067
1064
 
1068
1065
  if not IS_DEBUG_ENV:
1069
1066
  quiet_flag = "-q" if use_uv else "-qqq"
@@ -1094,62 +1091,54 @@ def uninstall_package(package: str, use_uv: bool = False) -> None:
1094
1091
  package: The package to uninstall.
1095
1092
  use_uv: Whether to use uv for package uninstallation.
1096
1093
  """
1097
- pip_command = ["uv", "pip"] if use_uv else ["pip"]
1098
- quiet_flag = "-q" if use_uv else "-qqq"
1099
-
1100
- if use_uv:
1101
- subprocess.check_call(
1102
- [
1103
- sys.executable,
1104
- "-m",
1105
- ]
1106
- + pip_command
1107
- + [
1108
- "uninstall",
1109
- quiet_flag,
1110
- package,
1111
- ]
1112
- )
1094
+ if use_uv and not is_installed_in_python_environment("uv"):
1095
+ # If uv is installed globally, don't run as a python module
1096
+ command = []
1113
1097
  else:
1114
- subprocess.check_call(
1115
- [
1116
- sys.executable,
1117
- "-m",
1118
- ]
1119
- + pip_command
1120
- + [
1121
- "uninstall",
1122
- quiet_flag,
1123
- "-y",
1124
- package,
1125
- ]
1126
- )
1098
+ command = [sys.executable, "-m"]
1127
1099
 
1100
+ command += (
1101
+ ["uv", "pip", "uninstall", "-q"]
1102
+ if use_uv
1103
+ else ["pip", "uninstall", "-y", "-qqq"]
1104
+ )
1105
+ command += [package]
1128
1106
 
1129
- def is_uv_installed() -> bool:
1130
- """Check if uv is installed in the current environment.
1107
+ subprocess.check_call(command)
1108
+
1109
+
1110
+ def is_installed_in_python_environment(package: str) -> bool:
1111
+ """Check if a package is installed in the current python environment.
1112
+
1113
+ Args:
1114
+ package: The package to check.
1131
1115
 
1132
1116
  Returns:
1133
- True if uv is installed, False otherwise.
1117
+ True if the package is installed, False otherwise.
1134
1118
  """
1135
1119
  try:
1136
- pkg_resources.get_distribution("uv")
1120
+ pkg_resources.get_distribution(package)
1137
1121
  return True
1138
1122
  except pkg_resources.DistributionNotFound:
1139
1123
  return False
1140
1124
 
1141
1125
 
1126
+ def is_uv_installed() -> bool:
1127
+ """Check if uv is installed.
1128
+
1129
+ Returns:
1130
+ True if uv is installed, False otherwise.
1131
+ """
1132
+ return shutil.which("uv") is not None
1133
+
1134
+
1142
1135
  def is_pip_installed() -> bool:
1143
1136
  """Check if pip is installed in the current environment.
1144
1137
 
1145
1138
  Returns:
1146
1139
  True if pip is installed, False otherwise.
1147
1140
  """
1148
- try:
1149
- pkg_resources.get_distribution("pip")
1150
- return True
1151
- except pkg_resources.DistributionNotFound:
1152
- return False
1141
+ return is_installed_in_python_environment("pip")
1153
1142
 
1154
1143
 
1155
1144
  def pretty_print_secret(
zenml/client.py CHANGED
@@ -3821,7 +3821,7 @@ class Client(metaclass=ClientMetaClass):
3821
3821
  templatable: Optional[bool] = None,
3822
3822
  tag: Optional[str] = None,
3823
3823
  user: Optional[Union[UUID, str]] = None,
3824
- run_metadata: Optional[Dict[str, str]] = None,
3824
+ run_metadata: Optional[Dict[str, Any]] = None,
3825
3825
  pipeline: Optional[Union[UUID, str]] = None,
3826
3826
  code_repository: Optional[Union[UUID, str]] = None,
3827
3827
  model: Optional[Union[UUID, str]] = None,
@@ -3974,6 +3974,7 @@ class Client(metaclass=ClientMetaClass):
3974
3974
  user: Optional[Union[UUID, str]] = None,
3975
3975
  model_version_id: Optional[Union[str, UUID]] = None,
3976
3976
  model: Optional[Union[UUID, str]] = None,
3977
+ run_metadata: Optional[Dict[str, Any]] = None,
3977
3978
  hydrate: bool = False,
3978
3979
  ) -> Page[StepRunResponse]:
3979
3980
  """List all pipelines.
@@ -4000,6 +4001,7 @@ class Client(metaclass=ClientMetaClass):
4000
4001
  cache_key: The cache key of the step run to filter by.
4001
4002
  code_hash: The code hash of the step run to filter by.
4002
4003
  status: The name of the run to filter by.
4004
+ run_metadata: Filter by run metadata.
4003
4005
  hydrate: Flag deciding whether to hydrate the output model(s)
4004
4006
  by including metadata fields in the response.
4005
4007
 
@@ -4028,6 +4030,7 @@ class Client(metaclass=ClientMetaClass):
4028
4030
  user=user,
4029
4031
  model_version_id=model_version_id,
4030
4032
  model=model,
4033
+ run_metadata=run_metadata,
4031
4034
  )
4032
4035
  step_run_filter_model.set_scope_workspace(self.active_workspace.id)
4033
4036
  return self.zen_store.list_run_steps(
@@ -4254,7 +4257,7 @@ class Client(metaclass=ClientMetaClass):
4254
4257
  user: Optional[Union[UUID, str]] = None,
4255
4258
  model: Optional[Union[UUID, str]] = None,
4256
4259
  pipeline_run: Optional[Union[UUID, str]] = None,
4257
- run_metadata: Optional[Dict[str, str]] = None,
4260
+ run_metadata: Optional[Dict[str, Any]] = None,
4258
4261
  tag: Optional[str] = None,
4259
4262
  hydrate: bool = False,
4260
4263
  ) -> Page[ArtifactVersionResponse]:
@@ -4320,6 +4323,7 @@ class Client(metaclass=ClientMetaClass):
4320
4323
  user=user,
4321
4324
  model=model,
4322
4325
  pipeline_run=pipeline_run,
4326
+ run_metadata=run_metadata,
4323
4327
  )
4324
4328
  artifact_version_filter_model.set_scope_workspace(
4325
4329
  self.active_workspace.id
zenml/constants.py CHANGED
@@ -165,6 +165,7 @@ ENV_ZENML_DISABLE_CLIENT_SERVER_MISMATCH_WARNING = (
165
165
  )
166
166
  ENV_ZENML_DISABLE_WORKSPACE_WARNINGS = "ZENML_DISABLE_WORKSPACE_WARNINGS"
167
167
  ENV_ZENML_SKIP_IMAGE_BUILDER_DEFAULT = "ZENML_SKIP_IMAGE_BUILDER_DEFAULT"
168
+ ENV_ZENML_SKIP_STACK_VALIDATION = "ZENML_SKIP_STACK_VALIDATION"
168
169
  ENV_ZENML_SERVER = "ZENML_SERVER"
169
170
  ENV_ZENML_ENFORCE_TYPE_ANNOTATIONS = "ZENML_ENFORCE_TYPE_ANNOTATIONS"
170
171
  ENV_ZENML_ENABLE_IMPLICIT_AUTH_METHODS = "ZENML_ENABLE_IMPLICIT_AUTH_METHODS"
@@ -18,7 +18,7 @@ from urllib.parse import urlparse
18
18
 
19
19
  from google.cloud.devtools import cloudbuild_v1
20
20
 
21
- from zenml.enums import ContainerRegistryFlavor, StackComponentType
21
+ from zenml.enums import StackComponentType
22
22
  from zenml.image_builders import BaseImageBuilder
23
23
  from zenml.integrations.gcp import GCP_ARTIFACT_STORE_FLAVOR
24
24
  from zenml.integrations.gcp.flavors import GCPImageBuilderConfig
@@ -72,14 +72,11 @@ class GCPImageBuilder(BaseImageBuilder, GoogleCredentialsMixin):
72
72
  def _validate_remote_components(stack: "Stack") -> Tuple[bool, str]:
73
73
  assert stack.container_registry
74
74
 
75
- if (
76
- stack.container_registry.flavor
77
- != ContainerRegistryFlavor.GCP.value
78
- ):
75
+ if stack.container_registry.config.is_local:
79
76
  return False, (
80
- "The GCP Image Builder requires a GCP container registry to "
81
- "push the image to. Please update your stack to include a "
82
- "GCP container registry and try again."
77
+ "The GCP Image Builder requires a remote container "
78
+ "registry to push the image to. Please update your stack "
79
+ "to include a remote container registry and try again."
83
80
  )
84
81
 
85
82
  if stack.artifact_store.flavor != GCP_ARTIFACT_STORE_FLAVOR:
zenml/models/__init__.py CHANGED
@@ -28,6 +28,7 @@ from zenml.models.v2.base.base import (
28
28
  BaseDatedResponseBody,
29
29
  )
30
30
  from zenml.models.v2.base.scoped import (
31
+ TaggableFilter,
31
32
  UserScopedRequest,
32
33
  UserScopedFilter,
33
34
  UserScopedResponse,
@@ -39,7 +40,7 @@ from zenml.models.v2.base.scoped import (
39
40
  WorkspaceScopedResponseBody,
40
41
  WorkspaceScopedResponseMetadata,
41
42
  WorkspaceScopedResponseResources,
42
- WorkspaceScopedTaggableFilter,
43
+ WorkspaceScopedFilter,
43
44
  )
44
45
  from zenml.models.v2.base.filter import (
45
46
  BaseFilter,
@@ -497,12 +498,13 @@ __all__ = [
497
498
  "WorkspaceScopedResponseBody",
498
499
  "WorkspaceScopedResponseMetadata",
499
500
  "WorkspaceScopedResponseResources",
500
- "WorkspaceScopedTaggableFilter",
501
+ "WorkspaceScopedFilter",
501
502
  "BaseFilter",
502
503
  "StrFilter",
503
504
  "BoolFilter",
504
505
  "NumericFilter",
505
506
  "UUIDFilter",
507
+ "TaggableFilter",
506
508
  "Page",
507
509
  # V2 Core
508
510
  "ActionFilter",
@@ -171,6 +171,8 @@ class BoolFilter(Filter):
171
171
  class StrFilter(Filter):
172
172
  """Filter for all string fields."""
173
173
 
174
+ json_encode_value: bool = False
175
+
174
176
  ALLOWED_OPS: ClassVar[List[str]] = [
175
177
  GenericFilterOps.EQUALS,
176
178
  GenericFilterOps.NOT_EQUALS,
@@ -211,16 +213,6 @@ class StrFilter(Filter):
211
213
  Raises:
212
214
  ValueError: the comparison of the column to a numeric value fails.
213
215
  """
214
- if self.operation == GenericFilterOps.CONTAINS:
215
- return column.like(f"%{self.value}%")
216
- if self.operation == GenericFilterOps.STARTSWITH:
217
- return column.startswith(f"{self.value}")
218
- if self.operation == GenericFilterOps.ENDSWITH:
219
- return column.endswith(f"{self.value}")
220
- if self.operation == GenericFilterOps.NOT_EQUALS:
221
- return column != self.value
222
- if self.operation == GenericFilterOps.ONEOF:
223
- return column.in_(self.value)
224
216
  if self.operation in {
225
217
  GenericFilterOps.GT,
226
218
  GenericFilterOps.LT,
@@ -254,7 +246,33 @@ class StrFilter(Filter):
254
246
  f"value '{self.value}' (must be numeric): {e}"
255
247
  )
256
248
 
257
- return column == self.value
249
+ if self.operation == GenericFilterOps.ONEOF:
250
+ assert isinstance(self.value, list)
251
+ # Convert the list of values to a list of json strings
252
+ json_list = (
253
+ [json.dumps(v) for v in self.value]
254
+ if self.json_encode_value
255
+ else self.value
256
+ )
257
+ return column.in_(json_list)
258
+
259
+ # Don't convert the value to a json string if the operation is contains
260
+ # because the quotes around strings will mess with the comparison
261
+ if self.operation == GenericFilterOps.CONTAINS:
262
+ return column.like(f"%{self.value}%")
263
+
264
+ json_value = (
265
+ json.dumps(self.value) if self.json_encode_value else self.value
266
+ )
267
+
268
+ if self.operation == GenericFilterOps.STARTSWITH:
269
+ return column.startswith(f"{json_value}")
270
+ if self.operation == GenericFilterOps.ENDSWITH:
271
+ return column.endswith(f"{json_value}")
272
+ if self.operation == GenericFilterOps.NOT_EQUALS:
273
+ return column != json_value
274
+
275
+ return column == json_value
258
276
 
259
277
 
260
278
  class UUIDFilter(StrFilter):
@@ -733,6 +751,7 @@ class BaseFilter(BaseModel):
733
751
  value: Any,
734
752
  table: Type[SQLModel],
735
753
  column: str,
754
+ json_encode_value: bool = False,
736
755
  ) -> "ColumnElement[bool]":
737
756
  """Generate custom filter conditions for a column of a table.
738
757
 
@@ -740,6 +759,7 @@ class BaseFilter(BaseModel):
740
759
  value: The filter value.
741
760
  table: The table which contains the column.
742
761
  column: The column name.
762
+ json_encode_value: Whether to json encode the value.
743
763
 
744
764
  Returns:
745
765
  The query conditions.
@@ -748,6 +768,9 @@ class BaseFilter(BaseModel):
748
768
  filter_ = FilterGenerator(table).define_filter(
749
769
  column=column, value=value, operator=operator
750
770
  )
771
+ if isinstance(filter_, StrFilter):
772
+ filter_.json_encode_value = json_encode_value
773
+
751
774
  return filter_.generate_query_conditions(table=table)
752
775
 
753
776
  @property
@@ -464,19 +464,19 @@ class WorkspaceScopedFilter(UserScopedFilter):
464
464
  return super().apply_sorting(query=query, table=table)
465
465
 
466
466
 
467
- class WorkspaceScopedTaggableFilter(WorkspaceScopedFilter):
468
- """Model to enable advanced scoping with workspace and tagging."""
467
+ class TaggableFilter(BaseFilter):
468
+ """Model to enable filtering and sorting by tags."""
469
469
 
470
470
  tag: Optional[str] = Field(
471
471
  description="Tag to apply to the filter query.", default=None
472
472
  )
473
473
 
474
474
  FILTER_EXCLUDE_FIELDS: ClassVar[List[str]] = [
475
- *WorkspaceScopedFilter.FILTER_EXCLUDE_FIELDS,
475
+ *BaseFilter.FILTER_EXCLUDE_FIELDS,
476
476
  "tag",
477
477
  ]
478
478
  CUSTOM_SORTING_OPTIONS: ClassVar[List[str]] = [
479
- *WorkspaceScopedFilter.CUSTOM_SORTING_OPTIONS,
479
+ *BaseFilter.CUSTOM_SORTING_OPTIONS,
480
480
  "tags",
481
481
  ]
482
482
 
@@ -35,7 +35,7 @@ from zenml.models.v2.base.base import (
35
35
  BaseResponseMetadata,
36
36
  BaseResponseResources,
37
37
  )
38
- from zenml.models.v2.base.scoped import WorkspaceScopedTaggableFilter
38
+ from zenml.models.v2.base.scoped import TaggableFilter
39
39
  from zenml.models.v2.core.tag import TagResponse
40
40
 
41
41
  if TYPE_CHECKING:
@@ -183,14 +183,14 @@ class ArtifactResponse(
183
183
  # ------------------ Filter Model ------------------
184
184
 
185
185
 
186
- class ArtifactFilter(WorkspaceScopedTaggableFilter):
186
+ class ArtifactFilter(TaggableFilter):
187
187
  """Model to enable advanced filtering of artifacts."""
188
188
 
189
189
  name: Optional[str] = None
190
190
  has_custom_name: Optional[bool] = None
191
191
 
192
192
  CUSTOM_SORTING_OPTIONS: ClassVar[List[str]] = [
193
- *WorkspaceScopedTaggableFilter.CUSTOM_SORTING_OPTIONS,
193
+ *TaggableFilter.CUSTOM_SORTING_OPTIONS,
194
194
  SORT_BY_LATEST_VERSION_KEY,
195
195
  ]
196
196
 
@@ -41,12 +41,13 @@ from zenml.logger import get_logger
41
41
  from zenml.metadata.metadata_types import MetadataType
42
42
  from zenml.models.v2.base.filter import FilterGenerator, StrFilter
43
43
  from zenml.models.v2.base.scoped import (
44
+ TaggableFilter,
45
+ WorkspaceScopedFilter,
44
46
  WorkspaceScopedRequest,
45
47
  WorkspaceScopedResponse,
46
48
  WorkspaceScopedResponseBody,
47
49
  WorkspaceScopedResponseMetadata,
48
50
  WorkspaceScopedResponseResources,
49
- WorkspaceScopedTaggableFilter,
50
51
  )
51
52
  from zenml.models.v2.core.artifact import ArtifactResponse
52
53
  from zenml.models.v2.core.tag import TagResponse
@@ -469,11 +470,12 @@ class ArtifactVersionResponse(
469
470
  # ------------------ Filter Model ------------------
470
471
 
471
472
 
472
- class ArtifactVersionFilter(WorkspaceScopedTaggableFilter):
473
+ class ArtifactVersionFilter(WorkspaceScopedFilter, TaggableFilter):
473
474
  """Model to enable advanced filtering of artifact versions."""
474
475
 
475
476
  FILTER_EXCLUDE_FIELDS: ClassVar[List[str]] = [
476
- *WorkspaceScopedTaggableFilter.FILTER_EXCLUDE_FIELDS,
477
+ *WorkspaceScopedFilter.FILTER_EXCLUDE_FIELDS,
478
+ *TaggableFilter.FILTER_EXCLUDE_FIELDS,
477
479
  "name",
478
480
  "only_unused",
479
481
  "has_custom_name",
@@ -482,6 +484,15 @@ class ArtifactVersionFilter(WorkspaceScopedTaggableFilter):
482
484
  "model_version_id",
483
485
  "run_metadata",
484
486
  ]
487
+ CUSTOM_SORTING_OPTIONS = [
488
+ *WorkspaceScopedFilter.CUSTOM_SORTING_OPTIONS,
489
+ *TaggableFilter.CUSTOM_SORTING_OPTIONS,
490
+ ]
491
+ CLI_EXCLUDE_FIELDS = [
492
+ *WorkspaceScopedFilter.CLI_EXCLUDE_FIELDS,
493
+ *TaggableFilter.CLI_EXCLUDE_FIELDS,
494
+ ]
495
+
485
496
  artifact_id: Optional[Union[UUID, str]] = Field(
486
497
  default=None,
487
498
  description="ID of the artifact to which this version belongs.",
@@ -548,7 +559,7 @@ class ArtifactVersionFilter(WorkspaceScopedTaggableFilter):
548
559
  description="Name/ID of a pipeline run that is associated with this "
549
560
  "artifact version.",
550
561
  )
551
- run_metadata: Optional[Dict[str, str]] = Field(
562
+ run_metadata: Optional[Dict[str, Any]] = Field(
552
563
  default=None,
553
564
  description="The run_metadata to filter the artifact versions by.",
554
565
  )
@@ -672,13 +683,19 @@ class ArtifactVersionFilter(WorkspaceScopedTaggableFilter):
672
683
  RunMetadataResourceSchema.resource_id
673
684
  == ArtifactVersionSchema.id,
674
685
  RunMetadataResourceSchema.resource_type
675
- == MetadataResourceTypes.ARTIFACT_VERSION,
686
+ == MetadataResourceTypes.ARTIFACT_VERSION.value,
676
687
  RunMetadataResourceSchema.run_metadata_id
677
688
  == RunMetadataSchema.id,
689
+ self.generate_custom_query_conditions_for_column(
690
+ value=key,
691
+ table=RunMetadataSchema,
692
+ column="key",
693
+ ),
678
694
  self.generate_custom_query_conditions_for_column(
679
695
  value=value,
680
696
  table=RunMetadataSchema,
681
697
  column="value",
698
+ json_encode_value=True,
682
699
  ),
683
700
  )
684
701
  custom_filters.append(additional_filter)
@@ -24,12 +24,13 @@ from zenml.constants import (
24
24
  TEXT_FIELD_MAX_LENGTH,
25
25
  )
26
26
  from zenml.models.v2.base.scoped import (
27
+ TaggableFilter,
28
+ WorkspaceScopedFilter,
27
29
  WorkspaceScopedRequest,
28
30
  WorkspaceScopedResponse,
29
31
  WorkspaceScopedResponseBody,
30
32
  WorkspaceScopedResponseMetadata,
31
33
  WorkspaceScopedResponseResources,
32
- WorkspaceScopedTaggableFilter,
33
34
  )
34
35
  from zenml.utils.pagination_utils import depaginate
35
36
 
@@ -322,7 +323,7 @@ class ModelResponse(
322
323
  # ------------------ Filter Model ------------------
323
324
 
324
325
 
325
- class ModelFilter(WorkspaceScopedTaggableFilter):
326
+ class ModelFilter(WorkspaceScopedFilter, TaggableFilter):
326
327
  """Model to enable advanced filtering of all Workspaces."""
327
328
 
328
329
  name: Optional[str] = Field(
@@ -330,10 +331,19 @@ class ModelFilter(WorkspaceScopedTaggableFilter):
330
331
  description="Name of the Model",
331
332
  )
332
333
 
334
+ FILTER_EXCLUDE_FIELDS: ClassVar[List[str]] = [
335
+ *WorkspaceScopedFilter.FILTER_EXCLUDE_FIELDS,
336
+ *TaggableFilter.FILTER_EXCLUDE_FIELDS,
337
+ ]
333
338
  CUSTOM_SORTING_OPTIONS: ClassVar[List[str]] = [
334
- *WorkspaceScopedTaggableFilter.CUSTOM_SORTING_OPTIONS,
339
+ *WorkspaceScopedFilter.CUSTOM_SORTING_OPTIONS,
340
+ *TaggableFilter.CUSTOM_SORTING_OPTIONS,
335
341
  SORT_BY_LATEST_VERSION_KEY,
336
342
  ]
343
+ CLI_EXCLUDE_FIELDS = [
344
+ *WorkspaceScopedFilter.CLI_EXCLUDE_FIELDS,
345
+ *TaggableFilter.CLI_EXCLUDE_FIELDS,
346
+ ]
337
347
 
338
348
  def apply_sorting(
339
349
  self,
@@ -33,12 +33,13 @@ from zenml.metadata.metadata_types import MetadataType
33
33
  from zenml.models.v2.base.filter import AnyQuery
34
34
  from zenml.models.v2.base.page import Page
35
35
  from zenml.models.v2.base.scoped import (
36
+ TaggableFilter,
37
+ WorkspaceScopedFilter,
36
38
  WorkspaceScopedRequest,
37
39
  WorkspaceScopedResponse,
38
40
  WorkspaceScopedResponseBody,
39
41
  WorkspaceScopedResponseMetadata,
40
42
  WorkspaceScopedResponseResources,
41
- WorkspaceScopedTaggableFilter,
42
43
  )
43
44
  from zenml.models.v2.core.service import ServiceResponse
44
45
  from zenml.models.v2.core.tag import TagResponse
@@ -576,13 +577,22 @@ class ModelVersionResponse(
576
577
  # ------------------ Filter Model ------------------
577
578
 
578
579
 
579
- class ModelVersionFilter(WorkspaceScopedTaggableFilter):
580
+ class ModelVersionFilter(WorkspaceScopedFilter, TaggableFilter):
580
581
  """Filter model for model versions."""
581
582
 
582
583
  FILTER_EXCLUDE_FIELDS: ClassVar[List[str]] = [
583
- *WorkspaceScopedTaggableFilter.FILTER_EXCLUDE_FIELDS,
584
+ *WorkspaceScopedFilter.FILTER_EXCLUDE_FIELDS,
585
+ *TaggableFilter.FILTER_EXCLUDE_FIELDS,
584
586
  "run_metadata",
585
587
  ]
588
+ CUSTOM_SORTING_OPTIONS = [
589
+ *WorkspaceScopedFilter.CUSTOM_SORTING_OPTIONS,
590
+ *TaggableFilter.CUSTOM_SORTING_OPTIONS,
591
+ ]
592
+ CLI_EXCLUDE_FIELDS = [
593
+ *WorkspaceScopedFilter.CLI_EXCLUDE_FIELDS,
594
+ *TaggableFilter.CLI_EXCLUDE_FIELDS,
595
+ ]
586
596
 
587
597
  name: Optional[str] = Field(
588
598
  default=None,
@@ -34,12 +34,13 @@ from zenml.constants import (
34
34
  from zenml.enums import ExecutionStatus
35
35
  from zenml.models.v2.base.base import BaseUpdate
36
36
  from zenml.models.v2.base.scoped import (
37
+ TaggableFilter,
38
+ WorkspaceScopedFilter,
37
39
  WorkspaceScopedRequest,
38
40
  WorkspaceScopedResponse,
39
41
  WorkspaceScopedResponseBody,
40
42
  WorkspaceScopedResponseMetadata,
41
43
  WorkspaceScopedResponseResources,
42
- WorkspaceScopedTaggableFilter,
43
44
  )
44
45
  from zenml.models.v2.core.tag import TagResponse
45
46
 
@@ -256,17 +257,23 @@ class PipelineResponse(
256
257
  # ------------------ Filter Model ------------------
257
258
 
258
259
 
259
- class PipelineFilter(WorkspaceScopedTaggableFilter):
260
+ class PipelineFilter(WorkspaceScopedFilter, TaggableFilter):
260
261
  """Pipeline filter model."""
261
262
 
262
263
  CUSTOM_SORTING_OPTIONS: ClassVar[List[str]] = [
263
- *WorkspaceScopedTaggableFilter.CUSTOM_SORTING_OPTIONS,
264
+ *WorkspaceScopedFilter.CUSTOM_SORTING_OPTIONS,
265
+ *TaggableFilter.CUSTOM_SORTING_OPTIONS,
264
266
  SORT_PIPELINES_BY_LATEST_RUN_KEY,
265
267
  ]
266
268
  FILTER_EXCLUDE_FIELDS: ClassVar[List[str]] = [
267
- *WorkspaceScopedTaggableFilter.FILTER_EXCLUDE_FIELDS,
269
+ *WorkspaceScopedFilter.FILTER_EXCLUDE_FIELDS,
270
+ *TaggableFilter.FILTER_EXCLUDE_FIELDS,
268
271
  "latest_run_status",
269
272
  ]
273
+ CLI_EXCLUDE_FIELDS = [
274
+ *WorkspaceScopedFilter.CLI_EXCLUDE_FIELDS,
275
+ *TaggableFilter.CLI_EXCLUDE_FIELDS,
276
+ ]
270
277
 
271
278
  name: Optional[str] = Field(
272
279
  default=None,
@@ -35,12 +35,13 @@ from zenml.constants import STR_FIELD_MAX_LENGTH
35
35
  from zenml.enums import ExecutionStatus
36
36
  from zenml.metadata.metadata_types import MetadataType
37
37
  from zenml.models.v2.base.scoped import (
38
+ TaggableFilter,
39
+ WorkspaceScopedFilter,
38
40
  WorkspaceScopedRequest,
39
41
  WorkspaceScopedResponse,
40
42
  WorkspaceScopedResponseBody,
41
43
  WorkspaceScopedResponseMetadata,
42
44
  WorkspaceScopedResponseResources,
43
- WorkspaceScopedTaggableFilter,
44
45
  )
45
46
  from zenml.models.v2.core.model_version import ModelVersionResponse
46
47
  from zenml.models.v2.core.tag import TagResponse
@@ -589,20 +590,21 @@ class PipelineRunResponse(
589
590
  # ------------------ Filter Model ------------------
590
591
 
591
592
 
592
- class PipelineRunFilter(WorkspaceScopedTaggableFilter):
593
+ class PipelineRunFilter(WorkspaceScopedFilter, TaggableFilter):
593
594
  """Model to enable advanced filtering of all Workspaces."""
594
595
 
595
596
  CUSTOM_SORTING_OPTIONS: ClassVar[List[str]] = [
596
- *WorkspaceScopedTaggableFilter.CUSTOM_SORTING_OPTIONS,
597
+ *WorkspaceScopedFilter.CUSTOM_SORTING_OPTIONS,
598
+ *TaggableFilter.CUSTOM_SORTING_OPTIONS,
597
599
  "tag",
598
600
  "stack",
599
601
  "pipeline",
600
602
  "model",
601
603
  "model_version",
602
604
  ]
603
-
604
605
  FILTER_EXCLUDE_FIELDS: ClassVar[List[str]] = [
605
- *WorkspaceScopedTaggableFilter.FILTER_EXCLUDE_FIELDS,
606
+ *WorkspaceScopedFilter.FILTER_EXCLUDE_FIELDS,
607
+ *TaggableFilter.FILTER_EXCLUDE_FIELDS,
606
608
  "unlisted",
607
609
  "code_repository_id",
608
610
  "build_id",
@@ -618,6 +620,11 @@ class PipelineRunFilter(WorkspaceScopedTaggableFilter):
618
620
  "templatable",
619
621
  "run_metadata",
620
622
  ]
623
+ CLI_EXCLUDE_FIELDS = [
624
+ *WorkspaceScopedFilter.CLI_EXCLUDE_FIELDS,
625
+ *TaggableFilter.CLI_EXCLUDE_FIELDS,
626
+ ]
627
+
621
628
  name: Optional[str] = Field(
622
629
  default=None,
623
630
  description="Name of the Pipeline Run",
@@ -681,7 +688,7 @@ class PipelineRunFilter(WorkspaceScopedTaggableFilter):
681
688
  union_mode="left_to_right",
682
689
  )
683
690
  unlisted: Optional[bool] = None
684
- run_metadata: Optional[Dict[str, str]] = Field(
691
+ run_metadata: Optional[Dict[str, Any]] = Field(
685
692
  default=None,
686
693
  description="The run_metadata to filter the pipeline runs by.",
687
694
  )
@@ -908,13 +915,19 @@ class PipelineRunFilter(WorkspaceScopedTaggableFilter):
908
915
  RunMetadataResourceSchema.resource_id
909
916
  == PipelineRunSchema.id,
910
917
  RunMetadataResourceSchema.resource_type
911
- == MetadataResourceTypes.PIPELINE_RUN,
918
+ == MetadataResourceTypes.PIPELINE_RUN.value,
912
919
  RunMetadataResourceSchema.run_metadata_id
913
920
  == RunMetadataSchema.id,
921
+ self.generate_custom_query_conditions_for_column(
922
+ value=key,
923
+ table=RunMetadataSchema,
924
+ column="key",
925
+ ),
914
926
  self.generate_custom_query_conditions_for_column(
915
927
  value=value,
916
928
  table=RunMetadataSchema,
917
929
  column="value",
930
+ json_encode_value=True,
918
931
  ),
919
932
  )
920
933
  custom_filters.append(additional_filter)