简体   繁体   English

Celery - 在所有节点上执行任务

[英]Celery - execute task on all nodes

I have a special use case where I need to run a task on all workers to check if a specific process is running on the celery worker.我有一个特殊的用例,我需要在所有工作人员上运行一项任务,以检查 celery 工作人员上是否正在运行特定进程。 The problem is that I need to run this on all my workers as each worker represents a replica of this specific process.问题是我需要在我的所有工作人员上运行它,因为每个工作人员都代表这个特定过程的副本。

In the end I want to display 8/20 workers are ready to process further tasks.最后,我想显示 8/20 的工人已准备好处理进一步的任务。 But currently I'm only able to process a task on either a random selected worker or just on one specific worker which does not solve my problem at all...但目前我只能在随机选择的工作人员或仅在一个根本无法解决我的问题的特定工作人员上处理任务......

Thanks in advance提前致谢

I can't think of a good way to do this on Celery.我想不出在 Celery 上执行此操作的好方法。 However, a nice workaround perhaps could be to implement your own command, and then you can broadcast that command to every worker (just like you can broadcast shutdown or status commands for an example).但是,一个不错的解决方法可能是实现您自己的命令,然后您可以将该命令广播给每个工作人员(就像您可以广播关闭或状态命令一样)。 When I think of it, this does indeed sound like some sort of monitoring/maintenance operation, right?当我想到它时,这听起来确实像是某种监控/维护操作,对吧?

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

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