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"])
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
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'])
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
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_)
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_)
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)
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)