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


Java TaskAttempt.getDiagnostics方法代码示例

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


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

示例1: verifyTaskAttemptGeneric

import org.apache.hadoop.mapreduce.v2.app.job.TaskAttempt; //导入方法依赖的package包/类
public void verifyTaskAttemptGeneric(TaskAttempt ta, TaskType ttype,
    String id, String state, String type, String rack,
    String nodeHttpAddress, String diagnostics, String assignedContainerId,
    long startTime, long finishTime, long elapsedTime, float progress) {

  TaskAttemptId attid = ta.getID();
  String attemptId = MRApps.toString(attid);

  WebServicesTestUtils.checkStringMatch("id", attemptId, id);
  WebServicesTestUtils.checkStringMatch("type", ttype.toString(), type);
  WebServicesTestUtils.checkStringMatch("state", ta.getState().toString(),
      state);
  WebServicesTestUtils.checkStringMatch("rack", ta.getNodeRackName(), rack);
  WebServicesTestUtils.checkStringMatch("nodeHttpAddress",
      ta.getNodeHttpAddress(), nodeHttpAddress);

  String expectDiag = "";
  List<String> diagnosticsList = ta.getDiagnostics();
  if (diagnosticsList != null && !diagnostics.isEmpty()) {
    StringBuffer b = new StringBuffer();
    for (String diag : diagnosticsList) {
      b.append(diag);
    }
    expectDiag = b.toString();
  }
  WebServicesTestUtils.checkStringMatch("diagnostics", expectDiag,
      diagnostics);
  WebServicesTestUtils.checkStringMatch("assignedContainerId",
      ConverterUtils.toString(ta.getAssignedContainerID()),
      assignedContainerId);

  assertEquals("startTime wrong", ta.getLaunchTime(), startTime);
  assertEquals("finishTime wrong", ta.getFinishTime(), finishTime);
  assertEquals("elapsedTime wrong", finishTime - startTime, elapsedTime);
  assertEquals("progress wrong", ta.getProgress() * 100, progress, 1e-3f);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:37,代码来源:TestAMWebServicesAttempts.java

示例2: getReport

import org.apache.hadoop.mapreduce.v2.app.job.TaskAttempt; //导入方法依赖的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.app.job.TaskAttempt.getDiagnostics方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。