Пример #1
0
def suspend_task_get(request, task_id):
    '''Returns status and result formattet in JSON.'''
    status = default_backend.get_status(task_id)
    res = default_backend.get_result(task_id)
    response_data = dict(task_id=task_id, status=status, result=res)
    if status in default_backend.EXCEPTION_STATES:
        traceback = default_backend.get_traceback(task_id)
        response_data.update({
            'traceback': traceback,
            'result': str(res.args[0])
        })
    return HttpResponse(JSON_dump(response_data), mimetype="application/json")
Пример #2
0
def task_status(request, task_id):
    """Returns task status and result in JSON format."""
    status = default_backend.get_status(task_id)
    res = default_backend.get_result(task_id)
    response_data = dict(id=task_id, status=status, result=res)
    if status in default_backend.EXCEPTION_STATES:
        traceback = default_backend.get_traceback(task_id)
        response_data.update(
            {"result": str(res.args[0]), "exc": get_full_cls_name(res.__class__), "traceback": traceback}
        )

    return HttpResponse(JSON_dump({"task": response_data}), mimetype="application/json")
Пример #3
0
def task_status(request, task_id):
    response = json_response(status=200, text='ok')
    status = default_backend.get_status(task_id)
    res = default_backend.get_result(task_id)
    response['data'] = {
        'id':     task_id,
        'status': status,
        'result': res
    }
    if status in default_backend.EXCEPTION_STATES:
        traceback = default_backend.get_traceback(task_id)
        response['data'].update({'result':    str(res.args[0]),
                                 'exc':       get_full_cls_name(res.__class__),
                                 'traceback': traceback})
    return response
def task_status(request, task_id):
    """Returns task status and result in JSON format."""
    status = default_backend.get_status(task_id)
    res = default_backend.get_result(task_id)
    response_data = dict(id=task_id, status=status, result=res)
    if status in default_backend.EXCEPTION_STATES:
        traceback = default_backend.get_traceback(task_id)
        response_data.update({
            "result": repr(res),
            "exc": get_full_cls_name(res.__class__),
            "traceback": traceback
        })

    return HttpResponse(JSON_dump({"task": response_data}),
                        mimetype="application/json")