ApifyGracefulStopExtension
Index
Methods
__init__
Parameters
crawler: Crawler
Returns None
from_crawler
Create the extension and hook it up to the spider's lifecycle.
Parameters
crawler: Crawler
Returns ApifyGracefulStopExtension
spider_closed
Stop listening for the abort of the Actor run.
Returns None
spider_opened
Start listening for the abort of the Actor run.
Returns None
A Scrapy extension that stops the crawl gracefully when the Actor run is being aborted.
A graceful abort gives the run a moment before it is killed. The extension uses it to stop the engine: no new requests are started, the ones in flight finish along with their callbacks and item pipelines, and the scheduler marks them as handled in the request queue, so resurrecting the run does not download them again. A migration is handled by
ApifySchedulerinstead: the platform restarts a migrating run only if its process does not exit on its own, so the scheduler keeps the crawl running with nothing to do rather than stopping it.