YARN-7936. Add default service AM Xmx. Contributed by Jian He

This commit is contained in:
Billie Rinaldi 2018-04-12 11:35:14 -07:00
parent 18844599ae
commit 53b3e59473
2 changed files with 9 additions and 2 deletions

View File

@ -758,8 +758,13 @@ private String buildCommandLine(Service app, Configuration conf,
Path appRootDir, boolean hasSliderAMLog4j) throws BadConfigException {
JavaCommandLineBuilder CLI = new JavaCommandLineBuilder();
CLI.forceIPv4().headless();
CLI.setJVMOpts(YarnServiceConf.get(YarnServiceConf.JVM_OPTS, null,
app.getConfiguration(), conf));
String jvmOpts = YarnServiceConf
.get(YarnServiceConf.JVM_OPTS, "", app.getConfiguration(), conf);
if (!jvmOpts.contains("-Xmx")) {
jvmOpts += DEFAULT_AM_JVM_XMX;
}
CLI.setJVMOpts(jvmOpts);
if (hasSliderAMLog4j) {
CLI.sysprop(SYSPROP_LOG4J_CONFIGURATION, YARN_SERVICE_LOG4J_FILENAME);
CLI.sysprop(SYSPROP_LOG_DIR, ApplicationConstants.LOG_DIR_EXPANSION_VAR);

View File

@ -38,6 +38,8 @@ public class YarnServiceConf {
public static final String AM_RESOURCE_MEM = "yarn.service.am-resource.memory";
public static final long DEFAULT_KEY_AM_RESOURCE_MEM = 1024;
public static final String DEFAULT_AM_JVM_XMX = " -Xmx768m ";
public static final String YARN_QUEUE = "yarn.service.queue";
public static final String API_SERVER_ADDRESS = "yarn.service.api-server.address";