浏览代码

AbortableTask must use the request, and not depend on magic kwargs.

Closes #383
David Arthur 14 年之前
父节点
当前提交
736361873e
共有 2 个文件被更改,包括 3 次插入1 次删除
  1. 1 0
      AUTHORS
  2. 2 1
      celery/contrib/abortable.py

+ 1 - 0
AUTHORS

@@ -69,5 +69,6 @@ Ordered by date of first contribution:
   Marcin Kuźmiński <marcin@python-works.com>
   Adriano Petrich <petrich@gmail.com>
   David Strauss <david@davidstrauss.net>
+  David Arthur <mumrah@gmail.com>
   Miguel Hernandez Martos <enlavin@gmail.com>
   Jannis Leidel <jannis@leidel.info>

+ 2 - 1
celery/contrib/abortable.py

@@ -155,7 +155,8 @@ class AbortableTask(Task):
         often (for performance).
 
         """
-        result = self.AsyncResult(kwargs["task_id"])
+        task_id = kwargs.get('task_id', self.request.id)
+        result = self.AsyncResult(task_id)
         if not isinstance(result, AbortableAsyncResult):
             return False
         return result.is_aborted()