We log our exception data and this seemed like an elegant way to do so. In our case, we wanted to log the exception only if it happened on the first try, so:
if metadata['failed'] and not metadata['retried']:
Thanks for pyres!
Add exception to metadata dictionary if job fails for use in after_pe…