##// END OF EJS Templates
BUG: For multiline outputs, conditionally prepend a newline if necessary. Move this code to where we actually write the output. Frontends should be able to decide whether to use this or not.
BUG: For multiline outputs, conditionally prepend a newline if necessary. Move this code to where we actually write the output. Frontends should be able to decide whether to use this or not.

File last commit:

r1338:72652d65
r3224:c77a02a1
Show More
asyncmultiengine1.py
22 lines | 614 B | text/x-python | PythonLexer
#!/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
from IPython.kernel import asyncclient
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()