Skip to content

Commit 8644b05

Browse files
committed
Revert "Add finalizer to Connection (logicalclocks#365)"
This reverts commit 44cedc0.
1 parent 16cf15a commit 8644b05

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

python/hopsworks_common/connection.py

+1-7
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import re
2222
import sys
2323
import warnings
24-
import weakref
2524
from typing import Any, Optional
2625

2726
from hopsworks_common import client, usage, util, version
@@ -352,7 +351,6 @@ def connect(self) -> None:
352351
"""
353352
client.stop()
354353
self._connected = True
355-
finalizer = weakref.finalize(self, self.close)
356354
try:
357355
# determine engine, needed to init client
358356
if (self._engine is not None and self._engine.lower() == "spark") or (
@@ -415,7 +413,6 @@ def connect(self) -> None:
415413
self._provide_project()
416414
except (TypeError, ConnectionError):
417415
self._connected = False
418-
finalizer.detach()
419416
raise
420417

421418
self._check_compatibility()
@@ -449,7 +446,7 @@ def close(self) -> None:
449446
This will clean up any materialized certificates on the local file system of
450447
external environments such as AWS SageMaker.
451448
452-
Usage is optional.
449+
Usage is recommended but optional.
453450
454451
!!! example
455452
```python
@@ -458,9 +455,6 @@ def close(self) -> None:
458455
conn.close()
459456
```
460457
"""
461-
if not self._connected:
462-
return # the connection is already closed
463-
464458
from hsfs import engine
465459

466460
if OpenSearchClientSingleton._instance:

0 commit comments

Comments
 (0)