Revert "Revert "use different queue for smaller emails (TNL-1591)""
This reverts commit 228cca4e38ec79f5cbb54098c788ab9556f602e2.
This commit is contained in:
@@ -275,7 +275,16 @@ def initialize_subtask_info(entry, action_name, total_num, subtask_id_list):
|
||||
return task_progress
|
||||
|
||||
|
||||
def queue_subtasks_for_query(entry, action_name, create_subtask_fcn, item_querysets, item_fields, items_per_task):
|
||||
# pylint: disable=bad-continuation
|
||||
def queue_subtasks_for_query(
|
||||
entry,
|
||||
action_name,
|
||||
create_subtask_fcn,
|
||||
item_querysets,
|
||||
item_fields,
|
||||
items_per_task,
|
||||
total_num_items,
|
||||
):
|
||||
"""
|
||||
Generates and queues subtasks to each execute a chunk of "items" generated by a queryset.
|
||||
|
||||
@@ -289,12 +298,12 @@ def queue_subtasks_for_query(entry, action_name, create_subtask_fcn, item_querys
|
||||
`item_fields` : the fields that should be included in the dict that is returned.
|
||||
These are in addition to the 'pk' field.
|
||||
`items_per_task` : maximum size of chunks to break each query chunk into for use by a subtask.
|
||||
`total_num_items` : total amount of items that will be put into subtasks
|
||||
|
||||
Returns: the task progress as stored in the InstructorTask object.
|
||||
|
||||
"""
|
||||
task_id = entry.task_id
|
||||
total_num_items = sum([item_queryset.count() for item_queryset in item_querysets])
|
||||
|
||||
# Calculate the number of tasks that will be created, and create a list of ids for each task.
|
||||
total_num_subtasks = _get_number_of_subtasks(total_num_items, items_per_task)
|
||||
|
||||
@@ -54,6 +54,7 @@ class TestSubtasks(InstructorTaskCourseTestCase):
|
||||
item_querysets=task_querysets,
|
||||
item_fields=[],
|
||||
items_per_task=items_per_task,
|
||||
total_num_items=initial_count,
|
||||
)
|
||||
|
||||
def test_queue_subtasks_for_query1(self):
|
||||
|
||||
Reference in New Issue
Block a user