<commit_before>from __future__ import absolute_import
from celery import shared_task
from apps.clients import client_factory

@shared_task
def get_generation(ba_name, **kwargs):
    # get data
    c = client_factory(ba_name)
    data = c.get_generation(**kwargs)
    return data<commit_msg>add warning to logs on no new data<commit_after>from __future__ import absolute_import
from celery import shared_task
from apps.clients import client_factory
import logging
from datetime import datetime


# set up logger
logger = logging.getLogger(__name__)

@shared_task
def get_generation(ba_name, **kwargs):
    # get data
    c = client_factory(ba_name)
    data = c.get_generation(**kwargs)
    
    # log
    if len(data) == 0:
        msg = 'No data in %s at %s with args %s' % (ba_name, datetime.utcnow().isoformat(),
                                                    kwargs)
        logger.warn(msg)
    
    # return
    return data
{'fraction_non_alphanumeric': 0.07922912205567452, 'fraction_numerical': 0.0010706638115631692, 'mean_word_length': 3.0476190476190474, '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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1384057', 'n_tokens_mistral': 278, 'n_tokens_neox': 268, 'n_words': 84}