replaced task decorator with shared_task decorator (#25925)

This commit is contained in:
Muhammad Soban Javed
2021-01-07 19:46:34 +05:00
committed by GitHub
parent e9dc5baf79
commit f62b1c417b
9 changed files with 42 additions and 42 deletions

View File

@@ -23,7 +23,7 @@ of the query for traversing StudentModule objects.
import logging
from functools import partial
from celery import task
from celery import shared_task
from django.conf import settings
from django.utils.translation import ugettext_noop
from edx_django_utils.monitoring import set_code_owner_attribute
@@ -55,7 +55,7 @@ from lms.djangoapps.instructor_task.tasks_helper.runner import run_main_task
TASK_LOG = logging.getLogger('edx.celery.task')
@task(base=BaseInstructorTask)
@shared_task(base=BaseInstructorTask)
@set_code_owner_attribute
def rescore_problem(entry_id, xmodule_instance_args):
"""Rescores a problem in a course, for all students or one specific student.
@@ -83,7 +83,7 @@ def rescore_problem(entry_id, xmodule_instance_args):
return run_main_task(entry_id, visit_fcn, action_name)
@task(base=BaseInstructorTask)
@shared_task(base=BaseInstructorTask)
@set_code_owner_attribute
def override_problem_score(entry_id, xmodule_instance_args):
"""
@@ -97,7 +97,7 @@ def override_problem_score(entry_id, xmodule_instance_args):
return run_main_task(entry_id, visit_fcn, action_name)
@task(base=BaseInstructorTask)
@shared_task(base=BaseInstructorTask)
@set_code_owner_attribute
def reset_problem_attempts(entry_id, xmodule_instance_args):
"""Resets problem attempts to zero for a particular problem for all students in a course.
@@ -120,7 +120,7 @@ def reset_problem_attempts(entry_id, xmodule_instance_args):
return run_main_task(entry_id, visit_fcn, action_name)
@task(base=BaseInstructorTask)
@shared_task(base=BaseInstructorTask)
@set_code_owner_attribute
def delete_problem_state(entry_id, xmodule_instance_args):
"""Deletes problem state entirely for all students on a particular problem in a course.
@@ -143,7 +143,7 @@ def delete_problem_state(entry_id, xmodule_instance_args):
return run_main_task(entry_id, visit_fcn, action_name)
@task(base=BaseInstructorTask)
@shared_task(base=BaseInstructorTask)
@set_code_owner_attribute
def send_bulk_course_email(entry_id, _xmodule_instance_args):
"""Sends emails to recipients enrolled in a course.
@@ -165,7 +165,7 @@ def send_bulk_course_email(entry_id, _xmodule_instance_args):
return run_main_task(entry_id, visit_fcn, action_name)
@task(
@shared_task(
name='lms.djangoapps.instructor_task.tasks.calculate_problem_responses_csv.v2',
base=BaseInstructorTask,
)
@@ -181,7 +181,7 @@ def calculate_problem_responses_csv(entry_id, xmodule_instance_args):
return run_main_task(entry_id, task_fn, action_name)
@task(base=BaseInstructorTask)
@shared_task(base=BaseInstructorTask)
@set_code_owner_attribute
def calculate_grades_csv(entry_id, xmodule_instance_args):
"""
@@ -198,7 +198,7 @@ def calculate_grades_csv(entry_id, xmodule_instance_args):
return run_main_task(entry_id, task_fn, action_name)
@task(base=BaseInstructorTask)
@shared_task(base=BaseInstructorTask)
@set_code_owner_attribute
def calculate_problem_grade_report(entry_id, xmodule_instance_args):
"""
@@ -216,7 +216,7 @@ def calculate_problem_grade_report(entry_id, xmodule_instance_args):
return run_main_task(entry_id, task_fn, action_name)
@task(base=BaseInstructorTask)
@shared_task(base=BaseInstructorTask)
@set_code_owner_attribute
def calculate_students_features_csv(entry_id, xmodule_instance_args):
"""
@@ -229,7 +229,7 @@ def calculate_students_features_csv(entry_id, xmodule_instance_args):
return run_main_task(entry_id, task_fn, action_name)
@task(base=BaseInstructorTask)
@shared_task(base=BaseInstructorTask)
@set_code_owner_attribute
def course_survey_report_csv(entry_id, xmodule_instance_args):
"""
@@ -242,7 +242,7 @@ def course_survey_report_csv(entry_id, xmodule_instance_args):
return run_main_task(entry_id, task_fn, action_name)
@task(base=BaseInstructorTask)
@shared_task(base=BaseInstructorTask)
@set_code_owner_attribute
def proctored_exam_results_csv(entry_id, xmodule_instance_args):
"""
@@ -254,7 +254,7 @@ def proctored_exam_results_csv(entry_id, xmodule_instance_args):
return run_main_task(entry_id, task_fn, action_name)
@task(base=BaseInstructorTask)
@shared_task(base=BaseInstructorTask)
@set_code_owner_attribute
def calculate_may_enroll_csv(entry_id, xmodule_instance_args):
"""
@@ -268,7 +268,7 @@ def calculate_may_enroll_csv(entry_id, xmodule_instance_args):
return run_main_task(entry_id, task_fn, action_name)
@task(base=BaseInstructorTask)
@shared_task(base=BaseInstructorTask)
@set_code_owner_attribute
def generate_certificates(entry_id, xmodule_instance_args):
"""
@@ -285,7 +285,7 @@ def generate_certificates(entry_id, xmodule_instance_args):
return run_main_task(entry_id, task_fn, action_name)
@task(base=BaseInstructorTask)
@shared_task(base=BaseInstructorTask)
@set_code_owner_attribute
def cohort_students(entry_id, xmodule_instance_args):
"""
@@ -298,7 +298,7 @@ def cohort_students(entry_id, xmodule_instance_args):
return run_main_task(entry_id, task_fn, action_name)
@task(base=BaseInstructorTask)
@shared_task(base=BaseInstructorTask)
@set_code_owner_attribute
def export_ora2_data(entry_id, xmodule_instance_args):
"""
@@ -309,7 +309,7 @@ def export_ora2_data(entry_id, xmodule_instance_args):
return run_main_task(entry_id, task_fn, action_name)
@task(base=BaseInstructorTask)
@shared_task(base=BaseInstructorTask)
@set_code_owner_attribute
def export_ora2_submission_files(entry_id, xmodule_instance_args):
"""