gaiacoop / django-huey

A django integration for huey task queue that supports multi queue management
MIT License
67 stars 5 forks source link

django-huey-monitor not working with djangohuey #10

Closed EvelynArinaitwe closed 2 years ago

EvelynArinaitwe commented 2 years ago

I use djangohuey --queue [name of queue] to run consumer, this runs my task, but the django-huey-monitor does not track the tasks, or are not created in the huey_monitor database tables. Which configuration am I missing?

pablop94 commented 2 years ago

Which is your DJANGO_HUEY setting?

pablop94 commented 2 years ago

It will work if you do the following:


from django_huey import db_task, on_startup, signal
from huey_monitor.tasks import startup_handler, store_signals

signal(queue='fast')(store_signals)
on_startup(queue='fast')(startup_handler)

@db_task(queue='fast')
def slow_task(parameter):
    import time
    time.sleep(60)

I'll be adding a comment in the README and maybe a configuration flag to register those signals automatically.

nkhaldi commented 1 year ago

If I have 2 queues: general and db I should do this?

signal(queue="general")(store_signals)
on_startup(queue="general")(startup_handler)
signal(queue="db")(store_signals)
on_startup(queue="db")(startup_handler)

What if I have multiple tasks.py files for each django application? Do I need to make this setup for each of them?

Anyway it does not work for me :(