jiwq commented on a change in pull request #2238:
URL: https://github.com/apache/hadoop/pull/2238#discussion_r475222031



##########
File path: 
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/dao/ClusterMetricsInfo.java
##########
@@ -134,6 +135,11 @@ public ClusterMetricsInfo(final ResourceScheduler rs) {
       this.totalMB = availableMB + allocatedMB;
       this.totalVirtualCores = availableVirtualCores + allocatedVirtualCores;
     }
+    if (rs instanceof FairScheduler) {
+      FairScheduler fs = (FairScheduler) rs;
+      totalUsedResourcesAcrossPartition = new 
ResourceInfo(fs.getQueueManager().getRootQueue().getResourceUsage());
+      totalClusterResourcesAcrossPartition = new 
ResourceInfo(fs.getClusterResource());
+    }

Review comment:
       I suggest move this code segment to `else if`. Such as:
   ```suggestion
       } else if (rs instanceof FairScheduler) {
         FairScheduler fs = (FairScheduler) rs;
         totalUsedResourcesAcrossPartition = new 
ResourceInfo(fs.getQueueManager().getRootQueue().getResourceUsage());
         totalClusterResourcesAcrossPartition = new 
ResourceInfo(fs.getClusterResource());
       } else {
         this.totalMB = availableMB + allocatedMB;
         this.totalVirtualCores = availableVirtualCores + allocatedVirtualCores;
       }
   ```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to