I Want To Get Function Returning Value
How can i get this:
def chunk1():
return 'Hello'
p1 = Process(target=chunk1).start()
I Want To Get Chunk1 Returning Value from Process How Can i do that?
I Want To Get Function Returning Value
How can i get this:
def chunk1():
return 'Hello'
p1 = Process(target=chunk1).start()
I Want To Get Chunk1 Returning Value from Process How Can i do that?
You probably want to use a Queue or something in shared memory.
https://docs.python.org/2/library/multiprocessing.html#module-multiprocessing
From that page:
# The Queue class is a near clone of Queue.Queue. For example:
from multiprocessing import Process, Queue
def f(q):
q.put([42, None, 'hello'])
if __name__ == '__main__':
q = Queue()
p = Process(target=f, args=(q,))
p.start()
print q.get() # prints "[42, None, 'hello']"
p.join()
But if this is young code, you might consider concurrent.futures instead.
concurrent.futures used with a queue, EG:
How would I go about using concurrent.futures and queues for a real-time scenario?