You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by su...@apache.org on 2016/07/19 22:02:11 UTC
[31/50] hadoop git commit: YARN-5383. Fix findbugs and checkstyle
issues in ContainerExecutor. (Vrushali C via Varun Saxena)
YARN-5383. Fix findbugs and checkstyle issues in ContainerExecutor. (Vrushali C via Varun Saxena)
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/a72cb382
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/a72cb382
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/a72cb382
Branch: refs/heads/YARN-2915
Commit: a72cb3825a11830be9ad35ae7ddbf42a3d2892b0
Parents: 7e5355c
Author: Varun Saxena <va...@apache.org>
Authored: Fri Jul 15 23:17:04 2016 +0530
Committer: Varun Saxena <va...@apache.org>
Committed: Fri Jul 15 23:17:04 2016 +0530
----------------------------------------------------------------------
.../server/nodemanager/ContainerExecutor.java | 52 ++++++++++----------
1 file changed, 27 insertions(+), 25 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hadoop/blob/a72cb382/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/ContainerExecutor.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/ContainerExecutor.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/ContainerExecutor.java
index 2689480..f08db5a 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/ContainerExecutor.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/ContainerExecutor.java
@@ -305,7 +305,7 @@ public abstract class ContainerExecutor implements Configurable {
List<String> command, Path logDir, String outFilename)
throws IOException {
ContainerLaunch.ShellScriptBuilder sb =
- ContainerLaunch.ShellScriptBuilder.create();
+ ContainerLaunch.ShellScriptBuilder.create();
Set<String> whitelist = new HashSet<>();
whitelist.add(YarnConfiguration.NM_DOCKER_CONTAINER_EXECUTOR_IMAGE_NAME);
@@ -316,7 +316,7 @@ public abstract class ContainerExecutor implements Configurable {
whitelist.add(ApplicationConstants.Environment.JAVA_HOME.name());
if (environment != null) {
- for (Map.Entry<String,String> env : environment.entrySet()) {
+ for (Map.Entry<String, String> env : environment.entrySet()) {
if (!whitelist.contains(env.getKey())) {
sb.env(env.getKey(), env.getValue());
} else {
@@ -326,19 +326,20 @@ public abstract class ContainerExecutor implements Configurable {
}
if (resources != null) {
- for (Path path: resources.keySet()) {
- for (String linkName: resources.get(path)) {
+ for (Map.Entry<Path, List<String>> resourceEntry :
+ resources.entrySet()) {
+ for (String linkName : resourceEntry.getValue()) {
if (new Path(linkName).getName().equals(WILDCARD)) {
// If this is a wildcarded path, link to everything in the
// directory from the working directory
- File directory = new File(path.toString());
+ File directory = new File(resourceEntry.getKey().toString());
for (File wildLink : directory.listFiles()) {
sb.symlink(new Path(wildLink.toString()),
new Path(wildLink.getName()));
}
} else {
- sb.symlink(path, new Path(linkName));
+ sb.symlink(resourceEntry.getKey(), new Path(linkName));
}
}
}
@@ -467,12 +468,12 @@ public abstract class ContainerExecutor implements Configurable {
* @param groupId the job owner's GID
* @param userName the job owner's username
* @param pidFile the path to the container's PID file
- * @param conf the configuration
+ * @param config the configuration
* @return the command line to execute
*/
protected String[] getRunCommand(String command, String groupId,
- String userName, Path pidFile, Configuration conf) {
- return getRunCommand(command, groupId, userName, pidFile, conf, null);
+ String userName, Path pidFile, Configuration config) {
+ return getRunCommand(command, groupId, userName, pidFile, config, null);
}
/**
@@ -488,18 +489,18 @@ public abstract class ContainerExecutor implements Configurable {
* systems it is ignored.
* @param pidFile the path to the container's PID file on Windows. On other
* operating systems it is ignored.
- * @param conf the configuration
+ * @param config the configuration
* @param resource on Windows this parameter controls memory and CPU limits.
* If null, no limits are set. On other operating systems it is ignored.
* @return the command line to execute
*/
protected String[] getRunCommand(String command, String groupId,
- String userName, Path pidFile, Configuration conf, Resource resource) {
+ String userName, Path pidFile, Configuration config, Resource resource) {
if (Shell.WINDOWS) {
return getRunCommandForWindows(command, groupId, userName, pidFile,
- conf, resource);
+ config, resource);
} else {
- return getRunCommandForOther(command, conf);
+ return getRunCommandForOther(command, config);
}
}
@@ -513,30 +514,31 @@ public abstract class ContainerExecutor implements Configurable {
* @param groupId the job owner's GID
* @param userName the job owner's username
* @param pidFile the path to the container's PID file
- * @param conf the configuration
+ * @param config the configuration
* @param resource this parameter controls memory and CPU limits.
* If null, no limits are set.
* @return the command line to execute
*/
protected String[] getRunCommandForWindows(String command, String groupId,
- String userName, Path pidFile, Configuration conf, Resource resource) {
+ String userName, Path pidFile, Configuration config, Resource resource) {
int cpuRate = -1;
int memory = -1;
if (resource != null) {
- if (conf.getBoolean(
+ if (config.getBoolean(
YarnConfiguration.NM_WINDOWS_CONTAINER_MEMORY_LIMIT_ENABLED,
- YarnConfiguration.DEFAULT_NM_WINDOWS_CONTAINER_MEMORY_LIMIT_ENABLED)) {
- memory = (int)resource.getMemorySize();
+ YarnConfiguration.
+ DEFAULT_NM_WINDOWS_CONTAINER_MEMORY_LIMIT_ENABLED)) {
+ memory = (int) resource.getMemorySize();
}
- if (conf.getBoolean(
+ if (config.getBoolean(
YarnConfiguration.NM_WINDOWS_CONTAINER_CPU_LIMIT_ENABLED,
YarnConfiguration.DEFAULT_NM_WINDOWS_CONTAINER_CPU_LIMIT_ENABLED)) {
int containerVCores = resource.getVirtualCores();
- int nodeVCores = NodeManagerHardwareUtils.getVCores(conf);
+ int nodeVCores = NodeManagerHardwareUtils.getVCores(config);
int nodeCpuPercentage =
- NodeManagerHardwareUtils.getNodeCpuPercentage(conf);
+ NodeManagerHardwareUtils.getNodeCpuPercentage(config);
float containerCpuPercentage =
(float)(nodeCpuPercentage * containerVCores) / nodeVCores;
@@ -564,20 +566,20 @@ public abstract class ContainerExecutor implements Configurable {
* Return a command line to execute the given command in the OS shell.
*
* @param command the command to execute
- * @param conf the configuration
+ * @param config the configuration
* @return the command line to execute
*/
protected String[] getRunCommandForOther(String command,
- Configuration conf) {
+ Configuration config) {
List<String> retCommand = new ArrayList<>();
boolean containerSchedPriorityIsSet = false;
int containerSchedPriorityAdjustment =
YarnConfiguration.DEFAULT_NM_CONTAINER_EXECUTOR_SCHED_PRIORITY;
- if (conf.get(YarnConfiguration.NM_CONTAINER_EXECUTOR_SCHED_PRIORITY) !=
+ if (config.get(YarnConfiguration.NM_CONTAINER_EXECUTOR_SCHED_PRIORITY) !=
null) {
containerSchedPriorityIsSet = true;
- containerSchedPriorityAdjustment = conf
+ containerSchedPriorityAdjustment = config
.getInt(YarnConfiguration.NM_CONTAINER_EXECUTOR_SCHED_PRIORITY,
YarnConfiguration.DEFAULT_NM_CONTAINER_EXECUTOR_SCHED_PRIORITY);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org