##// END OF EJS Templates
Merge pull request #4305 from minrk/even-more-ways-to-get-ifaces...
Merge pull request #4305 from minrk/even-more-ways-to-get-ifaces Add even more ways to populate localinterfaces use netifaces for faster IPython.utils.localinterfaces when availlable, Parse subprocess output from ifconfig / ip addr / ipconfig. Lower priority than netifaces, but still higher priority than socket.gethostbyname. Fallback to gethostname otherwise. Should be much faster in worst case scenario where machine are badly configurred and can wait up to ~30s to start ipython. Slighly slower in other cases.

File last commit:

r9190:20a102a5
r12911:aeeb7f5a merge
Show More
multiengine2.py
29 lines | 794 B | text/x-python | PythonLexer
MinRK
translate last remaining old parallel examples
r3690 #-------------------------------------------------------------------------------
# Imports
#-------------------------------------------------------------------------------
Thomas Kluyver
Update print syntax in parallel examples.
r6455 from __future__ import print_function
MinRK
translate last remaining old parallel examples
r3690
import time
from IPython.parallel import Client
#-------------------------------------------------------------------------------
# Setup
#-------------------------------------------------------------------------------
mux = Client()[:]
mux.clear()
mux.block=False
ar1 = mux.apply(time.sleep, 5)
ar2 = mux.push(dict(a=10,b=30,c=range(20000),d='The dog went swimming.'))
ar3 = mux.pull(('a','b','d'), block=False)
Thomas Kluyver
Update print syntax in parallel examples.
r6455 print("Try a non-blocking get_result")
MinRK
translate last remaining old parallel examples
r3690 ar4 = mux.get_result()
Thomas Kluyver
Update print syntax in parallel examples.
r6455 print("Now wait for all the results")
MinRK
translate last remaining old parallel examples
r3690 mux.wait([ar1,ar2,ar3,ar4])
Thomas Kluyver
Update print syntax in parallel examples.
r6455 print("The last pull got:", ar4.r)