##// END OF EJS Templates
Merging -r 1178 from lp:ipython....
Merging -r 1178 from lp:ipython. No major conflicts.

File last commit:

r1338:72652d65
r2125:2a3afbbd merge
Show More
asyncmultiengine1.py
22 lines | 614 B | text/x-python | PythonLexer
/ docs / examples / kernel / asyncmultiengine1.py
Brian E Granger
Adding examples from ipython1-dev to docs/examples/kernel. These ...
r1337 #!/usr/bin/env python
# encoding: utf-8
# A super simple example showing how to use all of this in a fully
# asynchronous manner. The TaskClient also works in this mode.
from twisted.internet import reactor, defer
Brian E Granger
Fixed most of the examples. A few still don't work, but this is a start.
r1338 from IPython.kernel import asyncclient
Brian E Granger
Adding examples from ipython1-dev to docs/examples/kernel. These ...
r1337
def printer(r):
print r
return r
def submit(client):
d = client.push(dict(a=5, b='asdf', c=[1,2,3]),targets=0,block=True)
d.addCallback(lambda _: client.pull(('a','b','c'),targets=0,block=True))
d.addBoth(printer)
d.addCallback(lambda _: reactor.stop())
d = asyncclient.get_multiengine_client()
d.addCallback(submit)
reactor.run()