Merge -c 1433138 from trunk to branch-2 to fix YARN-330. Fix flakey test: TestNodeManagerShutdown#testKillContainersOnShutdown. Contributed by Sandy Ryza

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1433147 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Hitesh Shah 2013-01-14 21:36:32 +00:00
parent 034ec8af5a
commit f2c7de8f4e
2 changed files with 12 additions and 2 deletions

View File

@ -168,6 +168,9 @@ Release 2.0.3-alpha - Unreleased
YARN-253. Fixed container-launch to not fail when there are no local
resources to localize. (Tom White via vinodkv)
YARN-330. Fix flakey test: TestNodeManagerShutdown#testKillContainersOnShutdown.
(Sandy Ryza via hitesh)
Release 2.0.2-alpha - 2012-09-07
YARN-9. Rename YARN_HOME to HADOOP_YARN_HOME. (vinodkv via acmurthy)

View File

@ -138,7 +138,14 @@ public class TestNodeManagerShutdown {
containerManager.getContainerStatus(request).getStatus();
Assert.assertEquals(ContainerState.RUNNING, containerStatus.getState());
try {Thread.sleep(5000);} catch (InterruptedException ex) {ex.printStackTrace();}
final int MAX_TRIES=20;
int numTries = 0;
while (!processStartFile.exists() && numTries < MAX_TRIES) {
try {
Thread.sleep(500);
} catch (InterruptedException ex) {ex.printStackTrace();}
numTries++;
}
nm.stop();
@ -202,7 +209,7 @@ public class TestNodeManagerShutdown {
fileWriter.write("trap \"echo $hello >> " + processStartFile + "\" SIGTERM\n");
fileWriter.write("echo \"Writing pid to start file\"\n");
fileWriter.write("echo $$ >> " + processStartFile + "\n");
fileWriter.write("while true; do\nsleep 1s;\ndone\n");
fileWriter.write("while true; do\ndate >> /dev/null;\n done\n");
fileWriter.close();
return scriptFile;