environment/lib/python2.7/site-packages/IPython/frontend/html/notebook/kernelmanager.py
def restart_kernel(self, kernel_id):
        """Restart a kernel while keeping clients connected."""
        self._check_kernel_id(kernel_id)
        km = self.get_kernel(kernel_id)
        km.restart_kernel()
        self.log.info("Kernel restarted: %s" % kernel_id)
        return kernel_id
        
        # the following remains, in case the KM restart machinery is
        # somehow unacceptable
        # Get the notebook_id to preserve the kernel/notebook association.
        notebook_id = self.notebook_for_kernel(kernel_id)
        # Create the new kernel first so we can move the clients over.
        new_kernel_id = self.start_kernel()
        # Now kill the old kernel.
        self.kill_kernel(kernel_id)
        # Now save the new kernel/notebook association. We have to save it
        # after the old kernel is killed as that will delete the mapping.
        self.set_kernel_for_notebook(notebook_id, new_kernel_id)
        self.log.info("Kernel restarted: %s" % new_kernel_id)
        return new_kernel_id
def restart_kernel(self, kernel_id):
        self._check_kernel_id(kernel_id)
        km = self.get_kernel(kernel_id)
        km.restart_kernel()
        self.log.info("Kernel restarted: %s" % kernel_id)
        return kernel_id
        
        # the following remains, in case the KM restart machinery is
        # somehow unacceptable
        # Get the notebook_id to preserve the kernel/notebook association.
        notebook_id = self.notebook_for_kernel(kernel_id)
        # Create the new kernel first so we can move the clients over.
        new_kernel_id = self.start_kernel()
        # Now kill the old kernel.
        self.kill_kernel(kernel_id)
        # Now save the new kernel/notebook association. We have to save it
        # after the old kernel is killed as that will delete the mapping.
        self.set_kernel_for_notebook(notebook_id, new_kernel_id)
        self.log.info("Kernel restarted: %s" % new_kernel_id)
        return new_kernel_id
def restart_kernel ( self , kernel_id ) : self . _check_kernel_id ( kernel_id ) km = self . get_kernel ( kernel_id ) km . restart_kernel ( ) self . log . info ( "Kernel restarted: %s" % kernel_id ) return kernel_id # the following remains, in case the KM restart machinery is # somehow unacceptable # Get the notebook_id to preserve the kernel/notebook association. notebook_id = self . notebook_for_kernel ( kernel_id ) # Create the new kernel first so we can move the clients over. new_kernel_id = self . start_kernel ( ) # Now kill the old kernel. self . kill_kernel ( kernel_id ) # Now save the new kernel/notebook association. We have to save it # after the old kernel is killed as that will delete the mapping. self . set_kernel_for_notebook ( notebook_id , new_kernel_id ) self . log . info ( "Kernel restarted: %s" % new_kernel_id ) return new_kernel_id
Restart a kernel while keeping clients connected.
Restart a kernel while keeping clients connected .