make Crawler.start() return a deferred that is fired when the crawl is finished

This commit is contained in:
Pablo Hoffman 2013-03-20 14:40:30 -03:00
parent c43931ea8c
commit 2a5c7ed4da
2 changed files with 4 additions and 0 deletions

View File

@ -101,6 +101,7 @@ how you :ref:`configure the downloader middlewares
.. method:: start()
Start the crawler. This calls :meth:`configure` if it hasn't been called yet.
Returns a deferred that is fired when the crawl is finished.
Settings API
============

View File

@ -74,6 +74,8 @@ class ExecutionEngine(object):
self.start_time = time()
yield self.signals.send_catch_log_deferred(signal=signals.engine_started)
self.running = True
self._closewait = defer.Deferred()
yield self._closewait
def stop(self):
"""Stop the execution engine gracefully"""
@ -284,3 +286,4 @@ class ExecutionEngine(object):
@defer.inlineCallbacks
def _finish_stopping_engine(self):
yield self.signals.send_catch_log_deferred(signal=signals.engine_stopped)
self._closewait.callback(None)