本文整理汇总了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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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')
示例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")