hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yu...@apache.org
Subject hadoop git commit: YARN-7057. FSAppAttempt#getResourceUsage doesn't need to consider resources queued for preemption. (Contributed by Karthik via Yufei Gu)
Date Tue, 12 Sep 2017 23:13:56 GMT
Repository: hadoop
Updated Branches:
  refs/heads/trunk 2ae72692f -> 82c5dd1d5


YARN-7057. FSAppAttempt#getResourceUsage doesn't need to consider resources queued for preemption.
(Contributed by Karthik via Yufei Gu)


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

Branch: refs/heads/trunk
Commit: 82c5dd1d508292ed88eda0f5356776437ba67d4c
Parents: 2ae7269
Author: Yufei Gu <yufei@apache.org>
Authored: Tue Sep 12 14:58:23 2017 -0700
Committer: Yufei Gu <yufei@apache.org>
Committed: Tue Sep 12 16:13:39 2017 -0700

----------------------------------------------------------------------
 .../scheduler/fair/FSAppAttempt.java             | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/82c5dd1d/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 fe57d1b..309dff4 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
@@ -614,9 +614,16 @@ public class FSAppAttempt extends SchedulerApplicationAttempt
 
     // Check if the app's allocation will be over its fairshare even
     // after preempting this container
-    Resource usageAfterPreemption = Resources.subtract(
-        getResourceUsage(), container.getAllocatedResource());
+    Resource usageAfterPreemption = Resources.clone(getResourceUsage());
 
+    // Subtract resources of containers already queued for preemption
+    synchronized (preemptionVariablesLock) {
+      Resources.subtractFrom(usageAfterPreemption, resourcesToBePreempted);
+    }
+
+    // Subtract this container's allocation to compute usage after preemption
+    Resources.subtractFrom(
+        usageAfterPreemption, container.getAllocatedResource());
     return !isUsageBelowShare(usageAfterPreemption, getFairShare());
   }
 
@@ -1270,13 +1277,7 @@ public class FSAppAttempt extends SchedulerApplicationAttempt
 
   @Override
   public Resource getResourceUsage() {
-    // Subtract copies the object, so that we have a snapshot,
-    // in case usage changes, while the caller is using the value
-    synchronized (preemptionVariablesLock) {
-      return containersToBePreempted.isEmpty()
-          ? getCurrentConsumption()
-          : Resources.subtract(getCurrentConsumption(), resourcesToBePreempted);
-    }
+    return getCurrentConsumption();
   }
 
   @Override


---------------------------------------------------------------------
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