HUEY alternative for rq.get_current_job()

338 Views Asked by At

We are migrating from rq, django-rq to HUEY for one of our Django project as rq is causing trouble running in Windows machine due to fork issue.

There was a function in rq named get_current_job() which actually returns the current instance of running job no matter where ever it's been called:

from rq import get_current_job

def update_job_status(status):
    job = get_current_job()  # even though no arguments are passed it's returning the current instance of job which is running in the memory.
    BackgroundJob.objects.filter(jobid=job.id).update(status=status)

I know that I can pass the Huey's task as an argument to update_job_status but the problem is it's been called from hell lot of the functions/nested functions and it's very difficult to change all the codes.

Is it possible to achieve something similar in Huey?

0

There are 0 best solutions below