YARN-4460. [Bug fix] RM fails to start when SMP is enabled. (Li Lu via Varun Saxena)

This commit is contained in:
Varun Saxena 2015-12-16 15:24:57 +05:30 committed by Sangjin Lee
parent 2e2dbf59d1
commit c4d7bbda5c
2 changed files with 9 additions and 5 deletions

View File

@ -25,6 +25,7 @@
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.security.UserGroupInformation;
import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
import org.apache.hadoop.yarn.api.records.ApplicationId;
@ -76,13 +77,13 @@ public TimelineServiceV2Publisher(RMContext rmContext) {
}
@Override
protected void serviceStart() throws Exception {
super.serviceStart();
protected void serviceInit(Configuration conf) throws Exception {
super.serviceInit(conf);
getDispatcher().register(SystemMetricsEventType.class,
new TimelineV2EventHandler());
publishContainerMetrics = getConfig().getBoolean(
YarnConfiguration.RM_PUBLISH_CONTAINER_METRICS_ENABLED,
YarnConfiguration.DEFAULT_RM_PUBLISH_CONTAINER_METRICS_ENABLED);
getDispatcher().register(SystemMetricsEventType.class,
new TimelineV2EventHandler());
}
@VisibleForTesting

View File

@ -156,7 +156,7 @@ public void testSystemMetricPublisherInitialization() {
try {
Configuration conf = getTimelineV2Conf();
conf.setBoolean(YarnConfiguration.RM_PUBLISH_CONTAINER_METRICS_ENABLED,
false);
YarnConfiguration.DEFAULT_RM_PUBLISH_CONTAINER_METRICS_ENABLED);
metricsPublisher.init(conf);
assertFalse(
"Default configuration should not publish container Metrics from RM",
@ -167,6 +167,9 @@ public void testSystemMetricPublisherInitialization() {
metricsPublisher = new TimelineServiceV2Publisher(mock(RMContext.class));
conf = getTimelineV2Conf();
metricsPublisher.init(conf);
assertTrue("Expected to have registered event handlers and set ready to "
+ "publish events after init",
metricsPublisher.isPublishContainerMetrics());
metricsPublisher.start();
assertTrue("Expected to publish container Metrics from RM",
metricsPublisher.isPublishContainerMetrics());