Comments (18)
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.
I've asked about this here: http://stackoverflow.com/questions/15445036/rqworker-timeout
from django-rq.
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.
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.
If I do that, timeout=500
is passed to my long_running_func
-- not to the rq Queue
initialization.
from django-rq.
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.
Sorry for the late reply. Try this:
queue.enqueue(populate_trends, args=[self], timeout=500)
from django-rq.
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.
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.
Yep, that syntax seems to do the trick. Interesting -- thanks again for the help.
from django-rq.
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.
Agreed with @irqed.
from django-rq.
@irqed @freeyoung you should already be able to pass timeout
argument to @job
decorator. Is it not working for you?
from django-rq.
@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.
@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.
@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.
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.
@ccurvey == saviour
from django-rq.
Related Issues (20)
- Regarding Logging
- django.core.exceptions.ImproperlyConfigured: Requested setting RQ_SHOW_ADMIN_LINK, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings. HOT 2
- Worker pool implementation
- job_timeout is not killing subprocess
- Separate RQScheduler into its own fake model
- RQ Job Terminated Unexpectedly HOT 2
- Allow Specifying Default Serializer for Django-RQ Queue HOT 2
- How to run django-rq worker via Webhook/API call HOT 1
- Django dumpdata will fail because of unmanaged model HOT 1
- KeyError accessing stats page HOT 2
- Error in job_detail.html at line 226 HOT 2
- Sentinel support broken since 2.9.0 HOT 5
- Add support for floating point intervals in rescheduler command HOT 1
- ValueError: Invalid attribute name/AttributeError: module has no attribute
- keys of command in MULTI calls must be in same slot HOT 1
- TypeError in job_detail.html with Python 12 HOT 3
- Database Errors When Running rqworker-pool HOT 14
- RQ WorkerPool is not loading models at all
- `get_scheduler` should support a custom connection
- Tag 2.10.2 on Git HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-rq.