在Celery中给定task_id的情况下检索任务结果对象 [英] Retrieve a task result object, given a `task_id` in Celery
本文介绍了在Celery中给定task_id的情况下检索任务结果对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我将 celery.result.AsyncResult
中的 task_id
存储在数据库中,并将其与任务会影响。这使我可以执行查询以检索与特定项目相关的所有 task_id
任务。
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_id
s of tasks that relate to a specific item.
因此,从数据库中检索 task_id
之后,我该如何检索有关任务状态/结果/等的信息?
So after retrieving the task_id
from the database, how do I go about retrieving information about the task's state/result/etc?
推荐答案
来自芹菜常见问题解答:
result = MyTask.AsyncResult(task_id)
result.get()
这篇关于在Celery中给定task_id的情况下检索任务结果对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文