##// END OF EJS Templates
update API after sagedays29...
update API after sagedays29 tests, docs updated to match * Client no longer has high-level methods (only in Views) * module functions can be pushed * clients can have a connection timeout * dependencies have separate switches for success/failure, not just success_only * add `with view.temp_flags(**flags):` for temporary flags Also updated some docs and examples

File last commit:

r3664:e90463ba
r3664:e90463ba
Show More
map.py
36 lines | 767 B | text/x-python | PythonLexer
MinRK
updated newparallel examples, moved into docs
r3609 from IPython.zmq.parallel.client import *
client = Client()
MinRK
update API after sagedays29...
r3664 view = client[:]
MinRK
updated newparallel examples, moved into docs
r3609
MinRK
update API after sagedays29...
r3664 @view.remote(block=True)
MinRK
updated newparallel examples, moved into docs
r3609 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:
MinRK
update API after sagedays29...
r3664 @view.parallel(block=False)
MinRK
updated newparallel examples, moved into docs
r3609 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