Mikko Ohtamaa
Mikko Ohtamaa

Reputation: 83338

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. E.g. 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.

Upvotes: 5

Views: 221

Answers (1)

Diego Navarro
Diego Navarro

Reputation: 9704

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.

Upvotes: 2

Related Questions