Skip to content
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

How to increase timeout of failed jobs #455

Open
eriktelepovsky opened this issue Nov 15, 2020 · 12 comments
Open

How to increase timeout of failed jobs #455

eriktelepovsky opened this issue Nov 15, 2020 · 12 comments

Comments

@eriktelepovsky
Copy link

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.

@selwin
Copy link
Collaborator

selwin commented Nov 18, 2020

Are you getting the queue using django_rq.get_queue()?

@eriktelepovsky
Copy link
Author

Hi @selwin. Do you mean when I requeue the failed jobs? I don't do it programmatically. I use django admin action:

image

@selwin
Copy link
Collaborator

selwin commented Nov 30, 2020

No, I meant when you're enqueueing the job originally.

@eriktelepovsky
Copy link
Author

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()

@selwin
Copy link
Collaborator

selwin commented Nov 30, 2020

Yeah, so I think that should work. Are your settings.py configured correctly? Alternatively you can also do @job('long_running', timeout=1000)

@eriktelepovsky
Copy link
Author

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.

@selwin
Copy link
Collaborator

selwin commented Nov 30, 2020 via email

@eriktelepovsky
Copy link
Author

I can look into it. Can you guide me where to start?

@selwin
Copy link
Collaborator

selwin commented Nov 30, 2020

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:
Selection_281

@eriktelepovsky
Copy link
Author

And what about automatic timeout update according to the current settings when job is requeued?

@selwin
Copy link
Collaborator

selwin commented Nov 30, 2020

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.

@eriktelepovsky
Copy link
Author

I created a PR #458

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants