Refactor Instructor Tasks - in prep for Grade report work

This commit is contained in:
Nimisha Asthagiri
2017-04-24 17:10:38 -04:00
parent 85d05558c5
commit 18433dab95
19 changed files with 1962 additions and 1862 deletions

View File

@@ -14,9 +14,12 @@ import dogstats_wrapper as dog_stats_api
from django.db import transaction, DatabaseError
from django.core.cache import cache
from lms.djangoapps.instructor_task.models import InstructorTask, PROGRESS, QUEUING
from util.db import outer_atomic
from .exceptions import DuplicateTaskException
from .models import InstructorTask, PROGRESS, QUEUING
TASK_LOG = logging.getLogger('edx.celery.task')
# Lock expiration should be long enough to allow a subtask to complete.
@@ -26,11 +29,6 @@ SUBTASK_LOCK_EXPIRE = 60 * 10 # Lock expires in 10 minutes
MAX_DATABASE_LOCK_RETRIES = 5
class DuplicateTaskException(Exception):
"""Exception indicating that a task already exists or has already completed."""
pass
def _get_number_of_subtasks(total_num_items, items_per_task):
"""
Determines number of subtasks that would be generated by _generate_items_for_subtask.