code: void recomputeProgress() {
      if (isComplete()) {
        this.progress = 1;
        // update the counters and the state
        TaskStatus completedStatus = taskStatuses.get(getSuccessfulTaskid());
        this.counters = completedStatus.getCounters();
        this.state = completedStatus.getStateString();
      } else if (failed) {
        this.progress = 0;
        // reset the counters and the state
        this.state = "";
        this.counters = new Counters();
      } else {
        double bestProgress = 0;
        String bestState = "";
        Counters bestCounters = new Counters();
        for (Iterator<TaskAttemptID> it = taskStatuses.keySet().iterator(); it.hasNext();) {
          TaskAttemptID taskid = it.next();
          TaskStatus status = taskStatuses.get(taskid);
          if (status.getRunState() == TaskStatus.State.SUCCEEDED) {
            bestProgress = 1;
            bestState = status.getStateString();
            bestCounters = status.getCounters();
            break;
          } else if (status.getRunState() == TaskStatus.State.COMMIT_PENDING) {
            //for COMMIT_PENDING, we take the last state that we recorded
            //when the task was RUNNING
            bestProgress = this.progress;
            bestState = this.state;
            bestCounters = this.counters;
          } else if (status.getRunState() == TaskStatus.State.RUNNING) {
            if (status.getProgress() >= bestProgress) {
              bestProgress = status.getProgress();
              bestState = status.getStateString();
              if (status.getIncludeCounters()) {
                bestCounters = status.getCounters();
              } else {
                bestCounters = this.counters;
              }
            }
          }
        }
        this.progress = bestProgress;
        this.state = bestState;
        this.counters = bestCounters;
      }
    }
docs: This method is called whenever there's a status change
  for one of the TIP's sub-tasks.  It recomputes the overall
  progress for the TIP.  We examine all sub-tasks and find
  the one that's most advanced (and non-failed).