|
|
@ -1164,6 +1164,7 @@ class Worker:
|
|
|
|
|
|
|
|
|
|
|
|
def handle_exception(self, job: 'Job', *exc_info):
|
|
|
|
def handle_exception(self, job: 'Job', *exc_info):
|
|
|
|
"""Walks the exception handler stack to delegate exception handling."""
|
|
|
|
"""Walks the exception handler stack to delegate exception handling."""
|
|
|
|
|
|
|
|
|
|
|
|
exc_string = ''.join(traceback.format_exception(*exc_info))
|
|
|
|
exc_string = ''.join(traceback.format_exception(*exc_info))
|
|
|
|
|
|
|
|
|
|
|
|
# If the job cannot be deserialized, it will raise when func_name or
|
|
|
|
# If the job cannot be deserialized, it will raise when func_name or
|
|
|
@ -1175,14 +1176,17 @@ class Worker:
|
|
|
|
'arguments': job.args,
|
|
|
|
'arguments': job.args,
|
|
|
|
'kwargs': job.kwargs,
|
|
|
|
'kwargs': job.kwargs,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func_name = job.func_name
|
|
|
|
except DeserializationError:
|
|
|
|
except DeserializationError:
|
|
|
|
extra = {}
|
|
|
|
extra = {}
|
|
|
|
|
|
|
|
func_name = '<DeserializationError>'
|
|
|
|
|
|
|
|
|
|
|
|
# the properties below should be safe however
|
|
|
|
# the properties below should be safe however
|
|
|
|
extra.update({'queue': job.origin, 'job_id': job.id})
|
|
|
|
extra.update({'queue': job.origin, 'job_id': job.id})
|
|
|
|
|
|
|
|
|
|
|
|
# func_name
|
|
|
|
# func_name
|
|
|
|
self.log.error(exc_string, exc_info=True, extra=extra)
|
|
|
|
self.log.error(f'[Job {job.id}]: exception raised while executing ({func_name})\n' + exc_string,
|
|
|
|
|
|
|
|
extra=extra)
|
|
|
|
|
|
|
|
|
|
|
|
for handler in self._exc_handlers:
|
|
|
|
for handler in self._exc_handlers:
|
|
|
|
self.log.debug('Invoking exception handler %s', handler)
|
|
|
|
self.log.debug('Invoking exception handler %s', handler)
|
|
|
|