From 7ec65c86177c7f150933636b5861447eecbcfb1a Mon Sep 17 00:00:00 2001 From: Jian He Date: Wed, 8 Oct 2014 10:58:51 -0700 Subject: [PATCH] YARN-2649. Fixed TestAMRMRPCNodeUpdates test failure. Contributed by Ming Ma (cherry picked from commit e16e25ab1beac89c8d8be4e9f2a7fbefe81d35f3) --- hadoop-yarn-project/CHANGES.txt | 2 ++ .../hadoop/yarn/server/resourcemanager/MockRM.java | 10 +++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt index d7424370d5f..1f26389a7b5 100644 --- a/hadoop-yarn-project/CHANGES.txt +++ b/hadoop-yarn-project/CHANGES.txt @@ -528,6 +528,8 @@ Release 2.6.0 - UNRELEASED YARN-1857. CapacityScheduler headroom doesn't account for other AM's running. (Chen He and Craig Welch via jianhe) + YARN-2649. Fixed TestAMRMRPCNodeUpdates test failure. (Ming Ma via jianhe) + Release 2.5.1 - 2014-09-05 INCOMPATIBLE CHANGES diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/MockRM.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/MockRM.java index 4f5fdebfbc8..5d37d48fc68 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/MockRM.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/MockRM.java @@ -386,7 +386,15 @@ public class MockRM extends ResourceManager { if (waitForAccepted) { waitForState(appId, RMAppState.ACCEPTED); } - return getRMContext().getRMApps().get(appId); + RMApp rmApp = getRMContext().getRMApps().get(appId); + + // unmanaged AM won't go to RMAppAttemptState.SCHEDULED. + if (waitForAccepted && !unmanaged) { + waitForState(rmApp.getCurrentAppAttempt().getAppAttemptId(), + RMAppAttemptState.SCHEDULED); + } + + return rmApp; } public MockNM registerNode(String nodeIdStr, int memory) throws Exception {