YARN-3941. Proportional Preemption policy should try to avoid sending duplicate PREEMPT_CONTAINER event to scheduler. (Sunil G via wangda)

This commit is contained in:
Wangda Tan 2015-07-23 10:07:57 -07:00
parent ee98d6354b
commit 3bba180051
3 changed files with 11 additions and 6 deletions

View File

@ -664,6 +664,8 @@ Release 2.8.0 - UNRELEASED
YARN-3956. Fix TestNodeManagerHardwareUtils fails on Mac (Varun Vasudev via wangda)
YARN-3941. Proportional Preemption policy should try to avoid sending duplicate PREEMPT_CONTAINER event to scheduler. (Sunil G via wangda)
Release 2.7.2 - UNRELEASED
INCOMPATIBLE CHANGES

View File

@ -260,13 +260,16 @@ public class ProportionalCapacityPreemptionPolicy implements SchedulingEditPolic
SchedulerEventType.KILL_CONTAINER));
preempted.remove(container);
} else {
if (preempted.get(container) != null) {
// We already updated the information to scheduler earlier, we need
// not have to raise another event.
continue;
}
//otherwise just send preemption events
rmContext.getDispatcher().getEventHandler().handle(
new ContainerPreemptEvent(appAttemptId, container,
SchedulerEventType.PREEMPT_CONTAINER));
if (preempted.get(container) == null) {
preempted.put(container, clock.getTime());
}
preempted.put(container, clock.getTime());
}
}
}

View File

@ -280,14 +280,14 @@ public class TestProportionalCapacityPreemptionPolicy {
// requests reiterated
when(mClock.getTime()).thenReturn(killTime / 2);
policy.editSchedule();
verify(mDisp, times(20)).handle(argThat(new IsPreemptionRequestFor(appC)));
verify(mDisp, times(10)).handle(argThat(new IsPreemptionRequestFor(appC)));
// kill req sent
when(mClock.getTime()).thenReturn(killTime + 1);
policy.editSchedule();
verify(mDisp, times(30)).handle(evtCaptor.capture());
verify(mDisp, times(20)).handle(evtCaptor.capture());
List<ContainerPreemptEvent> events = evtCaptor.getAllValues();
for (ContainerPreemptEvent e : events.subList(20, 30)) {
for (ContainerPreemptEvent e : events.subList(20, 20)) {
assertEquals(appC, e.getAppId());
assertEquals(KILL_CONTAINER, e.getType());
}