<commit_before>from django.conf import settings
import logging
from datetime import datetime, timedelta
from celery.decorators import task
from eve_proxy.models import CachedDocument

@task(ignore_result=True)
def clear_stale_cache(cache_extension=0):
    log = clear_stale_cache.get_logger()

    time = datetime.utcnow() - timedelta(seconds=cache_extension)
    objs = CachedDocument.objects.filter(cached_until__lt=time)
    log.info('Removing %s stale cache documents' % objs.count())
    objs.delete()


@task(ignore_result=True)
def clear_old_logs():<commit_msg>Fix the log autoclean job<commit_after>from django.conf import settings
import logging
from datetime import datetime, timedelta
from celery.decorators import task
from eve_proxy.models import CachedDocument, ApiAccessLog

@task(ignore_result=True)
def clear_stale_cache(cache_extension=0):
    log = clear_stale_cache.get_logger()

    time = datetime.utcnow() - timedelta(seconds=cache_extension)
    objs = CachedDocument.objects.filter(cached_until__lt=time)
    log.info('Removing %s stale cache documents' % objs.count())
    objs.delete()


@task(ignore_result=True)
def clear_old_logs():
{'fraction_non_alphanumeric': 0.09208261617900172, 'fraction_numerical': 0.0017211703958691911, 'mean_word_length': 6.179012345679013, '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': '7615024', 'n_tokens_mistral': 369, 'n_tokens_neox': 355, 'n_words': 82}