From c732ed760e115192652280cd4b5799d49e62db7e 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) --- 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 e8b82a06c0..22de88b87c 100644 --- a/hadoop-yarn-project/CHANGES.txt +++ b/hadoop-yarn-project/CHANGES.txt @@ -101,6 +101,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 f4d8731a01..b115fc896a 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 void reserveResource(SchedulerApplicationAttempt attempt, @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 1cefcf851f..853e0a57e0 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 void testSchedulerRecovery() throws Exception { 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.