Replies: 3 comments
-
This is a good point, we should probably implement something like |
Beta Was this translation helpful? Give feedback.
-
I looked into this as well. One option would be to subclass the Example: class MyWorker(Worker):
def handle_job_failure(self, job: 'Job', queue: 'Queue', started_job_registry=None, exc_string=''):
if <logic-to-abort-job-retries>:
self._stopped_job_id = job.id
job.retries_left = None
super().handle_job_failure(job, queue, started_job_registry, exc_string) |
Beta Was this translation helpful? Give feedback.
-
Besides implementing customizable exceptions like I'm happy to accept a PR for both :) |
Beta Was this translation helpful? Give feedback.
-
Hello,
I am trying to use the on_failure callback to prevent a job from retrying. Is there a better way than setting the job's
retry_count
to 0?I cant find any documentation or an method I can call to "prevent a job from retrying".
My use case I am trying to solve is to prevent a job from retrying if it fails due to a JobTimeout exception.
thanks
Beta Was this translation helpful? Give feedback.
All reactions