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