Esempio n. 1
0
 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')
Esempio n. 2
0
 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)
Esempio n. 3
0
 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)
Esempio n. 4
0
 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)
Esempio n. 5
0
 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)
Esempio n. 6
0
 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)
Esempio n. 7
0
 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)
Esempio n. 8
0
 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)
Esempio n. 9
0
File: redis.py Progetto: EG5h/pyres
 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)
Esempio n. 10
0
 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)
Esempio n. 11
0
 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')
Esempio n. 12
0
 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")