YARN-391. Formatting fixes for LCEResourceHandler classes. Contributed by Steve Loughran)

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1445882 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Siddharth Seth 2013-02-13 19:40:36 +00:00
parent 43204f0c83
commit 7bc6040ebb
3 changed files with 21 additions and 18 deletions

View File

@ -35,6 +35,9 @@ Release 2.0.4-beta - UNRELEASED
YARN-377. Use the new StringUtils methods added by HADOOP-9252 and fix
TestContainersMonitor. (Chris Nauroth via szetszwo)
YARN-391. Formatting fixes for LCEResourceHandler classes.
(Steve Loughran via sseth)
Release 2.0.3-alpha - 2013-02-06
INCOMPATIBLE CHANGES

View File

@ -80,17 +80,17 @@ public class CgroupsLCEResourcesHandler implements LCEResourcesHandler {
NM_LINUX_CONTAINER_CGROUPS_MOUNT, false);
this.cgroupMountPath = conf.get(YarnConfiguration.
NM_LINUX_CONTAINER_CGROUPS_MOUNT_PATH, null);
// remove extra /'s at end or start of cgroupPrefix
if (cgroupPrefix.charAt(0) == '/') {
cgroupPrefix = cgroupPrefix.substring(1);
cgroupPrefix = cgroupPrefix.substring(1);
}
int len = cgroupPrefix.length();
if (cgroupPrefix.charAt(len - 1) == '/') {
cgroupPrefix = cgroupPrefix.substring(0, len - 1);
cgroupPrefix = cgroupPrefix.substring(0, len - 1);
}
// mount cgroups if requested
if (cgroupMount && cgroupMountPath != null) {
ArrayList<String> cgroupKVs = new ArrayList<String>();
@ -98,14 +98,14 @@ public class CgroupsLCEResourcesHandler implements LCEResourcesHandler {
CONTROLLER_CPU);
lce.mountCgroups(cgroupKVs, cgroupPrefix);
}
initializeControllerPaths();
}
boolean isCpuWeightEnabled() {
return this.cpuWeightEnabled;
}
}
/*
* Next four functions are for an individual cgroup.
@ -155,7 +155,7 @@ public class CgroupsLCEResourcesHandler implements LCEResourcesHandler {
}
}
}
}
}
private void deleteCgroup(String controller, String groupName) {
String path = pathForCgroup(controller, groupName);
@ -165,7 +165,7 @@ public class CgroupsLCEResourcesHandler implements LCEResourcesHandler {
if (! new File(path).delete()) {
LOG.warn("Unable to delete cgroup at: " + path);
}
}
}
/*
* Next three functions operate on all the resources we are enforcing.
@ -178,7 +178,7 @@ public class CgroupsLCEResourcesHandler implements LCEResourcesHandler {
private void setupLimits(ContainerId containerId,
Resource containerResource) throws IOException {
String containerName = containerId.toString();
if (isCpuWeightEnabled()) {
createCgroup(CONTROLLER_CPU, containerName);
updateCgroup(CONTROLLER_CPU, containerName, "shares",
@ -202,7 +202,7 @@ public class CgroupsLCEResourcesHandler implements LCEResourcesHandler {
if (isCpuWeightEnabled()) {
deleteCgroup(CONTROLLER_CPU, containerName);
}
}
}
/*
@ -222,7 +222,7 @@ public class CgroupsLCEResourcesHandler implements LCEResourcesHandler {
String containerName = containerId.toString();
StringBuilder sb = new StringBuilder("cgroups=");
if (isCpuWeightEnabled()) {
sb.append(pathForCgroup(CONTROLLER_CPU, containerName) + "/cgroup.procs");
sb.append(",");
@ -231,7 +231,7 @@ public class CgroupsLCEResourcesHandler implements LCEResourcesHandler {
if (sb.charAt(sb.length() - 1) == ',') {
sb.deleteCharAt(sb.length() - 1);
}
return sb.toString();
}
@ -255,8 +255,8 @@ public class CgroupsLCEResourcesHandler implements LCEResourcesHandler {
BufferedReader in = null;
try {
in = new BufferedReader(new FileReader(new File(MTAB_FILE)));
in = new BufferedReader(new FileReader(new File(MTAB_FILE)));
for (String str = in.readLine(); str != null;
str = in.readLine()) {
Matcher m = MTAB_FILE_FORMAT.matcher(str);
@ -316,6 +316,6 @@ public class CgroupsLCEResourcesHandler implements LCEResourcesHandler {
} else {
throw new IOException("Not able to enforce cpu weights; cannot find "
+ "cgroup for cpu controller in " + MTAB_FILE);
}
}
}
}
}

View File

@ -33,7 +33,7 @@ public class DefaultLCEResourcesHandler implements LCEResourcesHandler {
private Configuration conf;
public DefaultLCEResourcesHandler() {
}
}
public void setConf(Configuration conf) {
this.conf = conf;
@ -42,7 +42,7 @@ public class DefaultLCEResourcesHandler implements LCEResourcesHandler {
@Override
public Configuration getConf() {
return conf;
}
}
public void init(LinuxContainerExecutor lce) {
}