Celery Get List Of Registered Tasks

For the newer versions of celery(4.0 or above), we can get registered tasks as follows.

from celery import current_app 
tasks = current_app.tasks.keys()

For older versions of celery, celery < 4, we can get registered tasks as follows.

from celery.task.control import  inspect
i = inspect()
i.registered_tasks()

This will give a dictionary of all workers & related registered tasks.

from itertools import chain
set(chain.from_iterable( i.registered_tasks().values() ))

In case if you have multiple workers running same tasks or if you just need a set of all registered tasks, it does the job.

Alternate Way:

From terminal you can get a dump of registered tasks by using this command

celery inspect registered

To inspect tasks related to a specific app, you can pass app name

celery -A app_name inspect registered

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)