##// END OF EJS Templates
A number of changes to how traitlets and components work....
A number of changes to how traitlets and components work. * Classes can be given as strings, like 'foo.bar.Bar' in the Type and Instance traitlets as well as the get_instances method of Component. This is done to allow for forward declarations. * New IPython.utils.importstring that imports a class from a string, like 'foo.bar.Bar'.

File last commit:

r1395:1feaf0a3
r2229:46a9a124
Show More
taskmap.py
18 lines | 490 B | text/x-python | PythonLexer
from IPython.kernel import client
tc = client.TaskClient()
result = tc.map(lambda x: 2*x, range(10))
print "Simple, default map: ", result
m = tc.mapper(block=False, clear_after=True, clear_before=True)
tids = m.map(lambda x: 2*x, range(10))
print "Submitted tasks, got ids: ", tids
tc.barrier(tids)
result = [tc.get_task_result(tid) for tid in tids]
print "Using a mapper: ", result
@tc.parallel()
def f(x): return 2*x
result = f(range(10))
print "Using a parallel function: ", result