Repository: hadoop
Updated Branches:
  refs/heads/branch-2 e12358c5c -> 389b659c9


YARN-7049. FSAppAttempt preemption related fields have confusing names. 
(Contributed by Karthik Kambatla via Yufei Gu)

(cherry picked from commit 9e2699ac2c99d8df85191dd7fbf9468b00f5b5aa)


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

Branch: refs/heads/branch-2
Commit: 389b659c940979727a30c10114e982817b75ea26
Parents: e12358c
Author: Yufei Gu <[email protected]>
Authored: Thu Aug 24 17:52:41 2017 -0700
Committer: Yufei Gu <[email protected]>
Committed: Thu Aug 24 17:54:00 2017 -0700

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


http://git-wip-us.apache.org/repos/asf/hadoop/blob/389b659c/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 2afa8d8..f202559 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
@@ -82,8 +82,9 @@ public class FSAppAttempt extends SchedulerApplicationAttempt
 
   // Preemption related variables
   private final Object preemptionVariablesLock = new Object();
-  private final Resource preemptedResources = 
Resources.clone(Resources.none());
-  private final Set<RMContainer> containersToPreempt = new HashSet<>();
+  private final Set<RMContainer> containersToBePreempted = new HashSet<>();
+  private final Resource resourcesToBePreempted =
+      Resources.clone(Resources.none());
 
   private Resource fairshareStarvation = Resources.none();
   private long lastTimeAtFairShare;
@@ -565,16 +566,17 @@ public class FSAppAttempt extends 
SchedulerApplicationAttempt
 
   void trackContainerForPreemption(RMContainer container) {
     synchronized (preemptionVariablesLock) {
-      if (containersToPreempt.add(container)) {
-        Resources.addTo(preemptedResources, container.getAllocatedResource());
+      if (containersToBePreempted.add(container)) {
+        Resources.addTo(resourcesToBePreempted,
+            container.getAllocatedResource());
       }
     }
   }
 
   private void untrackContainerForPreemption(RMContainer container) {
     synchronized (preemptionVariablesLock) {
-      if (containersToPreempt.remove(container)) {
-        Resources.subtractFrom(preemptedResources,
+      if (containersToBePreempted.remove(container)) {
+        Resources.subtractFrom(resourcesToBePreempted,
             container.getAllocatedResource());
       }
     }
@@ -583,7 +585,7 @@ public class FSAppAttempt extends 
SchedulerApplicationAttempt
   Set<ContainerId> getPreemptionContainerIds() {
     synchronized (preemptionVariablesLock) {
       Set<ContainerId> preemptionContainerIds = new HashSet<>();
-      for (RMContainer container : containersToPreempt) {
+      for (RMContainer container : containersToBePreempted) {
         preemptionContainerIds.add(container.getContainerId());
       }
       return preemptionContainerIds;
@@ -604,7 +606,7 @@ public class FSAppAttempt extends 
SchedulerApplicationAttempt
     }
 
     synchronized (preemptionVariablesLock) {
-      if (containersToPreempt.contains(container)) {
+      if (containersToBePreempted.contains(container)) {
         // The container is already under consideration for preemption
         return false;
       }
@@ -1269,9 +1271,9 @@ public class FSAppAttempt extends 
SchedulerApplicationAttempt
     // Subtract copies the object, so that we have a snapshot,
     // in case usage changes, while the caller is using the value
     synchronized (preemptionVariablesLock) {
-      return containersToPreempt.isEmpty()
+      return containersToBePreempted.isEmpty()
           ? getCurrentConsumption()
-          : Resources.subtract(getCurrentConsumption(), preemptedResources);
+          : Resources.subtract(getCurrentConsumption(), 
resourcesToBePreempted);
     }
   }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to