<commit_before>import logging

from django.core.mail import send_mail as django_send_mail

from keybar.tasks import celery


@celery.task(ignore_result=True, bind=True)
def send_mail_async(self, subject, message, from_email, recipient_list):
    logger = logging.getLogger('keybar.tasks.mail.send_mail_async')
    try:
        django_send_mail(
            subject, message, from_email, recipient_list, fail_silently=False)
        logger.debug(
            'Successfully sent email message to %r.', ', '.join(recipient_list))
    except Exception as exc:
        # catching all exceptions b/c it could be any number of things
        # depending on the backend
        logger.warning(
            'Failed to send email message to %r, retrying.', ', '.join(recipient_list))
        self.retry(exc=exc, retry_countdown=60)
<commit_msg>Use logged decorator in send_mail_async task<commit_after>from django.core.mail import send_mail as django_send_mail

from keybar.tasks import celery
from keybar.utils.logging import logged


@logged
@celery.task(ignore_result=True, bind=True)
def send_mail_async(self, subject, message, from_email, recipient_list):
    try:
        django_send_mail(
            subject, message, from_email, recipient_list, fail_silently=False)
        self.logger.debug(
            'Successfully sent email message to %r.', ', '.join(recipient_list))
    except Exception as exc:
        # catching all exceptions b/c it could be any number of things
        # depending on the backend
        self.logger.warning(
            'Failed to send email message to %r, retrying.', ', '.join(recipient_list))
        self.retry(exc=exc, retry_countdown=60)

{'fraction_non_alphanumeric': 0.08846383741781232, 'fraction_numerical': 0.002390914524805738, 'mean_word_length': 3.41688654353562, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5969264', 'n_tokens_mistral': 487, 'n_tokens_neox': 478, 'n_words': 142}