Java Code Examples for org.apache.hadoop.mapreduce.v2.api.records.TaskReport#setSuccessfulAttempt()

The following examples show how to use org.apache.hadoop.mapreduce.v2.api.records.TaskReport#setSuccessfulAttempt() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TaskImpl.java    From hadoop with Apache License 2.0 4 votes vote down vote up
@Override
public TaskReport getReport() {
  TaskReport report = recordFactory.newRecordInstance(TaskReport.class);
  readLock.lock();
  try {
    TaskAttempt bestAttempt = selectBestAttempt();
    report.setTaskId(taskId);
    report.setStartTime(getLaunchTime());
    report.setFinishTime(getFinishTime());
    report.setTaskState(getState());
    report.setProgress(bestAttempt == null ? 0f : bestAttempt.getProgress());
    report.setStatus(bestAttempt == null
        ? ""
        : bestAttempt.getReport().getStateString());

    for (TaskAttempt attempt : attempts.values()) {
      if (TaskAttemptState.RUNNING.equals(attempt.getState())) {
        report.addRunningAttempt(attempt.getID());
      }
    }

    report.setSuccessfulAttempt(successfulAttempt);
    
    for (TaskAttempt att : attempts.values()) {
      String prefix = "AttemptID:" + att.getID() + " Info:";
      for (CharSequence cs : att.getDiagnostics()) {
        report.addDiagnostics(prefix + cs);
        
      }
    }

    // Add a copy of counters as the last step so that their lifetime on heap
    // is as small as possible.
    report.setCounters(TypeConverter.toYarn(bestAttempt == null
        ? TaskAttemptImpl.EMPTY_COUNTERS
        : bestAttempt.getCounters()));

    return report;
  } finally {
    readLock.unlock();
  }
}
 
Example 2
Source File: TaskImpl.java    From big-c with Apache License 2.0 4 votes vote down vote up
@Override
public TaskReport getReport() {
  TaskReport report = recordFactory.newRecordInstance(TaskReport.class);
  readLock.lock();
  try {
    TaskAttempt bestAttempt = selectBestAttempt();
    report.setTaskId(taskId);
    report.setStartTime(getLaunchTime());
    report.setFinishTime(getFinishTime());
    report.setTaskState(getState());
    report.setProgress(bestAttempt == null ? 0f : bestAttempt.getProgress());
    report.setStatus(bestAttempt == null
        ? ""
        : bestAttempt.getReport().getStateString());

    for (TaskAttempt attempt : attempts.values()) {
      if (TaskAttemptState.RUNNING.equals(attempt.getState())) {
        report.addRunningAttempt(attempt.getID());
      }
    }

    report.setSuccessfulAttempt(successfulAttempt);
    
    for (TaskAttempt att : attempts.values()) {
      String prefix = "AttemptID:" + att.getID() + " Info:";
      for (CharSequence cs : att.getDiagnostics()) {
        report.addDiagnostics(prefix + cs);
        
      }
    }

    // Add a copy of counters as the last step so that their lifetime on heap
    // is as small as possible.
    report.setCounters(TypeConverter.toYarn(bestAttempt == null
        ? TaskAttemptImpl.EMPTY_COUNTERS
        : bestAttempt.getCounters()));

    return report;
  } finally {
    readLock.unlock();
  }
}