Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

rq timeout param in enqueue call not working, giving JobTimeoutException

I am trying to change the timeout on an rq job but nothing seems to work. I've got something to the effect of:

my_queue = Queue('my_task', connection=Redis())

job_args = (1, 2, 4)

my_queue.enqueue_call(
                    my_func,
                    args=job_args,
                    timeout=2700
            )

but I'm still getting

JobTimeoutException: Job exceeded maximum timeout value (180 seconds)

I've got so desperate I even tried going into the rq module queue.py and changing the default argument for timeout to 2700 and DEFAULT_TIMEOUT (variable defined in the Queue class, which contains the enqueue_call method). Am I missing something or is there an issue with this anyone knows about? Thanks!

like image 907
Obj3ctiv3_C_88 Avatar asked Apr 27 '16 18:04

Obj3ctiv3_C_88


2 Answers

We can tackle this by setting the timeout at Queue initialization.

from rq import Worker, Queue, Connection
q = Queue(default_timeout=3600)

Hope this will solve your query.

like image 159
asitm9 Avatar answered Oct 01 '22 18:10

asitm9


Use

my_queue = Queue('my_task', connection=Redis())
job_args = [1, 2, 4]

my_queue.enqueue_call(
                f=my_func,
                job_timeout=2700,
                args=job_args
        )

timeout is not the correct parameter name. Check "parse_args" function for all other parameter names in queue.py

like image 25
Shubhankar Mohan Avatar answered Oct 01 '22 19:10

Shubhankar Mohan