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


Java TaskInfo.getTaskType方法代码示例

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


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

示例1: validateTaskLevelKeyValuesFormat

import org.apache.hadoop.mapreduce.jobhistory.JobHistoryParser.TaskInfo; //导入方法依赖的package包/类
private static void validateTaskLevelKeyValuesFormat(JobInfo job,
                                boolean splitsCanBeEmpty) {
  Map<TaskID, TaskInfo> tasks = job.getAllTasks();

  // validate info of each task
  for (TaskInfo task : tasks.values()) {

    TaskID tid = task.getTaskId();
    long startTime = task.getStartTime();
    assertTrue("Invalid Start time", startTime > 0);
    
    long finishTime = task.getFinishTime();
    assertTrue("Task FINISH_TIME is < START_TIME in history file",
               startTime < finishTime);

    // Make sure that the Task type exists and it is valid
    TaskType type = task.getTaskType();
    assertTrue("Unknown Task type \"" + type + "\" is seen in " +
               "history file for task " + tid,
               (type.equals(TaskType.MAP) || 
                type.equals(TaskType.REDUCE) ||
                type.equals(TaskType.JOB_CLEANUP) || 
                type.equals(TaskType.JOB_SETUP)));

    if (type.equals(TaskType.MAP)) {
      String splits = task.getSplitLocations();
      //order in the condition OR check is important here
      if (!splitsCanBeEmpty || splits.length() != 0) {
        Matcher m = splitsPattern.matcher(splits);
        assertTrue("Unexpected format of SPLITS \"" + splits + "\" is seen" +
                   " in history file for task " + tid, m.matches());
      }
    }

    // Validate task status
    String status = task.getTaskStatus();
    assertTrue("Unexpected TASK_STATUS \"" + status + "\" is seen in" +
               " history file for task " + tid, (status.equals("SUCCEEDED") ||
               status.equals("FAILED") || status.equals("KILLED")));
  }
}
 
开发者ID:rekhajoshm,项目名称:mapreduce-fork,代码行数:42,代码来源:TestJobHistory.java


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