From 4ee90a0c7bf7c4a1b2ef46db15bce7d7c221d48b Mon Sep 17 00:00:00 2001 From: Stefan Nica Date: Wed, 25 Oct 2023 17:53:10 +0200 Subject: [PATCH] Always set the active workspace to be the default workspace server side --- src/zenml/client.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/zenml/client.py b/src/zenml/client.py index 6b84d192ce5..84999f9e60d 100644 --- a/src/zenml/client.py +++ b/src/zenml/client.py @@ -44,6 +44,7 @@ ENV_ZENML_ACTIVE_WORKSPACE_ID, ENV_ZENML_ENABLE_REPO_INIT_WARNINGS, ENV_ZENML_REPOSITORY_PATH, + ENV_ZENML_SERVER, PAGE_SIZE_DEFAULT, PAGINATION_STARTING_PAGE, REPOSITORY_DIRECTORY_NAME, @@ -1365,6 +1366,13 @@ def active_workspace(self) -> "WorkspaceResponseModel": workspace_id = os.environ[ENV_ZENML_ACTIVE_WORKSPACE_ID] return self.get_workspace(workspace_id) + from zenml.zen_stores.base_zen_store import DEFAULT_WORKSPACE_NAME + + # If running in a ZenML server environment, the active workspace is + # not relevant + if ENV_ZENML_SERVER in os.environ: + return self.get_workspace(DEFAULT_WORKSPACE_NAME) + workspace = ( self._config.active_workspace if self._config else None ) or GlobalConfiguration().get_active_workspace() @@ -1375,8 +1383,6 @@ def active_workspace(self) -> "WorkspaceResponseModel": "workspace." ) - from zenml.zen_stores.base_zen_store import DEFAULT_WORKSPACE_NAME - if workspace.name != DEFAULT_WORKSPACE_NAME: logger.warning( f"You are running with a non-default workspace "