Scrapy关闭蜘蛛仍然有工作

时间:2017-10-17 18:59:10

标签: python scrapy

2017-10-17 11:48:18 [scrapy.core.engine] INFO: Closing spider (finished)
29957 2017-10-17 11:48:19 [scrapy.statscollectors] INFO: Dumping Scrapy stats:
29958 {'downloader/request_bytes': 2175351,
29959  'downloader/request_count': 6472,
29960  'downloader/request_method_count/GET': 6472,
29961  'downloader/response_bytes': 494012842,
29962  'downloader/response_count': 6472,
29963  'downloader/response_status_count/200': 6419,
29964  'downloader/response_status_count/301': 53,
29965  'dupefilter/filtered': 8,
29966  'finish_reason': 'finished',
29967  'finish_time': datetime.datetime(2017, 10, 17, 11, 48, 19, 59301),
29968  'item_scraped_count': 6417,
29969  'log_count/DEBUG': 12891,
29970  'log_count/ERROR': 1,
29971  'log_count/INFO': 120,
29972  'memusage/max': 385605632,
29973  'memusage/startup': 94334976,
29974  'request_depth_max': 1,
29975  'response_received_count': 6419,
29976  'scheduler/dequeued': 6471,
29977  'scheduler/dequeued/memory': 6471,
29978  'scheduler/enqueued': 6471,
29979  'scheduler/enqueued/memory': 6471,
29980  'spider_exceptions/RuntimeError': 1,
29981  'start_time': datetime.datetime(2017, 10, 17, 9, 55, 15, 21744)}
29982 2017-10-17 11:48:19 [scrapy.core.engine] INFO: Spider closed (finished)

正如你所看到的,我的蜘蛛只做了6472个工作,但实际上我有228336个工作要做,但它刚刚关闭。 我正在抓取一个物业网站,每个物业都有一个身份证号码。我抓取了228336房屋ID并存储在一个文件中。而这个蜘蛛是为了验证这些ID(这一步是成功的)

事情是,我不知道为什么在没有完成所有工作的情况下关闭它,

def parse(self, response):
          print("number of the id_dict is %s"%len(self.house_id_dict))
          for n in self.house_id_dict.keys():    #house ID eg.44225621 
              yield response.follow("/for-sale/details/"+n, callback=self.parse_house)
          print("yield all the links!")

钥匙是房屋ID。它甚至不打印最后一行...... 我要发疯了......

0 个答案:

没有答案