当前位置: 首页>>代码示例>>Java>>正文


Java TaskReport.setStatus方法代码示例

本文整理汇总了Java中org.apache.hadoop.mapreduce.v2.api.records.TaskReport.setStatus方法的典型用法代码示例。如果您正苦于以下问题:Java TaskReport.setStatus方法的具体用法?Java TaskReport.setStatus怎么用?Java TaskReport.setStatus使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.hadoop.mapreduce.v2.api.records.TaskReport的用法示例。


在下文中一共展示了TaskReport.setStatus方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: newTaskReport

import org.apache.hadoop.mapreduce.v2.api.records.TaskReport; //导入方法依赖的package包/类
public static TaskReport newTaskReport(TaskId id) {
  TaskReport report = Records.newRecord(TaskReport.class);
  report.setTaskId(id);
  report
      .setStartTime(System.currentTimeMillis() - (int) (Math.random() * DT));
  report.setFinishTime(System.currentTimeMillis()
      + (int) (Math.random() * DT) + 1);
  report.setProgress((float) Math.random());
  report.setStatus("Moving average: " + Math.random());
  report.setCounters(TypeConverter.toYarn(newCounters()));
  report.setTaskState(TASK_STATES.next());
  return report;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:14,代码来源:MockJobs.java

示例2: getReport

import org.apache.hadoop.mapreduce.v2.api.records.TaskReport; //导入方法依赖的package包/类
@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();
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:43,代码来源:TaskImpl.java


注:本文中的org.apache.hadoop.mapreduce.v2.api.records.TaskReport.setStatus方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。