YARN-9685: NPE when rendering the info table of leaf queue in non-accessible partitions. Contributed by Tao Yang.
(cherry picked from commit 3b38f2019e
)
This commit is contained in:
parent
f6ce2f4a50
commit
b131214685
|
@ -157,9 +157,11 @@ class CapacitySchedulerPage extends RmView {
|
||||||
: resourceUsages.getAmUsed();
|
: resourceUsages.getAmUsed();
|
||||||
ri.
|
ri.
|
||||||
__("Used Capacity:",
|
__("Used Capacity:",
|
||||||
appendPercent(resourceUsages.getUsed().toString(),
|
appendPercent(resourceUsages.getUsed(),
|
||||||
capacities.getUsedCapacity() / 100))
|
capacities.getUsedCapacity() / 100))
|
||||||
.__("Configured Capacity:",
|
.__("Configured Capacity:",
|
||||||
|
capacities.getConfiguredMinResource() == null ?
|
||||||
|
Resources.none().toString() :
|
||||||
capacities.getConfiguredMinResource().toString())
|
capacities.getConfiguredMinResource().toString())
|
||||||
.__("Configured Max Capacity:",
|
.__("Configured Max Capacity:",
|
||||||
(capacities.getConfiguredMaxResource() == null
|
(capacities.getConfiguredMaxResource() == null
|
||||||
|
@ -168,10 +170,10 @@ class CapacitySchedulerPage extends RmView {
|
||||||
? "unlimited"
|
? "unlimited"
|
||||||
: capacities.getConfiguredMaxResource().toString())
|
: capacities.getConfiguredMaxResource().toString())
|
||||||
.__("Effective Capacity:",
|
.__("Effective Capacity:",
|
||||||
appendPercent(capacities.getEffectiveMinResource().toString(),
|
appendPercent(capacities.getEffectiveMinResource(),
|
||||||
capacities.getCapacity() / 100))
|
capacities.getCapacity() / 100))
|
||||||
.__("Effective Max Capacity:",
|
.__("Effective Max Capacity:",
|
||||||
appendPercent(capacities.getEffectiveMaxResource().toString(),
|
appendPercent(capacities.getEffectiveMaxResource(),
|
||||||
capacities.getMaxCapacity() / 100))
|
capacities.getMaxCapacity() / 100))
|
||||||
.__("Absolute Used Capacity:",
|
.__("Absolute Used Capacity:",
|
||||||
percent(capacities.getAbsoluteUsedCapacity() / 100))
|
percent(capacities.getAbsoluteUsedCapacity() / 100))
|
||||||
|
@ -320,6 +322,8 @@ class CapacitySchedulerPage extends RmView {
|
||||||
boolean isAutoCreatedLeafQueue = info.isLeafQueue() ?
|
boolean isAutoCreatedLeafQueue = info.isLeafQueue() ?
|
||||||
((CapacitySchedulerLeafQueueInfo) info).isAutoCreatedLeafQueue()
|
((CapacitySchedulerLeafQueueInfo) info).isAutoCreatedLeafQueue()
|
||||||
: false;
|
: false;
|
||||||
|
float capPercent = absMaxCap == 0 ? 0 : absCap/absMaxCap;
|
||||||
|
float usedCapPercent = absMaxCap == 0 ? 0 : absUsedCap/absMaxCap;
|
||||||
|
|
||||||
String Q_WIDTH = width(absMaxCap * Q_MAX_WIDTH);
|
String Q_WIDTH = width(absMaxCap * Q_MAX_WIDTH);
|
||||||
LI<UL<Hamlet>> li = ul.
|
LI<UL<Hamlet>> li = ul.
|
||||||
|
@ -328,9 +332,9 @@ class CapacitySchedulerPage extends RmView {
|
||||||
Q_WIDTH)
|
Q_WIDTH)
|
||||||
: Q_WIDTH).
|
: Q_WIDTH).
|
||||||
$title(join("Absolute Capacity:", percent(absCap))).
|
$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)).
|
";font-size:1px;left:0%;", absUsedCap > absCap ? Q_OVER : Q_UNDER)).
|
||||||
__('.').__().
|
__('.').__().
|
||||||
span(".q", "Queue: "+info.getQueuePath().substring(5)).__().
|
span(".q", "Queue: "+info.getQueuePath().substring(5)).__().
|
||||||
|
@ -658,8 +662,12 @@ class CapacitySchedulerPage extends RmView {
|
||||||
return QueuesBlock.class;
|
return QueuesBlock.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
static String appendPercent(String message, float f) {
|
static String appendPercent(ResourceInfo resourceInfo, float f) {
|
||||||
return message + " (" + StringUtils.formatPercent(f, 1) + ")";
|
if (resourceInfo == null) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
return resourceInfo.toString() + " ("
|
||||||
|
+ StringUtils.formatPercent(f, 1) + ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
static String percent(float f) {
|
static String percent(float f) {
|
||||||
|
|
|
@ -136,7 +136,8 @@ public class PartitionQueueCapacitiesInfo {
|
||||||
}
|
}
|
||||||
|
|
||||||
public ResourceInfo getConfiguredMaxResource() {
|
public ResourceInfo getConfiguredMaxResource() {
|
||||||
if (configuredMaxResource.getResource().equals(Resources.none())) {
|
if (configuredMaxResource == null
|
||||||
|
|| configuredMaxResource.getResource().equals(Resources.none())) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return configuredMaxResource;
|
return configuredMaxResource;
|
||||||
|
|
Loading…
Reference in New Issue