YARN-490. TestDistributedShell fails on Windows. Contributed by Chris Nauroth.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1459520 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
92fb7cdcde
commit
d6b33ee981
|
@ -21,6 +21,8 @@ Trunk - Unreleased
|
||||||
YARN-488. TestContainerManagerSecurity fails on Windows. (Chris Nauroth
|
YARN-488. TestContainerManagerSecurity fails on Windows. (Chris Nauroth
|
||||||
via hitesh)
|
via hitesh)
|
||||||
|
|
||||||
|
YARN-490. TestDistributedShell fails on Windows. (Chris Nauroth via hitesh)
|
||||||
|
|
||||||
BREAKDOWN OF HADOOP-8562 SUBTASKS
|
BREAKDOWN OF HADOOP-8562 SUBTASKS
|
||||||
|
|
||||||
YARN-158. Yarn creating package-info.java must not depend on sh.
|
YARN-158. Yarn creating package-info.java must not depend on sh.
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
|
|
||||||
package org.apache.hadoop.yarn.applications.distributedshell;
|
package org.apache.hadoop.yarn.applications.distributedshell;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
@ -39,6 +40,7 @@ import org.apache.hadoop.fs.FileStatus;
|
||||||
import org.apache.hadoop.fs.FileSystem;
|
import org.apache.hadoop.fs.FileSystem;
|
||||||
import org.apache.hadoop.fs.Path;
|
import org.apache.hadoop.fs.Path;
|
||||||
import org.apache.hadoop.yarn.api.ApplicationConstants;
|
import org.apache.hadoop.yarn.api.ApplicationConstants;
|
||||||
|
import org.apache.hadoop.yarn.api.ApplicationConstants.Environment;
|
||||||
import org.apache.hadoop.yarn.api.ClientRMProtocol;
|
import org.apache.hadoop.yarn.api.ClientRMProtocol;
|
||||||
import org.apache.hadoop.yarn.api.protocolrecords.GetNewApplicationResponse;
|
import org.apache.hadoop.yarn.api.protocolrecords.GetNewApplicationResponse;
|
||||||
import org.apache.hadoop.yarn.api.protocolrecords.KillApplicationRequest;
|
import org.apache.hadoop.yarn.api.protocolrecords.KillApplicationRequest;
|
||||||
|
@ -481,14 +483,15 @@ public class Client extends YarnClientImpl {
|
||||||
// It should be provided out of the box.
|
// It should be provided out of the box.
|
||||||
// For now setting all required classpaths including
|
// For now setting all required classpaths including
|
||||||
// the classpath to "." for the application jar
|
// the classpath to "." for the application jar
|
||||||
StringBuilder classPathEnv = new StringBuilder("${CLASSPATH}:./*");
|
StringBuilder classPathEnv = new StringBuilder(Environment.CLASSPATH.$())
|
||||||
|
.append(File.pathSeparatorChar).append("./*");
|
||||||
for (String c : conf.getStrings(
|
for (String c : conf.getStrings(
|
||||||
YarnConfiguration.YARN_APPLICATION_CLASSPATH,
|
YarnConfiguration.YARN_APPLICATION_CLASSPATH,
|
||||||
YarnConfiguration.DEFAULT_YARN_APPLICATION_CLASSPATH)) {
|
YarnConfiguration.DEFAULT_YARN_APPLICATION_CLASSPATH)) {
|
||||||
classPathEnv.append(':');
|
classPathEnv.append(File.pathSeparatorChar);
|
||||||
classPathEnv.append(c.trim());
|
classPathEnv.append(c.trim());
|
||||||
}
|
}
|
||||||
classPathEnv.append(":./log4j.properties");
|
classPathEnv.append(File.pathSeparatorChar).append("./log4j.properties");
|
||||||
|
|
||||||
// add the runtime classpath needed for tests to work
|
// add the runtime classpath needed for tests to work
|
||||||
if (conf.getBoolean(YarnConfiguration.IS_MINI_YARN_CLUSTER, false)) {
|
if (conf.getBoolean(YarnConfiguration.IS_MINI_YARN_CLUSTER, false)) {
|
||||||
|
@ -505,7 +508,7 @@ public class Client extends YarnClientImpl {
|
||||||
|
|
||||||
// Set java executable command
|
// Set java executable command
|
||||||
LOG.info("Setting up app master command");
|
LOG.info("Setting up app master command");
|
||||||
vargs.add("${JAVA_HOME}" + "/bin/java");
|
vargs.add(Environment.JAVA_HOME.$() + "/bin/java");
|
||||||
// Set Xmx based on am memory size
|
// Set Xmx based on am memory size
|
||||||
vargs.add("-Xmx" + amMemory + "m");
|
vargs.add("-Xmx" + amMemory + "m");
|
||||||
// Set class name
|
// Set class name
|
||||||
|
|
|
@ -29,6 +29,7 @@ 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.JarFinder;
|
import org.apache.hadoop.util.JarFinder;
|
||||||
|
import org.apache.hadoop.util.Shell;
|
||||||
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.apache.hadoop.yarn.server.resourcemanager.scheduler.ResourceScheduler;
|
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.ResourceScheduler;
|
||||||
|
@ -54,8 +55,8 @@ public class TestDistributedShell {
|
||||||
conf.setClass(YarnConfiguration.RM_SCHEDULER,
|
conf.setClass(YarnConfiguration.RM_SCHEDULER,
|
||||||
FifoScheduler.class, ResourceScheduler.class);
|
FifoScheduler.class, ResourceScheduler.class);
|
||||||
if (yarnCluster == null) {
|
if (yarnCluster == null) {
|
||||||
yarnCluster = new MiniYARNCluster(TestDistributedShell.class.getName(),
|
yarnCluster = new MiniYARNCluster(
|
||||||
1, 1, 1);
|
TestDistributedShell.class.getSimpleName(), 1, 1, 1);
|
||||||
yarnCluster.init(conf);
|
yarnCluster.init(conf);
|
||||||
yarnCluster.start();
|
yarnCluster.start();
|
||||||
URL url = Thread.currentThread().getContextClassLoader().getResource("yarn-site.xml");
|
URL url = Thread.currentThread().getContextClassLoader().getResource("yarn-site.xml");
|
||||||
|
@ -82,7 +83,7 @@ public class TestDistributedShell {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test(timeout=30000)
|
||||||
public void testDSShell() throws Exception {
|
public void testDSShell() throws Exception {
|
||||||
|
|
||||||
String[] args = {
|
String[] args = {
|
||||||
|
@ -91,7 +92,7 @@ public class TestDistributedShell {
|
||||||
"--num_containers",
|
"--num_containers",
|
||||||
"2",
|
"2",
|
||||||
"--shell_command",
|
"--shell_command",
|
||||||
"ls",
|
Shell.WINDOWS ? "dir" : "ls",
|
||||||
"--master_memory",
|
"--master_memory",
|
||||||
"512",
|
"512",
|
||||||
"--container_memory",
|
"--container_memory",
|
||||||
|
@ -110,7 +111,7 @@ public class TestDistributedShell {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test(timeout=30000)
|
||||||
public void testDSShellWithNoArgs() throws Exception {
|
public void testDSShellWithNoArgs() throws Exception {
|
||||||
|
|
||||||
String[] args = {};
|
String[] args = {};
|
||||||
|
|
Loading…
Reference in New Issue