Celery error: kombu.exceptions.NotBoundError: Can't call method on Exchange not bound to a channel
Celery error: kombu.exceptions.NotBoundError: Can't call method on Exchange not bound to a channel
我将 celery 4.0.2 与 rabbitmq 3.6.6 和 Django 1.10 一起使用,这是我的配置:
from django.conf import settings
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'my_app.settings')
app = Celery('my_app')
app.autodiscover_tasks(lambda: settings.INSTALLED_APPS)
app.conf.BROKER_URL = 'amqp://{}:{}@{}'.format(settings.AMQP_USER, settings.AMQP_PASSWORD, settings.AMQP_HOST)
app.conf.CELERY_DEFAULT_EXCHANGE = 'my_app.celery'
app.conf.CELERY_DEFAULT_QUEUE = 'my_app.celery_default'
app.conf.CELERY_TASK_SERIALIZER = 'json'
app.conf.CELERY_ACCEPT_CONTENT = ['json']
app.conf.CELERY_IGNORE_RESULT = True
app.conf.CELERY_DISABLE_RATE_LIMITS = True
app.conf.BROKER_POOL_LIMIT = 2
app.conf.CELERY_QUEUES = (
Queue(settings.QUEUE_1),
Queue(settings.QUEUE_2),
Queue(settings.QUEUE_3),
)
它工作正常,但是当我尝试添加一个新队列时,即
app.conf.CELERY_QUEUES = (
Queue(settings.QUEUE_1),
Queue(settings.QUEUE_2),
Queue(settings.QUEUE_3),
Queue(settings.QUEUE_4),
)
我收到这个错误:
kombu.exceptions.NotBoundError: Can't call method on Exchange not bound to a channel
如果我删除其中一个队列,它会再次工作,所以它似乎仅限于 3 个队列。我不明白为什么。 Celery 是这样启动的:
celery worker -A my_app.celery_app
有什么想法吗?提前致谢!
好的,这可能是因为我使用的是 Python 3.6,请参阅:https://github.com/celery/kombu/issues/675
我将 celery 4.0.2 与 rabbitmq 3.6.6 和 Django 1.10 一起使用,这是我的配置:
from django.conf import settings
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'my_app.settings')
app = Celery('my_app')
app.autodiscover_tasks(lambda: settings.INSTALLED_APPS)
app.conf.BROKER_URL = 'amqp://{}:{}@{}'.format(settings.AMQP_USER, settings.AMQP_PASSWORD, settings.AMQP_HOST)
app.conf.CELERY_DEFAULT_EXCHANGE = 'my_app.celery'
app.conf.CELERY_DEFAULT_QUEUE = 'my_app.celery_default'
app.conf.CELERY_TASK_SERIALIZER = 'json'
app.conf.CELERY_ACCEPT_CONTENT = ['json']
app.conf.CELERY_IGNORE_RESULT = True
app.conf.CELERY_DISABLE_RATE_LIMITS = True
app.conf.BROKER_POOL_LIMIT = 2
app.conf.CELERY_QUEUES = (
Queue(settings.QUEUE_1),
Queue(settings.QUEUE_2),
Queue(settings.QUEUE_3),
)
它工作正常,但是当我尝试添加一个新队列时,即
app.conf.CELERY_QUEUES = (
Queue(settings.QUEUE_1),
Queue(settings.QUEUE_2),
Queue(settings.QUEUE_3),
Queue(settings.QUEUE_4),
)
我收到这个错误:
kombu.exceptions.NotBoundError: Can't call method on Exchange not bound to a channel
如果我删除其中一个队列,它会再次工作,所以它似乎仅限于 3 个队列。我不明白为什么。 Celery 是这样启动的:
celery worker -A my_app.celery_app
有什么想法吗?提前致谢!
好的,这可能是因为我使用的是 Python 3.6,请参阅:https://github.com/celery/kombu/issues/675