New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is it possible to fail a job other than by raising an exception? #1313
Comments
At the moment raising an exception is the only way to fail a job. I'm open to ideas. |
I don't know much about the implementation of rq. As a user, I imagine something like:
|
I don't know if I should open a new issue, but I think it's strongly related to this one: Is there a possibility to raise an exception from "outside" of the worker or job in order to cancel/stop an ongoing job? |
This issue is about failing a job from “inside” the job. So I think the question of how to stop it from the outside merits its own issue. But perhaps you can reference this one. |
Please see this answer. Also, I use a custom retry handler function implementation. The job of the retry handler is,
I think its worth having a look and think it might help in some way. |
Starting from version 1.5.0, RQ allows you to configure retries.
So if you want RQ to retry your function, simply raise an exception within your function. |
I think there's no other solution than using exceptions because running code after failing the job doesn't make sense. I can implement a function similar to #1313 (comment) that will raise an error with some more information than a simple error. |
So the good news is that the in development version of RQ actually solves a few issues discussed in this thread.
RQ 1.7.0 comes with
RQ 1.8.0 (to be released) will include |
I heavily use the new Retrying Failed Jobs feature. (Thank you again 🎉)
At them moment I raise an exception, whenever I want a job to fail.
Is it possible to fail a job other than by raising an exception?
This would be interesting because it would often better communicate the intention of the code and also to keep the logs clean.
The text was updated successfully, but these errors were encountered: