##// END OF EJS Templates
Add little soma workflow example
Add little soma workflow example

File last commit:

r3564:b78cec8e
r3608:e2a7b436
Show More
map.py
19 lines | 474 B | text/x-python | PythonLexer
MinRK
added py4science demos as examples + NetworkX DAG dependencies
r3564 from IPython.zmq.parallel.client import *
client = Client('tcp://127.0.0.1:10101')
@remote(client, 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
msg_ids = map(square, range(42))
# submitted very fast
# wait for them to be done:
client.barrier(msg_id)
squares2 = map(client.results.get, msg_ids)
print squares == squares2
# True