Retrieve a task result object, given a `task_id` in Celery

北城以北 提交于 2019-11-30 07:02:55

问题


I store the task_id from an celery.result.AsyncResult in a database and relate it to the item that the task affects. This allows me to perform a query to retrieve all the task_ids of tasks that relate to a specific item.

So after retrieving the task_id from the database, how do I go about retrieving information about the task's state/result/etc?


回答1:


From the Celery FAQ:

result = MyTask.AsyncResult(task_id)
result.get()


来源:https://stackoverflow.com/questions/5544611/retrieve-a-task-result-object-given-a-task-id-in-celery

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!