Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deleting all pending tasks in celery / rabbitmq

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

like image 440
nabizan Avatar asked Oct 26 '22 15:10

nabizan


People also ask

How do you clear all celery tasks?

Best method I found was redis-cli KEYS "celery*" | xargs redis-cli DEL which worked for me. This will wipe out all tasks stored on the redis backend you're using.

Where are celery tasks stored?

In Celery, a result back end is a place where, when you call a Celery task with a return statement, the task results are stored. Choosing the right results back end can potentially save you hours of pain later.

What is the difference between RabbitMQ and Celery?

Celery is an asynchronous distributed task queue. RabbitMQ is a message broker which implements the Advanced Message Queuing Protocol (AMQP).


1 Answers

From the docs:

$ celery -A proj purge

or

from proj.celery import app
app.control.purge()

(EDIT: Updated with current method.)

like image 375
Philip Southam Avatar answered Oct 28 '22 04:10

Philip Southam