示例#1
0
 def test_get_job(self):
     worker = Worker(['basic'])
     self.resq.enqueue(Basic,"test1")
     job = Job.reserve('basic', self.resq)
     worker.working_on(job)
     name = "%s:%s:%s" % (os.uname()[1],os.getpid(),'basic')
     assert worker.job() == ResQ.decode(self.redis.get('resque:worker:%s' % name))
     assert worker.processing() == ResQ.decode(self.redis.get('resque:worker:%s' % name))
     worker.done_working()
     w2 = Worker(['basic'])
     print w2.job()
     assert w2.job() == {}
示例#2
0
文件: test_worker.py 项目: ph1l/pyres
 def test_get_job(self):
     worker = Worker(['basic'])
     self.resq.enqueue(Basic,"test1")
     job = Job.reserve('basic', self.resq)
     worker.working_on(job)
     name = "%s:%s:%s" % (os.uname()[1],os.getpid(),'basic')
     assert worker.job() == ResQ.decode(self.redis.get('resque:worker:%s' % name))
     assert worker.processing() == ResQ.decode(self.redis.get('resque:worker:%s' % name))
     worker.done_working(job)
     w2 = Worker(['basic'])
     print w2.job()
     assert w2.job() == {}
示例#3
0
    def all(cls, resq, start=0, count=1):
        items = resq.redis.lrange('resque:failed', start, count) or []

        ret_list = []
        for i in items:
            failure = ResQ.decode(i)
            failure['redis_value'] = b64encode(i)
            ret_list.append(failure)
        return ret_list
示例#4
0
文件: redis.py 项目: EG5h/pyres
    def all(cls, resq, start=0, count=1):
        items = resq.redis.lrange('resque:failed', start, count) or []

        ret_list = []
        for i in items:
            failure = ResQ.decode(i)
            failure['redis_value'] = b64encode(i)
            ret_list.append(failure)
        return ret_list
示例#5
0
def failed_retry(request):
    try:
        import json
    except ImportError:
        import simplejson as json
    failed_job = request.POST['failed_job']
    job = b64decode(failed_job)
    decoded = ResQ.decode(job)
    failure.retry(HOST, decoded['queue'], job)
    raise Redirect('/failed/')
示例#6
0
def failed_retry(request):
    try:
        import json
    except ImportError:
        import simplejson as json
    failed_job = request.POST['failed_job']
    job = b64decode(failed_job)
    decoded = ResQ.decode(job)
    failure.retry(HOST, decoded['queue'], job)
    raise Redirect('/failed/')
示例#7
0
def failed_job(request, retry=False):
    failed_job_ = request.POST['failed_job']
    job = b64decode(failed_job_)
    if retry:
        # post /failed/retry
        decoded = ResQ.decode(job)
        failure.retry(get_pyres(), decoded['queue'], job)
    else:
        # post /failed/delete
        failure.delete(get_pyres(), job)
    return redirect('resweb-failed')
示例#8
0
    def all(cls, resq, start=0, count=1):
        """Get a list of the items in the failure queue.

        Redis' documentation: `LLEN <http://redis.io/commands/LLEN>`_

        :param resq: The redis queue instance to check
        :type resq: :class:`ResQ`
        :param start: The location in the queue to start checking at.
        :type start: int
        :param count: The number of items to retrieve
        :type count: int

        :returns: A list of items in the queue
        :rtype: `list` of `dict`
        """
        items = resq.redis.lrange('resque:failed', start, count) or []

        ret_list = []
        for i in items:
            failure = ResQ.decode(i)
            failure['redis_value'] = b64encode(i)
            ret_list.append(failure)
        return ret_list
示例#9
0
文件: worker.py 项目: Affectiva/pyres
 def job(self):
     data = self.resq.redis.get("resque:worker:%s" % self)
     if data:
         return ResQ.decode(data)
     return {}
示例#10
0
文件: core.py 项目: Pyres/resweb
def failed_retry():
    failed_job = request.form['failed_job']
    job = b64decode(failed_job)
    decoded = ResQ.decode(job)
    failure.retry(g.pyres, decoded['queue'], job)
    return redirect(url_for('.failed'))
示例#11
0
 def job(self):
     data = self.resq.redis.get("resque:worker:%s" % self)
     if data:
         return ResQ.decode(data)
     return {}
def failed_retry(request):
    failed_job = request.POST['failed_job']
    job = b64decode(failed_job)
    decoded = ResQ.decode(job)
    failure.retry(HOST, decoded['queue'], job)
    raise Redirect('/failed/')
示例#13
0
文件: server.py 项目: c-oreills/pyres
def failed_retry(request):
    failed_job = request.POST['failed_job']
    job = b64decode(failed_job)
    decoded = ResQ.decode(job)
    failure.retry(HOST, decoded['queue'], job)
    raise Redirect('/failed/')
示例#14
0
文件: worker.py 项目: acmarques/pyres
 def job(self):
     data = self.resq.redis.get(self.namespace + ":worker:%s" % self)
     if data:
         return ResQ.decode(data)
     return {}
示例#15
0
文件: core.py 项目: salimane/resweb
def failed_retry():
    failed_job = request.form['failed_job']
    job = b64decode(failed_job)
    decoded = ResQ.decode(job)
    failure.retry(g.pyres, decoded['queue'], job)
    return redirect(url_for('.failed'))