相关疑难解决方法(0)

芹菜结果错误"args必须是列表或元组"

我正在运行一个Django网站并且刚刚让Celery运行,但是我遇到了令人困惑的错误.以下是代码的结构.

在tests.py中:

from tasks import *
from celery.result import AsyncResult

project = Project.objects.create()
# initalize various sub-objects of the project

c = function.delay(project.id)
r = AsyncResult(c.id).ready()
f = AsyncResult(c.id).failed()
# wait until the task is done  
while not r and not f:
    r = AsyncResult(c.id).ready()
    f = AsyncResult(c.id).failed()

self.assertEqual() #will fail because task fails
Run Code Online (Sandbox Code Playgroud)

在tasks.py中:

from __future__ import absolute_import
from celery import shared_task

@shared_task
def function(project_id)
    #a bunch of calculations followed by a save of the project
    project = Project.objects.get(project=project_id) …
Run Code Online (Sandbox Code Playgroud)

python django celery celery-task celeryd

3
推荐指数
1
解决办法
4561
查看次数

标签 统计

celery ×1

celery-task ×1

celeryd ×1

django ×1

python ×1