高效的Python IPC [英] Efficient Python IPC
问题描述
我正在Python3中制作一个应用程序,它将分为batch
和gui
部分.
Batch
负责处理逻辑,gui
负责显示逻辑.
I'm making an application in Python3, which will be divided in batch
and gui
parts.
Batch
is responsible for processing logic and gui
is responsible for displaying it.
我应在以下哪个进程间通信(IPC)框架中使用要求:
Which inter-process communication (IPC) framework should I use with the following requirements:
- GUI可以在批处理以外的其他设备上运行(GUI可以在本地或通过网络在同一设备,智能手机,平板电脑等设备上运行).
- 该批处理文件(Python3 IPc库)在Linux,Mac,Windows等操作系统上都可以正常工作.
- IPC应该支持用不同语言(Python,Javascript等)编写的GUI
- IPC的性能很重要-它应该尽可能交互",但又不会丢失信息.
- 几个GUI可以连接到同一批次.
附加内容:,如果还要保证GUI也可以用Python编写,那么选择会是其他选择吗?
additional: Will the choice be other if the GUI will be guaranteed to be written in Python also?
修改: 我发现了很多IPC库,例如:高效的Python到Python IPC 或 ActiveMQ或RabbitMQ或ZeroMQ或.
I have found a lot of IPC libraries, like here: Efficient Python to Python IPC or ActiveMQ or RabbitMQ or ZeroMQ or.
到目前为止,我发现的最好看的选项是:
The best looking options I have found so far are:
- rabbitmq
- zeromq
- pyro
他们是否适合解决此问题?如果不是,为什么呢?如果有更好的方法,请告诉我为什么.
Are they appropriate slutions to this problem? If not why? And if something is better, please tell me why also.
推荐答案
您提到的三个选项似乎很合适,并且可以满足您的要求.我认为您应该继续自己最熟悉\最熟悉的方式.
The three you mentioned seem a good fit and will uphold your requirements. I think you should go on with what you feel most comfortable\familiar with.
根据我的个人经验,我确实认为ZeroMQ是效率,易用性和互操作性之间的最佳组合.我很轻松地将zmq 2.2与Python 2.7集成在一起,因此这将是我个人的最爱.但是,正如我说的那样,我很确定您对这三个框架都不会出错.
From my personal experience, I do believe ZeroMQ is the best combination between efficiency, ease of use and inter-operability. I had an easy time integrating zmq 2.2 with Python 2.7, so that would be my personal favorite. However as I said I'm quite sure you can't go wrong with all 3 frameworks.
半相关:需求会随着时间而变化,您可能决定稍后再切换框架,因此封装对框架的依赖关系将是一个很好的设计模式. (例如,具有与框架交互的单个导管模块,并使其API使用您的内部数据结构和域语言)
Half related: Requirements tend to change with time, you may decide to switch framework later on, therefore encapsulating the dependency on the framework would be a good design pattern to use. (e.g. having a single conduit module that interacts with the framework and have its API use your internal datastructures and domain language)
这篇关于高效的Python IPC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!