Called by the event loop when it is stopped.

        Calls :py:meth:`on_stop`, then sends :py:data:`None` to each
        output to shut down the rest of the processing pipeline.
194085
def stop_event(self):
        
        self.logger.debug('stopping')
        try:
            self.on_stop()
        except Exception as ex:
            self.logger.exception(ex)
        for name in self.outputs:
            self.send(name, None)
50040
def send_stop_signal(self, silent=False):
        
        if self.is_running():
            self._stop_signal = True
        elif not silent:
            raise RuntimeError('Loop is currently not running')
736902
def stop(self, timeout=None):
        
        if timeout is not None:
            log.warning('timeout argument to stop() is deprecated - '
                        'it will be removed in future release')

        if not self.async_send:
            log.warning('producer.stop() called, but producer is not async')
            return

        if self.stopped:
            log.warning('producer.stop() called, but producer is already stopped')
            return

        if self.async_send:
            self.queue.put((STOP_ASYNC_PRODUCER, None, None))
            self.thread_stop_event.set()
            self.thread.join()

        if hasattr(self, '_cleanup_func'):
            # Remove cleanup handler now that we've stopped

            # py3 supports unregistering
            if hasattr(atexit, 'unregister'):
                atexit.unregister(self._cleanup_func)  # pylint: disable=no-member

            # py2 requires removing from private attribute...
            else:

                # ValueError on list.remove() if the exithandler no longer exists
                # but that is fine here
                try:
                    atexit._exithandlers.remove(  # pylint: disable=no-member
                        (self._cleanup_func, (self,), {}))
                except ValueError:
                    pass

            del self._cleanup_func

        self.stopped = True
341943
def stop(self):
        
        if self.socket is not None:
            self.socket.close()
            self.socket = None
            self.data = None
667509
def stop_execution(self):
        
        super(LoadDataset, self).stop_execution()
        self._loader = None
        self._iterator = None
186037
def stop_process(self):
        
        self._process.terminate()
        if not self._process.waitForFinished(100):
            self._process.kill()
1010316
def close(self):
        

        self._no_mute_on_stop_playback()

        # First close the subprocess
        self._stop()

        # Here is fallback solution and cleanup
        if self.connection_timeout_thread is not None:
            self.connection_timeout_thread.cancel()
        if self.delay_thread is not None:
            self.delay_thread.cancel()
        if self.process is not None:
            os.kill(self.process.pid, 15)
            self.process.wait()
        self.process = None
197908
def _StopAnalysisProcesses(self, abort=False):
    
    logger.debug('Stopping analysis processes.')
    self._StopMonitoringProcesses()

    # Note that multiprocessing.Queue is very sensitive regarding
    # blocking on either a get or a put. So we try to prevent using
    # any blocking behavior.

    if abort:
      # Signal all the processes to abort.
      self._AbortTerminate()

    if not self._use_zeromq:
      logger.debug('Emptying queues.')
      for event_queue in self._event_queues.values():
        event_queue.Empty()

    # Wake the processes to make sure that they are not blocking
    # waiting for the queue new items.
    for event_queue in self._event_queues.values():
      event_queue.PushItem(plaso_queue.QueueAbort(), block=False)

    # Try waiting for the processes to exit normally.
    self._AbortJoin(timeout=self._PROCESS_JOIN_TIMEOUT)
    for event_queue in self._event_queues.values():
      event_queue.Close(abort=abort)

    if abort:
      # Kill any remaining processes.
      self._AbortKill()
    else:
      # Check if the processes are still alive and terminate them if necessary.
      self._AbortTerminate()
      self._AbortJoin(timeout=self._PROCESS_JOIN_TIMEOUT)

      for event_queue in self._event_queues.values():
        event_queue.Close(abort=True)
1157376
def stop(self, signal=None):
        
        signal = signal or self.int_signal
        self.out.log("Cleaning up local Heroku process...")
        if self._process is None:
            self.out.log("No local Heroku process was running.")
            return

        try:
            os.killpg(os.getpgid(self._process.pid), signal)
            self.out.log("Local Heroku process terminated.")
        except OSError:
            self.out.log("Local Heroku was already terminated.")
            self.out.log(traceback.format_exc())
        finally:
            self._process = None
640297
def stop_event_stream(self):
        
        if self._stream:
            self._stream.stop()
            self._stream.join()
            self._stream = None
            with self._events.mutex:
                self._events.queue.clear()
997190
def stop_data_fetch(self):
        
        if self._data_fetcher:
            self._data_fetcher.stop.set()
            self._data_fetcher = None
1176684
def stop(self):
    """"""

    log.info('Stopping %s' % self)

    pids = list(self._processes)

    # Clean up the context
    for pid in pids:
      self.terminate(pid)

    while self._connections:
      pid = next(iter(self._connections))
      conn = self._connections.pop(pid, None)
      if conn:
        conn.close()

    self.__loop.stop()
57424
def close(self):
        
        if not self._closed:
            closed = False
            event = self.event('connection_lost')
            if self.transport:
                if self._loop.get_debug():
                    self.logger.debug('Closing connection %s', self)
                if self.transport.can_write_eof():
                    try:
                        self.transport.write_eof()
                    except Exception:
                        pass
                try:
                    worker = self.close_pipeline()
                    self.transport.close()
                    closed = self._loop.create_task(
                        self._close(event.waiter(), worker)
                    )
                except Exception:
                    pass
            self._closed = closed or True
            if not closed:
                event.fire()
        return self._closed
1345192
def on_shutdown(self):
        
        LOG.debug('%r.on_shutdown()', self)
        for stream, state in self._state_by_stream.items():
            state.lock.acquire()
            try:
                for sender, fp in reversed(state.jobs):
                    sender.close()
                    fp.close()
                    state.jobs.pop()
            finally:
                state.lock.release()
555943
def on_close(self, event):
        
        self.events.mouse_press.disconnect(self._process_mouse_event)
        self.events.mouse_move.disconnect(self._process_mouse_event)
        self.events.mouse_release.disconnect(self._process_mouse_event)
        self.events.mouse_wheel.disconnect(self._process_mouse_event)
1140722
async def shutdown(self):
        
        logger.display("Looper shutting down now...", extra={"cli": False})
        self.running = False
        start = time.perf_counter()
        if not self.runFut.done():
            await self.runFut
        self.stopall()
        logger.display("Looper shut down in {:.3f} seconds.".
                       format(time.perf_counter() - start), extra={"cli": False})
        # Unset signal handlers, bug: https://bugs.python.org/issue23548
        for sig_name in self.signals:
            logger.debug("Unsetting handler for {}".format(sig_name))
            sig_num = getattr(signal, sig_name)
            self.loop.remove_signal_handler(sig_num)
344608
def stop(self):
        
        if self._stack:
            try:
                self._stack.teardown()
            except Exception:
                self.fatal(sys.exc_info())

        super().stop()