Add traceback when setting exception on an excepted Future#113
Add traceback when setting exception on an excepted Future#113
Future#113Conversation
This was not being done, and so when the final value of the future was resolved, only the tornado stack trace was shown and the value of the original value. However, without the original traceback, debugging is practically impossible.
d42a7ed to
65a148e
Compare
| self.future().set_exception(exc_info[1]) | ||
| exception = exc_info[1] | ||
| exception.__traceback__ = exc_info[2] | ||
| self.future().set_exception(exception) |
There was a problem hiding this comment.
Just a question: is this really the recommended way of doing this (i.e. peeling out things from exc_info by hand?)
Is there no wrapper that transforms exc_info into something you can pass to future().set_exception?
There was a problem hiding this comment.
I am only doing this because the future here is a tornado concurrent.Future and the implementation of set_exception is as follows:
def set_exception(self, exception):
"""Sets the exception of a ``Future.``"""
self.set_exc_info(
(exception.__class__,
exception,
getattr(exception, '__traceback__', None)))
I am not sure if them getting __traceback__ is standard practice, but because we were not setting it, we were not seeing the actual stack trace of excepted processes
There was a problem hiding this comment.
I see that the exc_info is something homegrown:
plumpy/plumpy/process_states.py
Line 362 in 9a6ab9f
Should we open an issue to consider using a standard exception class rather than separate values for exception type, message and traceback?
Anyhow, this explains why you need to do manual work here...
There was a problem hiding this comment.
No that is actually standard python. If you call sys.exc_info it will return a tuple of exception type, exception and traceback. This is just a utility function to returns the stored version, because the system can override the current one if another exception occurs.
…am#113) This was not being done, and so when the final value of the future was resolved, only the tornado stack trace was shown and the value of the original value. However, without the original traceback, debugging is practically impossible.
Fixes #111
This was not being done, and so when the final value of the future was
resolved, only the tornado stack trace was shown and the value of the
original value. However, without the original traceback, debugging is
practically impossible.