Browse Source

YARN-3258. FairScheduler: Need to add more logging to investigate allocations. Contributed by Anubhav Dhoot.

(cherry picked from commit b5a22e983832d4843b5df1d07858988e8bbf37e3)
Tsuyoshi Ozawa 10 years ago
parent
commit
99b8255693

+ 3 - 0
hadoop-yarn-project/CHANGES.txt

@@ -38,6 +38,9 @@ Release 2.8.0 - UNRELEASED
     YARN-2495. Allow admin specify labels from each NM (Distributed 
     configuration for node label). (Naganarasimha G R via wangda)
 
+    YARN-3258. FairScheduler: Need to add more logging to investigate
+    allocations. (Anubhav Dhoot via ozawa)
+
   OPTIMIZATIONS
 
     YARN-3339. TestDockerContainerExecutor should pull a single image and not

+ 4 - 0
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

@@ -570,6 +570,10 @@ public class FSAppAttempt extends SchedulerApplicationAttempt
         // Check the AM resource usage for the leaf queue
         if (getLiveContainers().size() == 0 && !getUnmanagedAM()) {
           if (!getQueue().canRunAppAM(getAMResource())) {
+            if (LOG.isDebugEnabled()) {
+              LOG.debug("Skipping allocation because maxAMShare limit would " +
+                  "be exceeded");
+            }
             return Resources.none();
           }
         }

+ 7 - 1
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/FSLeafQueue.java

@@ -284,6 +284,8 @@ public class FSLeafQueue extends FSQueue {
     if (LOG.isDebugEnabled()) {
       LOG.debug("The updated demand for " + getName() + " is " + demand
           + "; the max is " + maxRes);
+      LOG.debug("The updated fairshare for " + getName() + " is "
+          + getFairShare());
     }
   }
   
@@ -304,7 +306,7 @@ public class FSLeafQueue extends FSQueue {
     Resource assigned = Resources.none();
     if (LOG.isDebugEnabled()) {
       LOG.debug("Node " + node.getNodeName() + " offered to queue: " +
-          getName());
+          getName() + " fairShare: " + getFairShare());
     }
 
     if (!assignContainerPreCheck(node)) {
@@ -330,6 +332,10 @@ public class FSLeafQueue extends FSQueue {
 
         assigned = sched.assignContainer(node);
         if (!assigned.equals(Resources.none())) {
+          if (LOG.isDebugEnabled()) {
+            LOG.debug("Assigned container in queue:" + getName() + " " +
+                "container:" + assigned);
+          }
           break;
         }
       }

+ 8 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/FSQueue.java

@@ -23,6 +23,8 @@ import java.util.Collection;
 import java.util.List;
 import java.util.Set;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.classification.InterfaceAudience.Private;
 import org.apache.hadoop.classification.InterfaceStability.Unstable;
 import org.apache.hadoop.security.UserGroupInformation;
@@ -41,6 +43,9 @@ import org.apache.hadoop.yarn.util.resource.Resources;
 @Private
 @Unstable
 public abstract class FSQueue implements Queue, Schedulable {
+  private static final Log LOG = LogFactory.getLog(
+      FSQueue.class.getName());
+
   private Resource fairShare = Resources.createResource(0, 0);
   private Resource steadyFairShare = Resources.createResource(0, 0);
   private final String name;
@@ -164,6 +169,9 @@ public abstract class FSQueue implements Queue, Schedulable {
   public void setFairShare(Resource fairShare) {
     this.fairShare = fairShare;
     metrics.setFairShare(fairShare);
+    if (LOG.isDebugEnabled()) {
+      LOG.debug("The updated fairShare for " + getName() + " is " + fairShare);
+    }
   }
 
   /** Get the steady fair share assigned to this Schedulable. */