##// END OF EJS Templates
added py4science demos as examples + NetworkX DAG dependencies
added py4science demos as examples + NetworkX DAG dependencies

File last commit:

r3564:b78cec8e
r3564:b78cec8e
Show More
loadbalance.py
20 lines | 342 B | text/x-python | PythonLexer
import time
from IPython.zmq.parallel.client import *
def wait(t):
import time
time.sleep(t)
return t
client = Client('tcp://127.0.0.1:10101')
view = client[None]
tic = time.time()
for i in range(128):
view.apply(wait, 1e-2*i)
# limit to 1k msgs/s
time.sleep(1e-2)
client.barrier()
toc = time.time()
print toc-tic