In Parallel Python it has something in the submit function called a callback (documentation) however it doesn\'t seem to explain it too well. I\'ve posted on
The relevant spot in the docs:
callback - callback function which will be called with argument
list equal to callbackargs+(result,)
as soon as calculation is done
callbackargs - additional arguments for callback function
So, if you want some code to be executed as soon as the result is ready, you put that code into a function and pass that function as the callback argument. If you don't need other arguments, it will be just, e.g.:
def itsdone(result):
print "Done! result=%r" % (result,)
...
submit(..., callback=itsdone)
For more on the callback pattern in Python, see e.g. my presentation here.