相关疑难解决方法(0)

在Celery中给出`task_id`,检索任务结果对象

我存储task_idcelery.result.AsyncResult数据库中,它涉及到的任务影响的项目.这允许我执行查询以检索task_id与特定项目相关的所有任务.

因此,task_id从数据库中检索后,如何检索有关任务状态/结果/等的信息?

python celery

36
推荐指数
1
解决办法
2万
查看次数

从未知任务中检索Celery中'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)

python jobs celery celery-task

8
推荐指数
1
解决办法
4570
查看次数

标签 统计

celery ×2

python ×2

celery-task ×1

jobs ×1