Giter Club home page Giter Club logo

Comments (9)

selwin avatar selwin commented on May 24, 2024

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.

ouhouhsami avatar ouhouhsami commented on May 24, 2024

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.

selwin avatar selwin commented on May 24, 2024

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.

ouhouhsami avatar ouhouhsami commented on May 24, 2024

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.

selwin avatar selwin commented on May 24, 2024

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.

ouhouhsami avatar ouhouhsami commented on May 24, 2024

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.

selwin avatar selwin commented on May 24, 2024

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.

ouhouhsami avatar ouhouhsami commented on May 24, 2024

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.

selwin avatar selwin commented on May 24, 2024

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)

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.