celery.utils.mail
celery.utils.mail
How task error emails are formatted and sent.
exception celery.utils.mail.SendmailWarning[源代码]
Problem happened while sending the email message.
class celery.utils.mail.Message(to=None, sender=None, subject=None, body=None, charset=’us-ascii’)[源代码]
class celery.utils.mail.Mailer(host=’localhost’, port=0, user=None, password=None, timeout=2, use_ssl=False, use_tls=False)[源代码]
- send(message, fail_silently=False, \*kwargs*)[源代码]
class celery.utils.mail.ErrorMail(task, \*kwargs*)[源代码]
Defines how and when task error e-mails should be sent.
参数: | task – The task instance that raised the error. |
---|
subject and body are format strings which are passed a context containing the following keys:
name
Name of the task.
id
UUID of the task.
exc
String representation of the exception.
args
Positional arguments.
kwargs
Keyword arguments.
traceback
String representation of the traceback.
hostname
Worker nodename.
EMAIL_SIGNATURE_SEP = ‘— ‘
body = ‘\nTask {name} with id {id} raised exception:\n{exc!r}\n\n\nTask was called with args: {args} kwargs: {kwargs}.\n\nThe contents of the full traceback was:\n\n{traceback}\n\n— \nJust to let you know,\npy-celery at {hostname}.\n’
Format string used to generate error email content.
format_body(context)[源代码]
format_subject(context)[源代码]
send(context, exc, fail_silently=True)[源代码]
should_send(context, exc)[源代码]
Return true or false depending on if a task error mail should be sent for this type of error.
subject = ‘ [{hostname}] Error: Task {name} ({id}): {exc!r}\n ‘
Format string used to generate error email subjects.