hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xg...@apache.org
Subject [04/50] [abbrv] hadoop git commit: YARN-6582. FSAppAttempt demand can be updated atomically in updateDemand(). (Karthik Kambatla via Yufei Gu)
Date Mon, 05 Jun 2017 20:30:53 GMT
YARN-6582. FSAppAttempt demand can be updated atomically in updateDemand(). (Karthik Kambatla
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/acc62866
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/acc62866
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/acc62866

Branch: refs/heads/YARN-5734
Commit: acc62866db8f0b8620b12aee84e57fd386e612b2
Parents: 06ec20c
Author: Yufei Gu <yufei@apache.org>
Authored: Thu May 25 14:22:13 2017 -0700
Committer: Xuan <xgong@apache.org>
Committed: Mon Jun 5 13:29:19 2017 -0700

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


http://git-wip-us.apache.org/repos/asf/hadoop/blob/acc62866/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 4f7e164..a5772ba 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
@@ -1286,24 +1286,21 @@ public class FSAppAttempt extends SchedulerApplicationAttempt
 
   @Override
   public void updateDemand() {
-    demand = Resources.createResource(0);
     // Demand is current consumption plus outstanding requests
-    Resources.addTo(demand, getCurrentConsumption());
+    Resource tmpDemand = Resources.clone(getCurrentConsumption());
 
     // Add up outstanding resource requests
-    try {
-      writeLock.lock();
-      for (SchedulerRequestKey k : getSchedulerKeys()) {
-        PendingAsk pendingAsk = getPendingAsk(k, ResourceRequest.ANY);
-        if (pendingAsk.getCount() > 0) {
-          Resources.multiplyAndAddTo(demand,
-              pendingAsk.getPerAllocationResource(),
-              pendingAsk.getCount());
-        }
+    for (SchedulerRequestKey k : getSchedulerKeys()) {
+      PendingAsk pendingAsk = getPendingAsk(k, ResourceRequest.ANY);
+      if (pendingAsk.getCount() > 0) {
+        Resources.multiplyAndAddTo(tmpDemand,
+            pendingAsk.getPerAllocationResource(),
+            pendingAsk.getCount());
       }
-    } finally {
-      writeLock.unlock();
     }
+
+    // Update demand
+    demand = tmpDemand;
   }
 
   @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