Commit 80a1426b authored by Vincent Pelletier's avatar Vincent Pelletier

Print tracebacks for exceptions occurring in NEOCluster.__del__ .

parent 75e245fe
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
import os, random, socket, sys, tempfile, threading, time, types, weakref import os, random, socket, sys, tempfile, threading, time, types, weakref
import traceback
from collections import deque from collections import deque
from itertools import count from itertools import count
from functools import wraps from functools import wraps
...@@ -665,12 +666,16 @@ class NEOCluster(object): ...@@ -665,12 +666,16 @@ class NEOCluster(object):
txn = transaction.TransactionManager() txn = transaction.TransactionManager()
return txn, self.db.open(transaction_manager=txn) return txn, self.db.open(transaction_manager=txn)
def __del__(self): def __del__(self, __print_exc=traceback.print_exc):
self.neoctl.close() try:
for node_type in 'admin', 'storage', 'master': self.neoctl.close()
for node in getattr(self, node_type + '_list'): for node_type in 'admin', 'storage', 'master':
node.close() for node in getattr(self, node_type + '_list'):
self.client.em.close() node.close()
self.client.em.close()
except:
__print_exc()
raise
def extraCellSortKey(self, key): def extraCellSortKey(self, key):
return Patch(self.client.cp, _getCellSortKey=lambda orig, *args: return Patch(self.client.cp, _getCellSortKey=lambda orig, *args:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment