本文整理汇总了Java中org.apache.hadoop.mapreduce.jobhistory.JobHistoryParser.TaskAttemptInfo.getFinishTime方法的典型用法代码示例。如果您正苦于以下问题:Java TaskAttemptInfo.getFinishTime方法的具体用法?Java TaskAttemptInfo.getFinishTime怎么用?Java TaskAttemptInfo.getFinishTime使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.hadoop.mapreduce.jobhistory.JobHistoryParser.TaskAttemptInfo
的用法示例。
在下文中一共展示了TaskAttemptInfo.getFinishTime方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getMaxReduceTime
import org.apache.hadoop.mapreduce.jobhistory.JobHistoryParser.TaskAttemptInfo; //导入方法依赖的package包/类
/**
* *
* @return This method returns the maximum time taken by reduce.
*/
@SuppressWarnings("deprecation")
private long getMaxReduceTime(Map<TaskAttemptID, TaskAttemptInfo> tasks, long referencedZeroTime) {
long maximumReduceTime = 0l;
for (Map.Entry<TaskAttemptID, TaskAttemptInfo> task : tasks
.entrySet()) {
if(!task.getKey().isMap()){
TaskAttemptInfo taskAttemptInfo = (TaskAttemptInfo) (task.getValue());
long reduceEnd = (taskAttemptInfo.getFinishTime()-referencedZeroTime)/CONVERSION_FACTOR_MILLISECS_TO_SECS;
maximumReduceTime = reduceEnd > maximumReduceTime ? reduceEnd : maximumReduceTime;
}}
return maximumReduceTime;
}
示例2: compare
import org.apache.hadoop.mapreduce.jobhistory.JobHistoryParser.TaskAttemptInfo; //导入方法依赖的package包/类
@Override
public int compare(TaskAttemptInfo a, TaskAttemptInfo b) {
long diff = a.getFinishTime() - b.getFinishTime();
return diff == 0 ? 0 : (diff < 0 ? -1 : 1);
}
示例3: validateTaskAttemptLevelKeyValuesFormat
import org.apache.hadoop.mapreduce.jobhistory.JobHistoryParser.TaskAttemptInfo; //导入方法依赖的package包/类
private static void validateTaskAttemptLevelKeyValuesFormat(JobInfo job) {
Map<TaskID, TaskInfo> tasks = job.getAllTasks();
// For each task
for (TaskInfo task : tasks.values()) {
// validate info of each attempt
for (TaskAttemptInfo attempt : task.getAllTaskAttempts().values()) {
TaskAttemptID id = attempt.getAttemptId();
assertNotNull(id);
long startTime = attempt.getStartTime();
assertTrue("Invalid Start time", startTime > 0);
long finishTime = attempt.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 = attempt.getTaskType();
assertTrue("Unknown Task type \"" + type + "\" is seen in " +
"history file for task attempt " + id,
(type.equals(TaskType.MAP) || type.equals(TaskType.REDUCE) ||
type.equals(TaskType.JOB_CLEANUP) ||
type.equals(TaskType.JOB_SETUP)));
// Validate task status
String status = attempt.getTaskStatus();
assertTrue("Unexpected TASK_STATUS \"" + status + "\" is seen in" +
" history file for task attempt " + id,
(status.equals(TaskStatus.State.SUCCEEDED.toString()) ||
status.equals(TaskStatus.State.FAILED.toString()) ||
status.equals(TaskStatus.State.KILLED.toString())));
// Successful Reduce Task Attempts should have valid SHUFFLE_FINISHED
// time and SORT_FINISHED time
if (type.equals(TaskType.REDUCE) &&
status.equals(TaskStatus.State.SUCCEEDED.toString())) {
long shuffleFinishTime = attempt.getShuffleFinishTime();
assertTrue(startTime < shuffleFinishTime);
long sortFinishTime = attempt.getSortFinishTime();
assertTrue(shuffleFinishTime < sortFinishTime);
}
else if (type.equals(TaskType.MAP) &&
status.equals(TaskStatus.State.SUCCEEDED.toString())) {
// Successful MAP Task Attempts should have valid MAP_FINISHED time
long mapFinishTime = attempt.getMapFinishTime();
assertTrue(startTime < mapFinishTime);
}
// check if hostname is valid
String hostname = attempt.getHostname();
Matcher m = hostNamePattern.matcher(hostname);
assertTrue("Unexpected Host name of task attempt " + id, m.matches());
// check if trackername is valid
String trackerName = attempt.getTrackerName();
m = trackerNamePattern.matcher(trackerName);
assertTrue("Unexpected tracker name of task attempt " + id,
m.matches());
if (!status.equals("KILLED")) {
// check if http port is valid
int httpPort = attempt.getHttpPort();
assertTrue(httpPort > 0);
}
// check if counters are parsable
Counters counters = attempt.getCounters();
assertNotNull(counters);
}
}
}