zenml-nightly 0.75.0.dev20250313__py3-none-any.whl → 0.75.0.dev20250315__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- zenml/VERSION +1 -1
- zenml/analytics/context.py +4 -4
- zenml/analytics/enums.py +2 -2
- zenml/artifacts/utils.py +2 -2
- zenml/cli/__init__.py +8 -9
- zenml/cli/base.py +2 -2
- zenml/cli/code_repository.py +1 -1
- zenml/cli/login.py +21 -18
- zenml/cli/pipeline.py +3 -3
- zenml/cli/project.py +172 -0
- zenml/cli/server.py +5 -5
- zenml/cli/service_accounts.py +0 -1
- zenml/cli/service_connectors.py +15 -16
- zenml/cli/stack.py +0 -2
- zenml/cli/stack_components.py +2 -2
- zenml/cli/utils.py +3 -3
- zenml/client.py +352 -341
- zenml/config/global_config.py +41 -43
- zenml/config/server_config.py +9 -9
- zenml/constants.py +5 -3
- zenml/event_hub/event_hub.py +1 -1
- zenml/integrations/gcp/__init__.py +1 -0
- zenml/integrations/gcp/flavors/vertex_orchestrator_flavor.py +5 -0
- zenml/integrations/gcp/flavors/vertex_step_operator_flavor.py +5 -28
- zenml/integrations/gcp/orchestrators/vertex_orchestrator.py +125 -78
- zenml/integrations/gcp/service_connectors/gcp_service_connector.py +7 -6
- zenml/integrations/gcp/vertex_custom_job_parameters.py +50 -0
- zenml/integrations/mlflow/steps/mlflow_registry.py +3 -3
- zenml/integrations/wandb/__init__.py +1 -1
- zenml/integrations/wandb/experiment_trackers/wandb_experiment_tracker.py +29 -9
- zenml/integrations/wandb/flavors/wandb_experiment_tracker_flavor.py +2 -0
- zenml/login/credentials.py +26 -27
- zenml/login/credentials_store.py +5 -5
- zenml/login/pro/client.py +9 -9
- zenml/login/pro/utils.py +8 -8
- zenml/login/pro/{tenant → workspace}/__init__.py +1 -1
- zenml/login/pro/{tenant → workspace}/client.py +25 -25
- zenml/login/pro/{tenant → workspace}/models.py +27 -28
- zenml/model/model.py +2 -2
- zenml/model_registries/base_model_registry.py +1 -1
- zenml/models/__init__.py +29 -29
- zenml/models/v2/base/filter.py +1 -1
- zenml/models/v2/base/scoped.py +49 -53
- zenml/models/v2/core/action.py +12 -12
- zenml/models/v2/core/artifact.py +15 -15
- zenml/models/v2/core/artifact_version.py +15 -15
- zenml/models/v2/core/code_repository.py +12 -12
- zenml/models/v2/core/event_source.py +12 -12
- zenml/models/v2/core/model.py +26 -18
- zenml/models/v2/core/model_version.py +15 -15
- zenml/models/v2/core/pipeline.py +15 -15
- zenml/models/v2/core/pipeline_build.py +14 -14
- zenml/models/v2/core/pipeline_deployment.py +12 -14
- zenml/models/v2/core/pipeline_run.py +16 -16
- zenml/models/v2/core/project.py +203 -0
- zenml/models/v2/core/run_metadata.py +2 -2
- zenml/models/v2/core/run_template.py +15 -15
- zenml/models/v2/core/schedule.py +12 -12
- zenml/models/v2/core/secret.py +1 -1
- zenml/models/v2/core/service.py +14 -14
- zenml/models/v2/core/step_run.py +13 -13
- zenml/models/v2/core/tag.py +96 -3
- zenml/models/v2/core/trigger.py +13 -13
- zenml/models/v2/core/trigger_execution.py +2 -2
- zenml/models/v2/core/user.py +0 -17
- zenml/models/v2/misc/server_models.py +6 -6
- zenml/models/v2/misc/statistics.py +4 -4
- zenml/orchestrators/cache_utils.py +7 -7
- zenml/orchestrators/input_utils.py +1 -1
- zenml/orchestrators/step_launcher.py +1 -1
- zenml/orchestrators/step_run_utils.py +3 -3
- zenml/orchestrators/utils.py +4 -4
- zenml/pipelines/build_utils.py +2 -2
- zenml/pipelines/pipeline_definition.py +5 -5
- zenml/pipelines/run_utils.py +1 -1
- zenml/service_connectors/service_connector.py +0 -3
- zenml/service_connectors/service_connector_utils.py +0 -1
- zenml/stack/stack.py +0 -1
- zenml/steps/base_step.py +10 -2
- zenml/utils/dashboard_utils.py +1 -1
- zenml/utils/tag_utils.py +0 -12
- zenml/zen_server/cloud_utils.py +3 -3
- zenml/zen_server/feature_gate/endpoint_utils.py +1 -1
- zenml/zen_server/feature_gate/zenml_cloud_feature_gate.py +1 -1
- zenml/zen_server/rbac/endpoint_utils.py +17 -17
- zenml/zen_server/rbac/models.py +47 -22
- zenml/zen_server/rbac/rbac_sql_zen_store.py +3 -3
- zenml/zen_server/rbac/utils.py +23 -25
- zenml/zen_server/rbac/zenml_cloud_rbac.py +7 -74
- zenml/zen_server/routers/artifact_version_endpoints.py +10 -10
- zenml/zen_server/routers/auth_endpoints.py +6 -6
- zenml/zen_server/routers/code_repositories_endpoints.py +12 -14
- zenml/zen_server/routers/model_versions_endpoints.py +13 -15
- zenml/zen_server/routers/models_endpoints.py +7 -9
- zenml/zen_server/routers/pipeline_builds_endpoints.py +14 -16
- zenml/zen_server/routers/pipeline_deployments_endpoints.py +13 -15
- zenml/zen_server/routers/pipelines_endpoints.py +16 -18
- zenml/zen_server/routers/{workspaces_endpoints.py → projects_endpoints.py} +111 -68
- zenml/zen_server/routers/run_metadata_endpoints.py +7 -9
- zenml/zen_server/routers/run_templates_endpoints.py +15 -17
- zenml/zen_server/routers/runs_endpoints.py +12 -14
- zenml/zen_server/routers/schedule_endpoints.py +12 -14
- zenml/zen_server/routers/secrets_endpoints.py +1 -3
- zenml/zen_server/routers/server_endpoints.py +7 -7
- zenml/zen_server/routers/service_connectors_endpoints.py +11 -13
- zenml/zen_server/routers/service_endpoints.py +7 -9
- zenml/zen_server/routers/stack_components_endpoints.py +9 -11
- zenml/zen_server/routers/stacks_endpoints.py +9 -11
- zenml/zen_server/routers/steps_endpoints.py +6 -6
- zenml/zen_server/routers/users_endpoints.py +5 -43
- zenml/zen_server/template_execution/utils.py +4 -4
- zenml/zen_server/utils.py +10 -10
- zenml/zen_server/zen_server_api.py +6 -5
- zenml/zen_stores/base_zen_store.py +38 -42
- zenml/zen_stores/migrations/versions/12eff0206201_rename_workspace_to_project.py +768 -0
- zenml/zen_stores/migrations/versions/41b28cae31ce_make_artifacts_workspace_scoped.py +3 -3
- zenml/zen_stores/migrations/versions/cbc6acd71f92_add_workspace_display_name.py +58 -0
- zenml/zen_stores/rest_zen_store.py +55 -63
- zenml/zen_stores/schemas/__init__.py +2 -2
- zenml/zen_stores/schemas/action_schemas.py +9 -9
- zenml/zen_stores/schemas/artifact_schemas.py +15 -17
- zenml/zen_stores/schemas/code_repository_schemas.py +16 -18
- zenml/zen_stores/schemas/event_source_schemas.py +9 -9
- zenml/zen_stores/schemas/model_schemas.py +15 -17
- zenml/zen_stores/schemas/pipeline_build_schemas.py +7 -7
- zenml/zen_stores/schemas/pipeline_deployment_schemas.py +7 -7
- zenml/zen_stores/schemas/pipeline_run_schemas.py +9 -9
- zenml/zen_stores/schemas/pipeline_schemas.py +9 -9
- zenml/zen_stores/schemas/{workspace_schemas.py → project_schemas.py} +47 -41
- zenml/zen_stores/schemas/run_metadata_schemas.py +5 -5
- zenml/zen_stores/schemas/run_template_schemas.py +9 -9
- zenml/zen_stores/schemas/schedule_schema.py +9 -9
- zenml/zen_stores/schemas/service_schemas.py +7 -7
- zenml/zen_stores/schemas/step_run_schemas.py +7 -7
- zenml/zen_stores/schemas/trigger_schemas.py +9 -9
- zenml/zen_stores/schemas/user_schemas.py +0 -12
- zenml/zen_stores/sql_zen_store.py +318 -275
- zenml/zen_stores/zen_store_interface.py +56 -70
- {zenml_nightly-0.75.0.dev20250313.dist-info → zenml_nightly-0.75.0.dev20250315.dist-info}/METADATA +1 -1
- {zenml_nightly-0.75.0.dev20250313.dist-info → zenml_nightly-0.75.0.dev20250315.dist-info}/RECORD +143 -140
- zenml/cli/workspace.py +0 -160
- zenml/models/v2/core/workspace.py +0 -131
- {zenml_nightly-0.75.0.dev20250313.dist-info → zenml_nightly-0.75.0.dev20250315.dist-info}/LICENSE +0 -0
- {zenml_nightly-0.75.0.dev20250313.dist-info → zenml_nightly-0.75.0.dev20250315.dist-info}/WHEEL +0 -0
- {zenml_nightly-0.75.0.dev20250313.dist-info → zenml_nightly-0.75.0.dev20250315.dist-info}/entry_points.txt +0 -0
zenml/client.py
CHANGED
@@ -46,8 +46,8 @@ from zenml.config.global_config import GlobalConfiguration
|
|
46
46
|
from zenml.config.pipeline_run_configuration import PipelineRunConfiguration
|
47
47
|
from zenml.config.source import Source
|
48
48
|
from zenml.constants import (
|
49
|
+
ENV_ZENML_ACTIVE_PROJECT_ID,
|
49
50
|
ENV_ZENML_ACTIVE_STACK_ID,
|
50
|
-
ENV_ZENML_ACTIVE_WORKSPACE_ID,
|
51
51
|
ENV_ZENML_ENABLE_REPO_INIT_WARNINGS,
|
52
52
|
ENV_ZENML_REPOSITORY_PATH,
|
53
53
|
ENV_ZENML_SERVER,
|
@@ -68,6 +68,7 @@ from zenml.enums import (
|
|
68
68
|
SorterOps,
|
69
69
|
StackComponentType,
|
70
70
|
StoreType,
|
71
|
+
TaggableResourceTypes,
|
71
72
|
)
|
72
73
|
from zenml.exceptions import (
|
73
74
|
AuthorizationException,
|
@@ -134,6 +135,10 @@ from zenml.models import (
|
|
134
135
|
PipelineResponse,
|
135
136
|
PipelineRunFilter,
|
136
137
|
PipelineRunResponse,
|
138
|
+
ProjectFilter,
|
139
|
+
ProjectRequest,
|
140
|
+
ProjectResponse,
|
141
|
+
ProjectUpdate,
|
137
142
|
RunMetadataRequest,
|
138
143
|
RunMetadataResource,
|
139
144
|
RunTemplateFilter,
|
@@ -184,10 +189,6 @@ from zenml.models import (
|
|
184
189
|
UserRequest,
|
185
190
|
UserResponse,
|
186
191
|
UserUpdate,
|
187
|
-
WorkspaceFilter,
|
188
|
-
WorkspaceRequest,
|
189
|
-
WorkspaceResponse,
|
190
|
-
WorkspaceUpdate,
|
191
192
|
)
|
192
193
|
from zenml.models.v2.core.step_run import StepRunUpdate
|
193
194
|
from zenml.services.service import ServiceConfig
|
@@ -214,38 +215,38 @@ F = TypeVar("F", bound=Callable[..., Any])
|
|
214
215
|
class ClientConfiguration(FileSyncModel):
|
215
216
|
"""Pydantic object used for serializing client configuration options."""
|
216
217
|
|
217
|
-
|
218
|
-
|
218
|
+
_active_project: Optional["ProjectResponse"] = None
|
219
|
+
active_project_id: Optional[UUID] = None
|
219
220
|
active_stack_id: Optional[UUID] = None
|
220
221
|
_active_stack: Optional["StackResponse"] = None
|
221
222
|
|
222
223
|
@property
|
223
|
-
def
|
224
|
-
"""Get the active
|
224
|
+
def active_project(self) -> "ProjectResponse":
|
225
|
+
"""Get the active project for the local client.
|
225
226
|
|
226
227
|
Returns:
|
227
|
-
The active
|
228
|
+
The active project.
|
228
229
|
|
229
230
|
Raises:
|
230
|
-
RuntimeError: If no active
|
231
|
+
RuntimeError: If no active project is set.
|
231
232
|
"""
|
232
|
-
if self.
|
233
|
-
return self.
|
233
|
+
if self._active_project:
|
234
|
+
return self._active_project
|
234
235
|
else:
|
235
236
|
raise RuntimeError(
|
236
|
-
"No active
|
237
|
-
"`zenml
|
238
|
-
"
|
237
|
+
"No active project is configured. Run "
|
238
|
+
"`zenml project set PROJECT_NAME` to set the active "
|
239
|
+
"project."
|
239
240
|
)
|
240
241
|
|
241
|
-
def
|
242
|
-
"""Set the
|
242
|
+
def set_active_project(self, project: "ProjectResponse") -> None:
|
243
|
+
"""Set the project for the local client.
|
243
244
|
|
244
245
|
Args:
|
245
|
-
|
246
|
+
project: The project to set active.
|
246
247
|
"""
|
247
|
-
self.
|
248
|
-
self.
|
248
|
+
self._active_project = project
|
249
|
+
self.active_project_id = project.id
|
249
250
|
|
250
251
|
def set_active_stack(self, stack: "StackResponse") -> None:
|
251
252
|
"""Set the stack for the local client.
|
@@ -346,7 +347,7 @@ class Client(metaclass=ClientMetaClass):
|
|
346
347
|
"""
|
347
348
|
|
348
349
|
_active_user: Optional["UserResponse"] = None
|
349
|
-
|
350
|
+
_active_project: Optional["ProjectResponse"] = None
|
350
351
|
_active_stack: Optional["StackResponse"] = None
|
351
352
|
|
352
353
|
def __init__(
|
@@ -412,7 +413,7 @@ class Client(metaclass=ClientMetaClass):
|
|
412
413
|
If a client configuration is found at the given path or the
|
413
414
|
path, it is loaded and used to initialize the client.
|
414
415
|
If no client configuration is found, the global configuration is
|
415
|
-
used instead to manage the active stack,
|
416
|
+
used instead to manage the active stack, project etc.
|
416
417
|
|
417
418
|
Args:
|
418
419
|
root: The path to set as the active repository root. If not set,
|
@@ -456,19 +457,19 @@ class Client(metaclass=ClientMetaClass):
|
|
456
457
|
|
457
458
|
This method is called to ensure that the client configuration
|
458
459
|
doesn't contain outdated information, such as an active stack or
|
459
|
-
|
460
|
+
project that no longer exists.
|
460
461
|
"""
|
461
462
|
if not self._config:
|
462
463
|
return
|
463
464
|
|
464
|
-
|
465
|
-
self._config.
|
465
|
+
active_project, active_stack = self.zen_store.validate_active_config(
|
466
|
+
self._config.active_project_id,
|
466
467
|
self._config.active_stack_id,
|
467
468
|
config_name="repo",
|
468
469
|
)
|
469
470
|
self._config.set_active_stack(active_stack)
|
470
|
-
if
|
471
|
-
self._config.
|
471
|
+
if active_project:
|
472
|
+
self._config.set_active_project(active_project)
|
472
473
|
|
473
474
|
def _load_config(self) -> Optional[ClientConfiguration]:
|
474
475
|
"""Loads the client configuration from disk.
|
@@ -678,30 +679,30 @@ class Client(metaclass=ClientMetaClass):
|
|
678
679
|
"""
|
679
680
|
self._set_active_root(root)
|
680
681
|
|
681
|
-
def
|
682
|
-
self,
|
683
|
-
) -> "
|
684
|
-
"""Set the
|
682
|
+
def set_active_project(
|
683
|
+
self, project_name_or_id: Union[str, UUID]
|
684
|
+
) -> "ProjectResponse":
|
685
|
+
"""Set the project for the local client.
|
685
686
|
|
686
687
|
Args:
|
687
|
-
|
688
|
+
project_name_or_id: The name or ID of the project to set active.
|
688
689
|
|
689
690
|
Returns:
|
690
|
-
The model of the active
|
691
|
+
The model of the active project.
|
691
692
|
"""
|
692
|
-
|
693
|
-
|
693
|
+
project = self.zen_store.get_project(
|
694
|
+
project_name_or_id=project_name_or_id
|
694
695
|
) # raises KeyError
|
695
696
|
if self._config:
|
696
|
-
self._config.
|
697
|
+
self._config.set_active_project(project)
|
697
698
|
# Sanitize the client configuration to reflect the current
|
698
699
|
# settings
|
699
700
|
self._sanitize_config()
|
700
701
|
else:
|
701
|
-
# set the active
|
702
|
+
# set the active project globally only if the client doesn't use
|
702
703
|
# a local configuration
|
703
|
-
GlobalConfiguration().
|
704
|
-
return
|
704
|
+
GlobalConfiguration().set_active_project(project)
|
705
|
+
return project
|
705
706
|
|
706
707
|
# ----------------------------- Server Settings ----------------------------
|
707
708
|
|
@@ -967,52 +968,60 @@ class Client(metaclass=ClientMetaClass):
|
|
967
968
|
self._active_user = self.zen_store.get_user(include_private=True)
|
968
969
|
return self._active_user
|
969
970
|
|
970
|
-
# --------------------------------
|
971
|
+
# -------------------------------- Projects ------------------------------
|
971
972
|
|
972
|
-
def
|
973
|
-
self,
|
974
|
-
|
975
|
-
|
973
|
+
def create_project(
|
974
|
+
self,
|
975
|
+
name: str,
|
976
|
+
description: str,
|
977
|
+
display_name: Optional[str] = None,
|
978
|
+
) -> ProjectResponse:
|
979
|
+
"""Create a new project.
|
976
980
|
|
977
981
|
Args:
|
978
|
-
name: Name of the
|
979
|
-
description: Description of the
|
982
|
+
name: Name of the project.
|
983
|
+
description: Description of the project.
|
984
|
+
display_name: Display name of the project.
|
980
985
|
|
981
986
|
Returns:
|
982
|
-
The created
|
987
|
+
The created project.
|
983
988
|
"""
|
984
|
-
return self.zen_store.
|
985
|
-
|
989
|
+
return self.zen_store.create_project(
|
990
|
+
ProjectRequest(
|
991
|
+
name=name,
|
992
|
+
description=description,
|
993
|
+
display_name=display_name or "",
|
994
|
+
)
|
986
995
|
)
|
987
996
|
|
988
|
-
def
|
997
|
+
def get_project(
|
989
998
|
self,
|
990
999
|
name_id_or_prefix: Optional[Union[UUID, str]],
|
991
1000
|
allow_name_prefix_match: bool = True,
|
992
1001
|
hydrate: bool = True,
|
993
|
-
) ->
|
994
|
-
"""Gets a
|
1002
|
+
) -> ProjectResponse:
|
1003
|
+
"""Gets a project.
|
995
1004
|
|
996
1005
|
Args:
|
997
|
-
name_id_or_prefix: The name or ID of the
|
1006
|
+
name_id_or_prefix: The name or ID of the project.
|
998
1007
|
allow_name_prefix_match: If True, allow matching by name prefix.
|
999
1008
|
hydrate: Flag deciding whether to hydrate the output model(s)
|
1000
1009
|
by including metadata fields in the response.
|
1001
1010
|
|
1002
1011
|
Returns:
|
1003
|
-
The
|
1012
|
+
The project
|
1004
1013
|
"""
|
1005
1014
|
if not name_id_or_prefix:
|
1006
|
-
return self.
|
1015
|
+
return self.active_project
|
1007
1016
|
return self._get_entity_by_id_or_name_or_prefix(
|
1008
|
-
get_method=self.zen_store.
|
1009
|
-
list_method=self.
|
1017
|
+
get_method=self.zen_store.get_project,
|
1018
|
+
list_method=self.list_projects,
|
1010
1019
|
name_id_or_prefix=name_id_or_prefix,
|
1011
1020
|
allow_name_prefix_match=allow_name_prefix_match,
|
1012
1021
|
hydrate=hydrate,
|
1013
1022
|
)
|
1014
1023
|
|
1015
|
-
def
|
1024
|
+
def list_projects(
|
1016
1025
|
self,
|
1017
1026
|
sort_by: str = "created",
|
1018
1027
|
page: int = PAGINATION_STARTING_PAGE,
|
@@ -1022,27 +1031,29 @@ class Client(metaclass=ClientMetaClass):
|
|
1022
1031
|
created: Optional[Union[datetime, str]] = None,
|
1023
1032
|
updated: Optional[Union[datetime, str]] = None,
|
1024
1033
|
name: Optional[str] = None,
|
1034
|
+
display_name: Optional[str] = None,
|
1025
1035
|
hydrate: bool = False,
|
1026
|
-
) -> Page[
|
1027
|
-
"""List all
|
1036
|
+
) -> Page[ProjectResponse]:
|
1037
|
+
"""List all projects.
|
1028
1038
|
|
1029
1039
|
Args:
|
1030
1040
|
sort_by: The column to sort by
|
1031
1041
|
page: The page of items
|
1032
1042
|
size: The maximum size of all pages
|
1033
1043
|
logical_operator: Which logical operator to use [and, or]
|
1034
|
-
id: Use the
|
1044
|
+
id: Use the project ID to filter by.
|
1035
1045
|
created: Use to filter by time of creation
|
1036
1046
|
updated: Use the last updated date for filtering
|
1037
|
-
name: Use the
|
1047
|
+
name: Use the project name for filtering
|
1048
|
+
display_name: Use the project display name for filtering
|
1038
1049
|
hydrate: Flag deciding whether to hydrate the output model(s)
|
1039
1050
|
by including metadata fields in the response.
|
1040
1051
|
|
1041
1052
|
Returns:
|
1042
|
-
Page of
|
1053
|
+
Page of projects
|
1043
1054
|
"""
|
1044
|
-
return self.zen_store.
|
1045
|
-
|
1055
|
+
return self.zen_store.list_projects(
|
1056
|
+
ProjectFilter(
|
1046
1057
|
sort_by=sort_by,
|
1047
1058
|
page=page,
|
1048
1059
|
size=size,
|
@@ -1051,107 +1062,113 @@ class Client(metaclass=ClientMetaClass):
|
|
1051
1062
|
created=created,
|
1052
1063
|
updated=updated,
|
1053
1064
|
name=name,
|
1065
|
+
display_name=display_name,
|
1054
1066
|
),
|
1055
1067
|
hydrate=hydrate,
|
1056
1068
|
)
|
1057
1069
|
|
1058
|
-
def
|
1070
|
+
def update_project(
|
1059
1071
|
self,
|
1060
1072
|
name_id_or_prefix: Optional[Union[UUID, str]],
|
1061
1073
|
new_name: Optional[str] = None,
|
1074
|
+
new_display_name: Optional[str] = None,
|
1062
1075
|
new_description: Optional[str] = None,
|
1063
|
-
) ->
|
1064
|
-
"""Update a
|
1076
|
+
) -> ProjectResponse:
|
1077
|
+
"""Update a project.
|
1065
1078
|
|
1066
1079
|
Args:
|
1067
|
-
name_id_or_prefix: Name, ID or prefix of the
|
1068
|
-
new_name: New name of the
|
1069
|
-
|
1080
|
+
name_id_or_prefix: Name, ID or prefix of the project to update.
|
1081
|
+
new_name: New name of the project.
|
1082
|
+
new_display_name: New display name of the project.
|
1083
|
+
new_description: New description of the project.
|
1070
1084
|
|
1071
1085
|
Returns:
|
1072
|
-
The updated
|
1086
|
+
The updated project.
|
1073
1087
|
"""
|
1074
|
-
|
1088
|
+
project = self.get_project(
|
1075
1089
|
name_id_or_prefix=name_id_or_prefix, allow_name_prefix_match=False
|
1076
1090
|
)
|
1077
|
-
|
1091
|
+
project_update = ProjectUpdate(
|
1092
|
+
name=new_name or project.name,
|
1093
|
+
display_name=new_display_name or project.display_name,
|
1094
|
+
)
|
1078
1095
|
if new_description:
|
1079
|
-
|
1080
|
-
return self.zen_store.
|
1081
|
-
|
1082
|
-
|
1096
|
+
project_update.description = new_description
|
1097
|
+
return self.zen_store.update_project(
|
1098
|
+
project_id=project.id,
|
1099
|
+
project_update=project_update,
|
1083
1100
|
)
|
1084
1101
|
|
1085
|
-
def
|
1086
|
-
"""Delete a
|
1102
|
+
def delete_project(self, name_id_or_prefix: str) -> None:
|
1103
|
+
"""Delete a project.
|
1087
1104
|
|
1088
1105
|
Args:
|
1089
|
-
name_id_or_prefix: The name or ID of the
|
1106
|
+
name_id_or_prefix: The name or ID of the project to delete.
|
1090
1107
|
|
1091
1108
|
Raises:
|
1092
|
-
IllegalOperationError: If the
|
1093
|
-
|
1109
|
+
IllegalOperationError: If the project to delete is the active
|
1110
|
+
project.
|
1094
1111
|
"""
|
1095
|
-
|
1112
|
+
project = self.get_project(
|
1096
1113
|
name_id_or_prefix, allow_name_prefix_match=False
|
1097
1114
|
)
|
1098
|
-
if self.
|
1115
|
+
if self.active_project.id == project.id:
|
1099
1116
|
raise IllegalOperationError(
|
1100
|
-
f"
|
1101
|
-
"it is currently active. Please set another
|
1117
|
+
f"Project '{name_id_or_prefix}' cannot be deleted since "
|
1118
|
+
"it is currently active. Please set another project as "
|
1102
1119
|
"active first."
|
1103
1120
|
)
|
1104
|
-
self.zen_store.
|
1121
|
+
self.zen_store.delete_project(project_name_or_id=project.id)
|
1105
1122
|
|
1106
1123
|
@property
|
1107
|
-
def
|
1108
|
-
"""Get the currently active
|
1124
|
+
def active_project(self) -> ProjectResponse:
|
1125
|
+
"""Get the currently active project of the local client.
|
1109
1126
|
|
1110
|
-
If no active
|
1111
|
-
active
|
1127
|
+
If no active project is configured locally for the client, the
|
1128
|
+
active project in the global configuration is used instead.
|
1112
1129
|
|
1113
1130
|
Returns:
|
1114
|
-
The active
|
1131
|
+
The active project.
|
1115
1132
|
|
1116
1133
|
Raises:
|
1117
|
-
RuntimeError: If the active
|
1134
|
+
RuntimeError: If the active project is not set.
|
1118
1135
|
"""
|
1119
|
-
if
|
1120
|
-
if not self.
|
1121
|
-
|
1136
|
+
if project_id := os.environ.get(ENV_ZENML_ACTIVE_PROJECT_ID):
|
1137
|
+
if not self._active_project or self._active_project.id != UUID(
|
1138
|
+
project_id
|
1122
1139
|
):
|
1123
|
-
self.
|
1140
|
+
self._active_project = self.get_project(project_id)
|
1124
1141
|
|
1125
|
-
return self.
|
1142
|
+
return self._active_project
|
1126
1143
|
|
1127
|
-
from zenml.constants import
|
1144
|
+
from zenml.constants import DEFAULT_PROJECT_NAME
|
1128
1145
|
|
1129
|
-
# If running in a ZenML server environment, the active
|
1146
|
+
# If running in a ZenML server environment, the active project is
|
1130
1147
|
# not relevant
|
1131
1148
|
if ENV_ZENML_SERVER in os.environ:
|
1132
|
-
return self.
|
1149
|
+
return self.get_project(DEFAULT_PROJECT_NAME)
|
1133
1150
|
|
1134
|
-
|
1135
|
-
self._config.
|
1136
|
-
) or GlobalConfiguration().
|
1137
|
-
if not
|
1151
|
+
project = (
|
1152
|
+
self._config.active_project if self._config else None
|
1153
|
+
) or GlobalConfiguration().get_active_project()
|
1154
|
+
if not project:
|
1138
1155
|
raise RuntimeError(
|
1139
|
-
"No active
|
1140
|
-
"`zenml
|
1141
|
-
"
|
1156
|
+
"No active project is configured. Run "
|
1157
|
+
"`zenml project set PROJECT_NAME` to set the active "
|
1158
|
+
"project."
|
1142
1159
|
)
|
1143
1160
|
|
1144
|
-
if
|
1161
|
+
if project.name != DEFAULT_PROJECT_NAME:
|
1145
1162
|
if not self.zen_store.get_store_info().is_pro_server():
|
1146
1163
|
logger.warning(
|
1147
|
-
f"You are running with a non-default
|
1148
|
-
f"'{
|
1164
|
+
f"You are running with a non-default project "
|
1165
|
+
f"'{project.name}'. The ZenML project feature is "
|
1149
1166
|
"available only in ZenML Pro. Pipelines, pipeline runs and "
|
1150
|
-
"artifacts produced in this
|
1167
|
+
"artifacts produced in this project will not be "
|
1151
1168
|
"accessible through the dashboard. Please visit "
|
1152
1169
|
"https://zenml.io/pro to learn more."
|
1153
1170
|
)
|
1154
|
-
return
|
1171
|
+
return project
|
1155
1172
|
|
1156
1173
|
# --------------------------------- Stacks ---------------------------------
|
1157
1174
|
|
@@ -1191,7 +1208,7 @@ class Client(metaclass=ClientMetaClass):
|
|
1191
1208
|
name=name,
|
1192
1209
|
components=stack_components,
|
1193
1210
|
stack_spec_path=stack_spec_file,
|
1194
|
-
|
1211
|
+
project=self.active_project.id,
|
1195
1212
|
labels=labels,
|
1196
1213
|
)
|
1197
1214
|
|
@@ -1317,7 +1334,7 @@ class Client(metaclass=ClientMetaClass):
|
|
1317
1334
|
|
1318
1335
|
# Create the update model
|
1319
1336
|
update_model = StackUpdate(
|
1320
|
-
|
1337
|
+
project=self.active_project.id,
|
1321
1338
|
stack_spec_path=stack_spec_file,
|
1322
1339
|
)
|
1323
1340
|
|
@@ -1627,7 +1644,7 @@ class Client(metaclass=ClientMetaClass):
|
|
1627
1644
|
name=config.service_name,
|
1628
1645
|
service_type=service_type,
|
1629
1646
|
config=config.model_dump(),
|
1630
|
-
|
1647
|
+
project=self.active_project.id,
|
1631
1648
|
model_version_id=model_version_id,
|
1632
1649
|
)
|
1633
1650
|
# Register the service
|
@@ -1639,7 +1656,7 @@ class Client(metaclass=ClientMetaClass):
|
|
1639
1656
|
allow_name_prefix_match: bool = True,
|
1640
1657
|
hydrate: bool = True,
|
1641
1658
|
type: Optional[str] = None,
|
1642
|
-
|
1659
|
+
project: Optional[Union[str, UUID]] = None,
|
1643
1660
|
) -> ServiceResponse:
|
1644
1661
|
"""Gets a service.
|
1645
1662
|
|
@@ -1649,7 +1666,7 @@ class Client(metaclass=ClientMetaClass):
|
|
1649
1666
|
hydrate: Flag deciding whether to hydrate the output model(s)
|
1650
1667
|
by including metadata fields in the response.
|
1651
1668
|
type: The type of the service.
|
1652
|
-
|
1669
|
+
project: The project name/ID to filter by.
|
1653
1670
|
|
1654
1671
|
Returns:
|
1655
1672
|
The Service
|
@@ -1682,7 +1699,7 @@ class Client(metaclass=ClientMetaClass):
|
|
1682
1699
|
list_method=type_scoped_list_method,
|
1683
1700
|
name_id_or_prefix=name_id_or_prefix,
|
1684
1701
|
allow_name_prefix_match=allow_name_prefix_match,
|
1685
|
-
|
1702
|
+
project=project,
|
1686
1703
|
hydrate=hydrate,
|
1687
1704
|
)
|
1688
1705
|
|
@@ -1698,7 +1715,7 @@ class Client(metaclass=ClientMetaClass):
|
|
1698
1715
|
type: Optional[str] = None,
|
1699
1716
|
flavor: Optional[str] = None,
|
1700
1717
|
user: Optional[Union[UUID, str]] = None,
|
1701
|
-
|
1718
|
+
project: Optional[Union[str, UUID]] = None,
|
1702
1719
|
hydrate: bool = False,
|
1703
1720
|
running: Optional[bool] = None,
|
1704
1721
|
service_name: Optional[str] = None,
|
@@ -1720,7 +1737,7 @@ class Client(metaclass=ClientMetaClass):
|
|
1720
1737
|
updated: Use the last updated date for filtering
|
1721
1738
|
type: Use the service type for filtering
|
1722
1739
|
flavor: Use the service flavor for filtering
|
1723
|
-
|
1740
|
+
project: The project name/ID to filter by.
|
1724
1741
|
user: Filter by user name/ID.
|
1725
1742
|
hydrate: Flag deciding whether to hydrate the output model(s)
|
1726
1743
|
by including metadata fields in the response.
|
@@ -1746,7 +1763,7 @@ class Client(metaclass=ClientMetaClass):
|
|
1746
1763
|
updated=updated,
|
1747
1764
|
type=type,
|
1748
1765
|
flavor=flavor,
|
1749
|
-
|
1766
|
+
project=project or self.active_project.id,
|
1750
1767
|
user=user,
|
1751
1768
|
running=running,
|
1752
1769
|
name=service_name,
|
@@ -1816,18 +1833,18 @@ class Client(metaclass=ClientMetaClass):
|
|
1816
1833
|
def delete_service(
|
1817
1834
|
self,
|
1818
1835
|
name_id_or_prefix: UUID,
|
1819
|
-
|
1836
|
+
project: Optional[Union[str, UUID]] = None,
|
1820
1837
|
) -> None:
|
1821
1838
|
"""Delete a service.
|
1822
1839
|
|
1823
1840
|
Args:
|
1824
1841
|
name_id_or_prefix: The name or ID of the service to delete.
|
1825
|
-
|
1842
|
+
project: The project name/ID to filter by.
|
1826
1843
|
"""
|
1827
1844
|
service = self.get_service(
|
1828
1845
|
name_id_or_prefix,
|
1829
1846
|
allow_name_prefix_match=False,
|
1830
|
-
|
1847
|
+
project=project,
|
1831
1848
|
)
|
1832
1849
|
self.zen_store.delete_service(service_id=service.id)
|
1833
1850
|
|
@@ -2005,7 +2022,7 @@ class Client(metaclass=ClientMetaClass):
|
|
2005
2022
|
type=component_type,
|
2006
2023
|
flavor=flavor,
|
2007
2024
|
configuration=configuration,
|
2008
|
-
|
2025
|
+
project=self.active_project.id,
|
2009
2026
|
labels=labels,
|
2010
2027
|
)
|
2011
2028
|
|
@@ -2054,7 +2071,7 @@ class Client(metaclass=ClientMetaClass):
|
|
2054
2071
|
)
|
2055
2072
|
|
2056
2073
|
update_model = ComponentUpdate(
|
2057
|
-
|
2074
|
+
project=self.active_project.id,
|
2058
2075
|
)
|
2059
2076
|
|
2060
2077
|
if name is not None:
|
@@ -2347,7 +2364,7 @@ class Client(metaclass=ClientMetaClass):
|
|
2347
2364
|
updated: Optional[Union[datetime, str]] = None,
|
2348
2365
|
name: Optional[str] = None,
|
2349
2366
|
latest_run_status: Optional[str] = None,
|
2350
|
-
|
2367
|
+
project: Optional[Union[str, UUID]] = None,
|
2351
2368
|
user: Optional[Union[UUID, str]] = None,
|
2352
2369
|
tag: Optional[str] = None,
|
2353
2370
|
tags: Optional[List[str]] = None,
|
@@ -2366,7 +2383,7 @@ class Client(metaclass=ClientMetaClass):
|
|
2366
2383
|
name: The name of the pipeline to filter by.
|
2367
2384
|
latest_run_status: Filter by the status of the latest run of a
|
2368
2385
|
pipeline.
|
2369
|
-
|
2386
|
+
project: The project name/ID to filter by.
|
2370
2387
|
user: The name/ID of the user to filter by.
|
2371
2388
|
tag: Tag to filter by.
|
2372
2389
|
tags: Tags to filter by.
|
@@ -2386,7 +2403,7 @@ class Client(metaclass=ClientMetaClass):
|
|
2386
2403
|
updated=updated,
|
2387
2404
|
name=name,
|
2388
2405
|
latest_run_status=latest_run_status,
|
2389
|
-
|
2406
|
+
project=project or self.active_project.id,
|
2390
2407
|
user=user,
|
2391
2408
|
tag=tag,
|
2392
2409
|
tags=tags,
|
@@ -2399,14 +2416,14 @@ class Client(metaclass=ClientMetaClass):
|
|
2399
2416
|
def get_pipeline(
|
2400
2417
|
self,
|
2401
2418
|
name_id_or_prefix: Union[str, UUID],
|
2402
|
-
|
2419
|
+
project: Optional[Union[str, UUID]] = None,
|
2403
2420
|
hydrate: bool = True,
|
2404
2421
|
) -> PipelineResponse:
|
2405
2422
|
"""Get a pipeline by name, id or prefix.
|
2406
2423
|
|
2407
2424
|
Args:
|
2408
2425
|
name_id_or_prefix: The name, ID or ID prefix of the pipeline.
|
2409
|
-
|
2426
|
+
project: The project name/ID to filter by.
|
2410
2427
|
hydrate: Flag deciding whether to hydrate the output model(s)
|
2411
2428
|
by including metadata fields in the response.
|
2412
2429
|
|
@@ -2417,23 +2434,23 @@ class Client(metaclass=ClientMetaClass):
|
|
2417
2434
|
get_method=self.zen_store.get_pipeline,
|
2418
2435
|
list_method=self.list_pipelines,
|
2419
2436
|
name_id_or_prefix=name_id_or_prefix,
|
2420
|
-
|
2437
|
+
project=project,
|
2421
2438
|
hydrate=hydrate,
|
2422
2439
|
)
|
2423
2440
|
|
2424
2441
|
def delete_pipeline(
|
2425
2442
|
self,
|
2426
2443
|
name_id_or_prefix: Union[str, UUID],
|
2427
|
-
|
2444
|
+
project: Optional[Union[str, UUID]] = None,
|
2428
2445
|
) -> None:
|
2429
2446
|
"""Delete a pipeline.
|
2430
2447
|
|
2431
2448
|
Args:
|
2432
2449
|
name_id_or_prefix: The name, ID or ID prefix of the pipeline.
|
2433
|
-
|
2450
|
+
project: The project name/ID to filter by.
|
2434
2451
|
"""
|
2435
2452
|
pipeline = self.get_pipeline(
|
2436
|
-
name_id_or_prefix=name_id_or_prefix,
|
2453
|
+
name_id_or_prefix=name_id_or_prefix, project=project
|
2437
2454
|
)
|
2438
2455
|
self.zen_store.delete_pipeline(pipeline_id=pipeline.id)
|
2439
2456
|
|
@@ -2448,7 +2465,7 @@ class Client(metaclass=ClientMetaClass):
|
|
2448
2465
|
template_id: Optional[UUID] = None,
|
2449
2466
|
stack_name_or_id: Union[str, UUID, None] = None,
|
2450
2467
|
synchronous: bool = False,
|
2451
|
-
|
2468
|
+
project: Optional[Union[str, UUID]] = None,
|
2452
2469
|
) -> PipelineRunResponse:
|
2453
2470
|
"""Trigger a pipeline from the server.
|
2454
2471
|
|
@@ -2488,7 +2505,7 @@ class Client(metaclass=ClientMetaClass):
|
|
2488
2505
|
runnable template on any stack.
|
2489
2506
|
synchronous: If `True`, this method will wait until the triggered
|
2490
2507
|
run is finished.
|
2491
|
-
|
2508
|
+
project: The project name/ID to filter by.
|
2492
2509
|
|
2493
2510
|
Raises:
|
2494
2511
|
RuntimeError: If triggering the pipeline failed.
|
@@ -2552,7 +2569,7 @@ class Client(metaclass=ClientMetaClass):
|
|
2552
2569
|
self.list_run_templates,
|
2553
2570
|
pipeline_id=pipeline.id,
|
2554
2571
|
stack_id=stack.id if stack else None,
|
2555
|
-
|
2572
|
+
project=project or pipeline.project.id,
|
2556
2573
|
)
|
2557
2574
|
|
2558
2575
|
for template in templates:
|
@@ -2591,14 +2608,14 @@ class Client(metaclass=ClientMetaClass):
|
|
2591
2608
|
def get_build(
|
2592
2609
|
self,
|
2593
2610
|
id_or_prefix: Union[str, UUID],
|
2594
|
-
|
2611
|
+
project: Optional[Union[str, UUID]] = None,
|
2595
2612
|
hydrate: bool = True,
|
2596
2613
|
) -> PipelineBuildResponse:
|
2597
2614
|
"""Get a build by id or prefix.
|
2598
2615
|
|
2599
2616
|
Args:
|
2600
2617
|
id_or_prefix: The id or id prefix of the build.
|
2601
|
-
|
2618
|
+
project: The project name/ID to filter by.
|
2602
2619
|
hydrate: Flag deciding whether to hydrate the output model(s)
|
2603
2620
|
by including metadata fields in the response.
|
2604
2621
|
|
@@ -2627,9 +2644,9 @@ class Client(metaclass=ClientMetaClass):
|
|
2627
2644
|
hydrate=hydrate,
|
2628
2645
|
)
|
2629
2646
|
scope = ""
|
2630
|
-
if
|
2631
|
-
list_kwargs["
|
2632
|
-
scope = f" in
|
2647
|
+
if project:
|
2648
|
+
list_kwargs["project"] = project
|
2649
|
+
scope = f" in project {project}"
|
2633
2650
|
|
2634
2651
|
entity = self.list_builds(**list_kwargs)
|
2635
2652
|
|
@@ -2662,7 +2679,7 @@ class Client(metaclass=ClientMetaClass):
|
|
2662
2679
|
id: Optional[Union[UUID, str]] = None,
|
2663
2680
|
created: Optional[Union[datetime, str]] = None,
|
2664
2681
|
updated: Optional[Union[datetime, str]] = None,
|
2665
|
-
|
2682
|
+
project: Optional[Union[str, UUID]] = None,
|
2666
2683
|
user: Optional[Union[UUID, str]] = None,
|
2667
2684
|
pipeline_id: Optional[Union[str, UUID]] = None,
|
2668
2685
|
stack_id: Optional[Union[str, UUID]] = None,
|
@@ -2686,7 +2703,7 @@ class Client(metaclass=ClientMetaClass):
|
|
2686
2703
|
id: Use the id of build to filter by.
|
2687
2704
|
created: Use to filter by time of creation
|
2688
2705
|
updated: Use the last updated date for filtering
|
2689
|
-
|
2706
|
+
project: The project name/ID to filter by.
|
2690
2707
|
user: Filter by user name/ID.
|
2691
2708
|
pipeline_id: The id of the pipeline to filter by.
|
2692
2709
|
stack_id: The id of the stack to filter by.
|
@@ -2713,7 +2730,7 @@ class Client(metaclass=ClientMetaClass):
|
|
2713
2730
|
id=id,
|
2714
2731
|
created=created,
|
2715
2732
|
updated=updated,
|
2716
|
-
|
2733
|
+
project=project or self.active_project.id,
|
2717
2734
|
user=user,
|
2718
2735
|
pipeline_id=pipeline_id,
|
2719
2736
|
stack_id=stack_id,
|
@@ -2732,15 +2749,15 @@ class Client(metaclass=ClientMetaClass):
|
|
2732
2749
|
)
|
2733
2750
|
|
2734
2751
|
def delete_build(
|
2735
|
-
self, id_or_prefix: str,
|
2752
|
+
self, id_or_prefix: str, project: Optional[Union[str, UUID]] = None
|
2736
2753
|
) -> None:
|
2737
2754
|
"""Delete a build.
|
2738
2755
|
|
2739
2756
|
Args:
|
2740
2757
|
id_or_prefix: The id or id prefix of the build.
|
2741
|
-
|
2758
|
+
project: The project name/ID to filter by.
|
2742
2759
|
"""
|
2743
|
-
build = self.get_build(id_or_prefix=id_or_prefix,
|
2760
|
+
build = self.get_build(id_or_prefix=id_or_prefix, project=project)
|
2744
2761
|
self.zen_store.delete_build(build_id=build.id)
|
2745
2762
|
|
2746
2763
|
# --------------------------------- Event Sources -------------------------
|
@@ -2773,7 +2790,7 @@ class Client(metaclass=ClientMetaClass):
|
|
2773
2790
|
flavor=flavor,
|
2774
2791
|
plugin_type=PluginType.EVENT_SOURCE,
|
2775
2792
|
plugin_subtype=event_source_subtype,
|
2776
|
-
|
2793
|
+
project=self.active_project.id,
|
2777
2794
|
)
|
2778
2795
|
|
2779
2796
|
return self.zen_store.create_event_source(event_source=event_source)
|
@@ -2783,7 +2800,7 @@ class Client(metaclass=ClientMetaClass):
|
|
2783
2800
|
self,
|
2784
2801
|
name_id_or_prefix: Union[UUID, str],
|
2785
2802
|
allow_name_prefix_match: bool = True,
|
2786
|
-
|
2803
|
+
project: Optional[Union[str, UUID]] = None,
|
2787
2804
|
hydrate: bool = True,
|
2788
2805
|
) -> EventSourceResponse:
|
2789
2806
|
"""Get an event source by name, ID or prefix.
|
@@ -2791,7 +2808,7 @@ class Client(metaclass=ClientMetaClass):
|
|
2791
2808
|
Args:
|
2792
2809
|
name_id_or_prefix: The name, ID or prefix of the stack.
|
2793
2810
|
allow_name_prefix_match: If True, allow matching by name prefix.
|
2794
|
-
|
2811
|
+
project: The project name/ID to filter by.
|
2795
2812
|
hydrate: Flag deciding whether to hydrate the output model(s)
|
2796
2813
|
by including metadata fields in the response.
|
2797
2814
|
|
@@ -2803,7 +2820,7 @@ class Client(metaclass=ClientMetaClass):
|
|
2803
2820
|
list_method=self.list_event_sources,
|
2804
2821
|
name_id_or_prefix=name_id_or_prefix,
|
2805
2822
|
allow_name_prefix_match=allow_name_prefix_match,
|
2806
|
-
|
2823
|
+
project=project,
|
2807
2824
|
hydrate=hydrate,
|
2808
2825
|
)
|
2809
2826
|
|
@@ -2819,7 +2836,7 @@ class Client(metaclass=ClientMetaClass):
|
|
2819
2836
|
name: Optional[str] = None,
|
2820
2837
|
flavor: Optional[str] = None,
|
2821
2838
|
event_source_type: Optional[str] = None,
|
2822
|
-
|
2839
|
+
project: Optional[Union[str, UUID]] = None,
|
2823
2840
|
user: Optional[Union[UUID, str]] = None,
|
2824
2841
|
hydrate: bool = False,
|
2825
2842
|
) -> Page[EventSourceResponse]:
|
@@ -2833,7 +2850,7 @@ class Client(metaclass=ClientMetaClass):
|
|
2833
2850
|
id: Use the id of event_sources to filter by.
|
2834
2851
|
created: Use to filter by time of creation
|
2835
2852
|
updated: Use the last updated date for filtering
|
2836
|
-
|
2853
|
+
project: The project name/ID to filter by.
|
2837
2854
|
user: Filter by user name/ID.
|
2838
2855
|
name: The name of the event_source to filter by.
|
2839
2856
|
flavor: The flavor of the event_source to filter by.
|
@@ -2849,7 +2866,7 @@ class Client(metaclass=ClientMetaClass):
|
|
2849
2866
|
size=size,
|
2850
2867
|
sort_by=sort_by,
|
2851
2868
|
logical_operator=logical_operator,
|
2852
|
-
|
2869
|
+
project=project or self.active_project.id,
|
2853
2870
|
user=user,
|
2854
2871
|
name=name,
|
2855
2872
|
flavor=flavor,
|
@@ -2871,7 +2888,7 @@ class Client(metaclass=ClientMetaClass):
|
|
2871
2888
|
configuration: Optional[Dict[str, Any]] = None,
|
2872
2889
|
rotate_secret: Optional[bool] = None,
|
2873
2890
|
is_active: Optional[bool] = None,
|
2874
|
-
|
2891
|
+
project: Optional[Union[str, UUID]] = None,
|
2875
2892
|
) -> EventSourceResponse:
|
2876
2893
|
"""Updates an event_source.
|
2877
2894
|
|
@@ -2884,7 +2901,7 @@ class Client(metaclass=ClientMetaClass):
|
|
2884
2901
|
contain the new secret value
|
2885
2902
|
is_active: Optional[bool] = Allows for activation/deactivating the
|
2886
2903
|
event source
|
2887
|
-
|
2904
|
+
project: The project name/ID to filter by.
|
2888
2905
|
|
2889
2906
|
Returns:
|
2890
2907
|
The model of the updated event_source.
|
@@ -2896,7 +2913,7 @@ class Client(metaclass=ClientMetaClass):
|
|
2896
2913
|
event_source = self.get_event_source(
|
2897
2914
|
name_id_or_prefix=name_id_or_prefix,
|
2898
2915
|
allow_name_prefix_match=False,
|
2899
|
-
|
2916
|
+
project=project,
|
2900
2917
|
)
|
2901
2918
|
|
2902
2919
|
# Create the update model
|
@@ -2925,19 +2942,19 @@ class Client(metaclass=ClientMetaClass):
|
|
2925
2942
|
def delete_event_source(
|
2926
2943
|
self,
|
2927
2944
|
name_id_or_prefix: Union[str, UUID],
|
2928
|
-
|
2945
|
+
project: Optional[Union[str, UUID]] = None,
|
2929
2946
|
) -> None:
|
2930
2947
|
"""Deletes an event_source.
|
2931
2948
|
|
2932
2949
|
Args:
|
2933
2950
|
name_id_or_prefix: The name, id or prefix id of the event_source
|
2934
2951
|
to deregister.
|
2935
|
-
|
2952
|
+
project: The project name/ID to filter by.
|
2936
2953
|
"""
|
2937
2954
|
event_source = self.get_event_source(
|
2938
2955
|
name_id_or_prefix=name_id_or_prefix,
|
2939
2956
|
allow_name_prefix_match=False,
|
2940
|
-
|
2957
|
+
project=project,
|
2941
2958
|
)
|
2942
2959
|
|
2943
2960
|
self.zen_store.delete_event_source(event_source_id=event_source.id)
|
@@ -2981,7 +2998,7 @@ class Client(metaclass=ClientMetaClass):
|
|
2981
2998
|
configuration=configuration,
|
2982
2999
|
service_account_id=service_account_id,
|
2983
3000
|
auth_window=auth_window,
|
2984
|
-
|
3001
|
+
project=self.active_project.id,
|
2985
3002
|
)
|
2986
3003
|
|
2987
3004
|
return self.zen_store.create_action(action=action)
|
@@ -2991,7 +3008,7 @@ class Client(metaclass=ClientMetaClass):
|
|
2991
3008
|
self,
|
2992
3009
|
name_id_or_prefix: Union[UUID, str],
|
2993
3010
|
allow_name_prefix_match: bool = True,
|
2994
|
-
|
3011
|
+
project: Optional[Union[str, UUID]] = None,
|
2995
3012
|
hydrate: bool = True,
|
2996
3013
|
) -> ActionResponse:
|
2997
3014
|
"""Get an action by name, ID or prefix.
|
@@ -2999,7 +3016,7 @@ class Client(metaclass=ClientMetaClass):
|
|
2999
3016
|
Args:
|
3000
3017
|
name_id_or_prefix: The name, ID or prefix of the action.
|
3001
3018
|
allow_name_prefix_match: If True, allow matching by name prefix.
|
3002
|
-
|
3019
|
+
project: The project name/ID to filter by.
|
3003
3020
|
hydrate: Flag deciding whether to hydrate the output model(s)
|
3004
3021
|
by including metadata fields in the response.
|
3005
3022
|
|
@@ -3011,7 +3028,7 @@ class Client(metaclass=ClientMetaClass):
|
|
3011
3028
|
list_method=self.list_actions,
|
3012
3029
|
name_id_or_prefix=name_id_or_prefix,
|
3013
3030
|
allow_name_prefix_match=allow_name_prefix_match,
|
3014
|
-
|
3031
|
+
project=project,
|
3015
3032
|
hydrate=hydrate,
|
3016
3033
|
)
|
3017
3034
|
|
@@ -3028,7 +3045,7 @@ class Client(metaclass=ClientMetaClass):
|
|
3028
3045
|
name: Optional[str] = None,
|
3029
3046
|
flavor: Optional[str] = None,
|
3030
3047
|
action_type: Optional[str] = None,
|
3031
|
-
|
3048
|
+
project: Optional[Union[str, UUID]] = None,
|
3032
3049
|
user: Optional[Union[UUID, str]] = None,
|
3033
3050
|
hydrate: bool = False,
|
3034
3051
|
) -> Page[ActionResponse]:
|
@@ -3042,7 +3059,7 @@ class Client(metaclass=ClientMetaClass):
|
|
3042
3059
|
id: Use the id of the action to filter by.
|
3043
3060
|
created: Use to filter by time of creation
|
3044
3061
|
updated: Use the last updated date for filtering
|
3045
|
-
|
3062
|
+
project: The project name/ID to filter by.
|
3046
3063
|
user: Filter by user name/ID.
|
3047
3064
|
name: The name of the action to filter by.
|
3048
3065
|
flavor: The flavor of the action to filter by.
|
@@ -3058,7 +3075,7 @@ class Client(metaclass=ClientMetaClass):
|
|
3058
3075
|
size=size,
|
3059
3076
|
sort_by=sort_by,
|
3060
3077
|
logical_operator=logical_operator,
|
3061
|
-
|
3078
|
+
project=project or self.active_project.id,
|
3062
3079
|
user=user,
|
3063
3080
|
name=name,
|
3064
3081
|
id=id,
|
@@ -3078,7 +3095,7 @@ class Client(metaclass=ClientMetaClass):
|
|
3078
3095
|
configuration: Optional[Dict[str, Any]] = None,
|
3079
3096
|
service_account_id: Optional[UUID] = None,
|
3080
3097
|
auth_window: Optional[int] = None,
|
3081
|
-
|
3098
|
+
project: Optional[Union[str, UUID]] = None,
|
3082
3099
|
) -> ActionResponse:
|
3083
3100
|
"""Update an action.
|
3084
3101
|
|
@@ -3092,7 +3109,7 @@ class Client(metaclass=ClientMetaClass):
|
|
3092
3109
|
auth_window: The new time window in minutes for which the service
|
3093
3110
|
account is authorized to execute the action. Set this to 0 to
|
3094
3111
|
authorize the service account indefinitely (not recommended).
|
3095
|
-
|
3112
|
+
project: The project name/ID to filter by.
|
3096
3113
|
|
3097
3114
|
Returns:
|
3098
3115
|
The updated action.
|
@@ -3100,7 +3117,7 @@ class Client(metaclass=ClientMetaClass):
|
|
3100
3117
|
action = self.get_action(
|
3101
3118
|
name_id_or_prefix=name_id_or_prefix,
|
3102
3119
|
allow_name_prefix_match=False,
|
3103
|
-
|
3120
|
+
project=project,
|
3104
3121
|
)
|
3105
3122
|
|
3106
3123
|
update_model = ActionUpdate(
|
@@ -3120,19 +3137,19 @@ class Client(metaclass=ClientMetaClass):
|
|
3120
3137
|
def delete_action(
|
3121
3138
|
self,
|
3122
3139
|
name_id_or_prefix: Union[str, UUID],
|
3123
|
-
|
3140
|
+
project: Optional[Union[str, UUID]] = None,
|
3124
3141
|
) -> None:
|
3125
3142
|
"""Delete an action.
|
3126
3143
|
|
3127
3144
|
Args:
|
3128
3145
|
name_id_or_prefix: The name, id or prefix id of the action
|
3129
3146
|
to delete.
|
3130
|
-
|
3147
|
+
project: The project name/ID to filter by.
|
3131
3148
|
"""
|
3132
3149
|
action = self.get_action(
|
3133
3150
|
name_id_or_prefix=name_id_or_prefix,
|
3134
3151
|
allow_name_prefix_match=False,
|
3135
|
-
|
3152
|
+
project=project,
|
3136
3153
|
)
|
3137
3154
|
|
3138
3155
|
self.zen_store.delete_action(action_id=action.id)
|
@@ -3167,7 +3184,7 @@ class Client(metaclass=ClientMetaClass):
|
|
3167
3184
|
event_source_id=event_source_id,
|
3168
3185
|
event_filter=event_filter,
|
3169
3186
|
action_id=action_id,
|
3170
|
-
|
3187
|
+
project=self.active_project.id,
|
3171
3188
|
)
|
3172
3189
|
|
3173
3190
|
return self.zen_store.create_trigger(trigger=trigger)
|
@@ -3177,7 +3194,7 @@ class Client(metaclass=ClientMetaClass):
|
|
3177
3194
|
self,
|
3178
3195
|
name_id_or_prefix: Union[UUID, str],
|
3179
3196
|
allow_name_prefix_match: bool = True,
|
3180
|
-
|
3197
|
+
project: Optional[Union[str, UUID]] = None,
|
3181
3198
|
hydrate: bool = True,
|
3182
3199
|
) -> TriggerResponse:
|
3183
3200
|
"""Get a trigger by name, ID or prefix.
|
@@ -3185,7 +3202,7 @@ class Client(metaclass=ClientMetaClass):
|
|
3185
3202
|
Args:
|
3186
3203
|
name_id_or_prefix: The name, ID or prefix of the trigger.
|
3187
3204
|
allow_name_prefix_match: If True, allow matching by name prefix.
|
3188
|
-
|
3205
|
+
project: The project name/ID to filter by.
|
3189
3206
|
hydrate: Flag deciding whether to hydrate the output model(s)
|
3190
3207
|
by including metadata fields in the response.
|
3191
3208
|
|
@@ -3197,7 +3214,7 @@ class Client(metaclass=ClientMetaClass):
|
|
3197
3214
|
list_method=self.list_triggers,
|
3198
3215
|
name_id_or_prefix=name_id_or_prefix,
|
3199
3216
|
allow_name_prefix_match=allow_name_prefix_match,
|
3200
|
-
|
3217
|
+
project=project,
|
3201
3218
|
hydrate=hydrate,
|
3202
3219
|
)
|
3203
3220
|
|
@@ -3218,7 +3235,7 @@ class Client(metaclass=ClientMetaClass):
|
|
3218
3235
|
event_source_subtype: Optional[str] = None,
|
3219
3236
|
action_flavor: Optional[str] = None,
|
3220
3237
|
action_subtype: Optional[str] = None,
|
3221
|
-
|
3238
|
+
project: Optional[Union[str, UUID]] = None,
|
3222
3239
|
user: Optional[Union[UUID, str]] = None,
|
3223
3240
|
hydrate: bool = False,
|
3224
3241
|
) -> Page[TriggerResponse]:
|
@@ -3232,7 +3249,7 @@ class Client(metaclass=ClientMetaClass):
|
|
3232
3249
|
id: Use the id of triggers to filter by.
|
3233
3250
|
created: Use to filter by time of creation
|
3234
3251
|
updated: Use the last updated date for filtering
|
3235
|
-
|
3252
|
+
project: The project name/ID to filter by.
|
3236
3253
|
user: Filter by user name/ID.
|
3237
3254
|
name: The name of the trigger to filter by.
|
3238
3255
|
event_source_id: The event source associated with the trigger.
|
@@ -3254,7 +3271,7 @@ class Client(metaclass=ClientMetaClass):
|
|
3254
3271
|
size=size,
|
3255
3272
|
sort_by=sort_by,
|
3256
3273
|
logical_operator=logical_operator,
|
3257
|
-
|
3274
|
+
project=project or self.active_project.id,
|
3258
3275
|
user=user,
|
3259
3276
|
name=name,
|
3260
3277
|
event_source_id=event_source_id,
|
@@ -3279,7 +3296,7 @@ class Client(metaclass=ClientMetaClass):
|
|
3279
3296
|
description: Optional[str] = None,
|
3280
3297
|
event_filter: Optional[Dict[str, Any]] = None,
|
3281
3298
|
is_active: Optional[bool] = None,
|
3282
|
-
|
3299
|
+
project: Optional[Union[str, UUID]] = None,
|
3283
3300
|
) -> TriggerResponse:
|
3284
3301
|
"""Updates a trigger.
|
3285
3302
|
|
@@ -3289,7 +3306,7 @@ class Client(metaclass=ClientMetaClass):
|
|
3289
3306
|
description: the new description of the trigger.
|
3290
3307
|
event_filter: The event filter configuration.
|
3291
3308
|
is_active: Whether the trigger is active or not.
|
3292
|
-
|
3309
|
+
project: The project name/ID to filter by.
|
3293
3310
|
|
3294
3311
|
Returns:
|
3295
3312
|
The model of the updated trigger.
|
@@ -3301,7 +3318,7 @@ class Client(metaclass=ClientMetaClass):
|
|
3301
3318
|
trigger = self.get_trigger(
|
3302
3319
|
name_id_or_prefix=name_id_or_prefix,
|
3303
3320
|
allow_name_prefix_match=False,
|
3304
|
-
|
3321
|
+
project=project,
|
3305
3322
|
)
|
3306
3323
|
|
3307
3324
|
# Create the update model
|
@@ -3329,19 +3346,19 @@ class Client(metaclass=ClientMetaClass):
|
|
3329
3346
|
def delete_trigger(
|
3330
3347
|
self,
|
3331
3348
|
name_id_or_prefix: Union[str, UUID],
|
3332
|
-
|
3349
|
+
project: Optional[Union[str, UUID]] = None,
|
3333
3350
|
) -> None:
|
3334
3351
|
"""Deletes an trigger.
|
3335
3352
|
|
3336
3353
|
Args:
|
3337
3354
|
name_id_or_prefix: The name, id or prefix id of the trigger
|
3338
3355
|
to deregister.
|
3339
|
-
|
3356
|
+
project: The project name/ID to filter by.
|
3340
3357
|
"""
|
3341
3358
|
trigger = self.get_trigger(
|
3342
3359
|
name_id_or_prefix=name_id_or_prefix,
|
3343
3360
|
allow_name_prefix_match=False,
|
3344
|
-
|
3361
|
+
project=project,
|
3345
3362
|
)
|
3346
3363
|
|
3347
3364
|
self.zen_store.delete_trigger(trigger_id=trigger.id)
|
@@ -3352,14 +3369,14 @@ class Client(metaclass=ClientMetaClass):
|
|
3352
3369
|
def get_deployment(
|
3353
3370
|
self,
|
3354
3371
|
id_or_prefix: Union[str, UUID],
|
3355
|
-
|
3372
|
+
project: Optional[Union[str, UUID]] = None,
|
3356
3373
|
hydrate: bool = True,
|
3357
3374
|
) -> PipelineDeploymentResponse:
|
3358
3375
|
"""Get a deployment by id or prefix.
|
3359
3376
|
|
3360
3377
|
Args:
|
3361
3378
|
id_or_prefix: The id or id prefix of the deployment.
|
3362
|
-
|
3379
|
+
project: The project name/ID to filter by.
|
3363
3380
|
hydrate: Flag deciding whether to hydrate the output model(s)
|
3364
3381
|
by including metadata fields in the response.
|
3365
3382
|
|
@@ -3387,9 +3404,9 @@ class Client(metaclass=ClientMetaClass):
|
|
3387
3404
|
hydrate=hydrate,
|
3388
3405
|
)
|
3389
3406
|
scope = ""
|
3390
|
-
if
|
3391
|
-
list_kwargs["
|
3392
|
-
scope = f" in
|
3407
|
+
if project:
|
3408
|
+
list_kwargs["project"] = project
|
3409
|
+
scope = f" in project {project}"
|
3393
3410
|
|
3394
3411
|
entity = self.list_deployments(**list_kwargs)
|
3395
3412
|
|
@@ -3422,7 +3439,7 @@ class Client(metaclass=ClientMetaClass):
|
|
3422
3439
|
id: Optional[Union[UUID, str]] = None,
|
3423
3440
|
created: Optional[Union[datetime, str]] = None,
|
3424
3441
|
updated: Optional[Union[datetime, str]] = None,
|
3425
|
-
|
3442
|
+
project: Optional[Union[str, UUID]] = None,
|
3426
3443
|
user: Optional[Union[UUID, str]] = None,
|
3427
3444
|
pipeline_id: Optional[Union[str, UUID]] = None,
|
3428
3445
|
stack_id: Optional[Union[str, UUID]] = None,
|
@@ -3440,7 +3457,7 @@ class Client(metaclass=ClientMetaClass):
|
|
3440
3457
|
id: Use the id of build to filter by.
|
3441
3458
|
created: Use to filter by time of creation
|
3442
3459
|
updated: Use the last updated date for filtering
|
3443
|
-
|
3460
|
+
project: The project name/ID to filter by.
|
3444
3461
|
user: Filter by user name/ID.
|
3445
3462
|
pipeline_id: The id of the pipeline to filter by.
|
3446
3463
|
stack_id: The id of the stack to filter by.
|
@@ -3460,7 +3477,7 @@ class Client(metaclass=ClientMetaClass):
|
|
3460
3477
|
id=id,
|
3461
3478
|
created=created,
|
3462
3479
|
updated=updated,
|
3463
|
-
|
3480
|
+
project=project or self.active_project.id,
|
3464
3481
|
user=user,
|
3465
3482
|
pipeline_id=pipeline_id,
|
3466
3483
|
stack_id=stack_id,
|
@@ -3475,17 +3492,17 @@ class Client(metaclass=ClientMetaClass):
|
|
3475
3492
|
def delete_deployment(
|
3476
3493
|
self,
|
3477
3494
|
id_or_prefix: str,
|
3478
|
-
|
3495
|
+
project: Optional[Union[str, UUID]] = None,
|
3479
3496
|
) -> None:
|
3480
3497
|
"""Delete a deployment.
|
3481
3498
|
|
3482
3499
|
Args:
|
3483
3500
|
id_or_prefix: The id or id prefix of the deployment.
|
3484
|
-
|
3501
|
+
project: The project name/ID to filter by.
|
3485
3502
|
"""
|
3486
3503
|
deployment = self.get_deployment(
|
3487
3504
|
id_or_prefix=id_or_prefix,
|
3488
|
-
|
3505
|
+
project=project,
|
3489
3506
|
hydrate=False,
|
3490
3507
|
)
|
3491
3508
|
self.zen_store.delete_deployment(deployment_id=deployment.id)
|
@@ -3517,21 +3534,21 @@ class Client(metaclass=ClientMetaClass):
|
|
3517
3534
|
description=description,
|
3518
3535
|
source_deployment_id=deployment_id,
|
3519
3536
|
tags=tags,
|
3520
|
-
|
3537
|
+
project=self.active_project.id,
|
3521
3538
|
)
|
3522
3539
|
)
|
3523
3540
|
|
3524
3541
|
def get_run_template(
|
3525
3542
|
self,
|
3526
3543
|
name_id_or_prefix: Union[str, UUID],
|
3527
|
-
|
3544
|
+
project: Optional[Union[str, UUID]] = None,
|
3528
3545
|
hydrate: bool = True,
|
3529
3546
|
) -> RunTemplateResponse:
|
3530
3547
|
"""Get a run template.
|
3531
3548
|
|
3532
3549
|
Args:
|
3533
3550
|
name_id_or_prefix: Name/ID/ID prefix of the template to get.
|
3534
|
-
|
3551
|
+
project: The project name/ID to filter by.
|
3535
3552
|
hydrate: Flag deciding whether to hydrate the output model(s)
|
3536
3553
|
by including metadata fields in the response.
|
3537
3554
|
|
@@ -3543,7 +3560,7 @@ class Client(metaclass=ClientMetaClass):
|
|
3543
3560
|
list_method=self.list_run_templates,
|
3544
3561
|
name_id_or_prefix=name_id_or_prefix,
|
3545
3562
|
allow_name_prefix_match=False,
|
3546
|
-
|
3563
|
+
project=project,
|
3547
3564
|
hydrate=hydrate,
|
3548
3565
|
)
|
3549
3566
|
|
@@ -3558,7 +3575,7 @@ class Client(metaclass=ClientMetaClass):
|
|
3558
3575
|
id: Optional[Union[UUID, str]] = None,
|
3559
3576
|
name: Optional[str] = None,
|
3560
3577
|
tag: Optional[str] = None,
|
3561
|
-
|
3578
|
+
project: Optional[Union[str, UUID]] = None,
|
3562
3579
|
pipeline_id: Optional[Union[str, UUID]] = None,
|
3563
3580
|
build_id: Optional[Union[str, UUID]] = None,
|
3564
3581
|
stack_id: Optional[Union[str, UUID]] = None,
|
@@ -3580,7 +3597,7 @@ class Client(metaclass=ClientMetaClass):
|
|
3580
3597
|
id: Filter by run template ID.
|
3581
3598
|
name: Filter by run template name.
|
3582
3599
|
tag: Filter by run template tags.
|
3583
|
-
|
3600
|
+
project: Filter by project name/ID.
|
3584
3601
|
pipeline_id: Filter by pipeline ID.
|
3585
3602
|
build_id: Filter by build ID.
|
3586
3603
|
stack_id: Filter by stack ID.
|
@@ -3604,7 +3621,7 @@ class Client(metaclass=ClientMetaClass):
|
|
3604
3621
|
id=id,
|
3605
3622
|
name=name,
|
3606
3623
|
tag=tag,
|
3607
|
-
|
3624
|
+
project=project,
|
3608
3625
|
pipeline_id=pipeline_id,
|
3609
3626
|
build_id=build_id,
|
3610
3627
|
stack_id=stack_id,
|
@@ -3625,7 +3642,7 @@ class Client(metaclass=ClientMetaClass):
|
|
3625
3642
|
description: Optional[str] = None,
|
3626
3643
|
add_tags: Optional[List[str]] = None,
|
3627
3644
|
remove_tags: Optional[List[str]] = None,
|
3628
|
-
|
3645
|
+
project: Optional[Union[str, UUID]] = None,
|
3629
3646
|
) -> RunTemplateResponse:
|
3630
3647
|
"""Update a run template.
|
3631
3648
|
|
@@ -3635,7 +3652,7 @@ class Client(metaclass=ClientMetaClass):
|
|
3635
3652
|
description: The new description of the run template.
|
3636
3653
|
add_tags: Tags to add to the run template.
|
3637
3654
|
remove_tags: Tags to remove from the run template.
|
3638
|
-
|
3655
|
+
project: The project name/ID to filter by.
|
3639
3656
|
|
3640
3657
|
Returns:
|
3641
3658
|
The updated run template.
|
@@ -3649,7 +3666,7 @@ class Client(metaclass=ClientMetaClass):
|
|
3649
3666
|
else:
|
3650
3667
|
template_id = self.get_run_template(
|
3651
3668
|
name_id_or_prefix,
|
3652
|
-
|
3669
|
+
project=project,
|
3653
3670
|
hydrate=False,
|
3654
3671
|
).id
|
3655
3672
|
|
@@ -3666,13 +3683,13 @@ class Client(metaclass=ClientMetaClass):
|
|
3666
3683
|
def delete_run_template(
|
3667
3684
|
self,
|
3668
3685
|
name_id_or_prefix: Union[str, UUID],
|
3669
|
-
|
3686
|
+
project: Optional[Union[str, UUID]] = None,
|
3670
3687
|
) -> None:
|
3671
3688
|
"""Delete a run template.
|
3672
3689
|
|
3673
3690
|
Args:
|
3674
3691
|
name_id_or_prefix: Name/ID/ID prefix of the template to delete.
|
3675
|
-
|
3692
|
+
project: The project name/ID to filter by.
|
3676
3693
|
"""
|
3677
3694
|
if is_valid_uuid(name_id_or_prefix):
|
3678
3695
|
template_id = (
|
@@ -3683,7 +3700,7 @@ class Client(metaclass=ClientMetaClass):
|
|
3683
3700
|
else:
|
3684
3701
|
template_id = self.get_run_template(
|
3685
3702
|
name_id_or_prefix,
|
3686
|
-
|
3703
|
+
project=project,
|
3687
3704
|
hydrate=False,
|
3688
3705
|
).id
|
3689
3706
|
|
@@ -3695,7 +3712,7 @@ class Client(metaclass=ClientMetaClass):
|
|
3695
3712
|
self,
|
3696
3713
|
name_id_or_prefix: Union[str, UUID],
|
3697
3714
|
allow_name_prefix_match: bool = True,
|
3698
|
-
|
3715
|
+
project: Optional[Union[str, UUID]] = None,
|
3699
3716
|
hydrate: bool = True,
|
3700
3717
|
) -> ScheduleResponse:
|
3701
3718
|
"""Get a schedule by name, id or prefix.
|
@@ -3703,7 +3720,7 @@ class Client(metaclass=ClientMetaClass):
|
|
3703
3720
|
Args:
|
3704
3721
|
name_id_or_prefix: The name, id or prefix of the schedule.
|
3705
3722
|
allow_name_prefix_match: If True, allow matching by name prefix.
|
3706
|
-
|
3723
|
+
project: The project name/ID to filter by.
|
3707
3724
|
hydrate: Flag deciding whether to hydrate the output model(s)
|
3708
3725
|
by including metadata fields in the response.
|
3709
3726
|
|
@@ -3715,7 +3732,7 @@ class Client(metaclass=ClientMetaClass):
|
|
3715
3732
|
list_method=self.list_schedules,
|
3716
3733
|
name_id_or_prefix=name_id_or_prefix,
|
3717
3734
|
allow_name_prefix_match=allow_name_prefix_match,
|
3718
|
-
|
3735
|
+
project=project,
|
3719
3736
|
hydrate=hydrate,
|
3720
3737
|
)
|
3721
3738
|
|
@@ -3729,7 +3746,7 @@ class Client(metaclass=ClientMetaClass):
|
|
3729
3746
|
created: Optional[Union[datetime, str]] = None,
|
3730
3747
|
updated: Optional[Union[datetime, str]] = None,
|
3731
3748
|
name: Optional[str] = None,
|
3732
|
-
|
3749
|
+
project: Optional[Union[str, UUID]] = None,
|
3733
3750
|
user: Optional[Union[UUID, str]] = None,
|
3734
3751
|
pipeline_id: Optional[Union[str, UUID]] = None,
|
3735
3752
|
orchestrator_id: Optional[Union[str, UUID]] = None,
|
@@ -3753,7 +3770,7 @@ class Client(metaclass=ClientMetaClass):
|
|
3753
3770
|
created: Use to filter by time of creation
|
3754
3771
|
updated: Use the last updated date for filtering
|
3755
3772
|
name: The name of the stack to filter by.
|
3756
|
-
|
3773
|
+
project: The project name/ID to filter by.
|
3757
3774
|
user: Filter by user name/ID.
|
3758
3775
|
pipeline_id: The id of the pipeline to filter by.
|
3759
3776
|
orchestrator_id: The id of the orchestrator to filter by.
|
@@ -3779,7 +3796,7 @@ class Client(metaclass=ClientMetaClass):
|
|
3779
3796
|
created=created,
|
3780
3797
|
updated=updated,
|
3781
3798
|
name=name,
|
3782
|
-
|
3799
|
+
project=project or self.active_project.id,
|
3783
3800
|
user=user,
|
3784
3801
|
pipeline_id=pipeline_id,
|
3785
3802
|
orchestrator_id=orchestrator_id,
|
@@ -3799,19 +3816,19 @@ class Client(metaclass=ClientMetaClass):
|
|
3799
3816
|
def delete_schedule(
|
3800
3817
|
self,
|
3801
3818
|
name_id_or_prefix: Union[str, UUID],
|
3802
|
-
|
3819
|
+
project: Optional[Union[str, UUID]] = None,
|
3803
3820
|
) -> None:
|
3804
3821
|
"""Delete a schedule.
|
3805
3822
|
|
3806
3823
|
Args:
|
3807
3824
|
name_id_or_prefix: The name, id or prefix id of the schedule
|
3808
3825
|
to delete.
|
3809
|
-
|
3826
|
+
project: The project name/ID to filter by.
|
3810
3827
|
"""
|
3811
3828
|
schedule = self.get_schedule(
|
3812
3829
|
name_id_or_prefix=name_id_or_prefix,
|
3813
3830
|
allow_name_prefix_match=False,
|
3814
|
-
|
3831
|
+
project=project,
|
3815
3832
|
)
|
3816
3833
|
logger.warning(
|
3817
3834
|
f"Deleting schedule '{name_id_or_prefix}'... This will only delete "
|
@@ -3826,7 +3843,7 @@ class Client(metaclass=ClientMetaClass):
|
|
3826
3843
|
self,
|
3827
3844
|
name_id_or_prefix: Union[str, UUID],
|
3828
3845
|
allow_name_prefix_match: bool = True,
|
3829
|
-
|
3846
|
+
project: Optional[Union[str, UUID]] = None,
|
3830
3847
|
hydrate: bool = True,
|
3831
3848
|
) -> PipelineRunResponse:
|
3832
3849
|
"""Gets a pipeline run by name, ID, or prefix.
|
@@ -3834,7 +3851,7 @@ class Client(metaclass=ClientMetaClass):
|
|
3834
3851
|
Args:
|
3835
3852
|
name_id_or_prefix: Name, ID, or prefix of the pipeline run.
|
3836
3853
|
allow_name_prefix_match: If True, allow matching by name prefix.
|
3837
|
-
|
3854
|
+
project: The project name/ID to filter by.
|
3838
3855
|
hydrate: Flag deciding whether to hydrate the output model(s)
|
3839
3856
|
by including metadata fields in the response.
|
3840
3857
|
|
@@ -3846,7 +3863,7 @@ class Client(metaclass=ClientMetaClass):
|
|
3846
3863
|
list_method=self.list_pipeline_runs,
|
3847
3864
|
name_id_or_prefix=name_id_or_prefix,
|
3848
3865
|
allow_name_prefix_match=allow_name_prefix_match,
|
3849
|
-
|
3866
|
+
project=project,
|
3850
3867
|
hydrate=hydrate,
|
3851
3868
|
)
|
3852
3869
|
|
@@ -3860,7 +3877,7 @@ class Client(metaclass=ClientMetaClass):
|
|
3860
3877
|
created: Optional[Union[datetime, str]] = None,
|
3861
3878
|
updated: Optional[Union[datetime, str]] = None,
|
3862
3879
|
name: Optional[str] = None,
|
3863
|
-
|
3880
|
+
project: Optional[Union[str, UUID]] = None,
|
3864
3881
|
pipeline_id: Optional[Union[str, UUID]] = None,
|
3865
3882
|
pipeline_name: Optional[str] = None,
|
3866
3883
|
stack_id: Optional[Union[str, UUID]] = None,
|
@@ -3897,7 +3914,7 @@ class Client(metaclass=ClientMetaClass):
|
|
3897
3914
|
id: The id of the runs to filter by.
|
3898
3915
|
created: Use to filter by time of creation
|
3899
3916
|
updated: Use the last updated date for filtering
|
3900
|
-
|
3917
|
+
project: The project name/ID to filter by.
|
3901
3918
|
pipeline_id: The id of the pipeline to filter by.
|
3902
3919
|
pipeline_name: DEPRECATED. Use `pipeline` instead to filter by
|
3903
3920
|
pipeline name.
|
@@ -3939,7 +3956,7 @@ class Client(metaclass=ClientMetaClass):
|
|
3939
3956
|
created=created,
|
3940
3957
|
updated=updated,
|
3941
3958
|
name=name,
|
3942
|
-
|
3959
|
+
project=project or self.active_project.id,
|
3943
3960
|
pipeline_id=pipeline_id,
|
3944
3961
|
pipeline_name=pipeline_name,
|
3945
3962
|
schedule_id=schedule_id,
|
@@ -3973,18 +3990,18 @@ class Client(metaclass=ClientMetaClass):
|
|
3973
3990
|
def delete_pipeline_run(
|
3974
3991
|
self,
|
3975
3992
|
name_id_or_prefix: Union[str, UUID],
|
3976
|
-
|
3993
|
+
project: Optional[Union[str, UUID]] = None,
|
3977
3994
|
) -> None:
|
3978
3995
|
"""Deletes a pipeline run.
|
3979
3996
|
|
3980
3997
|
Args:
|
3981
3998
|
name_id_or_prefix: Name, ID, or prefix of the pipeline run.
|
3982
|
-
|
3999
|
+
project: The project name/ID to filter by.
|
3983
4000
|
"""
|
3984
4001
|
run = self.get_pipeline_run(
|
3985
4002
|
name_id_or_prefix=name_id_or_prefix,
|
3986
4003
|
allow_name_prefix_match=False,
|
3987
|
-
|
4004
|
+
project=project,
|
3988
4005
|
)
|
3989
4006
|
self.zen_store.delete_run(run_id=run.id)
|
3990
4007
|
|
@@ -4028,7 +4045,7 @@ class Client(metaclass=ClientMetaClass):
|
|
4028
4045
|
pipeline_run_id: Optional[Union[str, UUID]] = None,
|
4029
4046
|
deployment_id: Optional[Union[str, UUID]] = None,
|
4030
4047
|
original_step_run_id: Optional[Union[str, UUID]] = None,
|
4031
|
-
|
4048
|
+
project: Optional[Union[str, UUID]] = None,
|
4032
4049
|
user: Optional[Union[UUID, str]] = None,
|
4033
4050
|
model_version_id: Optional[Union[str, UUID]] = None,
|
4034
4051
|
model: Optional[Union[UUID, str]] = None,
|
@@ -4047,7 +4064,7 @@ class Client(metaclass=ClientMetaClass):
|
|
4047
4064
|
updated: Use the last updated date for filtering
|
4048
4065
|
start_time: Use to filter by the time when the step started running
|
4049
4066
|
end_time: Use to filter by the time when the step finished running
|
4050
|
-
|
4067
|
+
project: The project name/ID to filter by.
|
4051
4068
|
user: Filter by user name/ID.
|
4052
4069
|
pipeline_run_id: The id of the pipeline run to filter by.
|
4053
4070
|
deployment_id: The id of the deployment to filter by.
|
@@ -4082,7 +4099,7 @@ class Client(metaclass=ClientMetaClass):
|
|
4082
4099
|
start_time=start_time,
|
4083
4100
|
end_time=end_time,
|
4084
4101
|
name=name,
|
4085
|
-
|
4102
|
+
project=project or self.active_project.id,
|
4086
4103
|
user=user,
|
4087
4104
|
model_version_id=model_version_id,
|
4088
4105
|
model=model,
|
@@ -4098,14 +4115,14 @@ class Client(metaclass=ClientMetaClass):
|
|
4098
4115
|
def get_artifact(
|
4099
4116
|
self,
|
4100
4117
|
name_id_or_prefix: Union[str, UUID],
|
4101
|
-
|
4118
|
+
project: Optional[Union[str, UUID]] = None,
|
4102
4119
|
hydrate: bool = False,
|
4103
4120
|
) -> ArtifactResponse:
|
4104
4121
|
"""Get an artifact by name, id or prefix.
|
4105
4122
|
|
4106
4123
|
Args:
|
4107
4124
|
name_id_or_prefix: The name, ID or prefix of the artifact to get.
|
4108
|
-
|
4125
|
+
project: The project name/ID to filter by.
|
4109
4126
|
hydrate: Flag deciding whether to hydrate the output model(s)
|
4110
4127
|
by including metadata fields in the response.
|
4111
4128
|
|
@@ -4116,7 +4133,7 @@ class Client(metaclass=ClientMetaClass):
|
|
4116
4133
|
get_method=self.zen_store.get_artifact,
|
4117
4134
|
list_method=self.list_artifacts,
|
4118
4135
|
name_id_or_prefix=name_id_or_prefix,
|
4119
|
-
|
4136
|
+
project=project,
|
4120
4137
|
hydrate=hydrate,
|
4121
4138
|
)
|
4122
4139
|
|
@@ -4132,7 +4149,7 @@ class Client(metaclass=ClientMetaClass):
|
|
4132
4149
|
name: Optional[str] = None,
|
4133
4150
|
has_custom_name: Optional[bool] = None,
|
4134
4151
|
user: Optional[Union[UUID, str]] = None,
|
4135
|
-
|
4152
|
+
project: Optional[Union[str, UUID]] = None,
|
4136
4153
|
hydrate: bool = False,
|
4137
4154
|
tag: Optional[str] = None,
|
4138
4155
|
tags: Optional[List[str]] = None,
|
@@ -4150,7 +4167,7 @@ class Client(metaclass=ClientMetaClass):
|
|
4150
4167
|
name: The name of the artifact to filter by.
|
4151
4168
|
has_custom_name: Filter artifacts with/without custom names.
|
4152
4169
|
user: Filter by user name or ID.
|
4153
|
-
|
4170
|
+
project: The project name/ID to filter by.
|
4154
4171
|
hydrate: Flag deciding whether to hydrate the output model(s)
|
4155
4172
|
by including metadata fields in the response.
|
4156
4173
|
tag: Filter artifacts by tag.
|
@@ -4172,7 +4189,7 @@ class Client(metaclass=ClientMetaClass):
|
|
4172
4189
|
tag=tag,
|
4173
4190
|
tags=tags,
|
4174
4191
|
user=user,
|
4175
|
-
|
4192
|
+
project=project or self.active_project.id,
|
4176
4193
|
)
|
4177
4194
|
return self.zen_store.list_artifacts(
|
4178
4195
|
artifact_filter_model,
|
@@ -4186,7 +4203,7 @@ class Client(metaclass=ClientMetaClass):
|
|
4186
4203
|
add_tags: Optional[List[str]] = None,
|
4187
4204
|
remove_tags: Optional[List[str]] = None,
|
4188
4205
|
has_custom_name: Optional[bool] = None,
|
4189
|
-
|
4206
|
+
project: Optional[Union[str, UUID]] = None,
|
4190
4207
|
) -> ArtifactResponse:
|
4191
4208
|
"""Update an artifact.
|
4192
4209
|
|
@@ -4196,14 +4213,14 @@ class Client(metaclass=ClientMetaClass):
|
|
4196
4213
|
add_tags: Tags to add to the artifact.
|
4197
4214
|
remove_tags: Tags to remove from the artifact.
|
4198
4215
|
has_custom_name: Whether the artifact has a custom name.
|
4199
|
-
|
4216
|
+
project: The project name/ID to filter by.
|
4200
4217
|
|
4201
4218
|
Returns:
|
4202
4219
|
The updated artifact.
|
4203
4220
|
"""
|
4204
4221
|
artifact = self.get_artifact(
|
4205
4222
|
name_id_or_prefix=name_id_or_prefix,
|
4206
|
-
|
4223
|
+
project=project,
|
4207
4224
|
)
|
4208
4225
|
artifact_update = ArtifactUpdate(
|
4209
4226
|
name=new_name,
|
@@ -4218,17 +4235,17 @@ class Client(metaclass=ClientMetaClass):
|
|
4218
4235
|
def delete_artifact(
|
4219
4236
|
self,
|
4220
4237
|
name_id_or_prefix: Union[str, UUID],
|
4221
|
-
|
4238
|
+
project: Optional[Union[str, UUID]] = None,
|
4222
4239
|
) -> None:
|
4223
4240
|
"""Delete an artifact.
|
4224
4241
|
|
4225
4242
|
Args:
|
4226
4243
|
name_id_or_prefix: The name, ID or prefix of the artifact to delete.
|
4227
|
-
|
4244
|
+
project: The project name/ID to filter by.
|
4228
4245
|
"""
|
4229
4246
|
artifact = self.get_artifact(
|
4230
4247
|
name_id_or_prefix=name_id_or_prefix,
|
4231
|
-
|
4248
|
+
project=project,
|
4232
4249
|
)
|
4233
4250
|
self.zen_store.delete_artifact(artifact_id=artifact.id)
|
4234
4251
|
logger.info(f"Deleted artifact '{artifact.name}'.")
|
@@ -4237,30 +4254,30 @@ class Client(metaclass=ClientMetaClass):
|
|
4237
4254
|
self,
|
4238
4255
|
only_versions: bool = True,
|
4239
4256
|
delete_from_artifact_store: bool = False,
|
4240
|
-
|
4257
|
+
project: Optional[Union[str, UUID]] = None,
|
4241
4258
|
) -> None:
|
4242
4259
|
"""Delete all unused artifacts and artifact versions.
|
4243
4260
|
|
4244
4261
|
Args:
|
4245
4262
|
only_versions: Only delete artifact versions, keeping artifacts
|
4246
4263
|
delete_from_artifact_store: Delete data from artifact metadata
|
4247
|
-
|
4264
|
+
project: The project name/ID to filter by.
|
4248
4265
|
"""
|
4249
4266
|
if delete_from_artifact_store:
|
4250
4267
|
unused_artifact_versions = depaginate(
|
4251
4268
|
self.list_artifact_versions,
|
4252
4269
|
only_unused=True,
|
4253
|
-
|
4270
|
+
project=project,
|
4254
4271
|
)
|
4255
4272
|
for unused_artifact_version in unused_artifact_versions:
|
4256
4273
|
self._delete_artifact_from_artifact_store(
|
4257
4274
|
unused_artifact_version
|
4258
4275
|
)
|
4259
4276
|
|
4260
|
-
|
4277
|
+
project = project or self.active_project.id
|
4261
4278
|
|
4262
4279
|
self.zen_store.prune_artifact_versions(
|
4263
|
-
|
4280
|
+
project_name_or_id=project, only_versions=only_versions
|
4264
4281
|
)
|
4265
4282
|
logger.info("All unused artifacts and artifact versions deleted.")
|
4266
4283
|
|
@@ -4270,7 +4287,7 @@ class Client(metaclass=ClientMetaClass):
|
|
4270
4287
|
self,
|
4271
4288
|
name_id_or_prefix: Union[str, UUID],
|
4272
4289
|
version: Optional[str] = None,
|
4273
|
-
|
4290
|
+
project: Optional[Union[str, UUID]] = None,
|
4274
4291
|
hydrate: bool = True,
|
4275
4292
|
) -> ArtifactVersionResponse:
|
4276
4293
|
"""Get an artifact version by ID or artifact name.
|
@@ -4281,7 +4298,7 @@ class Client(metaclass=ClientMetaClass):
|
|
4281
4298
|
version: The version of the artifact to get. Only used if
|
4282
4299
|
`name_id_or_prefix` is the name of the artifact. If not
|
4283
4300
|
specified, the latest version is returned.
|
4284
|
-
|
4301
|
+
project: The project name/ID to filter by.
|
4285
4302
|
hydrate: Flag deciding whether to hydrate the output model(s)
|
4286
4303
|
by including metadata fields in the response.
|
4287
4304
|
|
@@ -4294,7 +4311,7 @@ class Client(metaclass=ClientMetaClass):
|
|
4294
4311
|
method_name="get_artifact_version",
|
4295
4312
|
name_id_or_prefix=name_id_or_prefix,
|
4296
4313
|
version=version,
|
4297
|
-
|
4314
|
+
project=project,
|
4298
4315
|
hydrate=hydrate,
|
4299
4316
|
):
|
4300
4317
|
return cll # type: ignore[return-value]
|
@@ -4304,7 +4321,7 @@ class Client(metaclass=ClientMetaClass):
|
|
4304
4321
|
list_method=self.list_artifact_versions,
|
4305
4322
|
name_id_or_prefix=name_id_or_prefix,
|
4306
4323
|
version=version,
|
4307
|
-
|
4324
|
+
project=project,
|
4308
4325
|
hydrate=hydrate,
|
4309
4326
|
)
|
4310
4327
|
try:
|
@@ -4338,7 +4355,7 @@ class Client(metaclass=ClientMetaClass):
|
|
4338
4355
|
data_type: Optional[str] = None,
|
4339
4356
|
uri: Optional[str] = None,
|
4340
4357
|
materializer: Optional[str] = None,
|
4341
|
-
|
4358
|
+
project: Optional[Union[str, UUID]] = None,
|
4342
4359
|
model_version_id: Optional[Union[str, UUID]] = None,
|
4343
4360
|
only_unused: Optional[bool] = False,
|
4344
4361
|
has_custom_name: Optional[bool] = None,
|
@@ -4369,7 +4386,7 @@ class Client(metaclass=ClientMetaClass):
|
|
4369
4386
|
data_type: The data type of the artifact to filter by.
|
4370
4387
|
uri: The uri of the artifact to filter by.
|
4371
4388
|
materializer: The materializer of the artifact to filter by.
|
4372
|
-
|
4389
|
+
project: The project name/ID to filter by.
|
4373
4390
|
model_version_id: Filter by model version ID.
|
4374
4391
|
only_unused: Only return artifact versions that are not used in
|
4375
4392
|
any pipeline runs.
|
@@ -4405,7 +4422,7 @@ class Client(metaclass=ClientMetaClass):
|
|
4405
4422
|
data_type=data_type,
|
4406
4423
|
uri=uri,
|
4407
4424
|
materializer=materializer,
|
4408
|
-
|
4425
|
+
project=project or self.active_project.id,
|
4409
4426
|
model_version_id=model_version_id,
|
4410
4427
|
only_unused=only_unused,
|
4411
4428
|
has_custom_name=has_custom_name,
|
@@ -4427,7 +4444,7 @@ class Client(metaclass=ClientMetaClass):
|
|
4427
4444
|
version: Optional[str] = None,
|
4428
4445
|
add_tags: Optional[List[str]] = None,
|
4429
4446
|
remove_tags: Optional[List[str]] = None,
|
4430
|
-
|
4447
|
+
project: Optional[Union[str, UUID]] = None,
|
4431
4448
|
) -> ArtifactVersionResponse:
|
4432
4449
|
"""Update an artifact version.
|
4433
4450
|
|
@@ -4438,7 +4455,7 @@ class Client(metaclass=ClientMetaClass):
|
|
4438
4455
|
specified, the latest version is updated.
|
4439
4456
|
add_tags: Tags to add to the artifact version.
|
4440
4457
|
remove_tags: Tags to remove from the artifact version.
|
4441
|
-
|
4458
|
+
project: The project name/ID to filter by.
|
4442
4459
|
|
4443
4460
|
Returns:
|
4444
4461
|
The updated artifact version.
|
@@ -4446,7 +4463,7 @@ class Client(metaclass=ClientMetaClass):
|
|
4446
4463
|
artifact_version = self.get_artifact_version(
|
4447
4464
|
name_id_or_prefix=name_id_or_prefix,
|
4448
4465
|
version=version,
|
4449
|
-
|
4466
|
+
project=project,
|
4450
4467
|
)
|
4451
4468
|
artifact_version_update = ArtifactVersionUpdate(
|
4452
4469
|
add_tags=add_tags, remove_tags=remove_tags
|
@@ -4462,7 +4479,7 @@ class Client(metaclass=ClientMetaClass):
|
|
4462
4479
|
version: Optional[str] = None,
|
4463
4480
|
delete_metadata: bool = True,
|
4464
4481
|
delete_from_artifact_store: bool = False,
|
4465
|
-
|
4482
|
+
project: Optional[Union[str, UUID]] = None,
|
4466
4483
|
) -> None:
|
4467
4484
|
"""Delete an artifact version.
|
4468
4485
|
|
@@ -4477,12 +4494,12 @@ class Client(metaclass=ClientMetaClass):
|
|
4477
4494
|
version from the database.
|
4478
4495
|
delete_from_artifact_store: If True, delete the artifact object
|
4479
4496
|
itself from the artifact store.
|
4480
|
-
|
4497
|
+
project: The project name/ID to filter by.
|
4481
4498
|
"""
|
4482
4499
|
artifact_version = self.get_artifact_version(
|
4483
4500
|
name_id_or_prefix=name_id_or_prefix,
|
4484
4501
|
version=version,
|
4485
|
-
|
4502
|
+
project=project,
|
4486
4503
|
)
|
4487
4504
|
if delete_from_artifact_store:
|
4488
4505
|
self._delete_artifact_from_artifact_store(
|
@@ -4605,7 +4622,7 @@ class Client(metaclass=ClientMetaClass):
|
|
4605
4622
|
types[key] = metadata_type
|
4606
4623
|
|
4607
4624
|
run_metadata = RunMetadataRequest(
|
4608
|
-
|
4625
|
+
project=self.active_project.id,
|
4609
4626
|
resources=resources,
|
4610
4627
|
stack_component_id=stack_component_id,
|
4611
4628
|
publisher_step_id=publisher_step_id,
|
@@ -5100,7 +5117,7 @@ class Client(metaclass=ClientMetaClass):
|
|
5100
5117
|
"""
|
5101
5118
|
self._validate_code_repository_config(source=source, config=config)
|
5102
5119
|
repo_request = CodeRepositoryRequest(
|
5103
|
-
|
5120
|
+
project=self.active_project.id,
|
5104
5121
|
name=name,
|
5105
5122
|
config=config,
|
5106
5123
|
source=source,
|
@@ -5115,7 +5132,7 @@ class Client(metaclass=ClientMetaClass):
|
|
5115
5132
|
self,
|
5116
5133
|
name_id_or_prefix: Union[str, UUID],
|
5117
5134
|
allow_name_prefix_match: bool = True,
|
5118
|
-
|
5135
|
+
project: Optional[Union[str, UUID]] = None,
|
5119
5136
|
hydrate: bool = True,
|
5120
5137
|
) -> CodeRepositoryResponse:
|
5121
5138
|
"""Get a code repository by name, id or prefix.
|
@@ -5123,7 +5140,7 @@ class Client(metaclass=ClientMetaClass):
|
|
5123
5140
|
Args:
|
5124
5141
|
name_id_or_prefix: The name, ID or ID prefix of the code repository.
|
5125
5142
|
allow_name_prefix_match: If True, allow matching by name prefix.
|
5126
|
-
|
5143
|
+
project: The project name/ID to filter by.
|
5127
5144
|
hydrate: Flag deciding whether to hydrate the output model(s)
|
5128
5145
|
by including metadata fields in the response.
|
5129
5146
|
|
@@ -5136,7 +5153,7 @@ class Client(metaclass=ClientMetaClass):
|
|
5136
5153
|
name_id_or_prefix=name_id_or_prefix,
|
5137
5154
|
allow_name_prefix_match=allow_name_prefix_match,
|
5138
5155
|
hydrate=hydrate,
|
5139
|
-
|
5156
|
+
project=project,
|
5140
5157
|
)
|
5141
5158
|
|
5142
5159
|
def list_code_repositories(
|
@@ -5149,7 +5166,7 @@ class Client(metaclass=ClientMetaClass):
|
|
5149
5166
|
created: Optional[Union[datetime, str]] = None,
|
5150
5167
|
updated: Optional[Union[datetime, str]] = None,
|
5151
5168
|
name: Optional[str] = None,
|
5152
|
-
|
5169
|
+
project: Optional[Union[str, UUID]] = None,
|
5153
5170
|
user: Optional[Union[UUID, str]] = None,
|
5154
5171
|
hydrate: bool = False,
|
5155
5172
|
) -> Page[CodeRepositoryResponse]:
|
@@ -5164,7 +5181,7 @@ class Client(metaclass=ClientMetaClass):
|
|
5164
5181
|
created: Use to filter by time of creation.
|
5165
5182
|
updated: Use the last updated date for filtering.
|
5166
5183
|
name: The name of the code repository to filter by.
|
5167
|
-
|
5184
|
+
project: The project name/ID to filter by.
|
5168
5185
|
user: Filter by user name/ID.
|
5169
5186
|
hydrate: Flag deciding whether to hydrate the output model(s)
|
5170
5187
|
by including metadata fields in the response.
|
@@ -5181,7 +5198,7 @@ class Client(metaclass=ClientMetaClass):
|
|
5181
5198
|
created=created,
|
5182
5199
|
updated=updated,
|
5183
5200
|
name=name,
|
5184
|
-
|
5201
|
+
project=project or self.active_project.id,
|
5185
5202
|
user=user,
|
5186
5203
|
)
|
5187
5204
|
return self.zen_store.list_code_repositories(
|
@@ -5196,7 +5213,7 @@ class Client(metaclass=ClientMetaClass):
|
|
5196
5213
|
description: Optional[str] = None,
|
5197
5214
|
logo_url: Optional[str] = None,
|
5198
5215
|
config: Optional[Dict[str, Any]] = None,
|
5199
|
-
|
5216
|
+
project: Optional[Union[str, UUID]] = None,
|
5200
5217
|
) -> CodeRepositoryResponse:
|
5201
5218
|
"""Update a code repository.
|
5202
5219
|
|
@@ -5210,7 +5227,7 @@ class Client(metaclass=ClientMetaClass):
|
|
5210
5227
|
be used to update the existing configuration values. To remove
|
5211
5228
|
values from the existing configuration, set the value for that
|
5212
5229
|
key to `None`.
|
5213
|
-
|
5230
|
+
project: The project name/ID to filter by.
|
5214
5231
|
|
5215
5232
|
Returns:
|
5216
5233
|
The updated code repository.
|
@@ -5218,7 +5235,7 @@ class Client(metaclass=ClientMetaClass):
|
|
5218
5235
|
repo = self.get_code_repository(
|
5219
5236
|
name_id_or_prefix=name_id_or_prefix,
|
5220
5237
|
allow_name_prefix_match=False,
|
5221
|
-
|
5238
|
+
project=project,
|
5222
5239
|
)
|
5223
5240
|
update = CodeRepositoryUpdate(
|
5224
5241
|
name=name, description=description, logo_url=logo_url
|
@@ -5242,18 +5259,18 @@ class Client(metaclass=ClientMetaClass):
|
|
5242
5259
|
def delete_code_repository(
|
5243
5260
|
self,
|
5244
5261
|
name_id_or_prefix: Union[str, UUID],
|
5245
|
-
|
5262
|
+
project: Optional[Union[str, UUID]] = None,
|
5246
5263
|
) -> None:
|
5247
5264
|
"""Delete a code repository.
|
5248
5265
|
|
5249
5266
|
Args:
|
5250
5267
|
name_id_or_prefix: The name, ID or prefix of the code repository.
|
5251
|
-
|
5268
|
+
project: The project name/ID to filter by.
|
5252
5269
|
"""
|
5253
5270
|
repo = self.get_code_repository(
|
5254
5271
|
name_id_or_prefix=name_id_or_prefix,
|
5255
5272
|
allow_name_prefix_match=False,
|
5256
|
-
|
5273
|
+
project=project,
|
5257
5274
|
)
|
5258
5275
|
self.zen_store.delete_code_repository(code_repository_id=repo.id)
|
5259
5276
|
|
@@ -5370,7 +5387,6 @@ class Client(metaclass=ClientMetaClass):
|
|
5370
5387
|
assert connector_instance is not None
|
5371
5388
|
connector_request = connector_instance.to_model(
|
5372
5389
|
name=name,
|
5373
|
-
workspace=self.active_workspace.id,
|
5374
5390
|
description=description or "",
|
5375
5391
|
labels=labels,
|
5376
5392
|
)
|
@@ -5417,7 +5433,6 @@ class Client(metaclass=ClientMetaClass):
|
|
5417
5433
|
expiration_seconds=expiration_seconds,
|
5418
5434
|
expires_at=expires_at,
|
5419
5435
|
expires_skew_tolerance=expires_skew_tolerance,
|
5420
|
-
workspace=self.active_workspace.id,
|
5421
5436
|
labels=labels or {},
|
5422
5437
|
)
|
5423
5438
|
# Validate and configure the resources
|
@@ -5766,9 +5781,6 @@ class Client(metaclass=ClientMetaClass):
|
|
5766
5781
|
|
5767
5782
|
# Convert the update model to a request model for validation
|
5768
5783
|
connector_request_dict = connector_update.model_dump()
|
5769
|
-
connector_request_dict.update(
|
5770
|
-
workspace=self.active_workspace.id,
|
5771
|
-
)
|
5772
5784
|
connector_request = ServiceConnectorRequest.model_validate(
|
5773
5785
|
connector_request_dict
|
5774
5786
|
)
|
@@ -6040,7 +6052,6 @@ class Client(metaclass=ClientMetaClass):
|
|
6040
6052
|
connector_type: Optional[str] = None,
|
6041
6053
|
resource_type: Optional[str] = None,
|
6042
6054
|
resource_id: Optional[str] = None,
|
6043
|
-
workspace_id: Optional[UUID] = None,
|
6044
6055
|
) -> List[ServiceConnectorResourcesModel]:
|
6045
6056
|
"""List resources that can be accessed by service connectors.
|
6046
6057
|
|
@@ -6048,8 +6059,6 @@ class Client(metaclass=ClientMetaClass):
|
|
6048
6059
|
connector_type: The type of service connector to filter by.
|
6049
6060
|
resource_type: The type of resource to filter by.
|
6050
6061
|
resource_id: The ID of a particular resource instance to filter by.
|
6051
|
-
workspace_id: The ID of the workspace to filter by. If not provided,
|
6052
|
-
the active workspace will be used.
|
6053
6062
|
|
6054
6063
|
Returns:
|
6055
6064
|
The matching list of resources that available service
|
@@ -6057,7 +6066,6 @@ class Client(metaclass=ClientMetaClass):
|
|
6057
6066
|
"""
|
6058
6067
|
return self.zen_store.list_service_connector_resources(
|
6059
6068
|
ServiceConnectorFilter(
|
6060
|
-
workspace_id=workspace_id or self.active_workspace.id,
|
6061
6069
|
connector_type=connector_type,
|
6062
6070
|
resource_type=resource_type,
|
6063
6071
|
resource_id=resource_id,
|
@@ -6148,7 +6156,7 @@ class Client(metaclass=ClientMetaClass):
|
|
6148
6156
|
trade_offs=trade_offs,
|
6149
6157
|
ethics=ethics,
|
6150
6158
|
tags=tags,
|
6151
|
-
|
6159
|
+
project=self.active_project.id,
|
6152
6160
|
save_models_to_registry=save_models_to_registry,
|
6153
6161
|
)
|
6154
6162
|
)
|
@@ -6156,16 +6164,16 @@ class Client(metaclass=ClientMetaClass):
|
|
6156
6164
|
def delete_model(
|
6157
6165
|
self,
|
6158
6166
|
model_name_or_id: Union[str, UUID],
|
6159
|
-
|
6167
|
+
project: Optional[Union[str, UUID]] = None,
|
6160
6168
|
) -> None:
|
6161
6169
|
"""Deletes a model from Model Control Plane.
|
6162
6170
|
|
6163
6171
|
Args:
|
6164
6172
|
model_name_or_id: name or id of the model to be deleted.
|
6165
|
-
|
6173
|
+
project: The project name/ID to filter by.
|
6166
6174
|
"""
|
6167
6175
|
model = self.get_model(
|
6168
|
-
model_name_or_id=model_name_or_id,
|
6176
|
+
model_name_or_id=model_name_or_id, project=project
|
6169
6177
|
)
|
6170
6178
|
self.zen_store.delete_model(model_id=model.id)
|
6171
6179
|
|
@@ -6183,7 +6191,7 @@ class Client(metaclass=ClientMetaClass):
|
|
6183
6191
|
add_tags: Optional[List[str]] = None,
|
6184
6192
|
remove_tags: Optional[List[str]] = None,
|
6185
6193
|
save_models_to_registry: Optional[bool] = None,
|
6186
|
-
|
6194
|
+
project: Optional[Union[str, UUID]] = None,
|
6187
6195
|
) -> ModelResponse:
|
6188
6196
|
"""Updates an existing model in Model Control Plane.
|
6189
6197
|
|
@@ -6201,13 +6209,13 @@ class Client(metaclass=ClientMetaClass):
|
|
6201
6209
|
remove_tags: Tags to remove from to the model.
|
6202
6210
|
save_models_to_registry: Whether to save the model to the
|
6203
6211
|
registry.
|
6204
|
-
|
6212
|
+
project: The project name/ID to filter by.
|
6205
6213
|
|
6206
6214
|
Returns:
|
6207
6215
|
The updated model.
|
6208
6216
|
"""
|
6209
6217
|
model = self.get_model(
|
6210
|
-
model_name_or_id=model_name_or_id,
|
6218
|
+
model_name_or_id=model_name_or_id, project=project
|
6211
6219
|
)
|
6212
6220
|
return self.zen_store.update_model(
|
6213
6221
|
model_id=model.id,
|
@@ -6229,7 +6237,7 @@ class Client(metaclass=ClientMetaClass):
|
|
6229
6237
|
def get_model(
|
6230
6238
|
self,
|
6231
6239
|
model_name_or_id: Union[str, UUID],
|
6232
|
-
|
6240
|
+
project: Optional[Union[str, UUID]] = None,
|
6233
6241
|
hydrate: bool = True,
|
6234
6242
|
bypass_lazy_loader: bool = False,
|
6235
6243
|
) -> ModelResponse:
|
@@ -6237,7 +6245,7 @@ class Client(metaclass=ClientMetaClass):
|
|
6237
6245
|
|
6238
6246
|
Args:
|
6239
6247
|
model_name_or_id: name or id of the model to be retrieved.
|
6240
|
-
|
6248
|
+
project: The project name/ID to filter by.
|
6241
6249
|
hydrate: Flag deciding whether to hydrate the output model(s)
|
6242
6250
|
by including metadata fields in the response.
|
6243
6251
|
bypass_lazy_loader: Whether to bypass the lazy loader.
|
@@ -6250,7 +6258,7 @@ class Client(metaclass=ClientMetaClass):
|
|
6250
6258
|
"get_model",
|
6251
6259
|
model_name_or_id=model_name_or_id,
|
6252
6260
|
hydrate=hydrate,
|
6253
|
-
|
6261
|
+
project=project,
|
6254
6262
|
):
|
6255
6263
|
return cll # type: ignore[return-value]
|
6256
6264
|
|
@@ -6258,7 +6266,7 @@ class Client(metaclass=ClientMetaClass):
|
|
6258
6266
|
get_method=self.zen_store.get_model,
|
6259
6267
|
list_method=self.list_models,
|
6260
6268
|
name_id_or_prefix=model_name_or_id,
|
6261
|
-
|
6269
|
+
project=project,
|
6262
6270
|
hydrate=hydrate,
|
6263
6271
|
)
|
6264
6272
|
|
@@ -6273,7 +6281,7 @@ class Client(metaclass=ClientMetaClass):
|
|
6273
6281
|
name: Optional[str] = None,
|
6274
6282
|
id: Optional[Union[UUID, str]] = None,
|
6275
6283
|
user: Optional[Union[UUID, str]] = None,
|
6276
|
-
|
6284
|
+
project: Optional[Union[str, UUID]] = None,
|
6277
6285
|
hydrate: bool = False,
|
6278
6286
|
tag: Optional[str] = None,
|
6279
6287
|
tags: Optional[List[str]] = None,
|
@@ -6290,7 +6298,7 @@ class Client(metaclass=ClientMetaClass):
|
|
6290
6298
|
name: The name of the model to filter by.
|
6291
6299
|
id: The id of the model to filter by.
|
6292
6300
|
user: Filter by user name/ID.
|
6293
|
-
|
6301
|
+
project: The project name/ID to filter by.
|
6294
6302
|
hydrate: Flag deciding whether to hydrate the output model(s)
|
6295
6303
|
by including metadata fields in the response.
|
6296
6304
|
tag: The tag of the model to filter by.
|
@@ -6311,7 +6319,7 @@ class Client(metaclass=ClientMetaClass):
|
|
6311
6319
|
tag=tag,
|
6312
6320
|
tags=tags,
|
6313
6321
|
user=user,
|
6314
|
-
|
6322
|
+
project=project or self.active_project.id,
|
6315
6323
|
)
|
6316
6324
|
|
6317
6325
|
return self.zen_store.list_models(
|
@@ -6328,7 +6336,7 @@ class Client(metaclass=ClientMetaClass):
|
|
6328
6336
|
name: Optional[str] = None,
|
6329
6337
|
description: Optional[str] = None,
|
6330
6338
|
tags: Optional[List[str]] = None,
|
6331
|
-
|
6339
|
+
project: Optional[Union[str, UUID]] = None,
|
6332
6340
|
) -> ModelVersionResponse:
|
6333
6341
|
"""Creates a new model version in Model Control Plane.
|
6334
6342
|
|
@@ -6338,19 +6346,19 @@ class Client(metaclass=ClientMetaClass):
|
|
6338
6346
|
name: the name of the Model Version to be created.
|
6339
6347
|
description: the description of the Model Version to be created.
|
6340
6348
|
tags: Tags associated with the model.
|
6341
|
-
|
6349
|
+
project: The project name/ID to filter by.
|
6342
6350
|
|
6343
6351
|
Returns:
|
6344
6352
|
The newly created model version.
|
6345
6353
|
"""
|
6346
6354
|
model = self.get_model(
|
6347
|
-
model_name_or_id=model_name_or_id,
|
6355
|
+
model_name_or_id=model_name_or_id, project=project
|
6348
6356
|
)
|
6349
6357
|
return self.zen_store.create_model_version(
|
6350
6358
|
model_version=ModelVersionRequest(
|
6351
6359
|
name=name,
|
6352
6360
|
description=description,
|
6353
|
-
|
6361
|
+
project=model.project.id,
|
6354
6362
|
model=model.id,
|
6355
6363
|
tags=tags,
|
6356
6364
|
)
|
@@ -6375,7 +6383,7 @@ class Client(metaclass=ClientMetaClass):
|
|
6375
6383
|
model_version_name_or_number_or_id: Optional[
|
6376
6384
|
Union[str, int, ModelStages, UUID]
|
6377
6385
|
] = None,
|
6378
|
-
|
6386
|
+
project: Optional[Union[str, UUID]] = None,
|
6379
6387
|
hydrate: bool = True,
|
6380
6388
|
) -> ModelVersionResponse:
|
6381
6389
|
"""Get an existing model version from Model Control Plane.
|
@@ -6386,7 +6394,7 @@ class Client(metaclass=ClientMetaClass):
|
|
6386
6394
|
model_version_name_or_number_or_id: name, id, stage or number of
|
6387
6395
|
the model version to be retrieved. If skipped - latest version
|
6388
6396
|
is retrieved.
|
6389
|
-
|
6397
|
+
project: The project name/ID to filter by.
|
6390
6398
|
hydrate: Flag deciding whether to hydrate the output model(s)
|
6391
6399
|
by including metadata fields in the response.
|
6392
6400
|
|
@@ -6411,7 +6419,7 @@ class Client(metaclass=ClientMetaClass):
|
|
6411
6419
|
"get_model_version",
|
6412
6420
|
model_name_or_id=model_name_or_id,
|
6413
6421
|
model_version_name_or_number_or_id=model_version_name_or_number_or_id,
|
6414
|
-
|
6422
|
+
project=project,
|
6415
6423
|
hydrate=hydrate,
|
6416
6424
|
):
|
6417
6425
|
return cll # type: ignore[return-value]
|
@@ -6429,7 +6437,7 @@ class Client(metaclass=ClientMetaClass):
|
|
6429
6437
|
model_version_filter_model=ModelVersionFilter(
|
6430
6438
|
model=model_name_or_id,
|
6431
6439
|
number=model_version_name_or_number_or_id,
|
6432
|
-
|
6440
|
+
project=project or self.active_project.id,
|
6433
6441
|
),
|
6434
6442
|
hydrate=hydrate,
|
6435
6443
|
).items
|
@@ -6439,7 +6447,7 @@ class Client(metaclass=ClientMetaClass):
|
|
6439
6447
|
model_version_filter_model=ModelVersionFilter(
|
6440
6448
|
model=model_name_or_id,
|
6441
6449
|
sort_by=f"{SorterOps.DESCENDING}:number",
|
6442
|
-
|
6450
|
+
project=project or self.active_project.id,
|
6443
6451
|
),
|
6444
6452
|
hydrate=hydrate,
|
6445
6453
|
).items
|
@@ -6453,7 +6461,7 @@ class Client(metaclass=ClientMetaClass):
|
|
6453
6461
|
model_version_filter_model=ModelVersionFilter(
|
6454
6462
|
model=model_name_or_id,
|
6455
6463
|
stage=model_version_name_or_number_or_id,
|
6456
|
-
|
6464
|
+
project=project or self.active_project.id,
|
6457
6465
|
),
|
6458
6466
|
hydrate=hydrate,
|
6459
6467
|
).items
|
@@ -6462,7 +6470,7 @@ class Client(metaclass=ClientMetaClass):
|
|
6462
6470
|
model_version_filter_model=ModelVersionFilter(
|
6463
6471
|
model=model_name_or_id,
|
6464
6472
|
name=model_version_name_or_number_or_id,
|
6465
|
-
|
6473
|
+
project=project or self.active_project.id,
|
6466
6474
|
),
|
6467
6475
|
hydrate=hydrate,
|
6468
6476
|
).items
|
@@ -6506,7 +6514,7 @@ class Client(metaclass=ClientMetaClass):
|
|
6506
6514
|
hydrate: bool = False,
|
6507
6515
|
tag: Optional[str] = None,
|
6508
6516
|
tags: Optional[List[str]] = None,
|
6509
|
-
|
6517
|
+
project: Optional[Union[str, UUID]] = None,
|
6510
6518
|
) -> Page[ModelVersionResponse]:
|
6511
6519
|
"""Get model versions by filter from Model Control Plane.
|
6512
6520
|
|
@@ -6529,7 +6537,7 @@ class Client(metaclass=ClientMetaClass):
|
|
6529
6537
|
by including metadata fields in the response.
|
6530
6538
|
tag: The tag to filter by.
|
6531
6539
|
tags: Tags to filter by.
|
6532
|
-
|
6540
|
+
project: The project name/ID to filter by.
|
6533
6541
|
|
6534
6542
|
Returns:
|
6535
6543
|
A page object with all model versions.
|
@@ -6550,7 +6558,7 @@ class Client(metaclass=ClientMetaClass):
|
|
6550
6558
|
tags=tags,
|
6551
6559
|
user=user,
|
6552
6560
|
model=model_name_or_id,
|
6553
|
-
|
6561
|
+
project=project or self.active_project.id,
|
6554
6562
|
)
|
6555
6563
|
|
6556
6564
|
return self.zen_store.list_model_versions(
|
@@ -6568,7 +6576,7 @@ class Client(metaclass=ClientMetaClass):
|
|
6568
6576
|
description: Optional[str] = None,
|
6569
6577
|
add_tags: Optional[List[str]] = None,
|
6570
6578
|
remove_tags: Optional[List[str]] = None,
|
6571
|
-
|
6579
|
+
project: Optional[Union[str, UUID]] = None,
|
6572
6580
|
) -> ModelVersionResponse:
|
6573
6581
|
"""Get all model versions by filter.
|
6574
6582
|
|
@@ -6582,18 +6590,18 @@ class Client(metaclass=ClientMetaClass):
|
|
6582
6590
|
description: Target model version description to be set.
|
6583
6591
|
add_tags: Tags to add to the model version.
|
6584
6592
|
remove_tags: Tags to remove from to the model version.
|
6585
|
-
|
6593
|
+
project: The project name/ID to filter by.
|
6586
6594
|
|
6587
6595
|
Returns:
|
6588
6596
|
An updated model version.
|
6589
6597
|
"""
|
6590
6598
|
if not is_valid_uuid(model_name_or_id):
|
6591
|
-
model = self.get_model(model_name_or_id,
|
6599
|
+
model = self.get_model(model_name_or_id, project=project)
|
6592
6600
|
model_name_or_id = model.id
|
6593
|
-
|
6601
|
+
project = project or model.project.id
|
6594
6602
|
if not is_valid_uuid(version_name_or_id):
|
6595
6603
|
version_name_or_id = self.get_model_version(
|
6596
|
-
model_name_or_id, version_name_or_id,
|
6604
|
+
model_name_or_id, version_name_or_id, project=project
|
6597
6605
|
).id
|
6598
6606
|
|
6599
6607
|
return self.zen_store.update_model_version(
|
@@ -6947,7 +6955,7 @@ class Client(metaclass=ClientMetaClass):
|
|
6947
6955
|
logical_operator: LogicalOperators = LogicalOperators.AND,
|
6948
6956
|
trigger_id: Optional[UUID] = None,
|
6949
6957
|
user: Optional[Union[UUID, str]] = None,
|
6950
|
-
|
6958
|
+
project: Optional[Union[UUID, str]] = None,
|
6951
6959
|
hydrate: bool = False,
|
6952
6960
|
) -> Page[TriggerExecutionResponse]:
|
6953
6961
|
"""List all trigger executions matching the given filter criteria.
|
@@ -6959,7 +6967,7 @@ class Client(metaclass=ClientMetaClass):
|
|
6959
6967
|
logical_operator: Which logical operator to use [and, or].
|
6960
6968
|
trigger_id: ID of the trigger to filter by.
|
6961
6969
|
user: Filter by user name/ID.
|
6962
|
-
|
6970
|
+
project: Filter by project name/ID.
|
6963
6971
|
hydrate: Flag deciding whether to hydrate the output model(s)
|
6964
6972
|
by including metadata fields in the response.
|
6965
6973
|
|
@@ -6973,7 +6981,7 @@ class Client(metaclass=ClientMetaClass):
|
|
6973
6981
|
size=size,
|
6974
6982
|
user=user,
|
6975
6983
|
logical_operator=logical_operator,
|
6976
|
-
|
6984
|
+
project=project or self.active_project.id,
|
6977
6985
|
)
|
6978
6986
|
return self.zen_store.list_trigger_executions(
|
6979
6987
|
trigger_execution_filter_model=filter_model, hydrate=hydrate
|
@@ -6997,7 +7005,7 @@ class Client(metaclass=ClientMetaClass):
|
|
6997
7005
|
list_method: Callable[..., Page[AnyResponse]],
|
6998
7006
|
name_id_or_prefix: Union[str, UUID],
|
6999
7007
|
allow_name_prefix_match: bool = True,
|
7000
|
-
|
7008
|
+
project: Optional[Union[str, UUID]] = None,
|
7001
7009
|
hydrate: bool = True,
|
7002
7010
|
) -> AnyResponse:
|
7003
7011
|
"""Fetches an entity using the id, name, or partial id/name.
|
@@ -7010,7 +7018,7 @@ class Client(metaclass=ClientMetaClass):
|
|
7010
7018
|
allow_name_prefix_match: If True, allow matching by name prefix.
|
7011
7019
|
hydrate: Flag deciding whether to hydrate the output model(s)
|
7012
7020
|
by including metadata fields in the response.
|
7013
|
-
|
7021
|
+
project: The project name/ID to filter by.
|
7014
7022
|
|
7015
7023
|
Returns:
|
7016
7024
|
The entity with the given name, id or partial id.
|
@@ -7034,9 +7042,9 @@ class Client(metaclass=ClientMetaClass):
|
|
7034
7042
|
hydrate=hydrate,
|
7035
7043
|
)
|
7036
7044
|
scope = ""
|
7037
|
-
if
|
7038
|
-
scope = f"in
|
7039
|
-
list_kwargs["
|
7045
|
+
if project:
|
7046
|
+
scope = f"in project {project} "
|
7047
|
+
list_kwargs["project"] = project
|
7040
7048
|
entity = list_method(**list_kwargs)
|
7041
7049
|
|
7042
7050
|
# If only a single entity is found, return it
|
@@ -7050,7 +7058,7 @@ class Client(metaclass=ClientMetaClass):
|
|
7050
7058
|
list_method=list_method,
|
7051
7059
|
partial_id_or_name=name_id_or_prefix,
|
7052
7060
|
allow_name_prefix_match=allow_name_prefix_match,
|
7053
|
-
|
7061
|
+
project=project,
|
7054
7062
|
hydrate=hydrate,
|
7055
7063
|
)
|
7056
7064
|
|
@@ -7076,7 +7084,7 @@ class Client(metaclass=ClientMetaClass):
|
|
7076
7084
|
list_method: Callable[..., Page[AnyResponse]],
|
7077
7085
|
name_id_or_prefix: Union[str, UUID],
|
7078
7086
|
version: Optional[str],
|
7079
|
-
|
7087
|
+
project: Optional[Union[str, UUID]] = None,
|
7080
7088
|
hydrate: bool = True,
|
7081
7089
|
) -> "AnyResponse":
|
7082
7090
|
from zenml.utils.uuid_utils import is_valid_uuid
|
@@ -7104,9 +7112,9 @@ class Client(metaclass=ClientMetaClass):
|
|
7104
7112
|
hydrate=hydrate,
|
7105
7113
|
)
|
7106
7114
|
scope = ""
|
7107
|
-
if
|
7108
|
-
scope = f" in
|
7109
|
-
list_kwargs["
|
7115
|
+
if project:
|
7116
|
+
scope = f" in project {project}"
|
7117
|
+
list_kwargs["project"] = project
|
7110
7118
|
exact_name_matches = list_method(**list_kwargs)
|
7111
7119
|
|
7112
7120
|
if len(exact_name_matches) == 1:
|
@@ -7147,7 +7155,7 @@ class Client(metaclass=ClientMetaClass):
|
|
7147
7155
|
list_method: Callable[..., Page[AnyResponse]],
|
7148
7156
|
partial_id_or_name: str,
|
7149
7157
|
allow_name_prefix_match: bool,
|
7150
|
-
|
7158
|
+
project: Optional[Union[str, UUID]] = None,
|
7151
7159
|
hydrate: bool = True,
|
7152
7160
|
) -> AnyResponse:
|
7153
7161
|
"""Fetches an entity using a partial ID or name.
|
@@ -7159,7 +7167,7 @@ class Client(metaclass=ClientMetaClass):
|
|
7159
7167
|
allow_name_prefix_match: If True, allow matching by name prefix.
|
7160
7168
|
hydrate: Flag deciding whether to hydrate the output model(s)
|
7161
7169
|
by including metadata fields in the response.
|
7162
|
-
|
7170
|
+
project: The project name/ID to filter by.
|
7163
7171
|
|
7164
7172
|
Returns:
|
7165
7173
|
The entity with the given partial ID or name.
|
@@ -7177,9 +7185,9 @@ class Client(metaclass=ClientMetaClass):
|
|
7177
7185
|
if allow_name_prefix_match:
|
7178
7186
|
list_method_args["name"] = f"startswith:{partial_id_or_name}"
|
7179
7187
|
scope = ""
|
7180
|
-
if
|
7181
|
-
scope = f"in
|
7182
|
-
list_method_args["
|
7188
|
+
if project:
|
7189
|
+
scope = f"in project {project} "
|
7190
|
+
list_method_args["project"] = project
|
7183
7191
|
|
7184
7192
|
entity = list_method(**list_method_args)
|
7185
7193
|
|
@@ -7763,6 +7771,7 @@ class Client(metaclass=ClientMetaClass):
|
|
7763
7771
|
name: Optional[str] = None,
|
7764
7772
|
color: Optional[Union[str, ColorVariants]] = None,
|
7765
7773
|
exclusive: Optional[bool] = None,
|
7774
|
+
resource_type: Optional[Union[str, TaggableResourceTypes]] = None,
|
7766
7775
|
hydrate: bool = False,
|
7767
7776
|
) -> Page[TagResponse]:
|
7768
7777
|
"""Get tags by filter.
|
@@ -7770,7 +7779,7 @@ class Client(metaclass=ClientMetaClass):
|
|
7770
7779
|
Args:
|
7771
7780
|
sort_by: The column to sort by.
|
7772
7781
|
page: The page of items.
|
7773
|
-
size: The maximum size of all pages
|
7782
|
+
size: The maximum size of all pages
|
7774
7783
|
logical_operator: Which logical operator to use [and, or].
|
7775
7784
|
id: Use the id of stacks to filter by.
|
7776
7785
|
user: Use the user to filter by.
|
@@ -7779,6 +7788,7 @@ class Client(metaclass=ClientMetaClass):
|
|
7779
7788
|
name: The name of the tag.
|
7780
7789
|
color: The color of the tag.
|
7781
7790
|
exclusive: Flag indicating whether the tag is exclusive.
|
7791
|
+
resource_type: Filter tags associated with a specific resource type.
|
7782
7792
|
hydrate: Flag deciding whether to hydrate the output model(s)
|
7783
7793
|
by including metadata fields in the response.
|
7784
7794
|
|
@@ -7798,6 +7808,7 @@ class Client(metaclass=ClientMetaClass):
|
|
7798
7808
|
name=name,
|
7799
7809
|
color=color,
|
7800
7810
|
exclusive=exclusive,
|
7811
|
+
resource_type=resource_type,
|
7801
7812
|
),
|
7802
7813
|
hydrate=hydrate,
|
7803
7814
|
)
|