ProcessSpawner¶
-
class
pyacq.core.rpc.
ProcessSpawner
(name=None, address='tcp://127.0.0.1:*', qt=False, log_addr=None, log_level=None, executable=None)[source]¶ Utility for spawning and bootstrapping a new process with an
RPCServer
.Automatically creates an
RPCClient
that is connected to the remote process (spawner.client
).Parameters: - name : str | None
Optional process name that will be assigned to all remote log records.
- address : str
ZMQ socket address that the new process’s RPCServer will bind to. Default is
'tcp://127.0.0.1:*'
.Note: binding RPCServer to a public IP address is a potential security hazard (see
RPCServer
).- qt : bool
If True, then start a Qt application in the remote process, and use a
QtRPCServer
.- log_addr : str
Optional log server address to which the new process will send its log records. This will also cause the new process’s stdout and stderr to be captured and forwarded as log records.
- log_level : int
Optional initial log level to assign to the root logger in the new process.
- executable : str | None
Optional python executable to invoke. The default value is sys.executable.
Examples
# start a new process proc = ProcessSpawner() # ask the child process to do some work mod = proc._import('my.module') mod.do_work() # close the child process proc.close() proc.wait()
-
client
= None¶ An RPCClient instance that is connected to the RPCServer in the remote process