本文整理匯總了Python中IPython.kernel.inprocess.manager.InProcessKernelManager.restart_kernel方法的典型用法代碼示例。如果您正苦於以下問題:Python InProcessKernelManager.restart_kernel方法的具體用法?Python InProcessKernelManager.restart_kernel怎麽用?Python InProcessKernelManager.restart_kernel使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類IPython.kernel.inprocess.manager.InProcessKernelManager
的用法示例。
在下文中一共展示了InProcessKernelManager.restart_kernel方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_interface
# 需要導入模塊: from IPython.kernel.inprocess.manager import InProcessKernelManager [as 別名]
# 或者: from IPython.kernel.inprocess.manager.InProcessKernelManager import restart_kernel [as 別名]
def test_interface(self):
""" Does the in-process kernel manager implement the basic KM interface?
"""
km = InProcessKernelManager()
self.assert_(not km.has_kernel)
km.start_kernel()
self.assert_(km.has_kernel)
self.assert_(km.kernel is not None)
kc = BlockingInProcessKernelClient(kernel=km.kernel)
self.assert_(not kc.channels_running)
kc.start_channels()
self.assert_(kc.channels_running)
old_kernel = km.kernel
km.restart_kernel()
self.assertIsNotNone(km.kernel)
self.assertNotEquals(km.kernel, old_kernel)
km.shutdown_kernel()
self.assert_(not km.has_kernel)
self.assertRaises(NotImplementedError, km.interrupt_kernel)
self.assertRaises(NotImplementedError, km.signal_kernel, 9)
kc.stop_channels()
self.assert_(not kc.channels_running)