예제 #1
0
 def _dq(self):
     activef = join(self.dqdir, 'active.json')
     if exists(activef):
         with open(activef) as f:
             prios = json.load(f)
     else:
         prios = ()
     q = PriorityQueue(self._newdq, startprios=prios)
     if q:
         log.msg("Resuming crawl (%d requests scheduled)" % len(q), \
             spider=self.spider)
     return q
예제 #2
0
 def _loadinfo(self, chunksize):
     infopath = self._infopath()
     if os.path.exists(infopath):
         with open(infopath) as f:
             info = json.load(f)
     else:
         info = {
             'chunksize': chunksize,
             'size': 0,
             'tail': [0, 0, 0],
             'head': [0, 0],
         }
     return info
예제 #3
0
파일: queue.py 프로젝트: tml/scrapy
 def _loadinfo(self, chunksize):
     infopath = self._infopath()
     if os.path.exists(infopath):
         with open(infopath) as f:
             info = json.load(f)
     else:
         info = {
             'chunksize': chunksize,
             'size': 0,
             'tail': [0, 0, 0],
             'head': [0, 0],
         }
     return info