(request, task_id)
return JsonResponse({'task': response_data})
Return task status and result in JSON format.
Return task status and result in JSON format.
Return task status and result in JSON format .
def task_status(request, task_id):
    """Return task status and result in JSON format."""
    result = AsyncResult(task_id)
    state, retval = result.state, result.result
    response_data = {'id': task_id, 'status': state, 'result': retval}
    if state in states.EXCEPTION_STATES:
        traceback = result.traceback
        response_data.update({'result': safe_repr(retval),
                              'exc': get_full_cls_name(retval.__class__),
                              'traceback': traceback})
    return JsonResponse({'task': response_data})
def task_status ( request , task_id ) : result = AsyncResult ( task_id ) state , retval = result . state , result . result response_data = { 'id' : task_id , 'status' : state , 'result' : retval } if state in states . EXCEPTION_STATES : traceback = result . traceback response_data . update ( { 'result' : safe_repr ( retval ) , 'exc' : get_full_cls_name ( retval . __class__ ) , 'traceback' : traceback } ) return JsonResponse ( { 'task' : response_data } )