Pārlūkot izejas kodu

retry now reraises the original exception *with* stack. Thanks to ojii

Ask Solem 13 gadi atpakaļ
vecāks
revīzija
c370f94706
1 mainītis faili ar 5 papildinājumiem un 3 dzēšanām
  1. 5 3
      celery/app/task/__init__.py

+ 5 - 3
celery/app/task/__init__.py

@@ -562,9 +562,11 @@ class BaseTask(object):
                         "eta": eta})
 
         if max_retries is not None and options["retries"] > max_retries:
-            raise exc or self.MaxRetriesExceededError(
-                            "Can't retry %s[%s] args:%s kwargs:%s" % (
-                                self.name, options["task_id"], args, kwargs))
+            if exc:
+                raise
+            raise self.MaxRetriesExceededError(
+                    "Can't retry %s[%s] args:%s kwargs:%s" % (
+                        self.name, options["task_id"], args, kwargs))
 
         # If task was executed eagerly using apply(),
         # then the retry must also be executed eagerly.