Celery Result backend. DisabledBackend object has no attribute _get_task_meta_for

三世轮回 提交于 2019-12-01 02:51:12

问题


I have configured celery and the backend:

cleryapp = Celery(
    'tasks_app', brocker='amqp://guest@localhost//',
    backend='db+postgresql://guest@localhost:5432'
)

'results' appears disabled when i start the worker, but I read on another question here that that's not the issue.

The database is getting all the data correctly, but

result = AsyncResult(task_id)

raises

AttributeError: 'DisabledBackend' object has no attribute '_get_task_meta_for'

回答1:


I found a more convenient way to do that.

result = celery.AsyncResult(task_id)

celery is the Celery instance of your application, not the celery module.




回答2:


try using this instead where task is the name of your task function:

result = task.AsyncResult(task_id)



回答3:


you can try:

from celery import result, Celery
app = Celery(backend='redis://localhost:6379/0')
res = result.AsyncResult(id='7037247e-f528-43ba-bce5-ee0e30704c58', app=app)
print(res.info)



回答4:


just like it said celery , you should specify the value of backend, just like: app = Celery("tasks", broker='mongodb://localhost:27017/test',backend='mongodb://localhost:27017/test1')



来源:https://stackoverflow.com/questions/24309035/celery-result-backend-disabledbackend-object-has-no-attribute-get-task-meta-fo

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!