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):
try:
self.neoctl.close() self.neoctl.close()
for node_type in 'admin', 'storage', 'master': for node_type in 'admin', 'storage', 'master':
for node in getattr(self, node_type + '_list'): for node in getattr(self, node_type + '_list'):
node.close() node.close()
self.client.em.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