hadoop-yarn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t...@apache.org
Subject svn commit: r1492025 - in /hadoop/common/branches/branch-2/hadoop-yarn-project: ./ hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/ hadoop-yarn/hadoop-yarn-server/h...
Date Wed, 12 Jun 2013 00:49:06 GMT
Author: tucu
Date: Wed Jun 12 00:49:06 2013
New Revision: 1492025

URL: http://svn.apache.org/r1492025
Log:
YARN-795. Fair scheduler queue metrics should subtract allocated vCores from available vCores.
(ywskycn via tucu)

Modified:
    hadoop/common/branches/branch-2/hadoop-yarn-project/CHANGES.txt
    hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/QueueMetrics.java
    hadoop/common/branches/branch-2/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/branches/branch-2/hadoop-yarn-project/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-yarn-project/CHANGES.txt?rev=1492025&r1=1492024&r2=1492025&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-yarn-project/CHANGES.txt (original)
+++ hadoop/common/branches/branch-2/hadoop-yarn-project/CHANGES.txt Wed Jun 12 00:49:06 2013
@@ -524,6 +524,9 @@ Release 2.1.0-beta - UNRELEASED
     YARN-493. Fixed some shell related flaws in YARN on Windows. (Chris Nauroth
     via vinodkv)
 
+    YARN-795. Fair scheduler queue metrics should subtract allocated vCores from 
+    available vCores. (ywskycn via tucu) 
+
 Release 2.0.5-alpha - 06/06/2013
 
   INCOMPATIBLE CHANGES

Modified: hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/QueueMetrics.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/QueueMetrics.java?rev=1492025&r1=1492024&r2=1492025&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/QueueMetrics.java
(original)
+++ hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/QueueMetrics.java
Wed Jun 12 00:49:06 2013
@@ -452,7 +452,7 @@ public class QueueMetrics implements Met
   }
   
   public Resource getAllocatedResources() {
-    return BuilderUtils.newResource(allocatedMB.value(), 0);
+    return BuilderUtils.newResource(allocatedMB.value(), allocatedVCores.value());
   }
 
   public int getAllocatedMB() {

Modified: hadoop/common/branches/branch-2/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/branches/branch-2/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=1492025&r1=1492024&r2=1492025&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/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/branches/branch-2/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
Wed Jun 12 00:49:06 2013
@@ -219,6 +219,13 @@ public class TestFairScheduler {
     createSchedulingRequestExistingApplication(request, attId);
   }
   
+  private void createSchedulingRequestExistingApplication(int memory, int vcores,
+      int priority, ApplicationAttemptId attId) {
+	ResourceRequest request = createResourceRequest(memory, vcores, ResourceRequest.ANY,
+		priority, 1, true);
+	createSchedulingRequestExistingApplication(request, attId);
+  }
+  
   private void createSchedulingRequestExistingApplication(ResourceRequest request,
       ApplicationAttemptId attId) {
     List<ResourceRequest> ask = new ArrayList<ResourceRequest>();
@@ -352,17 +359,17 @@ public class TestFairScheduler {
     // Add a node
     RMNode node1 =
         MockNodes
-            .newNodeInfo(1, Resources.createResource(1024), 1, "127.0.0.1");
+            .newNodeInfo(1, Resources.createResource(1024, 4), 1, "127.0.0.1");
     NodeAddedSchedulerEvent nodeEvent1 = new NodeAddedSchedulerEvent(node1);
     scheduler.handle(nodeEvent1);
 
     // Add another node
     RMNode node2 =
-        MockNodes.newNodeInfo(1, Resources.createResource(512), 2, "127.0.0.2");
+        MockNodes.newNodeInfo(1, Resources.createResource(512, 2), 2, "127.0.0.2");
     NodeAddedSchedulerEvent nodeEvent2 = new NodeAddedSchedulerEvent(node2);
     scheduler.handle(nodeEvent2);
 
-    createSchedulingRequest(512, "queue1", "user1", 2);
+    createSchedulingRequest(512, 2, "queue1", "user1", 2);
 
     scheduler.update();
 
@@ -379,13 +386,18 @@ public class TestFairScheduler {
 
     assertEquals(1024, scheduler.getQueueManager().getQueue("queue1").
       getResourceUsage().getMemory());
+    assertEquals(2, scheduler.getQueueManager().getQueue("queue1").
+      getResourceUsage().getVirtualCores());
 
     // verify metrics
     QueueMetrics queue1Metrics = scheduler.getQueueManager().getQueue("queue1")
         .getMetrics();
     assertEquals(1024, queue1Metrics.getAllocatedMB());
+    assertEquals(2, queue1Metrics.getAllocatedVirtualCores());
     assertEquals(1024, scheduler.getRootQueueMetrics().getAllocatedMB());
+    assertEquals(2, scheduler.getRootQueueMetrics().getAllocatedVirtualCores());
     assertEquals(512, scheduler.getRootQueueMetrics().getAvailableMB());
+    assertEquals(4, scheduler.getRootQueueMetrics().getAvailableVirtualCores());
   }
 
   @Test (timeout = 5000)
@@ -1334,11 +1346,11 @@ public class TestFairScheduler {
     // Add a node
     RMNode node1 =
         MockNodes
-            .newNodeInfo(1, Resources.createResource(1024), 1, "127.0.0.1");
+            .newNodeInfo(1, Resources.createResource(1024, 4), 1, "127.0.0.1");
     NodeAddedSchedulerEvent nodeEvent1 = new NodeAddedSchedulerEvent(node1);
     scheduler.handle(nodeEvent1);
 
-    ApplicationAttemptId attId = createSchedulingRequest(1024, "queue1",
+    ApplicationAttemptId attId = createSchedulingRequest(1024, 4, "queue1",
         "user1", 1, 2);
     scheduler.update();
     NodeUpdateSchedulerEvent updateEvent = new NodeUpdateSchedulerEvent(node1);
@@ -1351,15 +1363,16 @@ public class TestFairScheduler {
         .getLiveContainers().iterator().next().getContainerId();
 
     // Cause reservation to be created
-    createSchedulingRequestExistingApplication(1024, 2, attId);
+    createSchedulingRequestExistingApplication(1024, 4, 2, attId);
     scheduler.update();
     scheduler.handle(updateEvent);
 
     assertEquals(1, app.getLiveContainers().size());
     assertEquals(0, scheduler.getRootQueueMetrics().getAvailableMB());
+    assertEquals(0, scheduler.getRootQueueMetrics().getAvailableVirtualCores());
     
     // Create request at higher priority
-    createSchedulingRequestExistingApplication(1024, 1, attId);
+    createSchedulingRequestExistingApplication(1024, 4, 1, attId);
     scheduler.update();
     scheduler.handle(updateEvent);
     
@@ -1373,6 +1386,7 @@ public class TestFairScheduler {
     scheduler.allocate(attId, new ArrayList<ResourceRequest>(),
         Arrays.asList(containerId), null, null);
     assertEquals(1024, scheduler.getRootQueueMetrics().getAvailableMB());
+    assertEquals(4, scheduler.getRootQueueMetrics().getAvailableVirtualCores());
     
     // Schedule at opening
     scheduler.update();
@@ -1385,6 +1399,7 @@ public class TestFairScheduler {
       Assert.assertEquals(2, liveContainer.getContainer().getPriority().getPriority());
     }
     assertEquals(0, scheduler.getRootQueueMetrics().getAvailableMB());
+    assertEquals(0, scheduler.getRootQueueMetrics().getAvailableVirtualCores());
   }
   
   @Test
@@ -1708,22 +1723,27 @@ public class TestFairScheduler {
   @Test
   public void testRemoveNodeUpdatesRootQueueMetrics() {
     assertEquals(0, scheduler.getRootQueueMetrics().getAvailableMB());
+	assertEquals(0, scheduler.getRootQueueMetrics().getAvailableVirtualCores());
     
-    RMNode node1 = MockNodes.newNodeInfo(1, Resources.createResource(1024), 1,
+    RMNode node1 = MockNodes.newNodeInfo(1, Resources.createResource(1024, 4), 1,
         "127.0.0.1");
     NodeAddedSchedulerEvent addEvent = new NodeAddedSchedulerEvent(node1);
     scheduler.handle(addEvent);
     
     assertEquals(1024, scheduler.getRootQueueMetrics().getAvailableMB());
+    assertEquals(4, scheduler.getRootQueueMetrics().getAvailableVirtualCores());
     scheduler.update(); // update shouldn't change things
     assertEquals(1024, scheduler.getRootQueueMetrics().getAvailableMB());
+    assertEquals(4, scheduler.getRootQueueMetrics().getAvailableVirtualCores());
     
     NodeRemovedSchedulerEvent removeEvent = new NodeRemovedSchedulerEvent(node1);
     scheduler.handle(removeEvent);
     
     assertEquals(0, scheduler.getRootQueueMetrics().getAvailableMB());
+    assertEquals(0, scheduler.getRootQueueMetrics().getAvailableVirtualCores());
     scheduler.update(); // update shouldn't change things
     assertEquals(0, scheduler.getRootQueueMetrics().getAvailableMB());
+    assertEquals(0, scheduler.getRootQueueMetrics().getAvailableVirtualCores());
 }
 
   @Test



Mime
View raw message