YARN-7699. queueUsagePercentage is coming as INF for getApp REST api call. Contributed by Sunil G.

This commit is contained in:
Rohith Sharma K S 2018-01-08 10:39:31 +05:30
parent bf5c948995
commit c2d6fa3656

View File

@ -1011,11 +1011,14 @@ public ApplicationResourceUsageReport getResourceUsageReport() {
getAppAMNodePartitionName(), cluster);
ResourceCalculator calc =
rmContext.getScheduler().getResourceCalculator();
float queueUsagePerc = 0.0f;
if (!calc.isInvalidDivisor(totalPartitionRes)) {
Resource effCap = ((AbstractCSQueue) getQueue())
.getEffectiveCapacity(getAppAMNodePartitionName());
float queueUsagePerc = calc.divide(totalPartitionRes,
report.getUsedResources(), effCap) * 100;
if (!effCap.equals(Resources.none())) {
queueUsagePerc = calc.divide(totalPartitionRes,
report.getUsedResources(), effCap) * 100;
}
report.setQueueUsagePercentage(queueUsagePerc);
}
return report;