YARN-2907. SchedulerNode#toString should print all resource detail instead of only memory. (Contributed by Rohith)

(cherry picked from commit c732ed760e)
This commit is contained in:
Junping Du 2014-12-01 05:38:22 -08:00
parent f4ab306347
commit c7bd22974a
3 changed files with 13 additions and 3 deletions

View File

@ -74,6 +74,9 @@ Release 2.7.0 - UNRELEASED
YARN-2165. Added the sanity check for the numeric configuration values of YARN-2165. Added the sanity check for the numeric configuration values of
the timeline service. (Vasanth kumar RJ via zjshen) 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 OPTIMIZATIONS
BUG FIXES BUG FIXES

View File

@ -242,9 +242,8 @@ public abstract class SchedulerNode {
@Override @Override
public String toString() { public String toString() {
return "host: " + rmNode.getNodeAddress() + " #containers=" return "host: " + rmNode.getNodeAddress() + " #containers="
+ getNumContainers() + " available=" + getNumContainers() + " available=" + getAvailableResource()
+ getAvailableResource().getMemory() + " used=" + " used=" + getUsedResource();
+ getUsedResource().getMemory();
} }
/** /**

View File

@ -214,6 +214,14 @@ public class TestWorkPreservingRMRestart {
AbstractYarnScheduler scheduler = AbstractYarnScheduler scheduler =
(AbstractYarnScheduler) rm2.getResourceScheduler(); (AbstractYarnScheduler) rm2.getResourceScheduler();
SchedulerNode schedulerNode1 = scheduler.getSchedulerNode(nm1.getNodeId()); 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.******* // ********* check scheduler node state.*******
// 2 running containers. // 2 running containers.