strategy.py 文件源码

python
阅读 29 收藏 0 点赞 0 评论 0

项目:frontera-docs-zh_CN 作者: xsren 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号