'Handle retry exception.'

def handle_retry(self, task, req, store_errors=True, **kwargs):

    (type_, _, tb) = sys.exc_info()
    try:
        reason = self.retval
        einfo = ExceptionInfo((type_, reason, tb))
        if store_errors:
            task.backend.mark_as_retry(req.id, reason.exc, einfo.traceback, request=req)
        task.on_retry(reason.exc, req.id, req.args, req.kwargs, einfo)
        signals.task_retry.send(sender=task, request=req, reason=reason, einfo=einfo)
        info(LOG_RETRY, {u'id': req.id, u'name': task.name, u'exc': text_t(reason)})
        return einfo
    finally:
        del tb
