本文整理汇总了Java中org.apache.hadoop.mapreduce.jobhistory.TaskAttemptStartedEvent类的典型用法代码示例。如果您正苦于以下问题:Java TaskAttemptStartedEvent类的具体用法?Java TaskAttemptStartedEvent怎么用?Java TaskAttemptStartedEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TaskAttemptStartedEvent类属于org.apache.hadoop.mapreduce.jobhistory包,在下文中一共展示了TaskAttemptStartedEvent类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: sendLaunchedEvents
import org.apache.hadoop.mapreduce.jobhistory.TaskAttemptStartedEvent; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private void sendLaunchedEvents() {
JobCounterUpdateEvent jce = new JobCounterUpdateEvent(attemptId.getTaskId()
.getJobId());
jce.addCounterUpdate(attemptId.getTaskId().getTaskType() == TaskType.MAP ?
JobCounter.TOTAL_LAUNCHED_MAPS : JobCounter.TOTAL_LAUNCHED_REDUCES, 1);
eventHandler.handle(jce);
LOG.info("TaskAttempt: [" + attemptId
+ "] using containerId: [" + container.getId() + " on NM: ["
+ StringInterner.weakIntern(container.getNodeId().toString()) + "]");
TaskAttemptStartedEvent tase =
new TaskAttemptStartedEvent(TypeConverter.fromYarn(attemptId),
TypeConverter.fromYarn(attemptId.getTaskId().getTaskType()),
launchTime, trackerName, httpPort, shufflePort, container.getId(),
locality.toString(), avataar.toString());
eventHandler.handle(
new JobHistoryEvent(attemptId.getTaskId().getJobId(), tase));
}
示例2: maybeEmitEvent
import org.apache.hadoop.mapreduce.jobhistory.TaskAttemptStartedEvent; //导入依赖的package包/类
HistoryEvent maybeEmitEvent(ParsedLine line, String taskAttemptIDName,
HistoryEventEmitter thatg) {
if (taskAttemptIDName == null) {
return null;
}
TaskAttemptID taskAttemptID = TaskAttemptID.forName(taskAttemptIDName);
String startTime = line.get("START_TIME");
String taskType = line.get("TASK_TYPE");
String trackerName = line.get("TRACKER_NAME");
String httpPort = line.get("HTTP_PORT");
String locality = line.get("LOCALITY");
if (locality == null) {
locality = "";
}
String avataar = line.get("AVATAAR");
if (avataar == null) {
avataar = "";
}
if (startTime != null && taskType != null) {
TaskAttempt20LineEventEmitter that =
(TaskAttempt20LineEventEmitter) thatg;
that.originalStartTime = Long.parseLong(startTime);
that.originalTaskType =
Version20LogInterfaceUtils.get20TaskType(taskType);
int port =
httpPort.equals("") ? DEFAULT_HTTP_PORT : Integer
.parseInt(httpPort);
return new TaskAttemptStartedEvent(taskAttemptID,
that.originalTaskType, that.originalStartTime, trackerName, port, -1,
locality, avataar);
}
return null;
}
示例3: sendLaunchedEvents
import org.apache.hadoop.mapreduce.jobhistory.TaskAttemptStartedEvent; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private void sendLaunchedEvents() {
JobCounterUpdateEvent jce = new JobCounterUpdateEvent(attemptId.getTaskId()
.getJobId());
jce.addCounterUpdate(attemptId.getTaskId().getTaskType() == TaskType.MAP ?
JobCounter.TOTAL_LAUNCHED_MAPS : JobCounter.TOTAL_LAUNCHED_REDUCES, 1);
eventHandler.handle(jce);
LOG.info("TaskAttempt: [" + attemptId
+ "] using containerId: [" + container.getId() + " on NM: ["
+ StringInterner.weakIntern(container.getNodeId().toString()) + "]");
TaskAttemptStartedEvent tase =
new TaskAttemptStartedEvent(TypeConverter.fromYarn(attemptId),
TypeConverter.fromYarn(attemptId.getTaskId().getTaskType()),
launchTime, trackerName, httpPort, shufflePort, container.getId(),
locality.toString(), avataar.toString());
eventHandler.handle(
new JobHistoryEvent(attemptId.getTaskId().getJobId(), tase));
}
示例4: processTaskAttemptStartedEvent
import org.apache.hadoop.mapreduce.jobhistory.TaskAttemptStartedEvent; //导入依赖的package包/类
private void processTaskAttemptStartedEvent(TaskAttemptStartedEvent event) {
ParsedTaskAttempt attempt =
getOrMakeTaskAttempt(event.getTaskType(), event.getTaskId().toString(),
event.getTaskAttemptId().toString());
if (attempt == null) {
return;
}
attempt.setStartTime(event.getStartTime());
attempt.putTrackerName(event.getTrackerName());
attempt.putHttpPort(event.getHttpPort());
attempt.putShufflePort(event.getShufflePort());
}
示例5: maybeEmitEvent
import org.apache.hadoop.mapreduce.jobhistory.TaskAttemptStartedEvent; //导入依赖的package包/类
HistoryEvent maybeEmitEvent(ParsedLine line, String taskAttemptIDName,
HistoryEventEmitter thatg) {
if (taskAttemptIDName == null) {
return null;
}
TaskAttemptID taskAttemptID = TaskAttemptID.forName(taskAttemptIDName);
String startTime = line.get("START_TIME");
String taskType = line.get("TASK_TYPE");
String trackerName = line.get("TRACKER_NAME");
String httpPort = line.get("HTTP_PORT");
if (startTime != null && taskType != null) {
TaskAttempt20LineEventEmitter that =
(TaskAttempt20LineEventEmitter) thatg;
that.originalStartTime = Long.parseLong(startTime);
that.originalTaskType =
Version20LogInterfaceUtils.get20TaskType(taskType);
int port =
httpPort.equals("") ? DEFAULT_HTTP_PORT : Integer
.parseInt(httpPort);
return new TaskAttemptStartedEvent(taskAttemptID,
that.originalTaskType, that.originalStartTime, trackerName, port);
}
return null;
}
示例6: processTaskAttemptStartedEvent
import org.apache.hadoop.mapreduce.jobhistory.TaskAttemptStartedEvent; //导入依赖的package包/类
private void processTaskAttemptStartedEvent(TaskAttemptStartedEvent event) {
LoggedTaskAttempt attempt =
getOrMakeTaskAttempt(event.getTaskType(), event.getTaskId().toString(),
event.getTaskAttemptId().toString());
if (attempt == null) {
return;
}
attempt.setStartTime(event.getStartTime());
}
示例7: process
import org.apache.hadoop.mapreduce.jobhistory.TaskAttemptStartedEvent; //导入依赖的package包/类
/**
* Process one {@link HistoryEvent}
*
* @param event
* The {@link HistoryEvent} to be processed.
*/
public void process(HistoryEvent event) {
if (finalized) {
throw new IllegalStateException(
"JobBuilder.process(HistoryEvent event) called after ParsedJob built");
}
// these are in lexicographical order by class name.
if (event instanceof AMStartedEvent) {
// ignore this event as Rumen currently doesnt need this event
//TODO Enhance Rumen to process this event and capture restarts
return;
} else if (event instanceof NormalizedResourceEvent) {
// Log an warn message as NormalizedResourceEvent shouldn't be written.
LOG.warn("NormalizedResourceEvent should be ignored in history server.");
} else if (event instanceof JobFinishedEvent) {
processJobFinishedEvent((JobFinishedEvent) event);
} else if (event instanceof JobInfoChangeEvent) {
processJobInfoChangeEvent((JobInfoChangeEvent) event);
} else if (event instanceof JobInitedEvent) {
processJobInitedEvent((JobInitedEvent) event);
} else if (event instanceof JobPriorityChangeEvent) {
processJobPriorityChangeEvent((JobPriorityChangeEvent) event);
} else if (event instanceof JobQueueChangeEvent) {
processJobQueueChangeEvent((JobQueueChangeEvent) event);
} else if (event instanceof JobStatusChangedEvent) {
processJobStatusChangedEvent((JobStatusChangedEvent) event);
} else if (event instanceof JobSubmittedEvent) {
processJobSubmittedEvent((JobSubmittedEvent) event);
} else if (event instanceof JobUnsuccessfulCompletionEvent) {
processJobUnsuccessfulCompletionEvent((JobUnsuccessfulCompletionEvent) event);
} else if (event instanceof MapAttemptFinishedEvent) {
processMapAttemptFinishedEvent((MapAttemptFinishedEvent) event);
} else if (event instanceof ReduceAttemptFinishedEvent) {
processReduceAttemptFinishedEvent((ReduceAttemptFinishedEvent) event);
} else if (event instanceof TaskAttemptFinishedEvent) {
processTaskAttemptFinishedEvent((TaskAttemptFinishedEvent) event);
} else if (event instanceof TaskAttemptStartedEvent) {
processTaskAttemptStartedEvent((TaskAttemptStartedEvent) event);
} else if (event instanceof TaskAttemptUnsuccessfulCompletionEvent) {
processTaskAttemptUnsuccessfulCompletionEvent((TaskAttemptUnsuccessfulCompletionEvent) event);
} else if (event instanceof TaskFailedEvent) {
processTaskFailedEvent((TaskFailedEvent) event);
} else if (event instanceof TaskFinishedEvent) {
processTaskFinishedEvent((TaskFinishedEvent) event);
} else if (event instanceof TaskStartedEvent) {
processTaskStartedEvent((TaskStartedEvent) event);
} else if (event instanceof TaskUpdatedEvent) {
processTaskUpdatedEvent((TaskUpdatedEvent) event);
} else
throw new IllegalArgumentException(
"JobBuilder.process(HistoryEvent): unknown event type:"
+ event.getEventType() + " for event:" + event);
}
示例8: process
import org.apache.hadoop.mapreduce.jobhistory.TaskAttemptStartedEvent; //导入依赖的package包/类
/**
* Process one {@link HistoryEvent}
*
* @param event
* The {@link HistoryEvent} to be processed.
*/
public void process(HistoryEvent event) {
if (finalized) {
throw new IllegalStateException(
"JobBuilder.process(HistoryEvent event) called after ParsedJob built");
}
// these are in lexicographical order by class name.
if (event instanceof AMStartedEvent) {
// ignore this event as Rumen currently doesnt need this event
//TODO Enhance Rumen to process this event and capture restarts
return;
} else if (event instanceof JobFinishedEvent) {
processJobFinishedEvent((JobFinishedEvent) event);
} else if (event instanceof JobInfoChangeEvent) {
processJobInfoChangeEvent((JobInfoChangeEvent) event);
} else if (event instanceof JobInitedEvent) {
processJobInitedEvent((JobInitedEvent) event);
} else if (event instanceof JobPriorityChangeEvent) {
processJobPriorityChangeEvent((JobPriorityChangeEvent) event);
} else if (event instanceof JobStatusChangedEvent) {
processJobStatusChangedEvent((JobStatusChangedEvent) event);
} else if (event instanceof JobSubmittedEvent) {
processJobSubmittedEvent((JobSubmittedEvent) event);
} else if (event instanceof JobUnsuccessfulCompletionEvent) {
processJobUnsuccessfulCompletionEvent((JobUnsuccessfulCompletionEvent) event);
} else if (event instanceof MapAttemptFinishedEvent) {
processMapAttemptFinishedEvent((MapAttemptFinishedEvent) event);
} else if (event instanceof ReduceAttemptFinishedEvent) {
processReduceAttemptFinishedEvent((ReduceAttemptFinishedEvent) event);
} else if (event instanceof TaskAttemptFinishedEvent) {
processTaskAttemptFinishedEvent((TaskAttemptFinishedEvent) event);
} else if (event instanceof TaskAttemptStartedEvent) {
processTaskAttemptStartedEvent((TaskAttemptStartedEvent) event);
} else if (event instanceof TaskAttemptUnsuccessfulCompletionEvent) {
processTaskAttemptUnsuccessfulCompletionEvent((TaskAttemptUnsuccessfulCompletionEvent) event);
} else if (event instanceof TaskFailedEvent) {
processTaskFailedEvent((TaskFailedEvent) event);
} else if (event instanceof TaskFinishedEvent) {
processTaskFinishedEvent((TaskFinishedEvent) event);
} else if (event instanceof TaskStartedEvent) {
processTaskStartedEvent((TaskStartedEvent) event);
} else if (event instanceof TaskUpdatedEvent) {
processTaskUpdatedEvent((TaskUpdatedEvent) event);
} else
throw new IllegalArgumentException(
"JobBuilder.process(HistoryEvent): unknown event type");
}
示例9: process
import org.apache.hadoop.mapreduce.jobhistory.TaskAttemptStartedEvent; //导入依赖的package包/类
/**
* Process one {@link HistoryEvent}
*
* @param event
* The {@link HistoryEvent} to be processed.
*/
public void process(HistoryEvent event) {
if (finalized) {
throw new IllegalStateException(
"JobBuilder.process(HistoryEvent event) called after LoggedJob built");
}
// these are in lexicographical order by class name.
if (event instanceof JobFinishedEvent) {
processJobFinishedEvent((JobFinishedEvent) event);
} else if (event instanceof JobInfoChangeEvent) {
processJobInfoChangeEvent((JobInfoChangeEvent) event);
} else if (event instanceof JobInitedEvent) {
processJobInitedEvent((JobInitedEvent) event);
} else if (event instanceof JobPriorityChangeEvent) {
processJobPriorityChangeEvent((JobPriorityChangeEvent) event);
} else if (event instanceof JobStatusChangedEvent) {
processJobStatusChangedEvent((JobStatusChangedEvent) event);
} else if (event instanceof JobSubmittedEvent) {
processJobSubmittedEvent((JobSubmittedEvent) event);
} else if (event instanceof JobUnsuccessfulCompletionEvent) {
processJobUnsuccessfulCompletionEvent((JobUnsuccessfulCompletionEvent) event);
} else if (event instanceof MapAttemptFinishedEvent) {
processMapAttemptFinishedEvent((MapAttemptFinishedEvent) event);
} else if (event instanceof ReduceAttemptFinishedEvent) {
processReduceAttemptFinishedEvent((ReduceAttemptFinishedEvent) event);
} else if (event instanceof TaskAttemptFinishedEvent) {
processTaskAttemptFinishedEvent((TaskAttemptFinishedEvent) event);
} else if (event instanceof TaskAttemptStartedEvent) {
processTaskAttemptStartedEvent((TaskAttemptStartedEvent) event);
} else if (event instanceof TaskAttemptUnsuccessfulCompletionEvent) {
processTaskAttemptUnsuccessfulCompletionEvent((TaskAttemptUnsuccessfulCompletionEvent) event);
} else if (event instanceof TaskFailedEvent) {
processTaskFailedEvent((TaskFailedEvent) event);
} else if (event instanceof TaskFinishedEvent) {
processTaskFinishedEvent((TaskFinishedEvent) event);
} else if (event instanceof TaskStartedEvent) {
processTaskStartedEvent((TaskStartedEvent) event);
} else if (event instanceof TaskUpdatedEvent) {
processTaskUpdatedEvent((TaskUpdatedEvent) event);
} else
throw new IllegalArgumentException(
"JobBuilder.process(HistoryEvent): unknown event type");
}