如何获取运行芹菜工人的名称?
我想特别关闭芹菜工人。我正在使用app.control.broadcast('shutdown')
;但是,这将关闭所有工人;因此,我想传递目标参数。
当我运行PS -EF | GREP芹菜
,我可以在该过程中看到- 主机名
。
我知道该格式为{celeryd_nodes} {nodename_sep} {hostName}
来自实用程序函数 nodeName
destination = ''.join(['celery', # CELERYD_NODES defined at /etc/default/newfies-celeryd
'@', # from celery.utils.__init__ import NODENAME_SEP
socket.gethostname()])
是否有返回nodeName的辅助功能?我不想自己创建它,因为我不想将值进行编码。
I want to shut down celery workers specifically. I was using app.control.broadcast('shutdown')
; however, this shutdown all the workers; therefore, I would like to pass the destination parameter.
When I run ps -ef | grep celery
, I can see the --hostname
on the process.
I know that the format is {CELERYD_NODES}{NODENAME_SEP}{hostname}
from the utility function nodename
destination = ''.join(['celery', # CELERYD_NODES defined at /etc/default/newfies-celeryd
'@', # from celery.utils.__init__ import NODENAME_SEP
socket.gethostname()])
Is there a helper function which returns the nodename? I don't want to create it myself since I don't want to hardcode the value.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不确定这是否是您要寻找的,但是使用
每个人的工人:
例如:
I am not sure if that's what you're looking for, but with control.inspect you can get info about the workers, for example:
so basically you can get the list of workers from each one of them:
for example: