YARN-7721. Fix TestContinuousScheduling fails sporadically with NPE.
Contributed by Wilfred Spiegelenburg.
This commit is contained in:
parent
c4733377d0
commit
d4bde134e3
@ -18,7 +18,9 @@
|
|||||||
|
|
||||||
package org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair;
|
package org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair;
|
||||||
|
|
||||||
|
import com.google.common.base.Supplier;
|
||||||
import org.apache.hadoop.conf.Configuration;
|
import org.apache.hadoop.conf.Configuration;
|
||||||
|
import org.apache.hadoop.test.GenericTestUtils;
|
||||||
import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
|
import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
|
||||||
import org.apache.hadoop.yarn.api.records.ContainerId;
|
import org.apache.hadoop.yarn.api.records.ContainerId;
|
||||||
import org.apache.hadoop.yarn.api.records.NodeId;
|
import org.apache.hadoop.yarn.api.records.NodeId;
|
||||||
@ -383,8 +385,8 @@ public void testFairSchedulerContinuousSchedulingInitTime() throws Exception {
|
|||||||
true);
|
true);
|
||||||
ask1.add(request1);
|
ask1.add(request1);
|
||||||
ask1.add(request2);
|
ask1.add(request2);
|
||||||
scheduler.allocate(id11, ask1, null, new ArrayList<ContainerId>(), null, null,
|
scheduler.allocate(id11, ask1, null, new ArrayList<ContainerId>(), null,
|
||||||
NULL_UPDATE_REQUESTS);
|
null, NULL_UPDATE_REQUESTS);
|
||||||
|
|
||||||
NodeAddedSchedulerEvent nodeEvent1 = new NodeAddedSchedulerEvent(node1);
|
NodeAddedSchedulerEvent nodeEvent1 = new NodeAddedSchedulerEvent(node1);
|
||||||
scheduler.handle(nodeEvent1);
|
scheduler.handle(nodeEvent1);
|
||||||
@ -393,6 +395,11 @@ public void testFairSchedulerContinuousSchedulingInitTime() throws Exception {
|
|||||||
// time
|
// time
|
||||||
mockClock.tickSec(delayThresholdTimeMs / 1000);
|
mockClock.tickSec(delayThresholdTimeMs / 1000);
|
||||||
scheduler.attemptScheduling(node);
|
scheduler.attemptScheduling(node);
|
||||||
|
GenericTestUtils.waitFor(new Supplier<Boolean>() {
|
||||||
|
public Boolean get() {
|
||||||
|
return fsAppAttempt.getLastScheduledContainer().size() != 0;
|
||||||
|
}
|
||||||
|
}, 10, 4000);
|
||||||
Map<SchedulerRequestKey, Long> lastScheduledContainer =
|
Map<SchedulerRequestKey, Long> lastScheduledContainer =
|
||||||
fsAppAttempt.getLastScheduledContainer();
|
fsAppAttempt.getLastScheduledContainer();
|
||||||
long initSchedulerTime =
|
long initSchedulerTime =
|
||||||
|
Loading…
Reference in New Issue
Block a user