How can I delete all pending tasks without knowing the task_id
for each task?
相关问题
- flask application with watchdog observer
- Error message 'No handlers could be found for
- How can I convince powershell (run through task sc
- RabbitMQ management plugin windows renders as blan
- Are topic exchanges the only exchanges that suppor
相关文章
- How do do an async ServiceController.WaitForStatus
- getting error Received unregistered task of type &
- How to check if an activity is locked (app pinning
- RabbitMQ with Unity IOC Container in .NET
- Install rabbitmqadmin on linux
- await Task.CompletedTask for what?
- Why is the call ambiguous? 'Task.Run(Action)
- Save content of Email body in outlook to a file
In Celery 3+
http://docs.celeryproject.org/en/3.1/faq.html#how-do-i-purge-all-waiting-tasks
CLI
Purge named queue:
Purge configured queue
So to purge the entire queue workers must be stopped.
In Celery 3+:
CLI:
Programatically:
http://docs.celeryproject.org/en/latest/faq.html#how-do-i-purge-all-waiting-tasks
From the docs:
or
(EDIT: Updated with current method.)
I found that
celery purge
doesn't work for my more complex celery config. I use multiple named queues for different purposes:The first column is the queue name, the second is the number of messages waiting in the queue, and the third is the number of listeners for that queue. The queues are:
The analytics task is a brute force tasks that worked great on small data sets, but now takes more than 24 hours to process. Occasionally, something will go wrong and it will get stuck waiting on the database. It needs to be re-written, but until then, when it gets stuck I kill the task, empty the queue, and try again. I detect "stuckness" by looking at the message count for the analytics queue, which should be 0 (finished analytics) or 1 (waiting for last night's analytics to finish). 2 or higher is bad, and I get an email.
celery purge
offers to erase tasks from one of the broadcast queues, and I don't see an option to pick a different named queue.Here's my process:
For celery 3.0+:
To purge a specific queue:
1. To properly purge the queue of waiting tasks you have to stop all the workers (http://celery.readthedocs.io/en/latest/faq.html#i-ve-purged-messages-but-there-are-still-messages-left-in-the-queue):
or (in case RabbitMQ/message broker is managed by Supervisor):
2. ...and then purge the tasks from a specific queue:
3. Start RabbitMQ:
or (in case RabbitMQ is managed by Supervisor):