YARN-10588. Percentage of queue and cluster is zero in WebUI . Contributed by Bilwa S T
(cherry picked from commit aa4c17b9d7
)
This commit is contained in:
parent
e2aaa10512
commit
f5810ea83c
|
@ -166,4 +166,9 @@ public class DefaultResourceCalculator extends ResourceCalculator {
|
|||
return ImmutableSet.of();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAllInvalidDivisor(Resource r) {
|
||||
return isInvalidDivisor(r);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -388,6 +388,7 @@ public class DominantResourceCalculator extends ResourceCalculator {
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAllInvalidDivisor(Resource r) {
|
||||
boolean flag = true;
|
||||
for (ResourceInformation res : r.getResources()) {
|
||||
|
|
|
@ -225,6 +225,15 @@ public abstract class ResourceCalculator {
|
|||
*/
|
||||
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>.
|
||||
*
|
||||
|
|
|
@ -1138,7 +1138,7 @@ public class SchedulerApplicationAttempt implements SchedulableEntity {
|
|||
.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,
|
||||
|
|
|
@ -1113,7 +1113,7 @@ public class FiCaSchedulerApp extends SchedulerApplicationAttempt {
|
|||
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())) {
|
||||
|
|
Loading…
Reference in New Issue