def is_queued(self, value): """ Return True if item is in queue or currently being processed. False otherwise """ cli = raw_client() entries = self._q.structure_paths[1] # eek this is aweful try: items = { cli.get(join(entries, x))[0] for x in cli.get_children(entries)} except NoNodeError: items = [] if util.tobytes(value) in items: return True return False
def is_queued(self, value): """ Return True if item is in queue or currently being processed. False otherwise """ cli = raw_client() entries = self._q.structure_paths[1] # eek this is aweful try: items = { cli.get(join(entries, x))[0] for x in cli.get_children(entries) } except NoNodeError: items = [] if util.tobytes(value) in items: return True return False
def put(self, value, priority=100): self._q.put(util.tobytes(value), priority=priority)
def create(path, value): try: return raw_client().create(path, util.tobytes(value), makepath=True) except NodeExistsError as err: raise exceptions.NodeExistsError("%s: %s" % (path, err))
def set(path, value): try: return raw_client().set(path, util.tobytes(value)) except NoNodeError as err: raise exceptions.NoNodeError( "Must first create node before setting a new value. %s" % err)