Skip to content

Commit

Permalink
[FSTORE-1320] Fix hopsworks.login second attempt not taking parameter…
Browse files Browse the repository at this point in the history
…s into account (#192)

* Cleanup client irrespective of whether connection was set

* Reset client in connection before initialising it
  • Loading branch information
vatj committed Apr 5, 2024
1 parent b4336d5 commit 070c4a9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
5 changes: 3 additions & 2 deletions python/hopsworks/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from pathlib import Path

from hopsworks.client.exceptions import RestAPIError, ProjectException
from hopsworks import version, constants
from hopsworks import version, constants, client
from hopsworks.connection import Connection

# Needs to run before import of hsml and hsfs
Expand Down Expand Up @@ -283,6 +283,7 @@ def _prompt_project(valid_connection, project):

def logout():
global _hw_connection
if type(_hw_connection) is Connection:
if isinstance(_hw_connection, Connection):
_hw_connection.close()
client.stop()
_hw_connection = Connection.connection
3 changes: 2 additions & 1 deletion python/hopsworks/client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,6 @@ def set_python_version(python_version):

def stop():
global _client
_client._close()
if _client:
_client._close()
_client = None
1 change: 1 addition & 0 deletions python/hopsworks/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ def connect(self):
conn.connect()
```
"""
client.stop()
self._connected = True
try:
# init client
Expand Down

0 comments on commit 070c4a9

Please sign in to comment.