##// END OF EJS Templates
* Implemented a proper main() function for kernel.py that reads command line input....
* Implemented a proper main() function for kernel.py that reads command line input. * Added options to launch_kernel() for specifying particular ports. * Wrote preliminary implementation for the KernelManager's start_kernel() and kill_kernel() methods * Updated IPythonWidget test script to reflect new functionality.

File last commit:

r2611:710f79b2
r2667:3547b230
Show More
ktest.py
52 lines | 1.1 KiB | text/x-python | PythonLexer
Brian Granger
Work on the kernel manager.
r2606 from Queue import Queue, Empty
import time
from kernelmanager import KernelManager
xreq_addr = ('127.0.0.1',5575)
sub_addr = ('127.0.0.1', 5576)
rep_addr = ('127.0.0.1', 5577)
km = KernelManager(xreq_addr, sub_addr, rep_addr)
epatters
* Refactored KernelManager to use Traitlets and to have its channels as attributes...
r2611 # xreq_channel = km.xreq_channel
sub_channel = km.sub_channel
Brian Granger
Work on the kernel manager.
r2606
# xreq_channel.start()
sub_channel.start()
print "Channels are started"
def printer(msg):
print
print msg
class CallHandler(object):
def __init__(self):
self.queue = Queue()
def __call__(self, handler, msg):
self.queue.put((handler, msg))
def handle(self):
try:
handler, msg = self.queue.get(block=False)
except Empty:
pass
else:
handler(msg)
call_handler = CallHandler()
sub_channel.override_call_handler(call_handler)
sub_channel.add_handler(printer, 'pyin')
sub_channel.add_handler(printer, 'pyout')
sub_channel.add_handler(printer, 'stdout')
sub_channel.add_handler(printer, 'stderr')
for i in range(100):
call_handler.handle()
time.sleep(1)
# xreq_channel.join()
epatters
* Refactored KernelManager to use Traitlets and to have its channels as attributes...
r2611 sub_channel.join()