From 600778948036228ed8f7b573900ab69fd27f5cb0 Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Wed, 8 Oct 2014 14:18:41 -0400 Subject: [PATCH] Send the full traceback with any exceptions in the queue process --- util/queuefile.py | 6 ++++++ util/queueprocess.py | 6 ++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/util/queuefile.py b/util/queuefile.py index d3d802856..81e6f318e 100644 --- a/util/queuefile.py +++ b/util/queuefile.py @@ -31,9 +31,15 @@ class QueueFile(object): if isinstance(result, Exception): self._closed = True self.raised_exception = True + + handled = False for handler in self._exception_handlers: handler(result) + handled = True + if handled: + return + raise result self._buffer += result diff --git a/util/queueprocess.py b/util/queueprocess.py index 55c552422..d22ade4f0 100644 --- a/util/queueprocess.py +++ b/util/queueprocess.py @@ -4,6 +4,8 @@ import multiprocessing import os import time import gipc +import sys +import traceback logger = multiprocessing.log_to_stderr() logger.setLevel(logging.INFO) @@ -42,8 +44,8 @@ def _run(get_producer, queues, chunk_size, args): while True: try: data = producer(chunk_size) or None - except Exception as ex: - data = ex + except Exception: + data = Exception("".join(traceback.format_exception(*sys.exc_info()))) for queue in queues: try: