|
@@ -50,6 +50,8 @@ public class LinuxContainerExecutor extends ContainerExecutor {
|
|
|
|
|
|
private String containerExecutorExe;
|
|
|
private LCEResourcesHandler resourcesHandler;
|
|
|
+ private boolean containerSchedPriorityIsSet = false;
|
|
|
+ private int containerSchedPriorityAdjustment = 0;
|
|
|
|
|
|
|
|
|
@Override
|
|
@@ -61,6 +63,13 @@ public class LinuxContainerExecutor extends ContainerExecutor {
|
|
|
conf.getClass(YarnConfiguration.NM_LINUX_CONTAINER_RESOURCES_HANDLER,
|
|
|
DefaultLCEResourcesHandler.class, LCEResourcesHandler.class), conf);
|
|
|
resourcesHandler.setConf(conf);
|
|
|
+
|
|
|
+ if (conf.get(YarnConfiguration.NM_CONTAINER_EXECUTOR_SCHED_PRIORITY) != null) {
|
|
|
+ containerSchedPriorityIsSet = true;
|
|
|
+ containerSchedPriorityAdjustment = conf
|
|
|
+ .getInt(YarnConfiguration.NM_CONTAINER_EXECUTOR_SCHED_PRIORITY,
|
|
|
+ YarnConfiguration.DEFAULT_NM_CONTAINER_EXECUTOR_SCHED_PRIORITY);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -114,6 +123,13 @@ public class LinuxContainerExecutor extends ContainerExecutor {
|
|
|
: conf.get(YarnConfiguration.NM_LINUX_CONTAINER_EXECUTOR_PATH, defaultPath);
|
|
|
}
|
|
|
|
|
|
+ protected void addSchedPriorityCommand(List<String> command) {
|
|
|
+ if (containerSchedPriorityIsSet) {
|
|
|
+ command.addAll(Arrays.asList("nice", "-n",
|
|
|
+ Integer.toString(containerSchedPriorityAdjustment)));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public void init() throws IOException {
|
|
|
// Send command to executor which will just start up,
|
|
@@ -145,14 +161,15 @@ public class LinuxContainerExecutor extends ContainerExecutor {
|
|
|
List<String> localDirs, List<String> logDirs)
|
|
|
throws IOException, InterruptedException {
|
|
|
|
|
|
- List<String> command = new ArrayList<String>(
|
|
|
- Arrays.asList(containerExecutorExe,
|
|
|
- user,
|
|
|
- Integer.toString(Commands.INITIALIZE_CONTAINER.getValue()),
|
|
|
- appId,
|
|
|
- nmPrivateContainerTokensPath.toUri().getPath().toString(),
|
|
|
- StringUtils.join(",", localDirs),
|
|
|
- StringUtils.join(",", logDirs)));
|
|
|
+ List<String> command = new ArrayList<String>();
|
|
|
+ addSchedPriorityCommand(command);
|
|
|
+ command.addAll(Arrays.asList(containerExecutorExe,
|
|
|
+ user,
|
|
|
+ Integer.toString(Commands.INITIALIZE_CONTAINER.getValue()),
|
|
|
+ appId,
|
|
|
+ nmPrivateContainerTokensPath.toUri().getPath().toString(),
|
|
|
+ StringUtils.join(",", localDirs),
|
|
|
+ StringUtils.join(",", logDirs)));
|
|
|
|
|
|
File jvm = // use same jvm as parent
|
|
|
new File(new File(System.getProperty("java.home"), "bin"), "java");
|
|
@@ -212,7 +229,9 @@ public class LinuxContainerExecutor extends ContainerExecutor {
|
|
|
try {
|
|
|
Path pidFilePath = getPidFilePath(containerId);
|
|
|
if (pidFilePath != null) {
|
|
|
- List<String> command = new ArrayList<String>(Arrays.asList(
|
|
|
+ List<String> command = new ArrayList<String>();
|
|
|
+ addSchedPriorityCommand(command);
|
|
|
+ command.addAll(Arrays.asList(
|
|
|
containerExecutorExe, user, Integer
|
|
|
.toString(Commands.LAUNCH_CONTAINER.getValue()), appId,
|
|
|
containerIdStr, containerWorkDir.toString(),
|