environment/lib/python2.7/site-packages/IPython/zmq/kernelmanager.py
def shutdown_kernel(self, restart=False):
        """ Attempts to the stop the kernel process cleanly. If the kernel
        cannot be stopped, it is killed, if possible.
        """
        # FIXME: Shutdown does not work on Windows due to ZMQ errors!
        if sys.platform == 'win32':
            self.kill_kernel()
            return

        # Pause the heart beat channel if it exists.
        if self._hb_channel is not None:
            self._hb_channel.pause()

        # Don't send any additional kernel kill messages immediately, to give
        # the kernel a chance to properly execute shutdown actions. Wait for at
        # most 1s, checking every 0.1s.
        self.shell_channel.shutdown(restart=restart)
        for i in range(10):
            if self.is_alive:
                time.sleep(0.1)
            else:
                break
        else:
            # OK, we've waited long enough.
            if self.has_kernel:
                self.kill_kernel()

        if not restart and self._connection_file_written:
            # cleanup connection files on full shutdown of kernel we started
            self._connection_file_written = False
            try:
                os.remove(self.connection_file)
            except IOError:
                pass
def shutdown_kernel(self, restart=False):
        # FIXME: Shutdown does not work on Windows due to ZMQ errors!
        if sys.platform == 'win32':
            self.kill_kernel()
            return

        # Pause the heart beat channel if it exists.
        if self._hb_channel is not None:
            self._hb_channel.pause()

        # Don't send any additional kernel kill messages immediately, to give
        # the kernel a chance to properly execute shutdown actions. Wait for at
        # most 1s, checking every 0.1s.
        self.shell_channel.shutdown(restart=restart)
        for i in range(10):
            if self.is_alive:
                time.sleep(0.1)
            else:
                break
        else:
            # OK, we've waited long enough.
            if self.has_kernel:
                self.kill_kernel()

        if not restart and self._connection_file_written:
            # cleanup connection files on full shutdown of kernel we started
            self._connection_file_written = False
            try:
                os.remove(self.connection_file)
            except IOError:
                pass
def shutdown_kernel ( self , restart = False ) : # FIXME: Shutdown does not work on Windows due to ZMQ errors! if sys . platform == 'win32' : self . kill_kernel ( ) return # Pause the heart beat channel if it exists. if self . _hb_channel is not None : self . _hb_channel . pause ( ) # Don't send any additional kernel kill messages immediately, to give # the kernel a chance to properly execute shutdown actions. Wait for at # most 1s, checking every 0.1s. self . shell_channel . shutdown ( restart = restart ) for i in range ( 10 ) : if self . is_alive : time . sleep ( 0.1 ) else : break else : # OK, we've waited long enough. if self . has_kernel : self . kill_kernel ( ) if not restart and self . _connection_file_written : # cleanup connection files on full shutdown of kernel we started self . _connection_file_written = False try : os . remove ( self . connection_file ) except IOError : pass
Attempts to the stop the kernel process cleanly. If the kernel
        cannot be stopped, it is killed, if possible.
Attempts to the stop the kernel process cleanly . If the kernel cannot be stopped it is killed if possible .