<commit_before>import json
import logging
import os

from celery import Celery
from celery.schedules import crontab

from whistleblower.suspicions import Suspicions
from whistleblower.targets.twitter import Post as TwitterPost, Twitter

rabbitmq_url = os.environ.get('CLOUDAMQP_URL', 'pyamqp://guest@localhost//')
app = Celery('tasks', broker=rabbitmq_url)


@app.task
def enqueue_twitter_posts():<commit_msg>Create tasks for seting up datasets<commit_after>import json
import logging
import os
import subprocess

from celery import Celery
from celery.schedules import crontab

from whistleblower.suspicions import Suspicions
from whistleblower.targets.twitter import Post as TwitterPost, Twitter

rabbitmq_url = os.environ.get('CLOUDAMQP_URL', 'pyamqp://guest@localhost//')
app = Celery('tasks', broker=rabbitmq_url)


@app.on_after_configure.connect
def setup_periodic_tasks(sender, **kwargs):
    sender.add_periodic_task(
        crontab(hour=3),
        update_suspicions_dataset.s()
    )
    sender.add_periodic_task(
        crontab(hour=13),
        enqueue_twitter_posts.s()
    )


@app.task
def update_suspicions_dataset():
    subprocess.run(['python', 'whistleblower/get_dataset.py'], check=True)
    subprocess.run(['python', 'rosie/rosie.py', 'run',
                    'chamber_of_deputies', 'data'], check=True)


@app.task
def enqueue_twitter_posts():
{'fraction_non_alphanumeric': 0.10437956204379562, 'fraction_numerical': 0.0021897810218978104, 'mean_word_length': 5.039647577092511, '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': '1322109', 'n_tokens_mistral': 464, 'n_tokens_neox': 427, 'n_words': 96}