<commit_before>import logging
import newrelic.agent

log = logging.getLogger(__name__)


def send_saved_search_alerts():
    from pmg import app
    from pmg.models import SavedSearch

    application = newrelic.agent.application()
    with newrelic.agent.BackgroundTask(application, name='send_saved_search_alerts', group='Task'):
        with app.app_context():
            SavedSearch.send_all_alerts()


def sync_soundcloud():
    from pmg import app
    from pmg.models.soundcloud_track import SoundcloudTrack
    application = newrelic.agent.application()
    with newrelic.agent.BackgroundTask(application, name='sync_soundcloud', group='Task'):
        with app.app_context():
            SoundcloudTrack.sync()


def schedule():
    from pmg import scheduler
    # Schedule background task for sending saved search alerts every
    # day at 3am (UTC)
    jobs = [
        scheduler.add_job('pmg.tasks:send_saved_search_alerts', 'cron',
                          id='send-saved-search-alerts', replace_existing=True,
                          coalesce=True, hour=3),
        scheduler.add_job(sync_soundcloud, 'cron',
                          id='sync-soundcloud', replace_existing=True,
                          coalesce=True, minute='*/1'),
    ]
    for job in jobs:
        log.info("Scheduled task: %s" % job)
<commit_msg>Change soundcloud sync to happen every 20 minutes<commit_after>import logging
import newrelic.agent

log = logging.getLogger(__name__)


def send_saved_search_alerts():
    from pmg import app
    from pmg.models import SavedSearch

    application = newrelic.agent.application()
    with newrelic.agent.BackgroundTask(application, name='send_saved_search_alerts', group='Task'):
        with app.app_context():
            SavedSearch.send_all_alerts()


def sync_soundcloud():
    from pmg import app
    from pmg.models.soundcloud_track import SoundcloudTrack
    application = newrelic.agent.application()
    with newrelic.agent.BackgroundTask(application, name='sync_soundcloud', group='Task'):
        with app.app_context():
            SoundcloudTrack.sync()


def schedule():
    from pmg import scheduler
    # Schedule background task for sending saved search alerts every
    # day at 3am (UTC)
    jobs = [
        scheduler.add_job('pmg.tasks:send_saved_search_alerts', 'cron',
                          id='send-saved-search-alerts', replace_existing=True,
                          coalesce=True, hour=3),
        scheduler.add_job(sync_soundcloud, 'cron',
                          id='sync-soundcloud', replace_existing=True,
                          coalesce=True, minute='*/20'),
    ]
    for job in jobs:
        log.info("Scheduled task: %s" % job)

{'fraction_non_alphanumeric': 0.09738104020656584, 'fraction_numerical': 0.0033198081888601992, 'mean_word_length': 2.8197183098591547, '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': '449235', 'n_tokens_mistral': 786, 'n_tokens_neox': 770, 'n_words': 175}