Example #1
0
	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);
Example #2
0
 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)
Example #3
0
	def to_json(self):
		json_dict = self.to_dict()
		return utils.decode(json.dumps(json_dict, ensure_ascii=True))
Example #4
0
	def serialize(self):
		self['__type'] = self.__class__.__name__
		json_dump = utils.decode(json_dumps(self))