diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt index b7ac0c498d1..f74a7cf894b 100644 --- a/hadoop-yarn-project/CHANGES.txt +++ b/hadoop-yarn-project/CHANGES.txt @@ -210,6 +210,9 @@ Release 2.4.0 - UNRELEASED YARN-1454. Fixed test failure issue with TestRMRestart. (Karthik Kambatla 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 INCOMPATIBLE CHANGES diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-unmanaged-am-launcher/pom.xml b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-unmanaged-am-launcher/pom.xml index a43badec533..824ab332742 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-unmanaged-am-launcher/pom.xml +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-unmanaged-am-launcher/pom.xml @@ -71,11 +71,6 @@ hadoop-mapreduce-client-core test - - org.apache.hadoop - hadoop-yarn-applications-distributedshell - test - org.apache.hadoop hadoop-yarn-server-tests diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-unmanaged-am-launcher/src/test/java/org/apache/hadoop/yarn/applications/unmanagedamlauncher/TestUnmanagedAMLauncher.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-unmanaged-am-launcher/src/test/java/org/apache/hadoop/yarn/applications/unmanagedamlauncher/TestUnmanagedAMLauncher.java index 5870d472587..0cc4b8e72a8 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-unmanaged-am-launcher/src/test/java/org/apache/hadoop/yarn/applications/unmanagedamlauncher/TestUnmanagedAMLauncher.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-unmanaged-am-launcher/src/test/java/org/apache/hadoop/yarn/applications/unmanagedamlauncher/TestUnmanagedAMLauncher.java @@ -32,7 +32,12 @@ import junit.framework.Assert; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; 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.server.MiniYARNCluster; import org.junit.AfterClass; @@ -122,8 +127,6 @@ public class TestUnmanagedAMLauncher { LOG.fatal("JAVA_HOME not defined. Test not running."); return; } - // start dist-shell with 0 containers because container launch will fail if - // there are no dist cache resources. String[] args = { "--classpath", classpath, @@ -132,9 +135,8 @@ public class TestUnmanagedAMLauncher { "--cmd", javaHome + "/bin/java -Xmx512m " - + "org.apache.hadoop.yarn.applications.distributedshell.ApplicationMaster " - + "--container_memory 128 --num_containers 1 --priority 0 " - + "--shell_command " + (Shell.WINDOWS ? "dir" : "ls") }; + + TestUnmanagedAMLauncher.class.getCanonicalName() + + " success" }; LOG.info("Initializing Launcher"); UnmanagedAMLauncher launcher = new UnmanagedAMLauncher(new Configuration( @@ -157,8 +159,6 @@ public class TestUnmanagedAMLauncher { LOG.fatal("JAVA_HOME not defined. Test not running."); return; } - - // remove shell command to make dist-shell fail in initialization itself String[] args = { "--classpath", classpath, @@ -167,8 +167,8 @@ public class TestUnmanagedAMLauncher { "--cmd", javaHome + "/bin/java -Xmx512m " - + "org.apache.hadoop.yarn.applications.distributedshell.ApplicationMaster " - + "--container_memory 128 --num_containers 1 --priority 0" }; + + TestUnmanagedAMLauncher.class.getCanonicalName() + + " failure" }; LOG.info("Initializing Launcher"); 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); + } + } }