spinach icon indicating copy to clipboard operation
spinach copied to clipboard

Non-idempotent jobs (max_retries unset) that fail on a dead broker are not signalled

Open bigjools opened this issue 3 years ago • 1 comments

Work was recently completed to send signals for jobs that fail as a result of a dead broker, however those jobs that have max_retries unset are not signalled as failed at all, unlike the idempotent ones which DO send a failure signal.

bigjools avatar Mar 10 '22 00:03 bigjools

Maybe try this.

Modify the Worker class in spinach to handle non-idempotent jobs that fail on a dead broker. Specifically, you can add a check in the process_job method to see if the job has max_retries unset, and if so, signal the job as failed if it fails due to a dead broker.

Here's an example implementation:

from spinach.worker import Worker

class CustomWorker(Worker):
    def process_job(self, job):
        try:
            self._process_job(job)
        except Exception as e:
            if not job.max_retries and 'dead' in str(e):
                self.send_failure_signal(job)
            else:
                raise e

some1ataplace avatar Apr 06 '23 23:04 some1ataplace

Fixed in 0.0.23

bigjools avatar May 10 '24 01:05 bigjools