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): |       if isinstance(result, Exception): | ||||||
|         self._closed = True |         self._closed = True | ||||||
|         self.raised_exception = True |         self.raised_exception = True | ||||||
|  | 
 | ||||||
|  |         handled = False | ||||||
|         for handler in self._exception_handlers: |         for handler in self._exception_handlers: | ||||||
|           handler(result) |           handler(result) | ||||||
|  |           handled = True | ||||||
|  |          | ||||||
|  |         if handled: | ||||||
|  |           return | ||||||
| 
 | 
 | ||||||
|         raise result |         raise result | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -4,6 +4,8 @@ import multiprocessing | ||||||
| import os | import os | ||||||
| import time | import time | ||||||
| import gipc | import gipc | ||||||
|  | import sys | ||||||
|  | import traceback | ||||||
| 
 | 
 | ||||||
| logger = multiprocessing.log_to_stderr() | logger = multiprocessing.log_to_stderr() | ||||||
| logger.setLevel(logging.INFO) | logger.setLevel(logging.INFO) | ||||||
|  | @ -42,8 +44,8 @@ def _run(get_producer, queues, chunk_size, args): | ||||||
|   while True: |   while True: | ||||||
|     try: |     try: | ||||||
|       data = producer(chunk_size) or None |       data = producer(chunk_size) or None | ||||||
|     except Exception as ex: |     except Exception: | ||||||
|       data = ex |       data = Exception("".join(traceback.format_exception(*sys.exc_info()))) | ||||||
| 
 | 
 | ||||||
|     for queue in queues: |     for queue in queues: | ||||||
|       try: |       try: | ||||||
|  |  | ||||||
		Reference in a new issue