def work(self):
batch, consumed = self.collect_batch()
self.states_context.fetch()
self.process_batch(batch)
self.update_score.flush()
self.states_context.release()
# Exiting, if crawl is finished
if self.strategy.finished():
logger.info("Successfully reached the crawling goal.")
logger.info("Closing crawling strategy.")
self.strategy.close()
logger.info("Finishing.")
reactor.callFromThread(reactor.stop)
self.stats['last_consumed'] = consumed
self.stats['last_consumption_run'] = asctime()
self.stats['consumed_since_start'] += consumed
评论列表
文章目录