本文整理汇总了Java中org.apache.hadoop.mapreduce.jobhistory.TaskFailedEvent类的典型用法代码示例。如果您正苦于以下问题:Java TaskFailedEvent类的具体用法?Java TaskFailedEvent怎么用?Java TaskFailedEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TaskFailedEvent类属于org.apache.hadoop.mapreduce.jobhistory包,在下文中一共展示了TaskFailedEvent类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createTaskFailedEvent
import org.apache.hadoop.mapreduce.jobhistory.TaskFailedEvent; //导入依赖的package包/类
private static TaskFailedEvent createTaskFailedEvent(TaskImpl task, List<String> diag, TaskStateInternal taskState, TaskAttemptId taId) {
StringBuilder errorSb = new StringBuilder();
if (diag != null) {
for (String d : diag) {
errorSb.append(", ").append(d);
}
}
TaskFailedEvent taskFailedEvent = new TaskFailedEvent(
TypeConverter.fromYarn(task.taskId),
// Hack since getFinishTime needs isFinished to be true and that doesn't happen till after the transition.
task.getFinishTime(taId),
TypeConverter.fromYarn(task.getType()),
errorSb.toString(),
taskState.toString(),
taId == null ? null : TypeConverter.fromYarn(taId),
task.getCounters());
return taskFailedEvent;
}
示例2: transition
import org.apache.hadoop.mapreduce.jobhistory.TaskFailedEvent; //导入依赖的package包/类
@Override
public TaskStateInternal transition(TaskImpl task, TaskEvent event) {
TaskAttemptId taskAttemptId =
((TaskTAttemptEvent) event).getTaskAttemptID();
task.handleTaskAttemptCompletion(taskAttemptId, taCompletionEventStatus);
task.finishedAttempts.add(taskAttemptId);
// check whether all attempts are finished
if (task.finishedAttempts.size() == task.attempts.size()) {
if (task.historyTaskStartGenerated) {
TaskFailedEvent taskFailedEvent = createTaskFailedEvent(task, null,
finalState, null); // TODO JH verify failedAttempt null
task.eventHandler.handle(new JobHistoryEvent(task.taskId.getJobId(),
taskFailedEvent));
} else {
LOG.debug("Not generating HistoryFinish event since start event not" +
" generated for task: " + task.getID());
}
task.eventHandler.handle(
new JobTaskEvent(task.taskId, getExternalState(finalState)));
return finalState;
}
return task.getInternalState();
}
示例3: processTaskFailedEvent
import org.apache.hadoop.mapreduce.jobhistory.TaskFailedEvent; //导入依赖的package包/类
private void processTaskFailedEvent(TaskFailedEvent event) {
ParsedTask task =
getOrMakeTask(event.getTaskType(), event.getTaskId().toString(), false);
if (task == null) {
return;
}
task.setFinishTime(event.getFinishTime());
task.setTaskStatus(getPre21Value(event.getTaskStatus()));
TaskFailed t = (TaskFailed)(event.getDatum());
task.putDiagnosticInfo(t.error.toString());
task.putFailedDueToAttemptId(t.failedDueToAttempt.toString());
org.apache.hadoop.mapreduce.jobhistory.JhCounters counters =
((TaskFailed) event.getDatum()).counters;
task.incorporateCounters(
counters == null ? EMPTY_COUNTERS : counters);
}
示例4: transition
import org.apache.hadoop.mapreduce.jobhistory.TaskFailedEvent; //导入依赖的package包/类
@Override
public TaskStateInternal transition(TaskImpl task, TaskEvent event) {
TaskAttemptId taskAttemptId =
((TaskTAttemptEvent) event).getTaskAttemptID();
LOG.info("receive attempt killed from"+task.getID().toString());
task.handleTaskAttemptCompletion(taskAttemptId, taCompletionEventStatus);
task.finishedAttempts.add(taskAttemptId);
// check whether all attempts are finished
if (task.finishedAttempts.size() == task.attempts.size()) {
if (task.historyTaskStartGenerated) {
TaskFailedEvent taskFailedEvent = createTaskFailedEvent(task, null,
finalState, null); // TODO JH verify failedAttempt null
task.eventHandler.handle(new JobHistoryEvent(task.taskId.getJobId(),
taskFailedEvent));
} else {
LOG.debug("Not generating HistoryFinish event since start event not" +
" generated for task: " + task.getID());
}
task.eventHandler.handle(
new JobTaskEvent(task.taskId, getExternalState(finalState)));
return finalState;
}
return task.getInternalState();
}
示例5: maybeEmitEvent
import org.apache.hadoop.mapreduce.jobhistory.TaskFailedEvent; //导入依赖的package包/类
HistoryEvent maybeEmitEvent(ParsedLine line, String taskIDName,
HistoryEventEmitter thatg) {
if (taskIDName == null) {
return null;
}
TaskID taskID = TaskID.forName(taskIDName);
String status = line.get("TASK_STATUS");
String finishTime = line.get("FINISH_TIME");
String taskType = line.get("TASK_TYPE");
String error = line.get("ERROR");
if (finishTime != null
&& (error != null || (status != null && !status
.equalsIgnoreCase("success")))) {
Task20LineHistoryEventEmitter that =
(Task20LineHistoryEventEmitter) thatg;
TaskType originalTaskType =
that.originalTaskType == null ? Version20LogInterfaceUtils
.get20TaskType(taskType) : that.originalTaskType;
return new TaskFailedEvent(taskID, Long.parseLong(finishTime),
originalTaskType, error, status, null);
}
return null;
}