##// END OF EJS Templates
split KernelManager into KernelManager + KernelClient
split KernelManager into KernelManager + KernelClient

File last commit:

r10285:5e1e98c2
r10285:5e1e98c2
Show More
manager.py
50 lines | 1.7 KiB | text/x-python | PythonLexer
MinRK
split KernelManager into KernelManager + KernelClient
r10285 """A kernel manager with a tornado IOLoop"""
Brian Granger
Refactoring kernel restarting.
r10282
#-----------------------------------------------------------------------------
# Copyright (C) 2013 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING, distributed as part of this software.
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------
from __future__ import absolute_import
import zmq
from zmq.eventloop import ioloop
from IPython.utils.traitlets import (
Instance
)
MinRK
split KernelManager into KernelManager + KernelClient
r10285 from IPython.kernel.manager import KernelManager
MinRK
update imports with new layout
r10284 from .restarter import IOLoopKernelRestarter
Brian Granger
Refactoring kernel restarting.
r10282
#-----------------------------------------------------------------------------
# Code
#-----------------------------------------------------------------------------
MinRK
split KernelManager into KernelManager + KernelClient
r10285 class IOLoopKernelManager(KernelManager):
Brian Granger
Refactoring kernel restarting.
r10282
loop = Instance('zmq.eventloop.ioloop.IOLoop', allow_none=False)
def _loop_default(self):
return ioloop.IOLoop.instance()
MinRK
update imports with new layout
r10284 _restarter = Instance('IPython.kernel.ioloop.IOLoopKernelRestarter')
Brian Granger
Refactoring kernel restarting.
r10282
def start_restarter(self):
if self.autorestart and self.has_kernel:
if self._restarter is None:
self._restarter = IOLoopKernelRestarter(
kernel_manager=self, loop=self.loop,
config=self.config, log=self.log
)
self._restarter.start()
def stop_restarter(self):
if self.autorestart:
if self._restarter is not None:
self._restarter.stop()