private boolean fasterButInaccurateCountTasks(
      JobInfo info, JobInProgress job) {
    if (job.pendingMaps() < 0 || job.pendingReduces() < 0) {
      LOG.warn("Bad pending tasks. job:" + job.getJobID() +
          " pendingMaps:" + job.pendingMaps() +
          " pendingReduces:" + job.pendingReduces());
      return false;
    }
    // Count maps
    int runningMaps = job.runningMaps();
    info.totalInitedTasks = job.numMapTasks + job.numReduceTasks;
    info.runningMaps = runningMaps;
    infosummary.totalRunningMaps += runningMaps;
    poolMgr.incRunningTasks(info.poolName, TaskType.MAP, runningMaps);
    info.neededSpeculativeMaps =  taskSelector.neededSpeculativeMaps(job);
    info.neededMaps = job.neededMaps();

    // Count reduces
    int runningReduces = job.runningReduces();
    info.runningReduces = runningReduces;
    infosummary.totalRunningReduces += runningReduces;
    poolMgr.incRunningTasks(info.poolName, TaskType.REDUCE, runningReduces);
    if (job.scheduleReduces()) {
      info.neededSpeculativeReduces =
          taskSelector.neededSpeculativeReduces(job);
      info.neededReduces = job.neededReduces();
    } else {
      info.neededReduces = 0;
    }
    return true;
  }
private boolean fasterButInaccurateCountTasks ( JobInfo info , JobInProgress job ) { if ( job . pendingMaps ( ) < 0 || job . pendingReduces ( ) < 0 ) { LOG . warn ( "Bad pending tasks. job:" + job . getJobID ( ) + " pendingMaps:" + job . pendingMaps ( ) + " pendingReduces:" + job . pendingReduces ( ) ) ; return false ; } int runningMaps = job . runningMaps ( ) ; info . totalInitedTasks = job . numMapTasks + job . numReduceTasks ; info . runningMaps = runningMaps ; infosummary . totalRunningMaps += runningMaps ; poolMgr . incRunningTasks ( info . poolName , TaskType . MAP , runningMaps ) ; info . neededSpeculativeMaps = taskSelector . neededSpeculativeMaps ( job ) ; info . neededMaps = job . neededMaps ( ) ; int runningReduces = job . runningReduces ( ) ; info . runningReduces = runningReduces ; infosummary . totalRunningReduces += runningReduces ; poolMgr . incRunningTasks ( info . poolName , TaskType . REDUCE , runningReduces ) ; if ( job . scheduleReduces ( ) ) { info . neededSpeculativeReduces = taskSelector . neededSpeculativeReduces ( job ) ; info . neededReduces = job . neededReduces ( ) ; } else { info . neededReduces = 0 ; } return true ; }
Obtain task counts for a job by using the information provided by
{@link JobInProgres}. It has been observed the task counters reported by
JobInProgress is incorrect occasionally.
@param info the JobInfo to update
@param job the corresponding JobInProgress
@return false If JobInProgress return bad value, count tasks failed