Add task progress table to instructor dash.

Add call to MakoMiddleware() to initialize templates in celery worker server.

Pass task_ids by POST properties (as a list) to collect task progress status.
This commit is contained in:
Brian Wilson
2013-04-30 02:16:15 -04:00
parent 91ac6e68e8
commit d503e3313f
4 changed files with 254 additions and 36 deletions

View File

@@ -29,7 +29,7 @@ from courseware import tasks
from courseware.access import (has_access, get_access_group_name,
course_beta_test_group_name)
from courseware.courses import get_course_with_access
from courseware.models import StudentModule
from courseware.models import StudentModule, CourseTaskLog
from django_comment_common.models import (Role,
FORUM_ROLE_ADMINISTRATOR,
FORUM_ROLE_MODERATOR,
@@ -217,10 +217,13 @@ def instructor_dashboard(request, course_id):
elif "Regrade ALL students' problem submissions" in action:
problem_url = request.POST.get('problem_to_regrade', '')
try:
result = tasks.regrade_problem_for_all_students(request, course_id, problem_url)
course_task_log_entry = tasks.regrade_problem_for_all_students(request, course_id, problem_url)
except Exception as e:
log.error("Encountered exception from regrade: {msg}", msg=e.message())
log.error("Encountered exception from regrade: {0}", e)
# check that a course_task_log entry was created:
if course_task_log_entry is None:
msg += '<font="red">Failed to create a background task for regrading "{0}".</font>'.format(problem_url)
elif "Reset student's attempts" in action or "Delete student state for problem" in action:
# get the form data
unique_student_identifier = request.POST.get('unique_student_identifier', '')
@@ -641,6 +644,9 @@ def instructor_dashboard(request, course_id):
if use_offline:
msg += "<br/><font color='orange'>Grades from %s</font>" % offline_grades_available(course_id)
# generate list of pending background tasks
course_tasks = CourseTaskLog.objects.filter(course_id = course_id).exclude(task_status='SUCCESS').exclude(task_status='FAILURE')
#----------------------------------------
# context for rendering
@@ -655,7 +661,7 @@ def instructor_dashboard(request, course_id):
'problems': problems, # psychometrics
'plots': plots, # psychometrics
'course_errors': modulestore().get_item_errors(course.location),
'course_tasks': course_tasks,
'djangopid': os.getpid(),
'mitx_version': getattr(settings, 'MITX_VERSION_STRING', ''),
'offline_grade_log': offline_grades_available(course_id),