django-rq
django-rq copied to clipboard
How to increase timeout of failed jobs
Hello. Is there a way how to change/increase timeout of failed jobs?
My jobs fail with exception:
rq.timeouts.JobTimeoutException: Task exceeded maximum timeout value
so I increased the DEFAULT_TIMEOUT
in RQ_QUEUES
setting, but every time I requeue failed jobs, the new setting is ignored and and is used previous timeout value.
Are you getting the queue using django_rq.get_queue()
?
Hi @selwin. Do you mean when I requeue the failed jobs? I don't do it programmatically. I use django admin action:
No, I meant when you're enqueueing the job originally.
I'm using method decorator:
from django_rq import job
@job('long_running')
def my_method()
...
so yes, I presume it is using get_queue()
Yeah, so I think that should work. Are your settings.py configured correctly? Alternatively you can also do @job('long_running', timeout=1000)
When I increase the timeout in the settings, it is applied to all new delayed jobs successfully. But it is not applied to the requeued failed jobs. Old timeout value is used.
Ah ok. Then what’s needed is a feature that allows you to update job.timeout prior to requeueing it.
Unfortunately this feature is not in DjangoRQ yet. If you want, I’ll be happy to accept a PR for this.
On Nov 30, 2020, at 3:54 PM, Erik Telepovský [email protected] wrote:
When I increase the timeout in the settings, it is applied to all new delayed jobs successfully. But it is not applied to the requeued failed jobs. Old timeout value is used.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.
I can look into it. Can you guide me where to start?
Create an edit_job_timeout
view in https://github.com/rq/django-rq/blob/master/django_rq/views.py#L302
This view should be reachable via job detail page:
And what about automatic timeout update according to the current settings when job is requeued?
It won't be automated, since the job
object is already created and stored in Redis, complete with it's timeout. Automatically updating a value that's already stored, whether it's in DB or Redis whenever a configuration is changed is not recommended.
I created a PR #458