Inline unhandled failure handler

main
Yannis Spiliopoulos 9 years ago
parent 14d8783212
commit b38aaab8a7

@ -538,9 +538,19 @@ class Worker(object):
pipeline.execute() pipeline.execute()
except Exception: except Exception:
pass pass
self.move_to_failed_queue_unhandled(
#Unhandled failure: move the job to the failed queue
self.log.warning(
'Moving job to {0!r} queue'.format(
self.failed_queue.name
)
)
self.failed_queue.quarantine(
job, job,
"Work-horse proccess was terminated unexpectedly" exc_info=(
"Work-horse proccess "
"was terminated unexpectedly"
)
) )
break break
except OSError as e: except OSError as e:
@ -732,11 +742,6 @@ class Worker(object):
self.log.warning('Moving job to {0!r} queue'.format(self.failed_queue.name)) self.log.warning('Moving job to {0!r} queue'.format(self.failed_queue.name))
self.failed_queue.quarantine(job, exc_info=exc_string) self.failed_queue.quarantine(job, exc_info=exc_string)
def move_to_failed_queue_unhandled(self, job, message):
"""Unhandled failure default handler: move the job to the failed queue."""
self.log.warning('Moving job to {0!r} queue'.format(self.failed_queue.name))
self.failed_queue.quarantine(job, exc_info=message)
def push_exc_handler(self, handler_func): def push_exc_handler(self, handler_func):
"""Pushes an exception handler onto the exc handler stack.""" """Pushes an exception handler onto the exc handler stack."""
self._exc_handlers.append(handler_func) self._exc_handlers.append(handler_func)

Loading…
Cancel
Save