From c7bd22974a0f71de55c2ae37416528583e3eda06 Mon Sep 17 00:00:00 2001 From: Junping Du Date: Mon, 1 Dec 2014 05:38:22 -0800 Subject: [PATCH] YARN-2907. SchedulerNode#toString should print all resource detail instead of only memory. (Contributed by Rohith) (cherry picked from commit c732ed760e115192652280cd4b5799d49e62db7e) --- hadoop-yarn-project/CHANGES.txt | 3 +++ .../server/resourcemanager/scheduler/SchedulerNode.java | 5 ++--- .../resourcemanager/TestWorkPreservingRMRestart.java | 8 ++++++++ 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt index ded5c2367af..f9ec5eda4b5 100644 --- a/hadoop-yarn-project/CHANGES.txt +++ b/hadoop-yarn-project/CHANGES.txt @@ -74,6 +74,9 @@ Release 2.7.0 - UNRELEASED YARN-2165. Added the sanity check for the numeric configuration values of the timeline service. (Vasanth kumar RJ via zjshen) + YARN-2907. SchedulerNode#toString should print all resource detail instead + of only memory. (Rohith via junping_du) + OPTIMIZATIONS BUG FIXES 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 f4d8731a012..b115fc896a2 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 @@ -242,9 +242,8 @@ public abstract class SchedulerNode { @Override public String toString() { return "host: " + rmNode.getNodeAddress() + " #containers=" - + getNumContainers() + " available=" - + getAvailableResource().getMemory() + " used=" - + getUsedResource().getMemory(); + + getNumContainers() + " available=" + getAvailableResource() + + " used=" + getUsedResource(); } /** diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestWorkPreservingRMRestart.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestWorkPreservingRMRestart.java index 1cefcf851fb..853e0a57e0b 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestWorkPreservingRMRestart.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestWorkPreservingRMRestart.java @@ -214,6 +214,14 @@ public class TestWorkPreservingRMRestart { AbstractYarnScheduler scheduler = (AbstractYarnScheduler) rm2.getResourceScheduler(); SchedulerNode schedulerNode1 = scheduler.getSchedulerNode(nm1.getNodeId()); + assertTrue( + "SchedulerNode#toString is not in expected format", + schedulerNode1 + .toString().contains(schedulerNode1.getAvailableResource().toString())); + assertTrue( + "SchedulerNode#toString is not in expected format", + schedulerNode1 + .toString().contains(schedulerNode1.getUsedResource().toString())); // ********* check scheduler node state.******* // 2 running containers.