Skip to content

Commit

Permalink
YARN-10588. Percentage of queue and cluster is zero in WebUI . Contri…
Browse files Browse the repository at this point in the history
…buted by Bilwa S T
  • Loading branch information
erichadoop committed Mar 15, 2021
1 parent 9b2f812 commit aa4c17b
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -166,4 +166,9 @@ public Set<String> getInsufficientResourceNames(Resource required,
return ImmutableSet.of();
}
}

@Override
public boolean isAllInvalidDivisor(Resource r) {
return isInvalidDivisor(r);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,7 @@ public boolean isInvalidDivisor(Resource r) {
return false;
}

@Override
public boolean isAllInvalidDivisor(Resource r) {
boolean flag = true;
for (ResourceInformation res : r.getResources()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,15 @@ public abstract float divide(
*/
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>.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1138,7 +1138,7 @@ public ApplicationResourceUsageReport getResourceUsageReport() {
.put(ResourceInformation.VCORES.getName(), 0L);
float queueUsagePerc = 0.0f;
float clusterUsagePerc = 0.0f;
if (!calc.isInvalidDivisor(cluster)) {
if (!calc.isAllInvalidDivisor(cluster)) {
float queueCapacityPerc = queue.getQueueInfo(false, false)
.getCapacity();
queueUsagePerc = calc.divide(cluster, usedResourceClone,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1113,7 +1113,7 @@ public ApplicationResourceUsageReport getResourceUsageReport() {
ResourceCalculator calc =
rmContext.getScheduler().getResourceCalculator();
float queueUsagePerc = 0.0f;
if (!calc.isInvalidDivisor(totalPartitionRes)) {
if (!calc.isAllInvalidDivisor(totalPartitionRes)) {
Resource effCap = ((AbstractCSQueue) getQueue())
.getEffectiveCapacity(getAppAMNodePartitionName());
if (!effCap.equals(Resources.none())) {
Expand Down

0 comments on commit aa4c17b

Please sign in to comment.