-
Notifications
You must be signed in to change notification settings - Fork 129
Closed
Description
Tracebacks of exceptions raised remotely via Executor.map() don't show the call stack of the worker but only
.../concurrent/futures/_base.py", line 391, in __get_result
raise self._exception
Python's internal concurrent.futures shows the remote traceback through the following "hack" at https://github.com/python/cpython/blob/5bc2390229bbcb4f13359e867fd8a140a1d5496b/Lib/concurrent/futures/process.py#L116
# Hack to embed stringification of remote traceback in local traceback
class _RemoteTraceback(Exception):
def __init__(self, tb):
self.tb = tb
def __str__(self):
return self.tb
class _ExceptionWithTraceback:
def __init__(self, exc, tb):
tb = ''.join(format_exception(type(exc), exc, tb))
self.exc = exc
# Traceback object needs to be garbage-collected as its frames
# contain references to all the objects in the exception scope
self.exc.__traceback__ = None
self.tb = '\n"""\n%s"""' % tb
def __reduce__(self):
return _rebuild_exc, (self.exc, self.tb)
def _rebuild_exc(exc, tb):
exc.__cause__ = _RemoteTraceback(tb)
return exc
I suggest a similar technique be applied at
mpi4py/src/mpi4py/futures/_lib.py
Line 59 in d56ecfd
def sys_exception(): |
def sys_exception():
exc = sys.exc_info()[1]
exc.__traceback__ = None
return exc
Metadata
Metadata
Assignees
Labels
No labels