コード例 #1
0
def task_get(request, task=None):
    """Retrieve a task processing status for the given task id.

    :param request: A :class:`pyramid.request.Request` object.

    :type request: pyramid.request.Request
    :rtype: fanboi2.tasks.ResultProxy
    """
    if task is None:
        task = celery.AsyncResult(request.matchdict['task'])
    response = ResultProxy(task)
    if response.success():
        if isinstance(response.object, BaseError):
            raise response.object
    return response
コード例 #2
0
def task_get(request, task=None):
    """Retrieve a task processing status for the given task id.

    :param request: A :class:`pyramid.request.Request` object.

    :type request: pyramid.request.Request
    :rtype: fanboi2.tasks.ResultProxy
    """
    if task is None:
        task = celery.AsyncResult(request.matchdict['task'])
    response = ResultProxy(task)
    if response.success():
        if isinstance(response.object, BaseError):
            raise response.object
    return response
コード例 #3
0
 def test_success_non_success(self):
     from fanboi2.tasks import ResultProxy
     proxy = ResultProxy(DummyAsyncResult('demo', 'pending'))
     self.assertFalse(proxy.success())
コード例 #4
0
 def test_success(self):
     from fanboi2.tasks import ResultProxy
     proxy = ResultProxy(DummyAsyncResult('demo', 'success'))
     self.assertTrue(proxy.success())
コード例 #5
0
ファイル: test_tasks.py プロジェクト: pepe5/fanboi2
 def test_success_non_success(self):
     from fanboi2.tasks import ResultProxy
     proxy = ResultProxy(DummyAsyncResult('demo', 'pending'))
     self.assertFalse(proxy.success())
コード例 #6
0
ファイル: test_tasks.py プロジェクト: pepe5/fanboi2
 def test_success(self):
     from fanboi2.tasks import ResultProxy
     proxy = ResultProxy(DummyAsyncResult('demo', 'success'))
     self.assertTrue(proxy.success())