You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by ep...@apache.org on 2019/08/08 12:52:57 UTC
[hadoop] branch trunk updated: YARN-9685: NPE when rendering the
info table of leaf queue in non-accessible partitions. Contributed by Tao
Yang.
This is an automated email from the ASF dual-hosted git repository.
epayne pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/hadoop.git
The following commit(s) were added to refs/heads/trunk by this push:
new 3b38f20 YARN-9685: NPE when rendering the info table of leaf queue in non-accessible partitions. Contributed by Tao Yang.
3b38f20 is described below
commit 3b38f2019e4f8d056580f3ed67ecef591011d7a6
Author: Eric E Payne <er...@verizonmedia.com>
AuthorDate: Thu Aug 8 12:37:50 2019 +0000
YARN-9685: NPE when rendering the info table of leaf queue in non-accessible partitions. Contributed by Tao Yang.
---
.../webapp/CapacitySchedulerPage.java | 24 ++++++++++++++--------
.../webapp/dao/PartitionQueueCapacitiesInfo.java | 3 ++-
2 files changed, 18 insertions(+), 9 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/webapp/CapacitySchedulerPage.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/CapacitySchedulerPage.java
index ed2f64e..8f68e83 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/CapacitySchedulerPage.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/CapacitySchedulerPage.java
@@ -157,10 +157,12 @@ class CapacitySchedulerPage extends RmView {
: resourceUsages.getAmUsed();
ri.
__("Used Capacity:",
- appendPercent(resourceUsages.getUsed().toString(),
+ appendPercent(resourceUsages.getUsed(),
capacities.getUsedCapacity() / 100))
.__("Configured Capacity:",
- capacities.getConfiguredMinResource().toString())
+ capacities.getConfiguredMinResource() == null ?
+ Resources.none().toString() :
+ capacities.getConfiguredMinResource().toString())
.__("Configured Max Capacity:",
(capacities.getConfiguredMaxResource() == null
|| capacities.getConfiguredMaxResource().getResource()
@@ -168,10 +170,10 @@ class CapacitySchedulerPage extends RmView {
? "unlimited"
: capacities.getConfiguredMaxResource().toString())
.__("Effective Capacity:",
- appendPercent(capacities.getEffectiveMinResource().toString(),
+ appendPercent(capacities.getEffectiveMinResource(),
capacities.getCapacity() / 100))
.__("Effective Max Capacity:",
- appendPercent(capacities.getEffectiveMaxResource().toString(),
+ appendPercent(capacities.getEffectiveMaxResource(),
capacities.getMaxCapacity() / 100))
.__("Absolute Used Capacity:",
percent(capacities.getAbsoluteUsedCapacity() / 100))
@@ -320,6 +322,8 @@ class CapacitySchedulerPage extends RmView {
boolean isAutoCreatedLeafQueue = info.isLeafQueue() ?
((CapacitySchedulerLeafQueueInfo) info).isAutoCreatedLeafQueue()
: false;
+ float capPercent = absMaxCap == 0 ? 0 : absCap/absMaxCap;
+ float usedCapPercent = absMaxCap == 0 ? 0 : absUsedCap/absMaxCap;
String Q_WIDTH = width(absMaxCap * Q_MAX_WIDTH);
LI<UL<Hamlet>> li = ul.
@@ -328,9 +332,9 @@ class CapacitySchedulerPage extends RmView {
Q_WIDTH)
: Q_WIDTH).
$title(join("Absolute Capacity:", percent(absCap))).
- span().$style(join(Q_GIVEN, ";font-size:1px;", width(absCap/absMaxCap))).
+ span().$style(join(Q_GIVEN, ";font-size:1px;", width(capPercent))).
__('.').__().
- span().$style(join(width(absUsedCap/absMaxCap),
+ span().$style(join(width(usedCapPercent),
";font-size:1px;left:0%;", absUsedCap > absCap ? Q_OVER : Q_UNDER)).
__('.').__().
span(".q", "Queue: "+info.getQueuePath().substring(5)).__().
@@ -658,8 +662,12 @@ class CapacitySchedulerPage extends RmView {
return QueuesBlock.class;
}
- static String appendPercent(String message, float f) {
- return message + " (" + StringUtils.formatPercent(f, 1) + ")";
+ static String appendPercent(ResourceInfo resourceInfo, float f) {
+ if (resourceInfo == null) {
+ return "";
+ }
+ return resourceInfo.toString() + " ("
+ + StringUtils.formatPercent(f, 1) + ")";
}
static String percent(float f) {
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/dao/PartitionQueueCapacitiesInfo.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/dao/PartitionQueueCapacitiesInfo.java
index 2a15502..cc4b565 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/dao/PartitionQueueCapacitiesInfo.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/dao/PartitionQueueCapacitiesInfo.java
@@ -136,7 +136,8 @@ public class PartitionQueueCapacitiesInfo {
}
public ResourceInfo getConfiguredMaxResource() {
- if (configuredMaxResource.getResource().equals(Resources.none())) {
+ if (configuredMaxResource == null
+ || configuredMaxResource.getResource().equals(Resources.none())) {
return null;
}
return configuredMaxResource;
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org