芹菜结果禁用?

时间:2014-05-05 20:28:33

标签: celery python-3.4

我正在玩celery教程的演示案例。但是,当我启动任务应用程序时,结果显示为禁用。如下。有什么想法吗?

celery --app=plmtcheck worker -l info

Then I see: 
- ** ---------- .> app:         plmtcheck:0x7f9fd2fdf160
- ** ---------- .> transport:   amqp://guest@localhost:5672//
- ** ---------- .> results:     disabled

I have seen the result is ready.

[2014-05-05 16:16:55,382: INFO/MainProcess] Connected to amqp://guest@127.0.0.1:5672//
[2014-05-05 16:16:55,389: INFO/MainProcess] mingle: searching for neighbors
[2014-05-05 16:16:56,401: INFO/MainProcess] mingle: all alone
[2014-05-05 16:16:56,422: WARNING/MainProcess] celery@D-NYC-00552088-Linux ready.
[2014-05-05 16:17:27,726: INFO/MainProcess] Received task: plmtcheck.add[7ea5a501-1085-48b7-8f7e-dac8ac2c5377]
[2014-05-05 16:17:27,759: INFO/MainProcess] Task plmtcheck.add[7ea5a501-1085-48b7-8f7e-dac8ac2c5377] succeeded in 0.032166894000056345s: 37

我的代码只是

from celery import Celery
app = Celery('plmtcheck', backend='amqp', broker='amqp://')

@app.task
def add(x, y): 
    return x + y

if __name__ == '__main__':
    app.worker_main()

1 个答案:

答案 0 :(得分:0)

安装 django-celery-results 包,然后将其添加到 settings.py 中

INSTALLED_APPS = [
...
'django_celery_results',
...
]

这会做你想做的事情