Skip to content

Commit e4cb40f

Browse files
authored
[FSTORE-1320] Fix hopsworks.login second attempt not taking parameters into account (#192) (#196)
* Cleanup client irrespective of whether connection was set * Reset client in connection before initialising it
1 parent b4336d5 commit e4cb40f

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

python/hopsworks/__init__.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
from pathlib import Path
2424

2525
from hopsworks.client.exceptions import RestAPIError, ProjectException
26-
from hopsworks import version, constants
26+
from hopsworks import version, constants, client
2727
from hopsworks.connection import Connection
2828

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

284284
def logout():
285285
global _hw_connection
286-
if type(_hw_connection) is Connection:
286+
if isinstance(_hw_connection, Connection):
287287
_hw_connection.close()
288+
client.stop()
288289
_hw_connection = Connection.connection

python/hopsworks/client/__init__.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -67,5 +67,6 @@ def set_python_version(python_version):
6767

6868
def stop():
6969
global _client
70-
_client._close()
70+
if _client:
71+
_client._close()
7172
_client = None

python/hopsworks/connection.py

+1
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@ def connect(self):
239239
conn.connect()
240240
```
241241
"""
242+
client.stop()
242243
self._connected = True
243244
try:
244245
# init client

0 commit comments

Comments
 (0)