-
Notifications
You must be signed in to change notification settings - Fork 0
concurrency: fix multiexception rendering to include timestamp and context; add timestamp exceptions if concurrent #68
Conversation
…ntext; add timestamp exceptions if concurrent
for exc in self.actual: | ||
with buff.indent("{.__class__.__qualname__}", exc): | ||
if isinstance(exc, self.__class__): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(This is actually a bug now that MultiException subtyping is in...)
@@ -343,15 +360,16 @@ def logged_wait(self, timeout=None, initial_log_interval=None): | |||
|
|||
|
|||
def _run_with_exception_logging(func, args, kwargs, ctx): | |||
ctx.update(threadname=threading.current_thread().name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ctx['threadname'] = threading.current_thread().name
(yea, I know it's unrefactored code, but there is no reason not to use the conventional style here...)
@@ -936,6 +954,10 @@ def _logged_func(self): | |||
except Exception as exc: | |||
_logger.silent_exception("Exception in thread running %s (traceback can be found in debug-level logs)", self.func) | |||
self.exc = exc | |||
try: | |||
exc.timestamp = time.time() | |||
except Exception: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What kind of Exception
are we expecting here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if exc
happens to have __slots__
or some __setattribute__
or a read-only timestamp
property it might not allow arbitrary attribute assignment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And we don't want a more specific exception? Or we just don't want to take the chance an exception logging related code will fail?
There's a bunch of code duplication here, but it's too much to refactor at this stage. In other words, we're looking for bugs, not so much for code elegance...