YARN-1450. Fixed test failure in TestUnmanagedAMLauncher by removing its dependency on distributed-shell. Contributed by Binglin Chang.

svn merge --ignore-ancestry -c 1548619 ../../trunk/


git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1548622 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Vinod Kumar Vavilapalli 2013-12-06 17:54:46 +00:00
parent 22b1584b87
commit fb14656ec7
3 changed files with 28 additions and 15 deletions

View File

@ -192,6 +192,9 @@ Release 2.4.0 - UNRELEASED
YARN-1454. Fixed test failure issue with TestRMRestart. (Karthik Kambatla YARN-1454. Fixed test failure issue with TestRMRestart. (Karthik Kambatla
via vinodkv) via vinodkv)
YARN-1450. Fixed test failure in TestUnmanagedAMLauncher by removing its
dependency on distributed-shell. (Binglin Chang via vinodkv)
Release 2.3.0 - UNRELEASED Release 2.3.0 - UNRELEASED
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -71,11 +71,6 @@
<artifactId>hadoop-mapreduce-client-core</artifactId> <artifactId>hadoop-mapreduce-client-core</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-yarn-applications-distributedshell</artifactId>
<scope>test</scope>
</dependency>
<dependency> <dependency>
<groupId>org.apache.hadoop</groupId> <groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-yarn-server-tests</artifactId> <artifactId>hadoop-yarn-server-tests</artifactId>

View File

@ -32,7 +32,12 @@ import junit.framework.Assert;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.util.Shell; import org.apache.hadoop.net.NetUtils;
import org.apache.hadoop.yarn.api.ApplicationMasterProtocol;
import org.apache.hadoop.yarn.api.protocolrecords.FinishApplicationMasterRequest;
import org.apache.hadoop.yarn.api.protocolrecords.RegisterApplicationMasterRequest;
import org.apache.hadoop.yarn.api.records.FinalApplicationStatus;
import org.apache.hadoop.yarn.client.ClientRMProxy;
import org.apache.hadoop.yarn.conf.YarnConfiguration; import org.apache.hadoop.yarn.conf.YarnConfiguration;
import org.apache.hadoop.yarn.server.MiniYARNCluster; import org.apache.hadoop.yarn.server.MiniYARNCluster;
import org.junit.AfterClass; import org.junit.AfterClass;
@ -122,8 +127,6 @@ public class TestUnmanagedAMLauncher {
LOG.fatal("JAVA_HOME not defined. Test not running."); LOG.fatal("JAVA_HOME not defined. Test not running.");
return; return;
} }
// start dist-shell with 0 containers because container launch will fail if
// there are no dist cache resources.
String[] args = { String[] args = {
"--classpath", "--classpath",
classpath, classpath,
@ -132,9 +135,8 @@ public class TestUnmanagedAMLauncher {
"--cmd", "--cmd",
javaHome javaHome
+ "/bin/java -Xmx512m " + "/bin/java -Xmx512m "
+ "org.apache.hadoop.yarn.applications.distributedshell.ApplicationMaster " + TestUnmanagedAMLauncher.class.getCanonicalName()
+ "--container_memory 128 --num_containers 1 --priority 0 " + " success" };
+ "--shell_command " + (Shell.WINDOWS ? "dir" : "ls") };
LOG.info("Initializing Launcher"); LOG.info("Initializing Launcher");
UnmanagedAMLauncher launcher = new UnmanagedAMLauncher(new Configuration( UnmanagedAMLauncher launcher = new UnmanagedAMLauncher(new Configuration(
@ -157,8 +159,6 @@ public class TestUnmanagedAMLauncher {
LOG.fatal("JAVA_HOME not defined. Test not running."); LOG.fatal("JAVA_HOME not defined. Test not running.");
return; return;
} }
// remove shell command to make dist-shell fail in initialization itself
String[] args = { String[] args = {
"--classpath", "--classpath",
classpath, classpath,
@ -167,8 +167,8 @@ public class TestUnmanagedAMLauncher {
"--cmd", "--cmd",
javaHome javaHome
+ "/bin/java -Xmx512m " + "/bin/java -Xmx512m "
+ "org.apache.hadoop.yarn.applications.distributedshell.ApplicationMaster " + TestUnmanagedAMLauncher.class.getCanonicalName()
+ "--container_memory 128 --num_containers 1 --priority 0" }; + " failure" };
LOG.info("Initializing Launcher"); LOG.info("Initializing Launcher");
UnmanagedAMLauncher launcher = new UnmanagedAMLauncher(new Configuration( UnmanagedAMLauncher launcher = new UnmanagedAMLauncher(new Configuration(
@ -185,4 +185,19 @@ public class TestUnmanagedAMLauncher {
} }
} }
// provide main method so this class can act as AM
public static void main(String[] args) throws Exception {
if (args[0].equals("success")) {
ApplicationMasterProtocol client = ClientRMProxy.createRMProxy(conf,
ApplicationMasterProtocol.class);
client.registerApplicationMaster(RegisterApplicationMasterRequest
.newInstance(NetUtils.getHostname(), -1, ""));
Thread.sleep(1000);
client.finishApplicationMaster(FinishApplicationMasterRequest
.newInstance(FinalApplicationStatus.SUCCEEDED, "success", null));
System.exit(0);
} else {
System.exit(1);
}
}
} }