(self)
return dfd.addBoth(_finish_stopping_engine)
Gracefully stop the execution engine
Gracefully stop the execution engine
Gracefully stop the execution engine
def stop(self) -> Deferred:
        """Gracefully stop the execution engine"""
        @inlineCallbacks
        def _finish_stopping_engine(_) -> Deferred:
            yield self.signals.send_catch_log_deferred(signal=signals.engine_stopped)
            self._closewait.callback(None)

        if not self.running:
            raise RuntimeError("Engine not running")

        self.running = False
        dfd = self.close_spider(self.spider, reason="shutdown") if self.spider is not None else succeed(None)
        return dfd.addBoth(_finish_stopping_engine)
def stop ( self ) -> Deferred : @ inlineCallbacks def _finish_stopping_engine ( _ ) -> Deferred : yield self . signals . send_catch_log_deferred ( signal = signals . engine_stopped ) self . _closewait . callback ( None ) if not self . running : raise RuntimeError ( "Engine not running" ) self . running = False dfd = self . close_spider ( self . spider , reason = "shutdown" ) if self . spider is not None else succeed ( None ) return dfd . addBoth ( _finish_stopping_engine )