Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always set the active workspace to be the default workspace server side #1989

Merged
merged 1 commit into from
Oct 26, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading