我存储task_id从celery.result.AsyncResult数据库中,它涉及到的任务影响的项目.这允许我执行查询以检索task_id与特定项目相关的所有任务.
因此,task_id从数据库中检索后,如何检索有关任务状态/结果/等的信息?
如果我以前不知道执行了哪个任务,如何提取任务的结果?这是设置:给定以下源('tasks.py'):
from celery import Celery
app = Celery('tasks', backend="db+mysql://u:p@localhost/db", broker = 'amqp://guest:guest@localhost:5672//')
@app.task
def add(x,y):
return x + y
@app.task
def mul(x,y):
return x * y
Run Code Online (Sandbox Code Playgroud)
RabbitMQ 3.3.2在本地运行:
marcs-mbp:sbin marcstreeter$ ./rabbitmq-server
RabbitMQ 3.3.2. Copyright (C) 2007-2014 GoPivotal, Inc.
## ## Licensed under the MPL. See http://www.rabbitmq.com/
## ##
########## Logs: /usr/local/var/log/rabbitmq/rabbit@localhost.log
###### ## /usr/local/var/log/rabbitmq/rabbit@localhost-sasl.log
##########
Starting broker... completed with 10 plugins.
Run Code Online (Sandbox Code Playgroud)
与Celery 3.1.12在本地运行:
-------------- celery@Marcs-MacBook-Pro.local v3.1.12 (Cipater)
---- **** -----
--- * *** * -- Darwin-13.2.0-x86_64-i386-64bit
-- * - **** …Run Code Online (Sandbox Code Playgroud)