Skip to content

Commit

Permalink
Address comments from Tucu
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Ferguson committed Dec 18, 2012
1 parent 932b095 commit 5979fc0
Showing 1 changed file with 12 additions and 21 deletions.
Expand Up @@ -66,12 +66,6 @@ public CgroupsLCEResourcesHandler() {
@Override
public void setConf(Configuration conf) {
this.conf = conf;
this.cgroupPrefix = conf.get(YarnConfiguration.
NM_LINUX_CONTAINER_CGROUPS_HIERARCHY, "/hadoop-yarn");
this.cgroupMount = conf.getBoolean(YarnConfiguration.
NM_LINUX_CONTAINER_CGROUPS_MOUNT, false);
this.cgroupMountPath = conf.get(YarnConfiguration.
NM_LINUX_CONTAINER_CGROUPS_MOUNT_PATH, null);
}

@Override
Expand All @@ -81,6 +75,13 @@ public Configuration getConf() {

public synchronized void init(LinuxContainerExecutor lce) {

this.cgroupPrefix = conf.get(YarnConfiguration.
NM_LINUX_CONTAINER_CGROUPS_HIERARCHY, "/hadoop-yarn");
this.cgroupMount = conf.getBoolean(YarnConfiguration.
NM_LINUX_CONTAINER_CGROUPS_MOUNT, false);
this.cgroupMountPath = conf.get(YarnConfiguration.
NM_LINUX_CONTAINER_CGROUPS_MOUNT_PATH, null);

if (cgroupMount) {
ArrayList<String> cgroupKVs = new ArrayList<String>();
cgroupKVs.add(CONTROLLER_CPU + "=" + cgroupMountPath + "/" +
Expand Down Expand Up @@ -245,12 +246,7 @@ private Map<String, List<String>> parseMtab() {
try {
fReader = new FileReader(new File(MTAB_FILE));
in = new BufferedReader(fReader);
} catch (FileNotFoundException f) {
LOG.warn("Mount file " + MTAB_FILE + " cannot be read.");
return ret;
}

try {

for (String str = in.readLine(); str != null;
str = in.readLine()) {
Matcher m = MTAB_FILE_FORMAT.matcher(str);
Expand All @@ -267,18 +263,13 @@ private Map<String, List<String>> parseMtab() {
}
}
} catch (IOException e) {
LOG.warn("Error while reading " + MTAB_FILE);
LOG.warn("Error while reading " + MTAB_FILE, e);
} finally {
// Close the streams
try {
fReader.close();
try {
in.close();
} catch (IOException i) {
LOG.warn("Error closing the stream " + in);
}
} catch (IOException i) {
LOG.warn("Error closing the stream " + fReader);
in.close();
} catch (IOException e2) {
LOG.warn("Error closing the stream " + in, e2);
}
}

Expand Down

0 comments on commit 5979fc0

Please sign in to comment.