Skip to content

Commit

Permalink
YARN-3533. Test: Fix launchAM in MockRM to wait for attempt to be sch…
Browse files Browse the repository at this point in the history
…eduled. Contributed by Anubhav Dhoot
  • Loading branch information
jian-he committed Apr 29, 2015
1 parent 2e21548 commit 4c1af15
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 3 additions & 0 deletions hadoop-yarn-project/CHANGES.txt
Expand Up @@ -271,6 +271,9 @@ Release 2.8.0 - UNRELEASED
YARN-3517. RM web ui for dumping scheduler logs should be for admins only
(Varun Vasudev via tgraves)

YARN-3533. Test: Fix launchAM in MockRM to wait for attempt to be scheduled.
(Anubhav Dhoot via jianhe)

Release 2.7.1 - UNRELEASED

INCOMPATIBLE CHANGES
Expand Down
Expand Up @@ -164,6 +164,8 @@ public void waitForContainerAllocated(MockNM nm, ContainerId containerId)
nm.nodeHeartbeat(true);
Thread.sleep(200);
}
Assert.assertNotNull("Failed in waiting for " + containerId + " " +
"allocation.", getResourceScheduler().getRMContainer(containerId));
}

public void waitForContainerToComplete(RMAppAttempt attempt,
Expand Down Expand Up @@ -662,7 +664,7 @@ public static void finishAMAndVerifyAppState(RMApp rmApp, MockRM rm, MockNM nm,
am.waitForState(RMAppAttemptState.FINISHED);
rm.waitForState(rmApp.getApplicationId(), RMAppState.FINISHED);
}

@SuppressWarnings("rawtypes")
private static void waitForSchedulerAppAttemptAdded(
ApplicationAttemptId attemptId, MockRM rm) throws InterruptedException {
Expand All @@ -677,13 +679,17 @@ private static void waitForSchedulerAppAttemptAdded(
}
tick++;
}
Assert.assertNotNull("Timed out waiting for SchedulerApplicationAttempt=" +
attemptId + " to be added.", ((AbstractYarnScheduler)
rm.getResourceScheduler()).getApplicationAttempt(attemptId));
}

public static MockAM launchAM(RMApp app, MockRM rm, MockNM nm)
throws Exception {
rm.waitForState(app.getApplicationId(), RMAppState.ACCEPTED);
RMAppAttempt attempt = app.getCurrentAppAttempt();
waitForSchedulerAppAttemptAdded(attempt.getAppAttemptId(), rm);
rm.waitForState(attempt.getAppAttemptId(), RMAppAttemptState.SCHEDULED);
System.out.println("Launch AM " + attempt.getAppAttemptId());
nm.nodeHeartbeat(true);
MockAM am = rm.sendAMLaunched(attempt.getAppAttemptId());
Expand Down

0 comments on commit 4c1af15

Please sign in to comment.