@Override
  public TaskAttemptInfo getMapTaskAttemptInfoAdjusted(int taskNumber,
      int taskAttemptNumber, int locality) {
    TaskType taskType = TaskType.MAP;
    LoggedTask loggedTask = getLoggedTask(taskType, taskNumber);
    if (loggedTask == null) {
      // TODO insert parameters
      TaskInfo taskInfo = new TaskInfo(0, 0, 0, 0, 0);
      return makeUpTaskAttemptInfo(taskType, taskInfo, taskAttemptNumber,
          taskNumber, locality);
    }
    LoggedTaskAttempt loggedAttempt = getLoggedTaskAttempt(taskType,
        taskNumber, taskAttemptNumber);
    if (loggedAttempt == null) {
      // Task exists, but attempt is missing.
      TaskInfo taskInfo = getTaskInfo(loggedTask);
      return makeUpTaskAttemptInfo(taskType, taskInfo, taskAttemptNumber,
          taskNumber, locality);
    } else {
      // Task and TaskAttempt both exist.
      if (loggedAttempt.getResult() == Values.KILLED) {
        TaskInfo taskInfo = getTaskInfo(loggedTask);
        return makeUpTaskAttemptInfo(taskType, taskInfo, taskAttemptNumber,
            taskNumber, locality);
      } else if (loggedAttempt.getResult() == Values.FAILED) {
        /**
         * FAILED attempt is not affected by locality however, made-up FAILED
         * attempts ARE affected by locality, since statistics are present for
         * attempts of different locality.
         */
        return getTaskAttemptInfo(loggedTask, loggedAttempt);
      } else if (loggedAttempt.getResult() == Values.SUCCESS) {
        int loggedLocality = getLocality(loggedTask, loggedAttempt);
        if (locality == loggedLocality) {
          return getTaskAttemptInfo(loggedTask, loggedAttempt);
        } else {
          // attempt succeeded in trace. It is scheduled in simulation with
          // a different locality.
          return scaleInfo(loggedTask, loggedAttempt, locality, loggedLocality,
              rackLocalOverNodeLocal, rackRemoteOverNodeLocal);
        }
      } else {
        throw new IllegalArgumentException(
            "attempt result is not SUCCEEDED, FAILED or KILLED: "
                + loggedAttempt.getResult());
      }
    }
  }
@ Override public TaskAttemptInfo getMapTaskAttemptInfoAdjusted ( int taskNumber , int taskAttemptNumber , int locality ) { TaskType taskType = TaskType . MAP ; LoggedTask loggedTask = getLoggedTask ( taskType , taskNumber ) ; if ( loggedTask == null ) { TaskInfo taskInfo = new TaskInfo ( 0 , 0 , 0 , 0 , 0 ) ; return makeUpTaskAttemptInfo ( taskType , taskInfo , taskAttemptNumber , taskNumber , locality ) ; } LoggedTaskAttempt loggedAttempt = getLoggedTaskAttempt ( taskType , taskNumber , taskAttemptNumber ) ; if ( loggedAttempt == null ) { TaskInfo taskInfo = getTaskInfo ( loggedTask ) ; return makeUpTaskAttemptInfo ( taskType , taskInfo , taskAttemptNumber , taskNumber , locality ) ; } else { if ( loggedAttempt . getResult ( ) == Values . KILLED ) { TaskInfo taskInfo = getTaskInfo ( loggedTask ) ; return makeUpTaskAttemptInfo ( taskType , taskInfo , taskAttemptNumber , taskNumber , locality ) ; } else if ( loggedAttempt . getResult ( ) == Values . FAILED ) { return getTaskAttemptInfo ( loggedTask , loggedAttempt ) ; } else if ( loggedAttempt . getResult ( ) == Values . SUCCESS ) { int loggedLocality = getLocality ( loggedTask , loggedAttempt ) ; if ( locality == loggedLocality ) { return getTaskAttemptInfo ( loggedTask , loggedAttempt ) ; } else { return scaleInfo ( loggedTask , loggedAttempt , locality , loggedLocality , rackLocalOverNodeLocal , rackRemoteOverNodeLocal ) ; } } else { throw new IllegalArgumentException ( "attempt result is not SUCCEEDED, FAILED or KILLED: " + loggedAttempt . getResult ( ) ) ; } } }
Get a {@link TaskAttemptInfo} with a {@link TaskAttemptID} associated with
taskType, taskNumber, and taskAttemptNumber. This function considers
locality, and follows the following decision logic: 1. Make up a
{@link TaskAttemptInfo} if the task attempt is missing in trace, 2. Make up
a {@link TaskAttemptInfo} if the task attempt has a KILLED final status in
trace, 3. If final state is FAILED, construct a {@link TaskAttemptInfo}
from the trace, without considering locality. 4. If final state is
SUCCEEDED, construct a {@link TaskAttemptInfo} from the trace, with runtime
scaled according to locality in simulation and locality in trace.