Browse Source

YARN-6493. Print requested node partition in assignContainer logs. (Jonathan Hung via wangda)

Change-Id: I3c5c012eb8d0887a4a37d58662bc37aac07ea86e
Wangda Tan 8 years ago
parent
commit
836e8f3e69

+ 11 - 3
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/allocator/AbstractContainerAllocator.java

@@ -88,16 +88,24 @@ public abstract class AbstractContainerAllocator {
       } else if (result.getAllocationState() == AllocationState.ALLOCATED){
         // This is a new container
         // Inform the ordering policy
+        RMContainer allocatedContainer = application.getRMContainer(
+            updatedContainer.getId());
+        if (allocatedContainer == null) {
+          LOG.warn("Allocated container for containerId "
+              + updatedContainer.getId() + " is null.");
+        }
         LOG.info("assignedContainer" + " application attempt="
             + application.getApplicationAttemptId() + " container="
             + updatedContainer.getId() + " queue=" + this + " clusterResource="
-            + clusterResource + " type=" + assignment.getType());
+            + clusterResource + " type=" + assignment.getType()
+            + " requestedPartition="
+            + (allocatedContainer == null ? "null" :
+                allocatedContainer.getNodeLabelExpression()));
 
         application
             .getCSLeafQueue()
             .getOrderingPolicy()
-            .containerAllocated(application,
-                application.getRMContainer(updatedContainer.getId()));
+            .containerAllocated(application, allocatedContainer);
 
         assignment.getAssignmentInformation().addAllocationDetails(
             updatedContainer.getId(),