##// END OF EJS Templates
allow_none=False by default for Type and Instance
allow_none=False by default for Type and Instance

File last commit:

r20940:4c8e4259
r20940:4c8e4259
Show More
manager.py
72 lines | 2.4 KiB | text/x-python | PythonLexer
MinRK
update inprocess kernel to new layout...
r10298 """A kernel manager for in-process kernels."""
epatters
Refactor kernel managers in preparation for the EmbeddedKernel.
r8408
Min RK
fix Session passing around in kernel.inprocess...
r20572 # Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
epatters
Refactor kernel managers in preparation for the EmbeddedKernel.
r8408
MinRK
wrap `client` method for InProcessKM
r10304 from IPython.utils.traitlets import Instance, DottedObjectName
MinRK
update inprocess kernel to new layout...
r10298 from IPython.kernel.managerabc import KernelManagerABC
from IPython.kernel.manager import KernelManager
Min RK
fix Session passing around in kernel.inprocess...
r20572 from IPython.kernel.zmq.session import Session
epatters
Refactor kernel managers in preparation for the EmbeddedKernel.
r8408
MinRK
update inprocess kernel to new layout...
r10298 class InProcessKernelManager(KernelManager):
Brian Granger
Docstring cleanup for kernelmanagers and channels....
r9128 """A manager for an in-process kernel.
epatters
Refactor kernel managers in preparation for the EmbeddedKernel.
r8408
Brian Granger
Docstring cleanup for kernelmanagers and channels....
r9128 This class implements the interface of
MinRK
move kernelmanagerabc into IPython.kernel
r9354 `IPython.kernel.kernelmanagerabc.KernelManagerABC` and allows
Brian Granger
Docstring cleanup for kernelmanagers and channels....
r9128 (asynchronous) frontends to be used seamlessly with an in-process kernel.
MinRK
split in process Manager and Client
r10297
MinRK
move zmq.KernelManagers into IPython.kernel
r9370 See `IPython.kernel.kernelmanager.KernelManager` for docstrings.
epatters
Refactor kernel managers in preparation for the EmbeddedKernel.
r8408 """
# The kernel process with which the KernelManager is communicating.
Sylvain Corlay
allow_none=False by default for Type and Instance
r20940 kernel = Instance('IPython.kernel.inprocess.ipkernel.InProcessKernel',
allow_none=True)
MinRK
wrap `client` method for InProcessKM
r10304 # the client class for KM.client() shortcut
client_class = DottedObjectName('IPython.kernel.inprocess.BlockingInProcessKernelClient')
Min RK
fix Session passing around in kernel.inprocess...
r20572
def _session_default(self):
# don't sign in-process messages
return Session(key=b'', parent=self)
epatters
Refactor kernel managers in preparation for the EmbeddedKernel.
r8408 #--------------------------------------------------------------------------
MinRK
update inprocess kernel to new layout...
r10298 # Kernel management methods
epatters
Refactor kernel managers in preparation for the EmbeddedKernel.
r8408 #--------------------------------------------------------------------------
MinRK
split in process Manager and Client
r10297
epatters
Refactor kernel managers in preparation for the EmbeddedKernel.
r8408 def start_kernel(self, **kwds):
MinRK
move IPython.inprocess to IPython.kernel.inprocess
r9375 from IPython.kernel.inprocess.ipkernel import InProcessKernel
Min RK
fix Session passing around in kernel.inprocess...
r20572 self.kernel = InProcessKernel(parent=self, session=self.session)
epatters
Refactor kernel managers in preparation for the EmbeddedKernel.
r8408
def shutdown_kernel(self):
Brian E. Granger
Make KernelManager.kill_kernel private....
r9130 self._kill_kernel()
epatters
Refactor kernel managers in preparation for the EmbeddedKernel.
r8408
def restart_kernel(self, now=False, **kwds):
self.shutdown_kernel()
self.start_kernel(**kwds)
@property
def has_kernel(self):
return self.kernel is not None
Brian E. Granger
Make KernelManager.kill_kernel private....
r9130 def _kill_kernel(self):
epatters
Refactor kernel managers in preparation for the EmbeddedKernel.
r8408 self.kernel = None
def interrupt_kernel(self):
epatters
REFACTOR: Terminology change: 'embedded' -> 'in-process'.
r8471 raise NotImplementedError("Cannot interrupt in-process kernel.")
epatters
Refactor kernel managers in preparation for the EmbeddedKernel.
r8408
def signal_kernel(self, signum):
epatters
REFACTOR: Terminology change: 'embedded' -> 'in-process'.
r8471 raise NotImplementedError("Cannot signal in-process kernel.")
epatters
Refactor kernel managers in preparation for the EmbeddedKernel.
r8408
def is_alive(self):
MinRK
wrap `client` method for InProcessKM
r10304 return self.kernel is not None
def client(self, **kwargs):
kwargs['kernel'] = self.kernel
return super(InProcessKernelManager, self).client(**kwargs)
epatters
Refactor kernel managers in preparation for the EmbeddedKernel.
r8408
Brian Granger
Creating an ABC for kernel managers and channels.
r9121 #-----------------------------------------------------------------------------
# ABC Registration
#-----------------------------------------------------------------------------
epatters
Refactor kernel managers in preparation for the EmbeddedKernel.
r8408
Brian Granger
Creating an ABC for kernel managers and channels.
r9121 KernelManagerABC.register(InProcessKernelManager)