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