YARN-3108. ApplicationHistoryServer doesn't process -D arguments (Chang Li via jeagles)

This commit is contained in:
Jonathan Eagles 2015-01-29 16:51:38 -06:00
parent 3f982c5c26
commit 30a8778c63
3 changed files with 31 additions and 0 deletions

View File

@ -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

View File

@ -33,6 +33,7 @@
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 @@ static ApplicationHistoryServer launchAppHistoryServer(String[] args) {
new CompositeServiceShutdownHook(appHistoryServer),
SHUTDOWN_HOOK_PRIORITY);
YarnConfiguration conf = new YarnConfiguration();
new GenericOptionsParser(conf, args);
appHistoryServer.init(conf);
appHistoryServer.start();
} catch (Throwable t) {

View File

@ -106,6 +106,32 @@ public void testLaunch() throws Exception {
}
}
//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 {