在 Python 中创建 MML 控制台的基础知识
我希望有一个用 Python 编写的 MML(人机语言)控制台作为控制和监视后端进程的唯一入口点。基本上能够:
- 如果后端进程未运行,则附加到现有后端进程
- ,仍然打开控制台并能够生成后端进程(通过引入正确的命令)
- 自动完成允许的命令
- 能够根据引入的命令更改后端进程行为
实现此目的的最佳方法是什么?如何将后端进程与可以打开和关闭而不杀死后端进程的控制台进行通信,我的意思是控制台不会是该进程的父进程。
需要用Python编写并在CentOS上运行,也许一些操作系统工具可以帮助进行进程通信?
I am looking to have a MML (man machine language) console written in Python as the only entry point to control and monitor a back-end process. Basically will be able to:
- attach to an existing back-end process
- if back-end process is not running, still open console and be able to spawn back-end process (by introducing the correct command)
- auto-complete permitted commands
- be able to change back-end process behavior based on the introduced commands
What would be the best way to achieve this? How to communicate the back-end process with a console that can be opened and closed without killing the back-end process, by this I mean that the console would not be the parent of that process.
Needs to be written in Python and will run on a CentOS, maybe some OS tools can help to communicate processes?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我的列表中最重要的是twisted。使用以下命令构建交互式控制台相当容易它的Perspective Broker系统将可能很适合你。另外它非常健壮,有一个快速的事件循环,而且非常健壮。
您还可以使用 cmd 模块,该模块最近在 Doug Hellmann 的优秀网站上得到了推荐本周 Python 模块 (PyMOTW)。
对于进程间通信,ZeroMQ 相当容易使用,而且速度非常快。
High on my list would be twisted. It's fairly easy to build a an interactive console with and it's Perspective Broker system would probably work well for you. Plus it's very robust, has a fast event loop, and it's very robust.
You could also use the cmd module, which was recently featured on Doug Hellmann's excellent site Python Module of the Week (PyMOTW).
For interprocess communication, ZeroMQ is fairly easy to work with, and it's very fast.
也许这是一个开始:http://code.google.com/p/squires/wiki /SquiresHowto
您可以使用 Socket 来进行前端和后端之间的通信。
Maybe this is a start: http://code.google.com/p/squires/wiki/SquiresHowto
You could use a Socket to do the communication between Front- and Backend.