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


Python ResQ.decode方法代码示例

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


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

示例1: test_get_job

# 需要导入模块: from pyres import ResQ [as 别名]
# 或者: from pyres.ResQ import decode [as 别名]
 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() == {}
开发者ID:duxiaoyao,项目名称:pyres,代码行数:14,代码来源:test_worker.py

示例2: all

# 需要导入模块: from pyres import ResQ [as 别名]
# 或者: from pyres.ResQ import decode [as 别名]
    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
开发者ID:EG5h,项目名称:pyres,代码行数:11,代码来源:redis.py

示例3: failed_retry

# 需要导入模块: from pyres import ResQ [as 别名]
# 或者: from pyres.ResQ import decode [as 别名]
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/')
开发者ID:harikrishnan83,项目名称:pyres,代码行数:12,代码来源:server.py

示例4: failed_job

# 需要导入模块: from pyres import ResQ [as 别名]
# 或者: from pyres.ResQ import decode [as 别名]
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')
开发者ID:geros,项目名称:pyres_django,代码行数:13,代码来源:views.py

示例5: all

# 需要导入模块: from pyres import ResQ [as 别名]
# 或者: from pyres.ResQ import decode [as 别名]
    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
开发者ID:TylerLubeck,项目名称:pyres,代码行数:25,代码来源:redis.py

示例6: job

# 需要导入模块: from pyres import ResQ [as 别名]
# 或者: from pyres.ResQ import decode [as 别名]
 def job(self):
     data = self.resq.redis.get("resque:worker:%s" % self)
     if data:
         return ResQ.decode(data)
     return {}
开发者ID:Affectiva,项目名称:pyres,代码行数:7,代码来源:worker.py

示例7: failed_retry

# 需要导入模块: from pyres import ResQ [as 别名]
# 或者: from pyres.ResQ import decode [as 别名]
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'))
开发者ID:Pyres,项目名称:resweb,代码行数:8,代码来源:core.py

示例8: failed_retry

# 需要导入模块: from pyres import ResQ [as 别名]
# 或者: from pyres.ResQ import decode [as 别名]
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/')
开发者ID:c-oreills,项目名称:pyres,代码行数:8,代码来源:server.py


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