<commit_before>"""
Celery task for Automatic Verifed Track Cohorting MVP feature.
"""
from celery.task import task
from celery.utils.log import get_task_logger
from django.contrib.auth.models import User
from opaque_keys.edx.keys import CourseKey

from openedx.core.djangoapps.course_groups.cohorts import add_user_to_cohort, get_cohort, get_cohort_by_name
from student.models import CourseEnrollment, CourseMode
from django.conf import settings

LOGGER = get_task_logger(__name__)


@task(bind=True, default_retry_delay=60, max_retries=2)
def sync_cohort_with_mode(self, course_id, user_id, verified_cohort_name, default_cohort_name):
    """
    If the learner's mode does not match their assigned cohort, move the learner into the correct cohort.
    It is assumed that this task is only initiated for courses that are using the<commit_msg>Update tasks.py<commit_after>"""
Celery task for Automatic Verifed Track Cohorting MVP feature.
"""
from celery.task import task
from celery.utils.log import get_task_logger
from django.contrib.auth.models import User
from opaque_keys.edx.keys import CourseKey

from openedx.core.djangoapps.course_groups.cohorts import add_user_to_cohort, get_cohort, get_cohort_by_name
from student.models import CourseEnrollment, CourseMode

LOGGER = get_task_logger(__name__)


@task(bind=True, default_retry_delay=60, max_retries=2)
def sync_cohort_with_mode(self, course_id, user_id, verified_cohort_name, default_cohort_name):
    """
    If the learner's mode does not match their assigned cohort, move the learner into the correct cohort.
    It is assumed that this task is only initiated for courses that are using the
{'fraction_non_alphanumeric': 0.06163141993957704, 'fraction_numerical': 0.0036253776435045317, 'mean_word_length': 6.076923076923077, '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': '369562', 'n_tokens_mistral': 531, 'n_tokens_neox': 494, 'n_words': 164}