Send the full traceback with any exceptions in the queue process
This commit is contained in:
parent
bb9502ee77
commit
6007789480
2 changed files with 10 additions and 2 deletions
|
@ -31,8 +31,14 @@ 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
|
||||
|
||||
|
|
|
@ -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:
|
||||
|
|
Reference in a new issue