def cb(status, msg): if is_success(status): beanstalk.delete(job_id) elif is_error(status): self.logger.warn( 'event %s handling failure (release with delay): %s', event['job_id'], msg) beanstalk.release(job_id, delay=RELEASE_DELAY)
def cb(status, msg): if is_success(status): beanstalk.delete(job_id) elif is_error(status): self.logger.warn('bury event %r' % event) beanstalk.bury(job_id) else: self.logger.warn('release event %r' % event) beanstalk.release(job_id)
def cb(status, msg): if is_success(status): try: beanstalk.delete(job_id) except ResponseError as err: self.logger.warn( "Job %s succeeded but was not deleted: %s", job_id, err) elif is_error(status): self.logger.warn( 'event %s handling failure (release with delay): %s', job_id, msg) try: beanstalk.release(job_id, delay=RELEASE_DELAY) except ResponseError as err: self.logger.error( "Job %s failed and could not be rescheduled: %s", job_id, err)