def __put_next(srv, hashdic, hashdic_left, allset, key, lock): dbg.job("submitted to: %s" % srv) while True: lock.acquire() if (len(hashdic[key]) == 0 or len(allset) == 0): lock.release() break next = hashdic[key].pop() if (next in allset): allset.remove(next) else: hashdic_left[key].append(next) next = None lock.release() if next is not None: with open(self.get_local_obj_path(next), "rb") as f: blob = f.read() for tr in self.translators: blob = tr.put(blob) # XXX HACK backoff = 0.5 remote_path = self.get_remote_obj_path(next) while not srv.put(remote_path, blob): dbg.dbg("backoff %s" % srv) time.sleep(backoff) backoff *= 2
def __put_next(srv, hashdic, hashdic_left, allset, key, lock): dbg.job("submitted to: %s" % srv) while True: lock.acquire() if(len(hashdic[key]) == 0 or len(allset) == 0): lock.release() break next = hashdic[key].pop() if(next in allset): allset.remove(next) else: hashdic_left[key].append(next) next = None lock.release() if next is not None: with open(self.get_local_obj_path(next), "rb") as f: blob = f.read() for tr in self.translators: blob = tr.put(blob) # XXX HACK backoff = 0.5 remote_path = self.get_remote_obj_path(next) while not srv.put(remote_path, blob): dbg.dbg("backoff %s" % srv) time.sleep(backoff) backoff *= 2
def __get(srv, path, remote_path): dbg.job("submitted to: %s (%s)" % (srv, path)) with open(path, "wb") as f: blob = srv.get(remote_path) if (blob is None): time.sleep(1) blob = srv.get(remote_path) for tr in reversed(self.translators): blob = tr.get(blob) f.write(blob)
def __get(srv, path, remote_path): dbg.job("submitted to: %s (%s)" % (srv, path)) with open(path, "wb") as f: blob = srv.get(remote_path) if(blob is None): time.sleep(1) blob = srv.get(remote_path) for tr in reversed(self.translators): blob = tr.get(blob) f.write(blob)
def __rm_next(srv, lst, lock): dbg.job("submitted to: %s" % srv) while True: lock.acquire() if (len(lst) == 0): lock.release() break next = lst.pop() lock.release() if next is not None: remote_path = self.get_remote_obj_path(next) srv.rm(remote_path)
def __rm_next(srv, lst, lock): dbg.job("submitted to: %s" % srv) while True: lock.acquire() if(len(lst) == 0): lock.release() break next = lst.pop() lock.release() if next is not None: remote_path = self.get_remote_obj_path(next) srv.rm(remote_path)
def __put_next(srv, lst, lock): dbg.job("submitted to: %s" % srv) while True: lock.acquire() if (len(lst) == 0): lock.release() break next = lst.pop() lock.release() if next is not None: with open(self.get_local_obj_path(next), "rb") as f: blob = f.read() for tr in self.translators: blob = tr.put(blob) # XXX HACK backoff = 0.5 remote_path = self.get_remote_obj_path(next) while not srv.put(remote_path, blob): time.sleep(backoff) backoff *= 2
def __put_next(srv, lst, lock): dbg.job("submitted to: %s" % srv) while True: lock.acquire() if(len(lst) == 0): lock.release() break next = lst.pop() lock.release() if next is not None: with open(self.get_local_obj_path(next), "rb") as f: blob = f.read() for tr in self.translators: blob = tr.put(blob) # XXX HACK backoff = 0.5 remote_path = self.get_remote_obj_path(next) while not srv.put(remote_path, blob): time.sleep(backoff) backoff *= 2
def __rm(srv, remote_path): dbg.job("submitted to: %s (%s)" % (srv, remote_path)) srv.rm(remote_path)