YARN-10588. Percentage of queue and cluster is zero in WebUI . Contributed by Bilwa S T
(cherry picked from commit aa4c17b9d7af122163789a731ced05f740562e45)
This commit is contained in:
parent
e2aaa10512
commit
f5810ea83c
@ -166,4 +166,9 @@ public Set<String> getInsufficientResourceNames(Resource required,
|
|||||||
return ImmutableSet.of();
|
return ImmutableSet.of();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAllInvalidDivisor(Resource r) {
|
||||||
|
return isInvalidDivisor(r);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -388,6 +388,7 @@ public boolean isInvalidDivisor(Resource r) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isAllInvalidDivisor(Resource r) {
|
public boolean isAllInvalidDivisor(Resource r) {
|
||||||
boolean flag = true;
|
boolean flag = true;
|
||||||
for (ResourceInformation res : r.getResources()) {
|
for (ResourceInformation res : r.getResources()) {
|
||||||
|
@ -225,6 +225,15 @@ public abstract float divide(
|
|||||||
*/
|
*/
|
||||||
public abstract boolean isInvalidDivisor(Resource r);
|
public abstract boolean isInvalidDivisor(Resource r);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine if all resources are zero.
|
||||||
|
*
|
||||||
|
* @param r resource
|
||||||
|
* @return true if all divisors are invalid (should not be used), false else
|
||||||
|
*/
|
||||||
|
public abstract boolean isAllInvalidDivisor(Resource r);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ratio of resource <code>a</code> to resource <code>b</code>.
|
* Ratio of resource <code>a</code> to resource <code>b</code>.
|
||||||
*
|
*
|
||||||
|
@ -1138,7 +1138,7 @@ public ApplicationResourceUsageReport getResourceUsageReport() {
|
|||||||
.put(ResourceInformation.VCORES.getName(), 0L);
|
.put(ResourceInformation.VCORES.getName(), 0L);
|
||||||
float queueUsagePerc = 0.0f;
|
float queueUsagePerc = 0.0f;
|
||||||
float clusterUsagePerc = 0.0f;
|
float clusterUsagePerc = 0.0f;
|
||||||
if (!calc.isInvalidDivisor(cluster)) {
|
if (!calc.isAllInvalidDivisor(cluster)) {
|
||||||
float queueCapacityPerc = queue.getQueueInfo(false, false)
|
float queueCapacityPerc = queue.getQueueInfo(false, false)
|
||||||
.getCapacity();
|
.getCapacity();
|
||||||
queueUsagePerc = calc.divide(cluster, usedResourceClone,
|
queueUsagePerc = calc.divide(cluster, usedResourceClone,
|
||||||
|
@ -1113,7 +1113,7 @@ public ApplicationResourceUsageReport getResourceUsageReport() {
|
|||||||
ResourceCalculator calc =
|
ResourceCalculator calc =
|
||||||
rmContext.getScheduler().getResourceCalculator();
|
rmContext.getScheduler().getResourceCalculator();
|
||||||
float queueUsagePerc = 0.0f;
|
float queueUsagePerc = 0.0f;
|
||||||
if (!calc.isInvalidDivisor(totalPartitionRes)) {
|
if (!calc.isAllInvalidDivisor(totalPartitionRes)) {
|
||||||
Resource effCap = ((AbstractCSQueue) getQueue())
|
Resource effCap = ((AbstractCSQueue) getQueue())
|
||||||
.getEffectiveCapacity(getAppAMNodePartitionName());
|
.getEffectiveCapacity(getAppAMNodePartitionName());
|
||||||
if (!effCap.equals(Resources.none())) {
|
if (!effCap.equals(Resources.none())) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user