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:
parent
22b1584b87
commit
fb14656ec7
|
@ -192,6 +192,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
|
||||
|
|
|
@ -71,11 +71,6 @@
|
|||
<artifactId>hadoop-mapreduce-client-core</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.hadoop</groupId>
|
||||
<artifactId>hadoop-yarn-applications-distributedshell</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.hadoop</groupId>
|
||||
<artifactId>hadoop-yarn-server-tests</artifactId>
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue