Browse Source

Added Task.store_errors_even_if_ignored, so it can be changed per Task, not just globally.

Ask Solem 14 years ago
parent
commit
38596b6156
2 changed files with 7 additions and 1 deletions
  1. 6 0
      celery/task/base.py
  2. 1 1
      celery/worker/job.py

+ 6 - 0
celery/task/base.py

@@ -157,6 +157,11 @@ class Task(object):
 
         Don't store the return value of this task.
 
+    .. attribute:: store_errors_even_if_ignored
+
+        If true, errors will be stored even if the task is configured
+        to ignore results.
+
     .. attribute:: disable_error_emails
 
         Disable all error e-mails for this task (only applicable if
@@ -220,6 +225,7 @@ class Task(object):
     priority = None
 
     ignore_result = conf.IGNORE_RESULT
+    store_errors_even_if_ignored = conf.STORE_ERRORS_EVEN_IF_IGNORED
     disable_error_emails = False
     max_retries = 3
     default_retry_delay = 3 * 60

+ 1 - 1
celery/worker/job.py

@@ -81,7 +81,7 @@ class WorkerTaskTrace(TaskTrace):
 
         self._store_errors = True
         if self.task.ignore_result:
-            self._store_errors = conf.STORE_ERRORS_EVEN_IF_IGNORED
+            self._store_errors = self.task.store_errors_even_if_ignored
         self.super = super(WorkerTaskTrace, self)
 
     def execute_safe(self, *args, **kwargs):