コード例 #1
0
ファイル: crawl.py プロジェクト: edmondsylar/memorious
 def op_count(cls, crawler, stage=None):
     """Total operations performed for this crawler"""
     if stage:
         total_ops = cls.conn.get(make_key(crawler, stage))
     else:
         total_ops = cls.conn.get(make_key(crawler, "total_ops"))
     return unpack_int(total_ops)
コード例 #2
0
ファイル: crawl.py プロジェクト: edmondsylar/memorious
 def runs(cls, crawler):
     for run_id in cls.run_ids(crawler):
         start = cls.conn.get(make_key("run", run_id, "start"))
         end = cls.conn.get(make_key("run", run_id, "end"))
         total_ops = cls.conn.get(make_key("run", run_id, "total_ops"))
         yield {
             'run_id': run_id,
             'total_ops': unpack_int(total_ops),
             'start': unpack_datetime(start, datetime.utcnow()),
             'end': unpack_datetime(end)
         }
コード例 #3
0
 def runs(cls, crawler):
     for run_id in cls.conn.lrange(make_key(crawler, "runs_list"), 0, -1):
         start = cls.conn.get(make_key("run", run_id, "start"))
         end = cls.conn.get(make_key("run", run_id, "end"))
         total_ops = cls.conn.get(make_key("run", run_id, "total_ops"))
         yield {
             'run_id': run_id,
             'total_ops': unpack_int(total_ops),
             'start': unpack_datetime(start),
             'end': unpack_datetime(end)
         }
コード例 #4
0
ファイル: queue.py プロジェクト: MediaUncovered/memorious
 def size(cls, crawler):
     """Total operations pending for this crawler"""
     key = make_key('queue_pending', crawler)
     return unpack_int(cls.conn.get(key))
コード例 #5
0
ファイル: crawl.py プロジェクト: edmondsylar/memorious
 def operation_end(cls, crawler, run_id):
     cls.conn.set(make_key(crawler, "last_run"), pack_now())
     pending = cls.conn.decr(make_key("run", run_id))
     if unpack_int(pending) == 0:
         cls.conn.set(make_key("run", run_id, "end"), pack_now())