How to query task by id in celery

Using celery 5.1.2 you can get the task id by the following code snippet:

from celery import current_app as celery_app

# in your function:
celery_app.tasks['task_dosomething'].AsyncResult('task_id')

Where task_dosomething is the name of your task and task_id is the id you choose. You can learn more about setting task id here

Works on windows 8

Leave a Comment

Your email address will not be published. Required fields are marked *