From 4b1dcbbe0c1d0036f65283be4b25d9b2211abed3 Mon Sep 17 00:00:00 2001 From: Karthik Kambatla Date: Tue, 26 Apr 2016 05:10:09 -0700 Subject: [PATCH] YARN-1297. FairScheduler: Move some logs to debug and check if debug logging is enabled --- .../rmcontainer/RMContainerImpl.java | 5 ++- .../scheduler/SchedulerNode.java | 36 +++++++++++-------- .../scheduler/fair/FSAppAttempt.java | 12 ++++--- .../scheduler/fair/FairScheduler.java | 16 +++++---- 4 files changed, 42 insertions(+), 27 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/rmcontainer/RMContainerImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmcontainer/RMContainerImpl.java index 16ab55df643..919f12d40bd 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmcontainer/RMContainerImpl.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmcontainer/RMContainerImpl.java @@ -435,7 +435,10 @@ public class RMContainerImpl implements RMContainer, Comparable { @Override public void handle(RMContainerEvent event) { - LOG.debug("Processing " + event.getContainerId() + " of type " + event.getType()); + if (LOG.isDebugEnabled()) { + LOG.debug("Processing " + event.getContainerId() + " of type " + event + .getType()); + } try { writeLock.lock(); RMContainerState oldState = getState(); 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 6c4f30081bb..e219494426e 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 @@ -154,11 +154,13 @@ public abstract class SchedulerNode { launchedContainers.put(container.getId(), rmContainer); - LOG.info("Assigned container " + container.getId() + " of capacity " - + container.getResource() + " on host " + rmNode.getNodeAddress() - + ", which has " + numContainers + " containers, " - + getAllocatedResource() + " used and " + getUnallocatedResource() - + " available after allocation"); + 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"); + } } /** @@ -175,11 +177,13 @@ public abstract class SchedulerNode { addUnallocatedResource(deltaResource); } - LOG.info((increase ? "Increased" : "Decreased") + " container " - + containerId + " of capacity " + deltaResource + " on host " - + rmNode.getNodeAddress() + ", which has " + numContainers - + " containers, " + getAllocatedResource() + " used and " - + getUnallocatedResource() + " available after allocation"); + if (LOG.isDebugEnabled()) { + LOG.debug((increase ? "Increased" : "Decreased") + " container " + + containerId + " of capacity " + deltaResource + " on host " + + rmNode.getNodeAddress() + ", which has " + numContainers + + " containers, " + getAllocatedResource() + " used and " + + getUnallocatedResource() + " available after allocation"); + } } /** @@ -261,11 +265,13 @@ public abstract class SchedulerNode { updateResource(container); } - LOG.info("Released container " + container.getId() + " of capacity " - + container.getResource() + " on host " + rmNode.getNodeAddress() - + ", which currently has " + numContainers + " containers, " - + getAllocatedResource() + " used and " + getUnallocatedResource() - + " available" + ", release resources=" + true); + if (LOG.isDebugEnabled()) { + LOG.debug("Released container " + container.getId() + " of capacity " + + container.getResource() + " on host " + rmNode.getNodeAddress() + + ", which currently has " + numContainers + " containers, " + + getAllocatedResource() + " used and " + getUnallocatedResource() + + " available" + ", release resources=" + true); + } } /** 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 e426da621f0..0190742fe33 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 @@ -135,12 +135,14 @@ public class FSAppAttempt extends SchedulerApplicationAttempt rmContainer.handle( new RMContainerFinishedEvent( containerId, - containerStatus, + containerStatus, event) - ); - LOG.info("Completed container: " + rmContainer.getContainerId() + - " in state: " + rmContainer.getState() + " event:" + event); - + ); + if (LOG.isDebugEnabled()) { + LOG.debug("Completed container: " + rmContainer.getContainerId() + + " in state: " + rmContainer.getState() + " event:" + event); + } + // Remove from the list of containers liveContainers.remove(rmContainer.getContainerId()); 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/FairScheduler.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/FairScheduler.java index 3df060026db..6a14c4c8674 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/FairScheduler.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/FairScheduler.java @@ -494,9 +494,11 @@ public class FairScheduler extends // TODO: Not sure if this ever actually adds this to the list of cleanup // containers on the RMNode (see SchedulerNode.releaseContainer()). super.completedContainer(container, status, RMContainerEventType.KILL); - LOG.info("Killing container" + container + - " (after waiting for preemption for " + - (getClock().getTime() - time) + "ms)"); + if (LOG.isDebugEnabled()) { + LOG.debug("Killing container" + container + + " (after waiting for preemption for " + + (getClock().getTime() - time) + "ms)"); + } } } else { // track the request in the FSAppAttempt itself @@ -869,9 +871,11 @@ public class FairScheduler extends updateRootQueueMetrics(); } - LOG.info("Application attempt " + application.getApplicationAttemptId() - + " released container " + container.getId() + " on node: " + node - + " with event: " + event); + if (LOG.isDebugEnabled()) { + LOG.debug("Application attempt " + application.getApplicationAttemptId() + + " released container " + container.getId() + " on node: " + node + + " with event: " + event); + } } private synchronized void addNode(List containerReports,