简体   繁体   English

在不使用多处理模块的情况下在Python进程之间排队

[英]Queue between Python processes without using the multiprocessing module

I need to start a child process that doesn't share its parent process's Python interpreter (Jython and CPython). 我需要启动一个不共享其父进程的Python解释器(Jython和CPython)的子进程。 I would like to use a convenient IPC tool like Queue.Queue or multiprocessing.Connection . 我想使用便捷的IPC工具,例如Queue.Queuemultiprocessing.Connection

How can that be achieved? 如何实现?

You could use a message queue library like ZeroMQ . 您可以使用消息队列库,例如ZeroMQ It has language bindings for Python and Java, your Jython scripts would need to use the Java classes of these bindings. 它具有用于Python和Java的语言绑定,您的Jython脚本将需要使用这些绑定的Java类。 Alternatively, there's a pure Python message queue snakeMQ . 另外,还有一个纯Python消息队列snakeMQ This should run in both C-Python and Jython as it does not require native libraries. 这应该在C-Python和Jython中运行,因为它不需要本机库。 You could encode your messages if it is more than strings and numbers, using JSON, or pickle (I'm not sure if pickle output is compatible between C-Python and Jython, though). 如果消息不只是字符串和数字,则可以使用JSON或pickle进行编码(我不知道pickle的输出是否在C-Python和Jython之间兼容)。

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

相关问题 使用多处理模块在进程之间传递消息 - Message passing between processes using multiprocessing module 是否可以从python多处理模块的进程之间自动共享队列对象? - Is queue object automatically shared among Processes from python multiprocessing module? 在Python多处理中,如何使用队列在进程之间传递用户定义的对象? - In Python multiprocessing, how can a user-defined object be communicated between processes using a queue? Python多重处理流程:使用Manager Queue时延迟识别事件 - Python Multiprocessing Processes: Delay in recognizing Event when using Manager Queue 在Python中使用多处理模块时,无法在进程之间进行互锁 - Unable to Inter-Lock between processes while using multiprocessing module in Python Python多处理:避免通过进程之间的模块进行通信 - Python multiprocessing: avoid communication via module between processes 2个进程之间的raspberry pi 3多处理队列同步 - raspberry pi 3 multiprocessing queue syncronization between 2 processes 进程之间进行通信:Python多处理 - Communicating between Processes: Python Multiprocessing 在 python 多处理中的进程之间使用共享值终止循环 - Loop termination using shared value between the processes in python multiprocessing 使用多处理在预先存在的Python进程之间进行通信 - Communicating between Pre-Existing Python Processes using Multiprocessing
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM