Author: jeagles
Date: Thu Oct 3 15:52:30 2013
New Revision: 1528914
URL: http://svn.apache.org/r1528914
Log:
Revert YARN-677. Increase coverage to FairScheduler (Vadim Bondarev and Dennis
Y via jeagles)
Modified:
hadoop/common/trunk/hadoop-yarn-project/CHANGES.txt
hadoop/common/trunk/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
Modified: hadoop/common/trunk/hadoop-yarn-project/CHANGES.txt
URL:
http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-yarn-project/CHANGES.txt?rev=1528914&r1=1528913&r2=1528914&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-yarn-project/CHANGES.txt (original)
+++ hadoop/common/trunk/hadoop-yarn-project/CHANGES.txt Thu Oct 3 15:52:30 2013
@@ -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
Modified:
hadoop/common/trunk/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
URL:
http://svn.apache.org/viewvc/hadoop/common/trunk/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?rev=1528914&r1=1528913&r2=1528914&view=diff
==============================================================================
---
hadoop/common/trunk/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
(original)
+++
hadoop/common/trunk/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
Thu Oct 3 15:52:30 2013
@@ -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.res
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.Invocation
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<? 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{