소스 검색

Batched tasks were failing silently

Added an except clause to the Batches task to log the error. Would be nice if
the Exception could bubble up and be reported on by celeryd, however I'm not
sure how to achieve this given the execution method of Batches.
David Arthur 14 년 전
부모
커밋
0daa561612
1개의 변경된 파일5개의 추가작업 그리고 1개의 파일을 삭제
  1. 5 1
      celery/contrib/batches.py

+ 5 - 1
celery/contrib/batches.py

@@ -53,9 +53,13 @@ from celery.worker import state
 def apply_batches_task(task, args, loglevel, logfile):
     task.request.update({"loglevel": loglevel, "logfile": logfile})
     try:
-        return task(*args)
+        result = task(*args)
+    except Exception, exp:
+        result = None
+        task.logger.error("There was an Exception: %s" % exp)
     finally:
         task.request.clear()
+    return result
 
 
 class SimpleRequest(object):