Exemple #1
0
def result(request, task_id):
    """
    Fetch the result for one Celery task id.
    """
    async = OcrTask.get_celery_result(task_id)
    out = dict(task_id=async .task_id,
               status=async .status,
               results=async .result)
    response = HttpResponse(mimetype="application/json")
    json.dump(out, response, ensure_ascii=False)
    return response
Exemple #2
0
def result(request, task_id):
    """
    Fetch the result for one Celery task id.
    """
    async = OcrTask.get_celery_result(task_id)
    out = dict(
        task_id=async.task_id,
        status=async.status,
        results=async.result
    )
    response = HttpResponse(mimetype="application/json")
    json.dump(out, response, ensure_ascii=False)
    return response
Exemple #3
0
def results(request, task_ids):
    """
    Fetch the results of several Celery task ids.
    """
    out = []
    for task_id in task_ids.split(","):
        async = OcrTask.get_celery_result(task_id)
        out.append(dict(
            result=_flatten_result(async.result),
            task_id=task_id,
            status=async.status,
        ))
    response = HttpResponse(mimetype="application/json")
    json.dump(out, response, ensure_ascii=False)
    return response
Exemple #4
0
def results(request, task_ids):
    """
    Fetch the results of several Celery task ids.
    """
    out = []
    for task_id in task_ids.split(","):
        async = OcrTask.get_celery_result(task_id)
        out.append(
            dict(
                result=_flatten_result(async .result),
                task_id=task_id,
                status=async .status,
            ))
    response = HttpResponse(mimetype="application/json")
    json.dump(out, response, ensure_ascii=False)
    return response