Skip to content

Commit

Permalink
Always set the active workspace to be the default workspace server si…
Browse files Browse the repository at this point in the history
…de (#1989)
  • Loading branch information
stefannica authored Oct 26, 2023
1 parent 0158785 commit 7c45c9a
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/zenml/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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()
Expand All @@ -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 "
Expand Down

0 comments on commit 7c45c9a

Please sign in to comment.