Skip to content

Commit 0e5008b

Browse files
author
Ask Solem
committed
send_error_email: Make it possible to set conf values by runtime.
1 parent 6c20587 commit 0e5008b

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

celery/tests/test_result.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ def test_get(self):
108108
self.assertRaises(KeyError, nok_res.get)
109109
self.assertIsInstance(nok2_res.result, KeyError)
110110

111-
112111
def test_get_timeout(self):
113112
res = AsyncResult(self.task4["id"]) # has RETRY status
114113
self.assertRaises(TimeoutError, res.get, timeout=0.1)

celery/worker/job.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -414,14 +414,14 @@ def on_failure(self, exc_info):
414414
self.logger.error(self.error_msg.strip() % context)
415415

416416
task_obj = tasks.get(self.task_name, object)
417-
self.send_error_email(task_obj, context, exc_info.exception)
417+
self.send_error_email(task_obj, context, exc_info.exception,
418+
whitelist=conf.CELERY_TASK_ERROR_WHITELIST,
419+
enabled=conf.CELERY_SEND_TASK_ERROR_EMAILS)
418420

419421
def send_error_email(self, task, context, exc,
420-
whitelist=conf.CELERY_TASK_ERROR_WHITELIST,
421-
enabled=conf.CELERY_SEND_TASK_ERROR_EMAILS,
422-
fail_silently=True):
422+
whitelist=None, enabled=False, fail_silently=True):
423423
if enabled and not task.disable_error_emails:
424-
if whitelist is not None:
424+
if whitelist:
425425
if not isinstance(exc, tuple(whitelist)):
426426
return
427427
subject = self.email_subject.strip() % context

0 commit comments

Comments
 (0)