YARN-6747. TestFSAppStarvation.testPreemptionEnable fails intermittently. (Contributed by Miklos Szegedi)

This commit is contained in:
Yufei Gu 2017-10-29 16:44:16 -07:00
parent 9114d7a5a0
commit d4811c8cfa

View File

@ -62,6 +62,9 @@ public void setup() {
ALLOC_FILE.getAbsolutePath());
conf.setBoolean(FairSchedulerConfiguration.PREEMPTION, true);
conf.setFloat(FairSchedulerConfiguration.PREEMPTION_THRESHOLD, 0f);
// This effectively disables the update thread since we call update
// explicitly on the main thread
conf.setLong(FairSchedulerConfiguration.UPDATE_INTERVAL_MS, Long.MAX_VALUE);
}
@After
@ -124,16 +127,17 @@ public void testPreemptionEnabled() throws Exception {
// Wait for apps to be processed by MockPreemptionThread
for (int i = 0; i < 6000; ++i) {
if(preemptionThread.totalAppsAdded() >
preemptionThread.uniqueAppsAdded()) {
if(preemptionThread.totalAppsAdded() >=
preemptionThread.uniqueAppsAdded() * 2) {
break;
}
Thread.sleep(10);
}
assertTrue("Each app is marked as starved exactly once",
preemptionThread.totalAppsAdded() >
preemptionThread.uniqueAppsAdded());
assertEquals("Each app should be marked as starved once" +
" at each scheduler update above",
preemptionThread.totalAppsAdded(),
preemptionThread.uniqueAppsAdded() * 2);
}
/*