更改芹菜默认队列,未按预期正常工作

2024-04-19 13:38:39 发布

您现在位置:Python中文网/ 问答频道 /正文

我已经覆盖了芹菜默认队列。下面是提到的设置。在

设置

BROKER_URL = "amqp://managedbrokerurl/username/"
CELERY_DEFAULT_QUEUE = 'project.env.default'
CELERY_ROUTES = {"app1.tasks.push_api_task": {"queue": "project.env.priority_queue"}}

工人

^{pr2}$

根据配置,我希望除了app1.tasks.push_api_task之外的所有任务都应该转到队列project.env.default。 但是一个奇怪的问题正在发生,例如任务将转到project.env.default队列以及celery队列(如果不覆盖,这是默认值)。在

我检查了我们的代码库,在任何地方都没有使用celery队列进行任务发布。在

如果你们也遇到过同样的问题,请帮忙。在

Celery Queue Screen


Tags: envprojectapidefaulturltask队列queue
2条回答

A worker instance can consume from any number of queues. By default it will consume from all queues defined in the CELERY_QUEUES setting (which if not specified defaults to the queue named celery)

我想你应该看看a section of celery docs

You can also start multiple workers on the same machine. If you do so be sure to give a unique name to each individual worker by specifying a host name with the hostname|-n argument:

Source

我知道这是一个非常晚的反应,但如果人们仍然遇到这个问题,问题是与一些芹菜的旧文件。在某些文档中,变量CELERY_DEFAULT_QUEUE的给定不正确,应该是CELERY_TASK_DEFAULT_QUEUE

相关问题 更多 >