##// END OF EJS Templates
Ongoing work on the config system....
Ongoing work on the config system. At this point, I am mostly testing out various approaches, but: * class_traits and class_trait_names added. * appconfig example created for testing new config ideas. * InteractiveShell traits updated. * shortname handling added to command line config loader.

File last commit:

r3666:a6a0636a
r3789:4999878d
Show More
map.py
36 lines | 756 B | text/x-python | PythonLexer
from IPython.parallel import *
client = Client()
view = client[:]
@view.remote(block=True)
def square(a):
"""return square of a number"""
return a*a
squares = map(square, range(42))
# but that blocked between each result; not exactly useful
square.block = False
arlist = map(square, range(42))
# submitted very fast
# wait for the results:
squares2 = [ r.get() for r in arlist ]
# now the more convenient @parallel decorator, which has a map method:
@view.parallel(block=False)
def psquare(a):
"""return square of a number"""
return a*a
# this chunks the data into n-negines jobs, not 42 jobs:
ar = psquare.map(range(42))
# wait for the results to be done:
squares3 = ar.get()
print squares == squares2, squares3==squares
# True