How to purge scheduled tasks? #7168
Replies: 6 comments 4 replies
-
Have the same problem. Unable to achieve this when using Redis as a Broker. However, using RabbitMQ it works |
Beta Was this translation helpful? Give feedback.
-
Having the same problem, has anyone figured out what is causing this? |
Beta Was this translation helpful? Give feedback.
-
The retried tasks are probably reserved tasks so purging them won't purge them from Celery's internal queue. I suggest that you revoke them all to avoid executing those tasks. |
Beta Was this translation helpful? Give feedback.
-
Stop celery before purging: |
Beta Was this translation helpful? Give feedback.
-
stop celery and retry |
Beta Was this translation helpful? Give feedback.
-
if you can find task IDs somehow for those scheduled tasks you can do this to mark it as revoked. just tried with redis, it works.
|
Beta Was this translation helpful? Give feedback.
-
In my project we are running Celery 5.2.1 with Django 3.2, Redis 5.4 as broker and have a single queue.
We are sometimes retrying tasks with a countdown, e.g. when they encounter an API error. This can sometimes lead to thousands of task being retried.
To reset the system and start from scratch I want to be able to purge all those scheduled tasks. However, the usual purge command does not seam to work and I could not find any other way to do that.
I was trying to purge the scheduled tasks with this command:
However, after that I can still see the tasks with
celery -A project inspect scheduled
and they are still being executed.I also tried to purge the redis DB:
$ redis-cli flushall; OK
But that also did not work. After I ran the command the scheduled tasks are still there.
Here are some example tasks to reproduce this issue:
Any help with how to purge these scheduled tasks would be very much appreciated.
Beta Was this translation helpful? Give feedback.
All reactions