Revert YARN-677. Increase coverage to FairScheduler (Vadim Bondarev and Dennis Y via jeagles)
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1528914 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
2db1d4d4ee
commit
dbdb8c6f1f
@ -44,9 +44,6 @@ Release 2.3.0 - UNRELEASED
|
||||
YARN-819. ResourceManager and NodeManager should check for a minimum allowed
|
||||
version (Robert Parker via jeagles)
|
||||
|
||||
YARN-677. Increase coverage to FairScheduler (Vadim Bondarev and Dennis Y
|
||||
via jeagles)
|
||||
|
||||
YARN-425. coverage fix for yarn api (Aleksey Gorshkov via jeagles)
|
||||
|
||||
OPTIMIZATIONS
|
||||
|
@ -39,7 +39,6 @@
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
|
||||
@ -87,8 +86,6 @@
|
||||
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.event.NodeAddedSchedulerEvent;
|
||||
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.event.NodeRemovedSchedulerEvent;
|
||||
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.event.NodeUpdateSchedulerEvent;
|
||||
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.event.SchedulerEvent;
|
||||
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.event.SchedulerEventType;
|
||||
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.policies.DominantResourceFairnessPolicy;
|
||||
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.policies.FifoPolicy;
|
||||
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.fifo.FifoScheduler;
|
||||
@ -103,9 +100,6 @@
|
||||
import org.mockito.stubbing.Answer;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.UnmodifiableIterator;
|
||||
|
||||
public class TestFairScheduler {
|
||||
|
||||
private class MockClock implements Clock {
|
||||
@ -2318,93 +2312,6 @@ public void testContinuousScheduling() throws Exception {
|
||||
Assert.assertEquals(1, consumption.getVirtualCores());
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testAggregateCapacityTrackingWithPreemptionEnabled() throws Exception {
|
||||
int KB = 1024;
|
||||
int iterationNumber = 10;
|
||||
Configuration conf = createConfiguration();
|
||||
conf.setBoolean("yarn.scheduler.fair.preemption", true);
|
||||
scheduler.reinitialize(conf, resourceManager.getRMContext());
|
||||
RMNode node = MockNodes.newNodeInfo(1, Resources.createResource(KB * iterationNumber));
|
||||
NodeAddedSchedulerEvent nodeAddEvent = new NodeAddedSchedulerEvent(node);
|
||||
scheduler.handle(nodeAddEvent);
|
||||
|
||||
for (int i = 0; i < iterationNumber; i++) {
|
||||
createSchedulingRequest(KB, "queue1", "user1", 1);
|
||||
scheduler.update();
|
||||
NodeUpdateSchedulerEvent updateEvent = new NodeUpdateSchedulerEvent(node);
|
||||
scheduler.handle(updateEvent);
|
||||
|
||||
assertEquals(KB,
|
||||
scheduler.getQueueManager().getQueue("queue1").getResourceUsage().getMemory());
|
||||
TimeUnit.SECONDS.sleep(1);
|
||||
}
|
||||
}
|
||||
|
||||
private static final class ExternalAppAddedSchedulerEvent extends SchedulerEvent {
|
||||
public ExternalAppAddedSchedulerEvent() {
|
||||
super(SchedulerEventType.APP_ADDED);
|
||||
}
|
||||
}
|
||||
|
||||
private static final class ExternalNodeRemovedSchedulerEvent extends SchedulerEvent {
|
||||
public ExternalNodeRemovedSchedulerEvent() {
|
||||
super(SchedulerEventType.NODE_REMOVED);
|
||||
}
|
||||
}
|
||||
|
||||
private static final class ExternalNodeUpdateSchedulerEvent extends SchedulerEvent {
|
||||
public ExternalNodeUpdateSchedulerEvent() {
|
||||
super(SchedulerEventType.NODE_UPDATE);
|
||||
}
|
||||
}
|
||||
|
||||
private static final class ExternalNodeAddedSchedulerEvent extends SchedulerEvent {
|
||||
public ExternalNodeAddedSchedulerEvent() {
|
||||
super(SchedulerEventType.NODE_ADDED);
|
||||
}
|
||||
}
|
||||
|
||||
private static final class ExternalAppRemovedSchedulerEvent extends SchedulerEvent {
|
||||
public ExternalAppRemovedSchedulerEvent() {
|
||||
super(SchedulerEventType.APP_REMOVED);
|
||||
}
|
||||
}
|
||||
|
||||
private static final class ExternalContainerExpiredSchedulerEvent extends SchedulerEvent {
|
||||
public ExternalContainerExpiredSchedulerEvent() {
|
||||
super(SchedulerEventType.CONTAINER_EXPIRED);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* try to handle external events type
|
||||
* and get {@code RuntimeException}
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test
|
||||
public void testSchedulerHandleFailWithExternalEvents() throws Exception {
|
||||
Configuration conf = createConfiguration();
|
||||
scheduler.reinitialize(conf, resourceManager.getRMContext());
|
||||
ImmutableSet<? extends SchedulerEvent> externalEvents = ImmutableSet.of(new ExternalAppAddedSchedulerEvent(),
|
||||
new ExternalNodeRemovedSchedulerEvent(), new ExternalNodeUpdateSchedulerEvent(),
|
||||
new ExternalNodeAddedSchedulerEvent(), new ExternalAppRemovedSchedulerEvent(),
|
||||
new ExternalContainerExpiredSchedulerEvent());
|
||||
|
||||
UnmodifiableIterator<? extends SchedulerEvent> iter = externalEvents.iterator();
|
||||
while(iter.hasNext())
|
||||
handleExternalEvent(iter.next());
|
||||
}
|
||||
|
||||
private void handleExternalEvent(SchedulerEvent event) throws Exception {
|
||||
try {
|
||||
scheduler.handle(event);
|
||||
} catch(RuntimeException ex) {
|
||||
//expected
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDontAllowUndeclaredPools() throws Exception{
|
||||
|
Loading…
Reference in New Issue
Block a user