Hello guest, if you read this it means you are not registered. Click here to register in a few simple steps, you will enjoy all features of our Forum.
Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Sharing objects in multiple processes
Here's a python package I made for sharing complex objects between processes.

git: https://github.com/dRoje/pipe-proxy

The idea is you create a proxy for your object and pass it to a process. Then you use the proxy like you have a reference to the original object. Although you can only use method calls, so accessing object variables is done threw setters and getters.

Say we have an object called ‘example’, creating proxy and proxy listener is easy:

from pipeproxy import proxy 
example = Example() 
exampleProxy, exampleProxyListener = proxy.createProxy(example)
Now you send the proxy to another process.

p = Process(target=someMethod, args=(exampleProxy,)) p.start()
Use it in the other process as you would use the original object (example):

def someMethod(exampleProxy):
But you do have to listen to it in the main process:
Read more and find examples here:


Top Page

Forum Jump:

Users browsing this thread: 1 Guest(s)