From 562af724978ea591f5b79d61305a05d789e3b184 Mon Sep 17 00:00:00 2001 From: Jonathan Turner Eagles Date: Thu, 3 Oct 2013 15:54:09 +0000 Subject: [PATCH] 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/branches/branch-2@1528915 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-yarn-project/CHANGES.txt | 3 - .../scheduler/fair/TestFairScheduler.java | 93 ------------------- 2 files changed, 96 deletions(-) diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt index 3f71e35c699..53d70c1e804 100644 --- a/hadoop-yarn-project/CHANGES.txt +++ b/hadoop-yarn-project/CHANGES.txt @@ -29,9 +29,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 diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/TestFairScheduler.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/TestFairScheduler.java index c127f625ca4..2c0e84e1013 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/TestFairScheduler.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/TestFairScheduler.java @@ -39,7 +39,6 @@ import java.util.Collections; 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.AppRemovedS 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.invocation.InvocationOnMock; 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 class TestFairScheduler { 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 externalEvents = ImmutableSet.of(new ExternalAppAddedSchedulerEvent(), - new ExternalNodeRemovedSchedulerEvent(), new ExternalNodeUpdateSchedulerEvent(), - new ExternalNodeAddedSchedulerEvent(), new ExternalAppRemovedSchedulerEvent(), - new ExternalContainerExpiredSchedulerEvent()); - - UnmodifiableIterator 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{