简体   繁体   English

如何获得在Celery中侦听特定Que的主机列表?

[英]How to get the list of hosts listening on a particular Que in Celery?

In my project I have two ques. 在我的项目中,我有两个问题。 I would like to know list of all the workers listening to a que. 我想知道所有听que的工人名单。 (need a pythonic way of doing this. Celery is running on a different machine and I want the details on other machine.) (需要使用pythonic的方法来执行此操作。Celery在另一台计算机上运行,​​我希望在其他计算机上获得详细信息。)

Well if you're using rabbitmq as a broker you can do this: 好吧,如果您使用rabbitmq作为代理,则可以执行以下操作:

sudo rabbitmqctl list_consumers

To check a specific queue: 要检查特定队列:

lpiner@host:~$ sudo rabbitmqctl list_consumers -p production |  grep queue1
queue1 <rabbit@host1-rabbitmq.2.15149.130>     None5   true    0       []
queue1 <rabbit@host1-rabbitmq.2.15256.130>     None4   true    0       []
queue1 <rabbit@host1-rabbitmq.2.21562.130>     None4   true    0       []
queue1 <rabbit@host1-rabbitmq.2.21644.130>     None4   true    0       []
queue1 <rabbit@host1-rabbitmq.2.6500.135>      None5   true    0       []
queue1 <rabbit@host2-rabbitmq.2.4028.137>      None10  true    0       []
queue1 <rabbit@host2-rabbitmq.2.4083.137>      None10  true    0       []
queue1 <rabbit@host2-rabbitmq.2.4463.137>      None9   true    0       []
queue1 <rabbit@host2-rabbitmq.2.4497.137>      None10  true    0       []
queue1 <rabbit@host2-rabbitmq.2.6508.137>      None5   true    0       []

You can also use the celery flower UI which is pretty cool. 您还可以使用非常酷的芹菜花UI。 https://flower.readthedocs.io/en/latest/ https://flower.readthedocs.io/en/latest/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM