code: private void completedTask(TaskAttemptID taskId, TaskStatus.State finalTaskState) {
      TaskStatus status = taskStatuses.get(taskId);
      status.setRunState(finalTaskState);
      activeTasks.remove(taskId);
    }
docs: Finalize the <b>completed</b> task; note that this might not be the first
  task-attempt of the {@link TaskInProgress} and hence might be declared
  {@link TaskStatus.State.SUCCEEDED} or {@link TaskStatus.State.KILLED}
  
  @param taskId id of the completed task-attempt
  @param finalTaskState final {@link TaskStatus.State} of the task-attempt