Commit 2f4774f4 by Brian Wilson

Pass status into course_email for tracking retry status.

parent ffbb228a
......@@ -34,7 +34,7 @@ class MockCourseEmailResult(object):
def get_mock_course_email_result(self):
"""Wrapper for mock email function."""
def mock_course_email_result(sent, failed, output, **kwargs): # pylint: disable=W0613
def mock_course_email_result(prev_results, sent, failed, output, **kwargs): # pylint: disable=W0613
"""Increments count of number of emails sent."""
self.emails_sent += sent
return True
......@@ -247,7 +247,7 @@ class TestEmailSendFromDashboard(ModuleStoreTestCase):
)
@override_settings(EMAILS_PER_TASK=3, EMAILS_PER_QUERY=7)
@patch('bulk_email.tasks.course_email_result')
@patch('bulk_email.tasks._course_email_result')
def test_chunked_queries_send_numerous_emails(self, email_mock):
"""
Test sending a large number of emails, to test the chunked querying
......@@ -304,4 +304,3 @@ class TestEmailSendExceptions(ModuleStoreTestCase):
entry = InstructorTaskFactory.create(task_key='', task_id='dummy')
with self.assertRaises(CourseEmail.DoesNotExist):
send_course_email(entry.id, 101, [], {'course_title': 'Test'}, False)
......@@ -271,4 +271,4 @@ def submit_task(request, task_type, task_class, course_id, task_input, task_key)
task_args = [instructor_task.id, _get_xmodule_instance_args(request, task_id)]
task_class.apply_async(task_args, task_id=task_id)
return instructor_task
\ No newline at end of file
return instructor_task
......@@ -23,7 +23,6 @@ from celery import task
from functools import partial
from instructor_task.tasks_helper import (run_main_task,
perform_module_state_update,
# perform_delegate_email_batches,
rescore_problem_module_state,
reset_attempts_module_state,
delete_problem_module_state,
......@@ -52,7 +51,10 @@ def rescore_problem(entry_id, xmodule_instance_args):
"""
action_name = 'rescored'
update_fcn = partial(rescore_problem_module_state, xmodule_instance_args)
filter_fcn = lambda(modules_to_update): modules_to_update.filter(state__contains='"done": true')
def filter_fcn(modules_to_update):
return modules_to_update.filter(state__contains='"done": true')
visit_fcn = partial(perform_module_state_update, update_fcn, filter_fcn)
return run_main_task(entry_id, visit_fcn, action_name)
......
......@@ -52,7 +52,7 @@ def _get_current_task():
return current_task
def perform_module_state_update(update_fcn, filter_fcn, entry_id, course_id, task_input, action_name):
def perform_module_state_update(update_fcn, filter_fcn, _entry_id, course_id, task_input, action_name):
"""
Performs generic update by visiting StudentModule instances with the update_fcn provided.
......@@ -76,7 +76,7 @@ def perform_module_state_update(update_fcn, filter_fcn, entry_id, course_id, tas
'succeeded': number of attempts that "succeeded"
'skipped': number of attempts that "skipped"
'failed': number of attempts that "failed"
'total': number of possible subtasks to attempt
'total': number of possible updates to attempt
'action_name': user-visible verb to use in status messages. Should be past-tense.
Pass-through of input `action_name`.
'duration_ms': how long the task has (or had) been running.
......
......@@ -23,7 +23,7 @@ from instructor_task.models import InstructorTask
from instructor_task.tests.test_base import InstructorTaskModuleTestCase
from instructor_task.tests.factories import InstructorTaskFactory
from instructor_task.tasks import rescore_problem, reset_problem_attempts, delete_problem_state
from instructor_task.tasks_helper import UpdateProblemModuleStateError #, update_problem_module_state
from instructor_task.tasks_helper import UpdateProblemModuleStateError
PROBLEM_URL_NAME = "test_urlname"
......
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