YARN-3108. ApplicationHistoryServer doesn't process -D arguments (Chang Li via jeagles)
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/a38ace17 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/a38ace17 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/a38ace17 Branch: refs/heads/HDFS-EC Commit: a38ace170345b605f773942e86f3f1f59e3bfd04 Parents: d0f21bd Author: Jonathan Eagles <jeag...@gmail.com> Authored: Thu Jan 29 16:51:38 2015 -0600 Committer: Zhe Zhang <z...@apache.org> Committed: Fri Jan 30 13:42:05 2015 -0800 ---------------------------------------------------------------------- hadoop-yarn-project/CHANGES.txt | 3 +++ .../ApplicationHistoryServer.java | 2 ++ .../TestApplicationHistoryServer.java | 26 ++++++++++++++++++++ 3 files changed, 31 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/a38ace17/hadoop-yarn-project/CHANGES.txt ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt index bda4948..bdaf022 100644 --- a/hadoop-yarn-project/CHANGES.txt +++ b/hadoop-yarn-project/CHANGES.txt @@ -222,6 +222,9 @@ Release 2.7.0 - UNRELEASED scheduler web UI and queue initialize/refresh logging. (Eric Payne via wangda) + YARN-3108. ApplicationHistoryServer doesn't process -D arguments (Chang Li + via jeagles) + OPTIMIZATIONS BUG FIXES http://git-wip-us.apache.org/repos/asf/hadoop/blob/a38ace17/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/ApplicationHistoryServer.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/ApplicationHistoryServer.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/ApplicationHistoryServer.java index 3524605..0bafd36 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/ApplicationHistoryServer.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/ApplicationHistoryServer.java @@ -33,6 +33,7 @@ import org.apache.hadoop.security.SecurityUtil; import org.apache.hadoop.service.CompositeService; import org.apache.hadoop.service.Service; import org.apache.hadoop.util.ExitUtil; +import org.apache.hadoop.util.GenericOptionsParser; import org.apache.hadoop.util.ReflectionUtils; import org.apache.hadoop.util.ShutdownHookManager; import org.apache.hadoop.util.StringUtils; @@ -153,6 +154,7 @@ public class ApplicationHistoryServer extends CompositeService { new CompositeServiceShutdownHook(appHistoryServer), SHUTDOWN_HOOK_PRIORITY); YarnConfiguration conf = new YarnConfiguration(); + new GenericOptionsParser(conf, args); appHistoryServer.init(conf); appHistoryServer.start(); } catch (Throwable t) { http://git-wip-us.apache.org/repos/asf/hadoop/blob/a38ace17/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/TestApplicationHistoryServer.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/TestApplicationHistoryServer.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/TestApplicationHistoryServer.java index cf85ff7..a7e7daa 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/TestApplicationHistoryServer.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/TestApplicationHistoryServer.java @@ -106,6 +106,32 @@ public class TestApplicationHistoryServer { } } + //test launch method with -D arguments + @Test(timeout = 60000) + public void testLaunchWithArguments() throws Exception { + ExitUtil.disableSystemExit(); + ApplicationHistoryServer historyServer = null; + try { + // Not able to modify the config of this test case, + // but others have been customized to avoid conflicts + String[] args = new String[2]; + args[0]="-D" + YarnConfiguration.TIMELINE_SERVICE_LEVELDB_TTL_INTERVAL_MS + "=4000"; + args[1]="-D" + YarnConfiguration.TIMELINE_SERVICE_TTL_MS + "=200"; + historyServer = + ApplicationHistoryServer.launchAppHistoryServer(args); + Configuration conf = historyServer.getConfig(); + assertEquals("4000", conf.get(YarnConfiguration.TIMELINE_SERVICE_LEVELDB_TTL_INTERVAL_MS)); + assertEquals("200", conf.get(YarnConfiguration.TIMELINE_SERVICE_TTL_MS)); + } catch (ExitUtil.ExitException e) { + assertEquals(0, e.status); + ExitUtil.resetFirstExitException(); + fail(); + } finally { + if (historyServer != null) { + historyServer.stop(); + } + } + } @Test(timeout = 240000) public void testFilterOverrides() throws Exception {