Retrieve list of tasks in a queue in Celery
EDIT: See other answers for getting a list of tasks in the queue.
You should look here:Celery Guide - Inspecting Workers
Basically this:
my_app = Celery(...)# Inspect all nodes.i = my_app.control.inspect()# Show the items that have an ETA or are scheduled for later processingi.scheduled()# Show tasks that are currently active.i.active()# Show tasks that have been claimed by workersi.reserved()
Depending on what you want
if you are using rabbitMQ, use this in terminal:
sudo rabbitmqctl list_queues
it will print list of queues with number of pending tasks. for example:
Listing queues ...0b27d8c59fba4974893ec22d478a7093 00e0a2da9828a48bc86fe993b210d984f 010@torob2.celery.pidbox 011926b79e30a4f0a9d95df61b6f402f7 015c036ad25884b82839495fb29bd6395 1celerey_mail_worker@torob2.celery.pidbox 0celery 166celeryev.795ec5bb-a919-46a8-80c6-5d91d2fcf2aa 0celeryev.faa4da32-a225-4f6c-be3b-d8814856d1b6 0
the number in right column is number of tasks in the queue. in above, celery queue has 166 pending task.
If you are using Celery+Django simplest way to inspect tasks using commands directly from your terminal in your virtual environment or using a full path to celery:
Doc: http://docs.celeryproject.org/en/latest/userguide/workers.html?highlight=revoke#inspecting-workers
$ celery inspect reserved$ celery inspect active$ celery inspect registered$ celery inspect scheduled
Also if you are using Celery+RabbitMQ you can inspect the list of queues using the following command:
More info: https://linux.die.net/man/1/rabbitmqctl
$ sudo rabbitmqctl list_queues