Giter Club home page Giter Club logo

Comments (18)

ccurvey avatar ccurvey commented on May 24, 2024 6

update for those of you finding this page from a search engine. The timeout parameter is now called job_timeout. So the proper incantation is

queue.enqueue(populate_trends, args=(self,), job_timeout=500) 

from django-rq.

ErikEvenson avatar ErikEvenson commented on May 24, 2024

I've asked about this here: http://stackoverflow.com/questions/15445036/rqworker-timeout

from django-rq.

ErikEvenson avatar ErikEvenson commented on May 24, 2024

It seems what is needed from my very quick perusal of the rq and django-rq code base, is a enqueue_call(...) method in django-rq's queue.py module that parallels rq's queue.py module here: https://github.com/nvie/rq/blob/5a5e14cc70bca19458070665eef753b9b2db78f5/rq/queue.py#L116. Then we could pass a timeout value to rq through django-rq.

from django-rq.

selwin avatar selwin commented on May 24, 2024

Yes, get_queue will return a Queue instance so you can just do:

queue = get_queue('default')
queue.enqueue(long_running_func, timeout=500)

I'm gonna close this issue, but feel free to open it again if you're having troubles.

from django-rq.

ErikEvenson avatar ErikEvenson commented on May 24, 2024

If I do that, timeout=500 is passed to my long_running_func -- not to the rq Queue initialization.

from django-rq.

ErikEvenson avatar ErikEvenson commented on May 24, 2024

I tried this and I think it is working. Thanks for your help.

queue = django_rq.get_queue('default')
queue.default_timeout = 500
queue.enqueue(
    populate_trends, 
    self, 
)

from django-rq.

selwin avatar selwin commented on May 24, 2024

Sorry for the late reply. Try this:

queue.enqueue(populate_trends, args=[self], timeout=500) 

from django-rq.

ErikEvenson avatar ErikEvenson commented on May 24, 2024

That doens't seem to work. I get an Assertion Error: [<Customer: Customer 2>] is not a valid args list. (self is a Customer object.)

from django-rq.

selwin avatar selwin commented on May 24, 2024

https://github.com/nvie/rq/blob/5a5e14cc70bca19458070665eef753b9b2db78f5/rq/job.py#L75 enforces args to be a tuple, so this should do the trick:

queue.enqueue(populate_trends, args=(self,), timeout=500) 

from django-rq.

ErikEvenson avatar ErikEvenson commented on May 24, 2024

Yep, that syntax seems to do the trick. Interesting -- thanks again for the help.

from django-rq.

mngmntt avatar mngmntt commented on May 24, 2024

Hello,

don't you want to make it an argument of @job decorator?

It doesn't really look good when you change something like this encoder.start.delay(video.id) to extra lines with getting a queue and setting a timeout.

I believe we just need to expose this argument and pass it to the get_queue in here:
https://github.com/ui/django-rq/blob/master/django_rq/decorators.py#L23

from django-rq.

freeyoung avatar freeyoung commented on May 24, 2024

Agreed with @irqed.

from django-rq.

selwin avatar selwin commented on May 24, 2024

@irqed @freeyoung you should already be able to pass timeout argument to @job decorator. Is it not working for you?

from django-rq.

mngmntt avatar mngmntt commented on May 24, 2024

@selwin @freeyoung nope, it didn't in some reason. But as you can see I've made a comment about 7 months ago. Even the link isn't correct anymore. Didn't use it since that project.

from django-rq.

selwin avatar selwin commented on May 24, 2024

@irqed sorry, I must have missed your comment. I only visited this thread again when Github sent me an email of @freeyoung's comment yesterday.

So it didn't work for you seven months ago, correct? If that's the case, it must have been a bug in RQ back then.

All along, Django RQ has accepted all *args and **kwargs and passing them into RQ's decorator so I don't see why it wouldn't work.

from django-rq.

mngmntt avatar mngmntt commented on May 24, 2024

@selwin @freeyoung yeah, I see that it should work properly. Sorry but I don't remember how I came up with this conclusion. I can't test it against that codebase anymore, I left the company. But I'll try to test it on the weekend.

from django-rq.

selwin avatar selwin commented on May 24, 2024

Thanks a lot. Much appreciated :)

Sent from my phone

On Jan 9, 2014, at 5:54 PM, Alexander Shchepetilnikov [email protected] wrote:

@selwin @freeyoung yeah, I see that it should work properly. Sorry but I don't remember how I came up with this conclusion. I can't test it against that codebase anymore, I left the company. But I'll try to test it on the weekend.


Reply to this email directly or view it on GitHub.

from django-rq.

extremoburo avatar extremoburo commented on May 24, 2024

@ccurvey == saviour

from django-rq.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.