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

(cherry picked from commit 281350674c)
This commit is contained in:
Rohith Sharma K S 2018-01-08 15:52:03 +05:30
parent f7fedac6cd
commit 37a8224101
1 changed files with 7 additions and 4 deletions

View File

@ -995,14 +995,17 @@ public class FiCaSchedulerApp extends SchedulerApplicationAttempt {
getAppAMNodePartitionName(), cluster); getAppAMNodePartitionName(), cluster);
ResourceCalculator calc = ResourceCalculator calc =
rmContext.getScheduler().getResourceCalculator(); rmContext.getScheduler().getResourceCalculator();
float queueUsagePerc = 0.0f;
if (!calc.isInvalidDivisor(totalPartitionRes)) { if (!calc.isInvalidDivisor(totalPartitionRes)) {
float queueAbsMaxCapPerPartition = float queueAbsMaxCapPerPartition =
((AbstractCSQueue) getQueue()).getQueueCapacities() ((AbstractCSQueue) getQueue()).getQueueCapacities()
.getAbsoluteCapacity(getAppAMNodePartitionName()); .getAbsoluteCapacity(getAppAMNodePartitionName());
float queueUsagePerc = calc.divide(totalPartitionRes, if (queueAbsMaxCapPerPartition != 0) {
report.getUsedResources(), queueUsagePerc = calc.divide(totalPartitionRes,
Resources.multiply(totalPartitionRes, queueAbsMaxCapPerPartition)) report.getUsedResources(),
* 100; Resources.multiply(totalPartitionRes, queueAbsMaxCapPerPartition))
* 100;
}
report.setQueueUsagePercentage(queueUsagePerc); report.setQueueUsagePercentage(queueUsagePerc);
} }
return report; return report;