Comments (9)
We used to have a problem where jobs with "get_current_job" would fail , but not ever since we added this line here: https://github.com/ui/django-rq/blob/master/django_rq/management/commands/rqworker.py#L69
Are you getting any errors?
from django-rq.
No, I don't get errors, I just get None returned by the get_current_job when I call it from outside the management command, even if there are current job in progress (not in queue, but job which is actually in progress).
So, as you mention, I don't know how I can push the redis connection inside LocalStack in django views.
I tried
import rq
rq.get_current_job() # return None
I think I should use something like from an API point of view.
import django_rq
django_rq.get_current_job()
from django-rq.
Sorry I wasn't being entirely clear. What I meant is that we already push the Redis connection into LocalStack when you run python manage.py rqworker
.
get_current_job
should just work. Are you running into these issues when during tests or in production? Could you perhaps provide a failing test case for this issue?
from django-rq.
Thx for your answer.
Well, I understood what you have done, but I think it's only working inside the scope of rqworker management command. In my use case, I need to access the get_current_job "from inside" the runserver command, which is an other process. I try to write the test !.
Cheers,
from django-rq.
Hold on, why would you want to use get_current_job within runserver command?
On Oct 16, 2013, at 2:04 PM, samuel goldszmidt [email protected] wrote:
Thx for your answer.
Well, I understood what you have done, but I think it's only working inside the scope of rqworker management command. In my use case, I need to access the get_current_job "from inside" the runserver command, which is an other process. I try to write the test !.
Cheers,
—
Reply to this email directly or view it on GitHub.
from django-rq.
I want to be able to get the current job in progress (not the enqueued ones).
I have got a django app that allows users to launch jobs, and I want to inform them about the state of these jobs : if it's "in progress", "failed" or "enqueued". May be my approach seems wrong to you ?
from django-rq.
It won't work because under runserver, that function would just be a regular function and not a job (get_current_job would always return None).
What you can do is to get the job id of the resultant job and query RQ for the status of the job from within Django.
On Oct 16, 2013, at 2:20 PM, samuel goldszmidt [email protected] wrote:
I want to be able to get the current job in progress (not en enqueued ones).
I have got a django app that allow user to launch jobs, and I want to inform them about the state of theirs job : if it's in progress, failed, or enqueued. May be my approach seems wrong to you ?—
Reply to this email directly or view it on GitHub.
from django-rq.
Ok, I just need helping hand to for the way to 'ask' workers about the job they are working on.
I have:
import django_rq
worker = django_rq.get_worker('default')
I can get worker.state, but not the current_job is working on. Is this the way to do it ?
Because I don't thing it's a good approach to keep job ids from the place I have enqueued them, as this information should be somewhere on the redis.
Also, I need to take a look at this : rq/rq#269
from django-rq.
It's not currently possible to ask workers about the job they're working on. You're right in that rq/rq#269 is what you'll need. I think it's a reasonable feature request :)
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.