Merge -r 1210547:1210548 from trunk to branch. FIXES: MAPREDUCE-3389

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.23@1210550 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Alejandro Abdelnur 2011-12-05 18:04:29 +00:00
parent 63c0db36e2
commit 6a70420d9d
2 changed files with 17 additions and 8 deletions

View File

@ -194,6 +194,9 @@ Release 0.23.1 - Unreleased
MAPREDUCE-3485. DISKS_FAILED -101 error code should be defined in same location as
ABORTED_CONTAINER_EXIT_STATUS. (Ravi Gummadi via mahadev)
MAPREDUCE-3389. MRApps loads the 'mrapp-generated-classpath' file with
classpath from the build machine. (tucu)
Release 0.23.0 - 2011-11-01
INCOMPATIBLE CHANGES

View File

@ -22,6 +22,7 @@ import static org.apache.hadoop.yarn.util.StringHelper._join;
import static org.apache.hadoop.yarn.util.StringHelper._split;
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
@ -180,18 +181,23 @@ public class MRApps extends Apps {
String mrAppGeneratedClasspathFile = "mrapp-generated-classpath";
classpathFileStream =
thisClassLoader.getResourceAsStream(mrAppGeneratedClasspathFile);
// Put the file itself on classpath for tasks.
String classpathElement = thisClassLoader.getResource(mrAppGeneratedClasspathFile).getFile();
if (classpathElement.contains("!")) {
classpathElement = classpathElement.substring(0, classpathElement.indexOf("!"));
}
else {
classpathElement = new File(classpathElement).getParent();
}
Apps.addToEnvironment(
environment,
Environment.CLASSPATH.name(), classpathElement);
reader = new BufferedReader(new InputStreamReader(classpathFileStream));
String cp = reader.readLine();
if (cp != null) {
Apps.addToEnvironment(environment, Environment.CLASSPATH.name(), cp.trim());
}
// Put the file itself on classpath for tasks.
Apps.addToEnvironment(
environment,
Environment.CLASSPATH.name(),
thisClassLoader.getResource(mrAppGeneratedClasspathFile).getFile()
.split("!")[0]);
}
// Add standard Hadoop classes
for (String c : ApplicationConstants.APPLICATION_CLASSPATH) {
Apps.addToEnvironment(environment, Environment.CLASSPATH.name(), c);