From 958e8c0e257216c82f68fee726e5280a919da94a Mon Sep 17 00:00:00 2001 From: Wangda Tan Date: Fri, 15 Sep 2017 21:24:11 -0700 Subject: [PATCH] YARN-6977. Node information is not provided for non am containers in RM logs. (Suma Shivaprasad via wangda) Change-Id: I0c44d09a560446dee2ba68c2b9ae69fce0ec1d3e (cherry picked from commit 8a42e922fad613f3cf1cc6cb0f3fa72546a9cc56) --- .../resourcemanager/scheduler/SchedulerNode.java | 8 -------- .../scheduler/common/fica/FiCaSchedulerNode.java | 13 +++++++++++++ .../scheduler/fair/FSSchedulerNode.java | 10 ++++++++++ 3 files changed, 23 insertions(+), 8 deletions(-) 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/SchedulerNode.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/SchedulerNode.java index 272537c8bf..90fa3e4ebc 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/SchedulerNode.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/SchedulerNode.java @@ -170,14 +170,6 @@ protected synchronized void allocateContainer(RMContainer rmContainer, launchedContainers.put(container.getId(), new ContainerInfo(rmContainer, launchedOnNode)); - - if (LOG.isDebugEnabled()) { - LOG.debug("Assigned container " + container.getId() + " of capacity " - + container.getResource() + " on host " + rmNode.getNodeAddress() - + ", which has " + numContainers + " containers, " - + getAllocatedResource() + " used and " + getUnallocatedResource() - + " available after allocation"); - } } /** 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/common/fica/FiCaSchedulerNode.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/common/fica/FiCaSchedulerNode.java index c26a11bf8a..7277779b1c 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/common/fica/FiCaSchedulerNode.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/common/fica/FiCaSchedulerNode.java @@ -160,4 +160,17 @@ public synchronized Resource getTotalKillableResources() { public synchronized Map getKillableContainers() { return Collections.unmodifiableMap(killableContainers); } + + protected synchronized void allocateContainer(RMContainer rmContainer, + boolean launchedOnNode) { + super.allocateContainer(rmContainer, launchedOnNode); + + final Container container = rmContainer.getContainer(); + LOG.info("Assigned container " + container.getId() + " of capacity " + + container.getResource() + " on host " + getRMNode().getNodeAddress() + + ", which has " + getNumContainers() + " containers, " + + getAllocatedResource() + " used and " + getUnallocatedResource() + + " available after allocation"); + } + } 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/FSSchedulerNode.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/FSSchedulerNode.java index 93646f47ca..44ec9c3bc8 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/FSSchedulerNode.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/FSSchedulerNode.java @@ -25,6 +25,7 @@ import org.apache.hadoop.classification.InterfaceAudience.Private; import org.apache.hadoop.classification.InterfaceStability.Unstable; import org.apache.hadoop.yarn.api.records.ApplicationAttemptId; +import org.apache.hadoop.yarn.api.records.Container; import org.apache.hadoop.yarn.api.records.ContainerId; import org.apache.hadoop.yarn.api.records.Resource; import org.apache.hadoop.yarn.server.resourcemanager.rmcontainer.RMContainer; @@ -239,6 +240,15 @@ Set getContainersForPreemption() { protected synchronized void allocateContainer(RMContainer rmContainer, boolean launchedOnNode) { super.allocateContainer(rmContainer, launchedOnNode); + if (LOG.isDebugEnabled()) { + final Container container = rmContainer.getContainer(); + LOG.debug("Assigned container " + container.getId() + " of capacity " + + container.getResource() + " on host " + getRMNode().getNodeAddress() + + ", which has " + getNumContainers() + " containers, " + + getAllocatedResource() + " used and " + getUnallocatedResource() + + " available after allocation"); + } + Resource allocated = rmContainer.getAllocatedResource(); if (!Resources.isNone(allocated)) { // check for satisfied preemption request and update bookkeeping