hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From templ...@apache.org
Subject hadoop git commit: YARN-6380. FSAppAttempt keeps redundant copy of the queue
Date Thu, 11 May 2017 20:48:12 GMT
Repository: hadoop
Updated Branches:
  refs/heads/trunk 2ada100da -> 90cb5b463


YARN-6380. FSAppAttempt keeps redundant copy of the queue


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/90cb5b46
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/90cb5b46
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/90cb5b46

Branch: refs/heads/trunk
Commit: 90cb5b4635b7a0849912458afad052f569131a59
Parents: 2ada100
Author: Daniel Templeton <templedf@apache.org>
Authored: Thu May 11 13:47:02 2017 -0700
Committer: Daniel Templeton <templedf@apache.org>
Committed: Thu May 11 13:47:02 2017 -0700

----------------------------------------------------------------------
 .../scheduler/fair/FSAppAttempt.java            | 21 ++++++++------------
 1 file changed, 8 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/90cb5b46/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/FSAppAttempt.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/FSAppAttempt.java
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/FSAppAttempt.java
index a1c4b4b..4f7e164 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/FSAppAttempt.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/FSAppAttempt.java
@@ -41,7 +41,6 @@ import org.apache.hadoop.yarn.server.resourcemanager.rmcontainer.RMContainerFini
 import org.apache.hadoop.yarn.server.resourcemanager.rmcontainer.RMContainerImpl;
 import org.apache.hadoop.yarn.server.resourcemanager.scheduler.ActiveUsersManager;
 import org.apache.hadoop.yarn.server.resourcemanager.scheduler.NodeType;
-import org.apache.hadoop.yarn.server.resourcemanager.scheduler.Queue;
 import org.apache.hadoop.yarn.server.resourcemanager.scheduler.QueueMetrics;
 import org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerApplicationAttempt;
 import org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerNode;
@@ -79,7 +78,6 @@ public class FSAppAttempt extends SchedulerApplicationAttempt
   private final ResourceWeights resourceWeights;
   private Resource demand = Resources.createResource(0);
   private final FairScheduler scheduler;
-  private FSQueue fsQueue;
   private Resource fairShare = Resources.createResource(0, 0);
 
   // Preemption related variables
@@ -118,7 +116,6 @@ public class FSAppAttempt extends SchedulerApplicationAttempt
     super(applicationAttemptId, user, queue, activeUsersManager, rmContext);
 
     this.scheduler = scheduler;
-    this.fsQueue = queue;
     this.startTime = scheduler.getClock().getTime();
     this.lastTimeAtFairShare = this.startTime;
     this.appPriority = Priority.newInstance(1);
@@ -229,11 +226,11 @@ public class FSAppAttempt extends SchedulerApplicationAttempt
    */
   @Override
   public Resource getHeadroom() {
-    final FSQueue queue = (FSQueue) this.queue;
-    SchedulingPolicy policy = queue.getPolicy();
+    final FSQueue fsQueue = getQueue();
+    SchedulingPolicy policy = fsQueue.getPolicy();
 
-    Resource queueFairShare = queue.getFairShare();
-    Resource queueUsage = queue.getResourceUsage();
+    Resource queueFairShare = fsQueue.getFairShare();
+    Resource queueUsage = fsQueue.getResourceUsage();
     Resource clusterResource = this.scheduler.getClusterResource();
     Resource clusterUsage = this.scheduler.getRootQueueMetrics()
         .getAllocatedResources();
@@ -243,7 +240,7 @@ public class FSAppAttempt extends SchedulerApplicationAttempt
     subtractResourcesOnBlacklistedNodes(clusterAvailableResources);
 
     Resource queueMaxAvailableResources =
-        Resources.subtract(queue.getMaxShare(), queueUsage);
+        Resources.subtract(fsQueue.getMaxShare(), queueUsage);
     Resource maxAvailableResource = Resources.componentwiseMin(
         clusterAvailableResources, queueMaxAvailableResources);
 
@@ -514,8 +511,6 @@ public class FSAppAttempt extends SchedulerApplicationAttempt
 
   @Override
   public FSLeafQueue getQueue() {
-    Queue queue = super.getQueue();
-    assert queue instanceof FSLeafQueue;
     return (FSLeafQueue) queue;
   }
 
@@ -1102,7 +1097,7 @@ public class FSAppAttempt extends SchedulerApplicationAttempt
   Resource fairShareStarvation() {
     long now = scheduler.getClock().getTime();
     Resource threshold = Resources.multiply(
-        getFairShare(), fsQueue.getFairSharePreemptionThreshold());
+        getFairShare(), getQueue().getFairSharePreemptionThreshold());
     Resource fairDemand = Resources.componentwiseMin(threshold, demand);
 
     // Check if the queue is starved for fairshare
@@ -1113,7 +1108,7 @@ public class FSAppAttempt extends SchedulerApplicationAttempt
     }
 
     if (!starved ||
-        now - lastTimeAtFairShare < fsQueue.getFairSharePreemptionTimeout()) {
+        now - lastTimeAtFairShare < getQueue().getFairSharePreemptionTimeout()) {
       fairshareStarvation = Resources.none();
     } else {
       // The app has been starved for longer than preemption-timeout.
@@ -1128,7 +1123,7 @@ public class FSAppAttempt extends SchedulerApplicationAttempt
    * {@code share}.
    */
   private boolean isUsageBelowShare(Resource usage, Resource share) {
-    return fsQueue.getPolicy().getResourceCalculator().compare(
+    return getQueue().getPolicy().getResourceCalculator().compare(
         scheduler.getClusterResource(), usage, share, true) < 0;
   }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org


Mime
View raw message