def receive(self): try: if self.pipe.llen(self.internal_queue) > 0: return utils.decode(self.pipe.lindex(self.internal_queue, -1)) return utils.decode(self.pipe.brpoplpush(self.source_queue, self.internal_queue, 0)) except Exception as exc: raise exceptions.PipelineError(exc);
def receive(self): try: if self.pipe.llen(self.internal_queue) > 0: return utils.decode(self.pipe.lindex(self.internal_queue, -1)) return utils.decode( self.pipe.brpoplpush(self.source_queue, self.internal_queue, 0)) except Exception as exc: raise exceptions.PipelineError(exc)
def to_json(self): json_dict = self.to_dict() return utils.decode(json.dumps(json_dict, ensure_ascii=True))
def serialize(self): self['__type'] = self.__class__.__name__ json_dump = utils.decode(json_dumps(self))