MAPREDUCE-3884. PWD should be first in the classpath of MR tasks (tucu)

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1292424 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Alejandro Abdelnur 2012-02-22 17:57:32 +00:00
parent efbc58f30c
commit 267bebeab0
3 changed files with 8 additions and 3 deletions

View File

@ -132,6 +132,8 @@ Release 0.23.2 - UNRELEASED
MAPREDUCE-3798. Fixed failing TestJobCleanup.testCusomCleanup() and moved it
to the maven build. (Ravi Prakash via vinodkv)
MAPREDUCE-3884. PWD should be first in the classpath of MR tasks (tucu)
Release 0.23.1 - 2012-02-17

View File

@ -230,6 +230,9 @@ public class MRApps extends Apps {
boolean userClassesTakesPrecedence =
conf.getBoolean(MRJobConfig.MAPREDUCE_JOB_USER_CLASSPATH_FIRST, false);
Apps.addToEnvironment(environment,
Environment.CLASSPATH.name(),
Environment.PWD.$());
if (!userClassesTakesPrecedence) {
MRApps.setMRFrameworkClasspath(environment, conf);
}

View File

@ -130,7 +130,7 @@ public class TestMRApps {
Job job = Job.getInstance();
Map<String, String> environment = new HashMap<String, String>();
MRApps.setClasspath(environment, job.getConfiguration());
assertEquals("$HADOOP_CONF_DIR:" +
assertEquals("$PWD:$HADOOP_CONF_DIR:" +
"$HADOOP_COMMON_HOME/share/hadoop/common/*:" +
"$HADOOP_COMMON_HOME/share/hadoop/common/lib/*:" +
"$HADOOP_HDFS_HOME/share/hadoop/hdfs/*:" +
@ -152,7 +152,7 @@ public class TestMRApps {
}
String env_str = env.get("CLASSPATH");
assertSame("MAPREDUCE_JOB_USER_CLASSPATH_FIRST set, but not taking effect!",
env_str.indexOf("job.jar"), 0);
env_str.indexOf("$PWD:job.jar"), 0);
}
@Test public void testSetClasspathWithNoUserPrecendence() {
@ -166,7 +166,7 @@ public class TestMRApps {
}
String env_str = env.get("CLASSPATH");
assertNotSame("MAPREDUCE_JOB_USER_CLASSPATH_FIRST false, but taking effect!",
env_str.indexOf("job.jar"), 0);
env_str.indexOf("$PWD:job.jar"), 0);
}
}