YARN-7503. Configurable heap size / JVM opts in service AM. Contributed by Jonathan Hung
This commit is contained in:
parent
28d0fcbef4
commit
6bf2c30192
@ -559,7 +559,7 @@ private ApplicationId submitApp(Service app)
|
|||||||
Map<String, String> env = addAMEnv();
|
Map<String, String> env = addAMEnv();
|
||||||
|
|
||||||
// create AM CLI
|
// create AM CLI
|
||||||
String cmdStr = buildCommandLine(serviceName, conf, appRootDir, hasAMLog4j);
|
String cmdStr = buildCommandLine(app, conf, appRootDir, hasAMLog4j);
|
||||||
submissionContext.setResource(Resource.newInstance(YarnServiceConf
|
submissionContext.setResource(Resource.newInstance(YarnServiceConf
|
||||||
.getLong(YarnServiceConf.AM_RESOURCE_MEM,
|
.getLong(YarnServiceConf.AM_RESOURCE_MEM,
|
||||||
YarnServiceConf.DEFAULT_KEY_AM_RESOURCE_MEM, app.getConfiguration(),
|
YarnServiceConf.DEFAULT_KEY_AM_RESOURCE_MEM, app.getConfiguration(),
|
||||||
@ -624,12 +624,12 @@ private void printLocalResources(Map<String, LocalResource> map) {
|
|||||||
LOG.debug(builder.toString());
|
LOG.debug(builder.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
private String buildCommandLine(String serviceName, Configuration conf,
|
private String buildCommandLine(Service app, Configuration conf,
|
||||||
Path appRootDir, boolean hasSliderAMLog4j) throws BadConfigException {
|
Path appRootDir, boolean hasSliderAMLog4j) throws BadConfigException {
|
||||||
JavaCommandLineBuilder CLI = new JavaCommandLineBuilder();
|
JavaCommandLineBuilder CLI = new JavaCommandLineBuilder();
|
||||||
CLI.forceIPv4().headless();
|
CLI.forceIPv4().headless();
|
||||||
//TODO CLI.setJVMHeap
|
CLI.setJVMOpts(YarnServiceConf.get(YarnServiceConf.JVM_OPTS, null,
|
||||||
//TODO CLI.addJVMOPTS
|
app.getConfiguration(), conf));
|
||||||
if (hasSliderAMLog4j) {
|
if (hasSliderAMLog4j) {
|
||||||
CLI.sysprop(SYSPROP_LOG4J_CONFIGURATION, YARN_SERVICE_LOG4J_FILENAME);
|
CLI.sysprop(SYSPROP_LOG4J_CONFIGURATION, YARN_SERVICE_LOG4J_FILENAME);
|
||||||
CLI.sysprop(SYSPROP_LOG_DIR, ApplicationConstants.LOG_DIR_EXPANSION_VAR);
|
CLI.sysprop(SYSPROP_LOG_DIR, ApplicationConstants.LOG_DIR_EXPANSION_VAR);
|
||||||
@ -637,7 +637,7 @@ private String buildCommandLine(String serviceName, Configuration conf,
|
|||||||
CLI.add(ServiceMaster.class.getCanonicalName());
|
CLI.add(ServiceMaster.class.getCanonicalName());
|
||||||
//TODO debugAM CLI.add(Arguments.ARG_DEBUG)
|
//TODO debugAM CLI.add(Arguments.ARG_DEBUG)
|
||||||
CLI.add("-" + ServiceMaster.YARNFILE_OPTION, new Path(appRootDir,
|
CLI.add("-" + ServiceMaster.YARNFILE_OPTION, new Path(appRootDir,
|
||||||
serviceName + ".json"));
|
app.getName() + ".json"));
|
||||||
// pass the registry binding
|
// pass the registry binding
|
||||||
CLI.addConfOptionToCLI(conf, RegistryConstants.KEY_REGISTRY_ZK_ROOT,
|
CLI.addConfOptionToCLI(conf, RegistryConstants.KEY_REGISTRY_ZK_ROOT,
|
||||||
RegistryConstants.DEFAULT_ZK_REGISTRY_ROOT);
|
RegistryConstants.DEFAULT_ZK_REGISTRY_ROOT);
|
||||||
|
@ -85,6 +85,11 @@ public class YarnServiceConf {
|
|||||||
public static final String READINESS_CHECK_INTERVAL = "yarn.service.readiness-check-interval.seconds";
|
public static final String READINESS_CHECK_INTERVAL = "yarn.service.readiness-check-interval.seconds";
|
||||||
public static final int DEFAULT_READINESS_CHECK_INTERVAL = 30; // seconds
|
public static final int DEFAULT_READINESS_CHECK_INTERVAL = 30; // seconds
|
||||||
|
|
||||||
|
/**
|
||||||
|
* JVM opts.
|
||||||
|
*/
|
||||||
|
public static final String JVM_OPTS = "yarn.service.am.java.opts";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get long value for the property. First get from the userConf, if not
|
* Get long value for the property. First get from the userConf, if not
|
||||||
* present, get from systemConf.
|
* present, get from systemConf.
|
||||||
|
@ -48,13 +48,12 @@ protected String getJavaBinary() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the size of the heap if a non-empty heap is passed in.
|
* Set JVM opts.
|
||||||
* @param heap empty string or something like "128M" ,"1G" etc. The value is
|
* @param jvmOpts JVM opts
|
||||||
* trimmed.
|
|
||||||
*/
|
*/
|
||||||
public void setJVMHeap(String heap) {
|
public void setJVMOpts(String jvmOpts) {
|
||||||
if (ServiceUtils.isSet(heap)) {
|
if (ServiceUtils.isSet(jvmOpts)) {
|
||||||
add("-Xmx" + heap.trim());
|
add(jvmOpts);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user