0

I have a simple shared celery task like this:

@shared_task
def add():
    x = barakah(name="add()", year="add()", month="add()")
    x.save()
    return "id is add()= " + str(x.id)

And I call it here in this CELERYBEAT_SCHEDULE:

CELERYBEAT_SCHEDULE = {
    'add': {
        'task': 'water.tasks.add',
        'schedule': timedelta(seconds=3),
        'args': ()
    },
}

This is the celery command I use:

celery -A adi worker -B -l info

It runs fine as per schedule but other old tasks are also executing as well. How do I stop the old tasks? I have even tried uninstalling celery and rabbitmq but the old tasks seem to be cached somewhere. I tried this answer but what I tried didn't work. Any ideas?

Community
  • 1
  • 1
  • Might this be of any help? [http://stackoverflow.com/questions/8230833/stopping-purging-periodic-tasks-in-django-celery][1] [1]: http://stackoverflow.com/questions/8230833/stopping-purging-periodic-tasks-in-django-celery – michel.iamit Apr 16 '15 at 07:10

1 Answers1

0

Use celery purge command.

From celery docs:

purge: Purge messages from all configured task queues.

Warning There is no undo for this operation, and messages will be permanently deleted!

$ celery -A proj purge
Alexander Sysoev
  • 825
  • 6
  • 16