def atomic_method(method):
 def wrapper(*args, **kwargs):
  try:
   method(*args, **kwargs)
  except Exception:
   args[0].exceptionq.put(('A worker thread crashed:\n' + traceback.format_exc()))
 return wrapper

def atomic_method ( method ) : def wrapper ( * args , ** kwargs ) : try : method ( * args , ** kwargs ) except Exception : args [ 0 ] . exceptionq . put ( ( 'A worker thread crashed:\n' + traceback . format_exc ( ) ) ) return wrapper
decorator to catch the exceptions that happen in detached thread atomic tasks and display them in the logs .