Example #1
0
 def patch_to_redis(self, fullpatch):
     """
     Called on session finish, once per recid."""
     identifier = client_patches.format(
         uuid=fullpatch["task_id"], recid=fullpatch["recid"], record_hash=fullpatch["record_hash"]
     )
     self.conn.rpush(identifier, fullpatch["patch"])
Example #2
0
 def all_patches(self):
     identifier = client_patches.format(uuid=self.uuid, recid="*", record_hash="*")
     patches = defaultdict(list)
     for sub_id in self.conn.scan_iter(identifier):
         for patch in self.conn.lrange(sub_id, 0, -1):
             recid = int(sub_id.split(":")[3])
             patches[recid].append(patch)
     return patches
Example #3
0
 def patch_to_redis(self, fullpatch):
     """
     Called on session finish, once per recid."""
     identifier = client_patches.format(
         uuid=fullpatch['task_id'],
         recid=fullpatch['recid'],
         record_hash=fullpatch['record_hash'],
     )
     self.conn.rpush(identifier, fullpatch['patch'])
Example #4
0
 def all_patches(self):
     identifier = client_patches.format(uuid=self.uuid,
                                        recid='*',
                                        record_hash='*')
     patches = defaultdict(list)
     for sub_id in self.conn.scan_iter(identifier):
         for patch in self.conn.lrange(sub_id, 0, -1):
             recid = int(sub_id.split(':')[3])
             patches[recid].append(patch)
     return patches
Example #5
0
def get_sorted_fullpatches(recid, worker_id):
    """Get sorted fullpatches for this worker.

    :param recid: recid to get patches for
    """
    identifier = client_patches.format(uuid=worker_id, recid=recid, record_hash="*")
    conn = get_redis_conn()
    for id_ in conn.scan_iter(identifier):
        patch = conn.lpop(id_)
        while patch is not None:
            yield id_to_fullpatch(id_, patch)
            patch = conn.lpop(id_)
Example #6
0
def get_sorted_fullpatches(recid, worker_id):
    """Get sorted fullpatches for this worker.

    :param recid: recid to get patches for
    """
    identifier = client_patches.format(uuid=worker_id,
                                       recid=recid,
                                       record_hash='*')
    conn = get_redis_conn()
    for id_ in conn.scan_iter(identifier):
        patch = conn.lpop(id_)
        while patch is not None:
            yield id_to_fullpatch(id_, patch)
            patch = conn.lpop(id_)
Example #7
0
 def _clear_own_patches(self):
     identifier = client_patches.format(uuid=self.task_id, recid="*", record_hash="*")
     for redis_patch in self.conn.scan_iter(identifier):
         self.conn.delete(redis_patch)
Example #8
0
 def _clear_own_patches(self):
     identifier = client_patches.format(uuid=self.task_id,
                                        recid='*',
                                        record_hash='*')
     for redis_patch in self.conn.scan_iter(identifier):
         self.conn.delete(redis_patch)