Celery DisabledBackend 问题处理

时间:2024-10-24 19:44:56

问题描述:
celery flask中用task_id获取结果时遇到如下问题,正常不用flask没有问题

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

1.排查 backend

from celery import Celery

broker = 'redis://127.0.0.1:6379/1'
backend = 'redis://127.0.0.1:6379/2'

app_celery = Celery('tasks', broker=broker, backend=backend)
  1. 检查获取结果时是否设置app
res = AsyncResult(task_id,app=app_celery)
  1. 重启所有python进程

  2. 重启 celery