This is an automated email from the ASF dual-hosted git repository. abmodi pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/hadoop.git
The following commit(s) were added to refs/heads/trunk by this push: new a79564f YARN-9732. yarn.system-metrics-publisher.enabled=false is not honored by RM. Contributed by KWON BYUNGCHANG. a79564f is described below commit a79564fed0b641f7207f5066500128326a3ac296 Author: Abhishek Modi <abm...@apache.org> AuthorDate: Fri Aug 9 22:25:30 2019 +0530 YARN-9732. yarn.system-metrics-publisher.enabled=false is not honored by RM. Contributed by KWON BYUNGCHANG. --- .../server/resourcemanager/ResourceManager.java | 6 ++- .../resourcemanager/TestRMTimelineService.java | 59 ++++++++++++++++++---- 2 files changed, 52 insertions(+), 13 deletions(-) diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ResourceManager.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ResourceManager.java index d976043..c0a9133 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ResourceManager.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ResourceManager.java @@ -575,11 +575,13 @@ public class ResourceManager extends CompositeService protected SystemMetricsPublisher createSystemMetricsPublisher() { List<SystemMetricsPublisher> publishers = new ArrayList<SystemMetricsPublisher>(); - if (YarnConfiguration.timelineServiceV1Enabled(conf)) { + if (YarnConfiguration.timelineServiceV1Enabled(conf) && + YarnConfiguration.systemMetricsPublisherEnabled(conf)) { SystemMetricsPublisher publisherV1 = new TimelineServiceV1Publisher(); publishers.add(publisherV1); } - if (YarnConfiguration.timelineServiceV2Enabled(conf)) { + if (YarnConfiguration.timelineServiceV2Enabled(conf) && + YarnConfiguration.systemMetricsPublisherEnabled(conf)) { // we're dealing with the v.2.x publisher LOG.info("system metrics publisher with the timeline service V2 is " + "configured"); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestRMTimelineService.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestRMTimelineService.java index f824fa1..795979c 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestRMTimelineService.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestRMTimelineService.java @@ -38,10 +38,14 @@ import org.junit.Test; public class TestRMTimelineService { private static MockRM rm; - private void setup(boolean v1Enabled, boolean v2Enabled) { + private void setup(boolean v1Enabled, boolean v2Enabled, + boolean systemMetricEnabled) { Configuration conf = new YarnConfiguration(new Configuration(false)); Assert.assertFalse(YarnConfiguration.timelineServiceEnabled(conf)); + conf.setBoolean(YarnConfiguration.SYSTEM_METRICS_PUBLISHER_ENABLED, + systemMetricEnabled); + if (v1Enabled || v2Enabled) { conf.setBoolean(YarnConfiguration.TIMELINE_SERVICE_ENABLED, true); } @@ -69,7 +73,8 @@ public class TestRMTimelineService { } // validate RM services exist or not as we specified - private void validate(boolean v1Enabled, boolean v2Enabled) { + private void validate(boolean v1Enabled, boolean v2Enabled, + boolean systemMetricEnabled) { boolean v1PublisherServiceFound = false; boolean v2PublisherServiceFound = false; List<Service> services = rm.getServices(); @@ -81,8 +86,13 @@ public class TestRMTimelineService { } } - Assert.assertEquals(v1Enabled, v1PublisherServiceFound); - Assert.assertEquals(v2Enabled, v2PublisherServiceFound); + if(systemMetricEnabled) { + Assert.assertEquals(v1Enabled, v1PublisherServiceFound); + Assert.assertEquals(v2Enabled, v2PublisherServiceFound); + } else { + Assert.assertEquals(false, v1PublisherServiceFound); + Assert.assertEquals(false, v2PublisherServiceFound); + } } private void cleanup() throws Exception { @@ -92,31 +102,58 @@ public class TestRMTimelineService { // runs test to validate RM creates a timeline service publisher if and // only if the service is enabled for v1 and v2 (independently). - private void runTest(boolean v1Enabled, boolean v2Enabled) throws Exception { - setup(v1Enabled, v2Enabled); - validate(v1Enabled, v2Enabled); + private void runTest(boolean v1Enabled, boolean v2Enabled, + boolean systemMetricEnabled) throws Exception { + setup(v1Enabled, v2Enabled, systemMetricEnabled); + validate(v1Enabled, v2Enabled, systemMetricEnabled); cleanup(); } @Test public void testTimelineServiceV1V2Enabled() throws Exception { - runTest(true, true); + runTest(true, true, true); } @Test public void testTimelineServiceV1Enabled() throws Exception { - runTest(true, false); + runTest(true, false, true); } @Test public void testTimelineServiceV2Enabled() throws Exception { - runTest(false, true); + runTest(false, true, true); } @Test public void testTimelineServiceDisabled() throws Exception { - runTest(false, false); + runTest(false, false, true); + } + + + @Test + public void testTimelineServiceV1V2EnabledSystemMetricDisable() + throws Exception { + runTest(true, true, false); + } + + @Test + public void testTimelineServiceV1EnabledSystemMetricDisable() + throws Exception { + runTest(true, false, false); + } + + @Test + public void testTimelineServiceV2EnabledSystemMetricDisable() + throws Exception { + runTest(false, true, false); } + + @Test + public void testTimelineServiceDisabledSystemMetricDisable() + throws Exception { + runTest(false, false, false); + } + } --------------------------------------------------------------------- To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-commits-h...@hadoop.apache.org