diff --git a/lms/djangoapps/courseware/task_queue.py b/lms/djangoapps/courseware/task_submit.py similarity index 100% rename from lms/djangoapps/courseware/task_queue.py rename to lms/djangoapps/courseware/task_submit.py diff --git a/lms/djangoapps/courseware/tests/test_task_queue.py b/lms/djangoapps/courseware/tests/test_task_submit.py similarity index 95% rename from lms/djangoapps/courseware/tests/test_task_queue.py rename to lms/djangoapps/courseware/tests/test_task_submit.py index a3161c2411..08ddba42e6 100644 --- a/lms/djangoapps/courseware/tests/test_task_queue.py +++ b/lms/djangoapps/courseware/tests/test_task_submit.py @@ -12,14 +12,14 @@ from django.test.testcases import TestCase from xmodule.modulestore.exceptions import ItemNotFoundError from courseware.tests.factories import UserFactory, CourseTaskLogFactory -from courseware.task_queue import (get_running_course_tasks, - course_task_log_status, - _encode_problem_and_student_input, - AlreadyRunningError, - submit_rescore_problem_for_all_students, - submit_rescore_problem_for_student, - submit_reset_problem_attempts_for_all_students, - submit_delete_problem_state_for_all_students) +from courseware.task_submit import (get_running_course_tasks, + course_task_log_status, + _encode_problem_and_student_input, + AlreadyRunningError, + submit_rescore_problem_for_all_students, + submit_rescore_problem_for_student, + submit_reset_problem_attempts_for_all_students, + submit_delete_problem_state_for_all_students) log = logging.getLogger("mitx." + __name__) @@ -277,5 +277,5 @@ class TaskQueueTestCase(TestCase): request.user = self.student with self.assertRaises(AlreadyRunningError): # just skip making the argument check, so we don't have to fake it deeper down - with patch('courseware.task_queue._check_arguments_for_rescoring'): + with patch('courseware.task_submit._check_arguments_for_rescoring'): submit_rescore_problem_for_all_students(request, course_id, problem_url) diff --git a/lms/djangoapps/courseware/tests/test_tasks.py b/lms/djangoapps/courseware/tests/test_tasks.py index 3a5c5de58f..4552d18f31 100644 --- a/lms/djangoapps/courseware/tests/test_tasks.py +++ b/lms/djangoapps/courseware/tests/test_tasks.py @@ -20,7 +20,7 @@ from xmodule.modulestore.exceptions import ItemNotFoundError from student.tests.factories import CourseEnrollmentFactory, UserFactory, AdminFactory from courseware.model_data import StudentModule -from courseware.task_queue import (submit_rescore_problem_for_all_students, +from courseware.task_submit import (submit_rescore_problem_for_all_students, submit_rescore_problem_for_student, course_task_log_status, submit_reset_problem_attempts_for_all_students, diff --git a/lms/djangoapps/instructor/views.py b/lms/djangoapps/instructor/views.py index 7e53da48e3..53618d3760 100644 --- a/lms/djangoapps/instructor/views.py +++ b/lms/djangoapps/instructor/views.py @@ -25,7 +25,7 @@ from xmodule.modulestore.django import modulestore from xmodule.modulestore.exceptions import ItemNotFoundError from courseware import grades -from courseware import task_queue +from courseware import task_submit from courseware.access import (has_access, get_access_group_name, course_beta_test_group_name) from courseware.courses import get_course_with_access @@ -243,7 +243,7 @@ def instructor_dashboard(request, course_id): problem_urlname = request.POST.get('problem_for_all_students', '') problem_url = get_module_url(problem_urlname) try: - course_task_log_entry = task_queue.submit_rescore_problem_for_all_students(request, course_id, problem_url) + course_task_log_entry = task_submit.submit_rescore_problem_for_all_students(request, course_id, problem_url) if course_task_log_entry is None: msg += 'Failed to create a background task for rescoring "{0}".'.format(problem_url) else: @@ -260,7 +260,7 @@ def instructor_dashboard(request, course_id): problem_urlname = request.POST.get('problem_for_all_students', '') problem_url = get_module_url(problem_urlname) try: - course_task_log_entry = task_queue.submit_reset_problem_attempts_for_all_students(request, course_id, problem_url) + course_task_log_entry = task_submit.submit_reset_problem_attempts_for_all_students(request, course_id, problem_url) if course_task_log_entry is None: msg += 'Failed to create a background task for resetting "{0}".'.format(problem_url) else: @@ -356,7 +356,7 @@ def instructor_dashboard(request, course_id): msg += "Couldn't reset module state. " else: try: - course_task_log_entry = task_queue.submit_rescore_problem_for_student(request, course_id, module_state_key, student) + course_task_log_entry = task_submit.submit_rescore_problem_for_student(request, course_id, module_state_key, student) if course_task_log_entry is None: msg += 'Failed to create a background task for rescoring "{0}" for student {1}.'.format(module_state_key, unique_student_identifier) else: @@ -721,7 +721,7 @@ def instructor_dashboard(request, course_id): # generate list of pending background tasks if settings.MITX_FEATURES.get('ENABLE_COURSE_BACKGROUND_TASKS'): - course_tasks = task_queue.get_running_course_tasks(course_id) + course_tasks = task_submit.get_running_course_tasks(course_id) else: course_tasks = None @@ -1294,7 +1294,7 @@ def get_background_task_table(course_id, problem_url, student=None): Returns a tuple of (msg, datatable), where the msg is a possible error message, and the datatable is the datatable to be used for display. """ - history_entries = task_queue.get_course_task_history(course_id, problem_url, student) + history_entries = task_submit.get_course_task_history(course_id, problem_url, student) datatable = None msg = "" # first check to see if there is any history at all @@ -1329,7 +1329,7 @@ def get_background_task_table(course_id, problem_url, student=None): if 'duration_ms' in task_outputs: duration_ms = task_outputs['duration_ms'] # get progress status message: - success, message = task_queue.get_task_completion_message(course_task) + success, message = task_submit.get_task_completion_message(course_task) if success: status = "Complete" else: diff --git a/lms/envs/test.py b/lms/envs/test.py index 8e8097759c..5342d81a4e 100644 --- a/lms/envs/test.py +++ b/lms/envs/test.py @@ -189,9 +189,3 @@ PASSWORD_HASHERS = ( # 'django.contrib.auth.hashers.CryptPasswordHasher', ) -################################# CELERY ###################################### - -# By default don't use a worker, execute tasks as if they were local functions -CELERY_ALWAYS_EAGER = True -CELERY_RESULT_BACKEND = 'cache' -BROKER_TRANSPORT = 'memory' diff --git a/lms/urls.py b/lms/urls.py index 36fcd15985..cba6d76a4a 100644 --- a/lms/urls.py +++ b/lms/urls.py @@ -58,7 +58,7 @@ urlpatterns = ('', # nopep8 name='auth_password_reset_done'), url(r'^heartbeat$', include('heartbeat.urls')), - url(r'^course_task_log_status/$', 'courseware.task_queue.course_task_log_status', name='course_task_log_status'), + url(r'^course_task_log_status/$', 'courseware.task_submit.course_task_log_status', name='course_task_log_status'), ) # University profiles only make sense in the default edX context