Deleting all pending tasks in celery / rabbitmq

2019-01-20 21:39发布

How can I delete all pending tasks without knowing the task_id for each task?

7条回答
Animai°情兽
2楼-- · 2019-01-20 22:26

For Celery 2.x and 3.x:

When using worker with -Q parameter to define queues, for example

celery worker -Q queue1,queue2,queue3

then celery purge will not work, because you cannot pass the queue params to it. It will only delete the default queue. The solution is to start your workers with --purge parameter like this:

celery worker -Q queue1,queue2,queue3 --purge

This will however run the worker.

Other option is to use the amqp subcommand of celery

celery amqp queue.delete queue1
celery amqp queue.delete queue2
celery amqp queue.delete queue3
查看更多
登录 后发表回答