'Update InstructorTask object corresponding to this task with info about success.
Updates task_output and task_state.  But it shouldn\'t actually do anything
if the task is only creating subtasks to actually do the work.
Assumes `task_progress` is a dict containing the task\'s result, with the following keys:
\'attempted\': number of attempts made
\'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
\'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.
This is JSON-serialized and stored in the task_output column of the InstructorTask entry.'

def on_success(self, task_progress, task_id, args, kwargs):

    TASK_LOG.debug('Task    %s:    success    returned    with    progress:    %s', task_id, task_progress)
    entry_id = args[0]
    entry = InstructorTask.objects.get(pk=entry_id)
    if (len(entry.subtasks) == 0):
        entry.task_output = InstructorTask.create_output_for_success(task_progress)
        entry.task_state = SUCCESS
        entry.save_now()
