Commit 9e11a565 by Brian Wilson

Rename task_queue.py to task_submit.py.

parent c676cfd6
......@@ -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)
......@@ -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,
......
......@@ -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 += '<font color="red">Failed to create a background task for rescoring "{0}".</font>'.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 += '<font color="red">Failed to create a background task for resetting "{0}".</font>'.format(problem_url)
else:
......@@ -356,7 +356,7 @@ def instructor_dashboard(request, course_id):
msg += "<font color='red'>Couldn't reset module state. </font>"
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 += '<font color="red">Failed to create a background task for rescoring "{0}" for student {1}.</font>'.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:
......
......@@ -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'
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment