##// END OF EJS Templates
handle empty metadata in pyout messages more gracefully.
handle empty metadata in pyout messages more gracefully.

File last commit:

r10304:608887ab
r11673:46e19504
Show More
manager.py
77 lines | 2.8 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
#-----------------------------------------------------------------------------
MinRK
update inprocess kernel to new layout...
r10298 # Copyright (C) 2013 The IPython Development Team
epatters
Refactor kernel managers in preparation for the EmbeddedKernel.
r8408 #
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING, distributed as part of this software.
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------
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
epatters
Refactor kernel managers in preparation for the EmbeddedKernel.
r8408
#-----------------------------------------------------------------------------
# Main kernel manager class
#-----------------------------------------------------------------------------
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.
MinRK
move IPython.inprocess to IPython.kernel.inprocess
r9375 kernel = Instance('IPython.kernel.inprocess.ipkernel.InProcessKernel')
MinRK
wrap `client` method for InProcessKM
r10304 # the client class for KM.client() shortcut
client_class = DottedObjectName('IPython.kernel.inprocess.BlockingInProcessKernelClient')
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
epatters
REFACTOR: Terminology change: 'embedded' -> 'in-process'.
r8471 self.kernel = InProcessKernel()
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)