<commit_before>from __future__ import absolute_import

import logging

from django.core.management import call_command

from celery import shared_task

from bluebottle.clients.utils import LocalTenant

logger = logging.getLogger()


@shared_task
def sync_surveys():
    logger.info("Synchronzing all surveys")
    call_command('sync_surveys')
    logger.info("Finished synchronizing surveys")


@shared_task
def sync_survey(client, survey):
    logger.info("Synchronzing survey (webhook)")
    with LocalTenant(client, clear_tenant=True):
        survey.synchronize()
    logger.info("Finished synchronizing survey")<commit_msg>Explicitly set tenant<commit_after>from __future__ import absolute_import

import logging

from django.db import connection

from django.core.management import call_command

from celery import shared_task

from bluebottle.clients.utils import LocalTenant

logger = logging.getLogger()


@shared_task
def sync_surveys():
    logger.info("Synchronzing all surveys")
    call_command('sync_surveys')
    logger.info("Finished synchronizing surveys")


@shared_task
def sync_survey(client, survey):
    logger.info("Synchronzing survey (webhook)")
    connection.set_tenant(client)
    with LocalTenant(client, clear_tenant=True):
        survey.synchronize()
    logger.info("Finished synchronizing survey")
{'fraction_non_alphanumeric': 0.08408408408408409, 'fraction_numerical': 0.0, 'mean_word_length': 5.5024390243902435, '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': '6482153', 'n_tokens_mistral': 393, 'n_tokens_neox': 391, 'n_words': 94}