##// END OF EJS Templates
Ported the IPython Sphinx directive to 0.11....
Ported the IPython Sphinx directive to 0.11. This was originally written by John Hunter for the 0.10 API, now it works with 0.11. We still need to automate its test suite, but at least now it runs and the script itself can be executed as a test that produces screen output and figures in a subdir.

File last commit:

r1338:72652d65
r2439:858c6e09
Show More
multiengine2.ipy
38 lines | 1.0 KiB | text/plain | TextLexer
Brian E Granger
Adding examples from ipython1-dev to docs/examples/kernel. These ...
r1337 #-------------------------------------------------------------------------------
# Imports
#-------------------------------------------------------------------------------
import time
import numpy
Brian E Granger
Fixed most of the examples. A few still don't work, but this is a start.
r1338 import IPython.kernel.magic
from IPython.kernel import client
from IPython.kernel.error import *
Brian E Granger
Adding examples from ipython1-dev to docs/examples/kernel. These ...
r1337
mec = client.MultiEngineClient()
#-------------------------------------------------------------------------------
# Setup
#-------------------------------------------------------------------------------
mec.reset()
# print mec.keys()
mec.activate()
# mec.block=True
mec.get_ids()
n = len(mec)
assert n >= 4, "Not Enough Engines: %i, 4 needed for this script"%n
mec.block=False
pr1 = mec.execute('import time')
pr2 = mec.execute('time.sleep(5)')
pr3 = mec.push(dict(a=10,b=30,c=range(20000),d='The dog went swimming.'))
pr4 = mec.pull(('a','b','d'))
print "Try a non-blocking get_result"
assert pr4.get_result(block=False, default='not done')=='not done'
print "Now wait for all the results"
mec.barrier((pr1,pr2,pr3,pr4))
print "The last pull got:", pr4.r