Browse Source

views.task_status now returns exception if status is RETRY

Ask Solem 15 years ago
parent
commit
17f8c97010
1 changed files with 4 additions and 3 deletions
  1. 4 3
      celery/views.py

+ 4 - 3
celery/views.py

@@ -37,17 +37,18 @@ def task_status(request, task_id):
     """Returns task status and result in JSON format."""
     async_result = AsyncResult(task_id)
     status = async_result.status
-    if status == "FAILURE":
+    result = async_result.result
+    if status in ("FAILURE", "RETRY"):
         response_data = {
             "id": task_id,
             "status": status,
-            "result": async_result.result.args[0],
+            "result": result.args[0],
         }
     else:
         response_data = {
             "id": task_id,
             "status": status,
-            "result": async_result.result,
+            "result": result,
         }
     return HttpResponse(JSON_dump({"task": response_data}),
             mimetype="application/json")