当前位置: 首页>>代码示例>>Python>>正文


Python ResQ.encode方法代码示例

本文整理汇总了Python中pyres.ResQ.encode方法的典型用法代码示例。如果您正苦于以下问题:Python ResQ.encode方法的具体用法?Python ResQ.encode怎么用?Python ResQ.encode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyres.ResQ的用法示例。


在下文中一共展示了ResQ.encode方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: save

# 需要导入模块: from pyres import ResQ [as 别名]
# 或者: from pyres.ResQ import encode [as 别名]
 def save(self, resq):
     data = {
         'failed_at' : str(datetime.datetime.now()),
         'payload'   : self._payload,
         'error'     : self._parse_message(self._exception),
         'backtrace' : self._parse_traceback(self._traceback),
         'queue'     : self._queue
     }
     data = ResQ.encode(data)
     resq.redis.push('failed', data)
开发者ID:deepu,项目名称:pyres,代码行数:12,代码来源:failure.py

示例2: save

# 需要导入模块: from pyres import ResQ [as 别名]
# 或者: from pyres.ResQ import encode [as 别名]
 def save(self, resq=None):
     if not resq:
         resq = ResQ()
     data = {
         "failed_at": str(datetime.datetime.now()),
         "payload": self._payload,
         "error": self._parse_message(self._exception),
         "backtrace": self._parse_traceback(self._traceback),
         "queue": self._queue,
     }
     if self._worker:
         data["worker"] = self._worker
     data = ResQ.encode(data)
     resq.redis.push("resque:failed", data)
开发者ID:thomasst,项目名称:pyres,代码行数:16,代码来源:redis.py

示例3: save

# 需要导入模块: from pyres import ResQ [as 别名]
# 或者: from pyres.ResQ import encode [as 别名]
 def save(self, resq=None):
     if not resq:
         resq = ResQ()
     data = {
         'failed_at' : str(datetime.datetime.now()),
         'payload'   : self._payload,
         'error'     : self._parse_message(self._exception),
         'backtrace' : self._parse_traceback(self._traceback),
         'queue'     : self._queue
     }
     if self._worker:
         data['worker'] = self._worker
     data = ResQ.encode(data)
     resq.redis.rpush('resque:failed', data)
开发者ID:aezell,项目名称:pyres,代码行数:16,代码来源:redis.py

示例4: save

# 需要导入模块: from pyres import ResQ [as 别名]
# 或者: from pyres.ResQ import encode [as 别名]
 def save(self, resq=None):
     """Saves the failed Job into a "failed" Redis queue preserving all its original enqueud info."""
     if not resq:
         resq = ResQ()
     data = {
         "failed_at": int(time.mktime(datetime.datetime.now().timetuple())),
         "payload": self._payload,
         "error": self._parse_message(self._exception),
         "backtrace": self._parse_traceback(self._traceback),
         "queue": self._queue,
     }
     if self._worker:
         data["worker"] = self._worker
     data = ResQ.encode(data)
     resq.redis.rpush("resque:failed", data)
开发者ID:SMFOSS,项目名称:pyres,代码行数:17,代码来源:redis.py

示例5: save

# 需要导入模块: from pyres import ResQ [as 别名]
# 或者: from pyres.ResQ import encode [as 别名]
 def save(self, resq=None):
     """Saves the failed Job into a "failed" Redis queue preserving all its original enqueud info."""
     if not resq:
         resq = ResQ()
     data = {
         'failed_at' : int(time.mktime(datetime.datetime.now().timetuple())),
         'payload'   : self._payload,
         'error'     : self._parse_message(self._exception),
         'backtrace' : self._parse_traceback(self._traceback),
         'queue'     : self._queue
     }
     if self._worker:
         data['worker'] = self._worker
     data = ResQ.encode(data)
     resq.redis.rpush('resque:failed', data)
开发者ID:harikrishnan83,项目名称:pyres,代码行数:17,代码来源:redis.py

示例6: save

# 需要导入模块: from pyres import ResQ [as 别名]
# 或者: from pyres.ResQ import encode [as 别名]
 def save(self, resq=None):
     """Saves the failed Job into a "failed" Redis queue preserving all its original enqueud info."""
     if not resq:
         resq = ResQ()
     data = {
         'failed_at' : datetime.datetime.now().strftime('%Y/%m/%d %H:%M:%S'),
         'payload'   : self._payload,
         'exception' : self._exception.__class__.__name__,
         'error'     : self._parse_message(self._exception),
         'backtrace' : self._parse_traceback(self._traceback),
         'queue'     : self._queue
     }
     if self._worker:
         data['worker'] = self._worker
     data = ResQ.encode(data)
     resq.redis.rpush('resque:failed', data)
开发者ID:EG5h,项目名称:pyres,代码行数:18,代码来源:redis.py

示例7: save

# 需要导入模块: from pyres import ResQ [as 别名]
# 或者: from pyres.ResQ import encode [as 别名]
 def save(self, resq=None):
     """Saves the failed Job into a "failed" Redis queue preserving all its original enqueud info."""
     if not resq:
         resq = ResQ()
     data = {
         "failed_at": datetime.datetime.now().strftime("%Y/%m/%d %H:%M:%S"),
         "payload": self._payload,
         "exception": self._exception.__class__.__name__,
         "error": self._parse_message(self._exception),
         "backtrace": self._parse_traceback(self._traceback),
         "queue": self._queue,
     }
     if self._worker:
         data["worker"] = self._worker
     data = ResQ.encode(data)
     resq.redis.rpush("resque:failed", data)
开发者ID:kvamsi,项目名称:pyres,代码行数:18,代码来源:redis.py

示例8: test_push

# 需要导入模块: from pyres import ResQ [as 别名]
# 或者: from pyres.ResQ import encode [as 别名]
 def test_push(self):
     self.resq.push('pushq','content-newqueue')
     self.resq.push('pushq','content2-newqueue')
     assert self.redis.llen('resque:queue:pushq') == 2
     assert self.redis.lindex('resque:queue:pushq', 0) == ResQ.encode('content-newqueue')
     assert self.redis.lindex('resque:queue:pushq', 1) == ResQ.encode('content2-newqueue')
开发者ID:fakechris,项目名称:pyres,代码行数:8,代码来源:test_resq.py

示例9: test_push

# 需要导入模块: from pyres import ResQ [as 别名]
# 或者: from pyres.ResQ import encode [as 别名]
 def test_push(self):
     self.resq.push("pushq", "content-newqueue")
     self.resq.push("pushq", "content2-newqueue")
     assert self.redis.llen("resque:queue:pushq") == 2
     assert self.redis.lindex("resque:queue:pushq", 0) == ResQ.encode("content-newqueue")
     assert self.redis.lindex("resque:queue:pushq", 1) == ResQ.encode("content2-newqueue")
开发者ID:aezell,项目名称:pyres,代码行数:8,代码来源:test_resq.py


注:本文中的pyres.ResQ.encode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。