In the example code below, I\'d like to recover the return value of the function worker
. How can I go about doing this? Where is this value stored?
The pebble package has a nice abstraction leveraging multiprocessing.Pipe
which makes this quite straightforward:
from pebble import concurrent
@concurrent.process
def function(arg, kwarg=0):
return arg + kwarg
future = function(1, kwarg=1)
print(future.result())
Example from: https://pythonhosted.org/Pebble/#concurrent-decorators