-
-
Notifications
You must be signed in to change notification settings - Fork 282
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
get_current_job from django_rq #35
Comments
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? |
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). I tried
I think I should use something like from an API point of view.
|
Sorry I wasn't being entirely clear. What I meant is that we already push the Redis connection into LocalStack when you run
|
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, |
Hold on, why would you want to use get_current_job within runserver command?
|
I want to be able to get the current job in progress (not the enqueued ones). |
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.
|
Ok, I just need helping hand to for the way to 'ask' workers about the job they are working on.
I can get worker.state, but not the current_job is working on. Is this the way to do it ? Also, I need to take a look at this : rq/rq#269 |
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 :) |
Hi,
I'm trying to use get_current_job() function from rq , but I can't figure how to do this.
I'm using django_rq, and think it's a problem of connection ?
When looking a code in rq/jobs.py, we see it uses LocalStack, and it seems that LocalStack is not 'aware' of our redis connection, as mentioned in django_rq rqworker command.
Cheers,
The text was updated successfully, but these errors were encountered: