|
@@ -68,6 +68,7 @@ public class RMApplicationHistoryWriter extends CompositeService {
|
|
|
|
|
|
private Dispatcher dispatcher;
|
|
|
private ApplicationHistoryWriter writer;
|
|
|
+ private boolean historyServiceEnabled;
|
|
|
|
|
|
public RMApplicationHistoryWriter() {
|
|
|
super(RMApplicationHistoryWriter.class.getName());
|
|
@@ -76,6 +77,11 @@ public class RMApplicationHistoryWriter extends CompositeService {
|
|
|
@Override
|
|
|
protected synchronized void serviceInit(
|
|
|
Configuration conf) throws Exception {
|
|
|
+
|
|
|
+ historyServiceEnabled = conf.getBoolean(
|
|
|
+ YarnConfiguration.YARN_HISTORY_SERVICE_ENABLED,
|
|
|
+ YarnConfiguration.DEFAULT_YARN_HISTORY_SERVICE_ENABLED);
|
|
|
+
|
|
|
writer = createApplicationHistoryStore(conf);
|
|
|
addIfService(writer);
|
|
|
|
|
@@ -96,12 +102,9 @@ public class RMApplicationHistoryWriter extends CompositeService {
|
|
|
|
|
|
protected ApplicationHistoryStore createApplicationHistoryStore(
|
|
|
Configuration conf) {
|
|
|
- boolean ahsEnabled = conf.getBoolean(
|
|
|
- YarnConfiguration.RM_HISTORY_WRITER_ENABLED,
|
|
|
- YarnConfiguration.DEFAULT_RM_HISTORY_WRITER_ENABLED);
|
|
|
// If the history writer is not enabled, a dummy store will be used to
|
|
|
// write nothing
|
|
|
- if (ahsEnabled) {
|
|
|
+ if (historyServiceEnabled) {
|
|
|
try {
|
|
|
Class<? extends ApplicationHistoryStore> storeClass =
|
|
|
conf.getClass(YarnConfiguration.RM_HISTORY_WRITER_CLASS,
|
|
@@ -225,42 +228,49 @@ public class RMApplicationHistoryWriter extends CompositeService {
|
|
|
|
|
|
@SuppressWarnings("unchecked")
|
|
|
public void applicationAttemptStarted(RMAppAttempt appAttempt) {
|
|
|
- dispatcher.getEventHandler().handle(
|
|
|
+ if (historyServiceEnabled) {
|
|
|
+ dispatcher.getEventHandler().handle(
|
|
|
new WritingApplicationAttemptStartEvent(appAttempt.getAppAttemptId(),
|
|
|
- ApplicationAttemptStartData.newInstance(
|
|
|
- appAttempt.getAppAttemptId(), appAttempt.getHost(),
|
|
|
- appAttempt.getRpcPort(), appAttempt.getMasterContainer()
|
|
|
- .getId())));
|
|
|
+ ApplicationAttemptStartData.newInstance(appAttempt.getAppAttemptId(),
|
|
|
+ appAttempt.getHost(), appAttempt.getRpcPort(), appAttempt
|
|
|
+ .getMasterContainer().getId())));
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
@SuppressWarnings("unchecked")
|
|
|
public void applicationAttemptFinished(RMAppAttempt appAttempt) {
|
|
|
- dispatcher.getEventHandler().handle(
|
|
|
+ if (historyServiceEnabled) {
|
|
|
+ dispatcher.getEventHandler().handle(
|
|
|
new WritingApplicationAttemptFinishEvent(appAttempt.getAppAttemptId(),
|
|
|
- ApplicationAttemptFinishData.newInstance(appAttempt
|
|
|
- .getAppAttemptId(), appAttempt.getDiagnostics().toString(),
|
|
|
- appAttempt.getTrackingUrl(), appAttempt
|
|
|
- .getFinalApplicationStatus(), appAttempt
|
|
|
- .createApplicationAttemptState())));
|
|
|
+ ApplicationAttemptFinishData.newInstance(
|
|
|
+ appAttempt.getAppAttemptId(), appAttempt.getDiagnostics()
|
|
|
+ .toString(), appAttempt.getTrackingUrl(), appAttempt
|
|
|
+ .getFinalApplicationStatus(), appAttempt
|
|
|
+ .createApplicationAttemptState())));
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
@SuppressWarnings("unchecked")
|
|
|
public void containerStarted(RMContainer container) {
|
|
|
- dispatcher.getEventHandler().handle(
|
|
|
+ if (historyServiceEnabled) {
|
|
|
+ dispatcher.getEventHandler().handle(
|
|
|
new WritingContainerStartEvent(container.getContainerId(),
|
|
|
- ContainerStartData.newInstance(container.getContainerId(),
|
|
|
- container.getAllocatedResource(), container.getAllocatedNode(),
|
|
|
- container.getAllocatedPriority(), container.getStartTime())));
|
|
|
+ ContainerStartData.newInstance(container.getContainerId(),
|
|
|
+ container.getAllocatedResource(), container.getAllocatedNode(),
|
|
|
+ container.getAllocatedPriority(), container.getStartTime())));
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
@SuppressWarnings("unchecked")
|
|
|
public void containerFinished(RMContainer container) {
|
|
|
- dispatcher.getEventHandler().handle(
|
|
|
+ if (historyServiceEnabled) {
|
|
|
+ dispatcher.getEventHandler().handle(
|
|
|
new WritingContainerFinishEvent(container.getContainerId(),
|
|
|
- ContainerFinishData.newInstance(container.getContainerId(),
|
|
|
- container.getFinishTime(), container.getDiagnosticsInfo(),
|
|
|
- container.getLogURL(), container.getContainerExitStatus(),
|
|
|
- container.getContainerState())));
|
|
|
+ ContainerFinishData.newInstance(container.getContainerId(),
|
|
|
+ container.getFinishTime(), container.getDiagnosticsInfo(),
|
|
|
+ container.getLogURL(), container.getContainerExitStatus(),
|
|
|
+ container.getContainerState())));
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|