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
Written by
Abdur-Rahmaan Janhangeer
Chef
Python author of 7+ years having worked for Python companies around the world
Suggested Posts
How to set task id in celery
Here’s a convenient way to set task id in celery: import uuid # in-built in Python task_id = str(uui...
How to solve celery task has no attribute AsyncResult
I was looking through Grinberg’s tuto on celery and flask. I saw querying tasks by task = long_task....
Python EFL: Building Custom Elementary Widgets (2026)
Want to create unique UI components tailored to your app’s needs? This Python EFL tutorial teaches y...