Browse Source

Forgot to add urls.py and views.py to repository

Ask Solem 16 years ago
parent
commit
a6f873eec4
2 changed files with 16 additions and 0 deletions
  1. 7 0
      celery/urls.py
  2. 9 0
      celery/views.py

+ 7 - 0
celery/urls.py

@@ -0,0 +1,7 @@
+from django.conf.urls.defaults import patterns, url
+from celery import views
+
+urlpatterns = patterns("",
+    url(r'^(?P<task_id>[\w\d\-]+)/done/?$', views.is_task_done,
+        name="celery-is_task_done"),
+)

+ 9 - 0
celery/views.py

@@ -0,0 +1,9 @@
+from django.http import Http404, HttpResponse
+from celery.task import is_done
+
+JSON_TASK_STATUS = """{"task": {"id": "%s", "executed": %s}}"""
+
+
+def is_task_done(request, task_id):
+    return HttpResponse(JSON_TASK_STATUS % (
+        task_id, is_done(task_id) and "true" or "false"))