Skip to content

Commit

Permalink
[AUTO-BACKPORT 10173] fix: client.logout() re-enables client.login() (#…
Browse files Browse the repository at this point in the history
…10177)

Co-authored-by: Ryan <rb@hpe.com>
  • Loading branch information
github-actions[bot] and rb-determined-ai authored Nov 1, 2024
1 parent 42f74e6 commit 88c8887
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions harness/determined/experimental/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,15 +308,17 @@ def whoami() -> User:
# DOES NOT REQUIRE SINGLETON (don't force a login in order to log out).
def logout() -> None:
"""Log out of the current session."""
if _determined is not None:
return _determined.logout()

logger.warning(
"client has not been logged in, either explicitly by client.login() or implicitly by any "
"other client.* function, so client.logout() has no session to log out of and is a no-op. "
"If you would like to log out of the default active session, try "
"client.Determined().logout() instead."
)
global _determined
if _determined is None:
logger.warning(
"client has not been logged in, either explicitly by client.login() or implicitly by "
"any other client.* function, so client.logout() has no session to log out of and is a "
"no-op. If you would like to log out of the default active session, try "
"client.Determined().logout() instead."
)
else:
_determined.logout()
_determined = None


@_require_singleton
Expand Down

0 comments on commit 88c8887

Please sign in to comment.