예제 #1
0
    def __init__(self, **kwargs):
        self._config = batch_email(**kwargs)
        self._fail_counts = collections.defaultdict(collections.Counter)
        self._disabled_counts = collections.defaultdict(collections.Counter)
        self._scheduling_fail_counts = collections.defaultdict(collections.Counter)
        self._fail_expls = collections.defaultdict(_fail_queue(self._config.error_messages))
        self._update_next_send()

        self._email_format = email().format
        if email().receiver:
            self._default_owner = set(filter(None, email().receiver.split(',')))
        else:
            self._default_owner = set()
예제 #2
0
    def __init__(self, **kwargs):
        self._config = batch_email(**kwargs)
        self._fail_counts = collections.defaultdict(collections.Counter)
        self._disabled_counts = collections.defaultdict(collections.Counter)
        self._scheduling_fail_counts = collections.defaultdict(collections.Counter)
        self._fail_expls = collections.defaultdict(_fail_queue(self._config.error_messages))
        self._update_next_send()

        self._email_format = email().format
        if email().receiver:
            self._default_owner = set(filter(None, email().receiver.split(',')))
        else:
            self._default_owner = set()
예제 #3
0
 def _send_email(self, fail_counts, disable_counts, scheduling_counts, fail_expls, owner):
     num_failures = sum(six.itervalues(fail_counts))
     num_disables = sum(six.itervalues(disable_counts))
     num_scheduling_failures = sum(six.itervalues(scheduling_counts))
     subject_parts = [
         _plural_format('{} failure{}', num_failures),
         _plural_format('{} disable{}', num_disables),
         _plural_format('{} scheduling failure{}', num_scheduling_failures),
     ]
     subject_base = ', '.join(filter(None, subject_parts))
     if subject_base:
         prefix = '' if owner in self._default_owner else 'Your tasks have '
         subject = 'Luigi: {}{} in the last {} minutes'.format(
             prefix, subject_base, self._config.email_interval)
         email_body = self._email_body(fail_counts, disable_counts, scheduling_counts, fail_expls)
         send_email(subject, email_body, email().sender, (owner,))
예제 #4
0
 def _send_email(self, fail_counts, disable_counts, scheduling_counts, fail_expls, owner):
     num_failures = sum(six.itervalues(fail_counts))
     num_disables = sum(six.itervalues(disable_counts))
     num_scheduling_failures = sum(six.itervalues(scheduling_counts))
     subject_parts = [
         _plural_format('{} failure{}', num_failures),
         _plural_format('{} disable{}', num_disables),
         _plural_format('{} scheduling failure{}', num_scheduling_failures),
     ]
     subject_base = ', '.join(filter(None, subject_parts))
     if subject_base:
         prefix = '' if owner in self._default_owner else 'Your tasks have '
         subject = 'Luigi: {}{} in the last {} minutes'.format(
             prefix, subject_base, self._config.email_interval)
         email_body = self._email_body(fail_counts, disable_counts, scheduling_counts, fail_expls)
         send_email(subject, email_body, email().sender, (owner,))