What RPC module should I use to implement RCP in Python and be able to change connection method later?

◇◆丶佛笑我妖孽 提交于 2019-12-02 11:27:02

I'd say that the easiest way to communicate two different python processes in your case is using pyro3. I've recently used pyro4 in a small project and it was very effective to let me focus in the information I wanted to send/receive rather than in the way to encode/decode it properly.

I recommend you to use v3 because v4 isn't tested against python 2.5 according to the tox.ini file in the sources, so you might have some problems there.

Regarding networking, this library takes care of the sockets itself, so there isn't any explicit support for telnet or ssh (although using paramiko is in the TODO list). Hene, you'll probably need to rely on ssh tunnels as in this example.

As a partial solution for python 2.6+ you could have a look at Versile Python (currently in development), we just added support for reactor-driven byte communication over pipes (requires a platform which allows select.select on pipe file descriptors, i.e. not Windows). This enables links to VPy ORBs over pipes or stdin/stdout. See this recipe for an example how it can be used with ssh.

Versile Python requires python 2.6+ or 3.x so unfortunately does not work with 2.5.

Spyne supports pluggable protocols and transports, but it doesn't support SSH (or any other socket-like transport) yet. It's a stable but quite new project -- especially the client logic needs some serious work.

As for your original question, among the serializers I'm familiar with, (which is mostly what you see on the spyne web site) the most suitable to pipe through a stream transport is MessagePack as it supports the iterator-over-file-like-object (a.k.a the streaming deserialization) interface.

Would it interest you to use something with rabbitmq for sending receiving commands and logs?

https://github.com/nvalerkos/cronio

It's python 2.7 needs a rabbitmq

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!