<commit_before>from __future__ import absolute_import, unicode_literals

from celery.task import task


@task()
def sync_collection_engines(collection_id=None, created_at=None):
    from module.models import Collection
    collection = Collection.objects.filter(id=collection_id, updated_at=created_at).first()
    if not collection:
        return
    for coll_group in collection.collection_groups.all().prefetch_related('engine'):
        # NOTE(idegtiarov) Refactor send one sync request instead of bunch of requests
        coll_group.engine.engine_driver.sync_collection_activities(collection)<commit_msg>Fix sync task database communication (#124)<commit_after>from __future__ import absolute_import, unicode_literals

from celery.task import task


@task()
def sync_collection_engines(collection_id=None, created_at=None):
    from module.models import Collection
    collection = Collection.objects.filter(id=collection_id, updated_at=created_at).first()
    if not collection:
        return
    for coll_group in collection.collection_groups.all().select_related('engine'):
        coll_group.engine.engine_driver.sync_collection_activities(collection)
{'fraction_non_alphanumeric': 0.07738607050730868, 'fraction_numerical': 0.0025795356835769563, 'mean_word_length': 5.613636363636363, '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': '4802522', 'n_tokens_mistral': 319, 'n_tokens_neox': 308, 'n_words': 73}