简体   繁体   中英

Celery: selectively clearing queue from Python tasks

Sometimes I have a situation where Celery queue builds up on accidental unnecessary tasks, clogging down the server. Eg the code shoots up 20 000 tasks instead of 1.

How one can inspect what Python tasks Celery queue contains and then get selectively rid of certain tasks?

Tasks are defined and started with the standard Celery decorators (if that matters):

@task()
def update_foobar(foo, bar):
    # Some heavy activon here
    pass

update_foobar.delay(foo, bar)

Stack: Django + Celery + RabbitMQ.

Maybe you can use Flower . It's a real time monitor for Celery with a nice web interface. I think you can shutdown tasks from there. Anyways I would try to avoid those queued unnecessary tasks.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM