[ 
https://issues.apache.org/jira/browse/YARN-11537?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17769814#comment-17769814
 ] 

ASF GitHub Bot commented on YARN-11537:
---------------------------------------

goiri commented on code in PR #6121:
URL: https://github.com/apache/hadoop/pull/6121#discussion_r1339225762


##########
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/main/java/org/apache/hadoop/yarn/server/router/rmadmin/FederationRMAdminInterceptor.java:
##########
@@ -1137,12 +1143,75 @@ private QueryFederationQueuePoliciesResponse 
filterPoliciesConfigurationsByQueue
       }
     }
 
+    // Step3. To paginate the returned results.
+    return queryFederationQueuePoliciesPagination(federationQueueWeights, 
pageSize, currentPage);
+  }
+
+  /**
+   * Filter PoliciesConfigurations, and we paginate Policies within this 
method.
+   *
+   * @param policiesConfigurations policy configurations.
+   * @param pageSize Items per page.
+   * @param currentPage The number of pages to be queried.
+   * @return federation queue policies response.
+   * @throws YarnException indicates exceptions from yarn servers.
+   */
+  private QueryFederationQueuePoliciesResponse filterPoliciesConfigurations(
+      Map<String, SubClusterPolicyConfiguration> policiesConfigurations,
+      int pageSize, int currentPage) throws YarnException {
+
+    // Step1. Check the parameters, if the policy list is empty, return empty 
directly.
+    if (MapUtils.isEmpty(policiesConfigurations)) {
+      return null;
+    }
+
+    // Step2. Traverse policiesConfigurations and obtain the 
FederationQueueWeight list.
+    List<FederationQueueWeight> federationQueueWeights = new ArrayList<>();
+    for (Map.Entry<String, SubClusterPolicyConfiguration> entry :
+        policiesConfigurations.entrySet()) {
+      String queue = entry.getKey();
+      SubClusterPolicyConfiguration policyConf = entry.getValue();
+      if(policyConf == null) {

Review Comment:
   Spacing.
   In any case, I think we should do:
   ```
   if (policyConf != null) {
     FederationQueueWeight federationQueueWeight = 
parseFederationQueueWeight(queue, policyConf);
       if (federationQueueWeight != null) {
         federationQueueWeights.add(federationQueueWeight);
       }
   }
   ```
   





> [Federation] Router CLI Supports List SubClusterPolicyConfiguration Of Queues.
> ------------------------------------------------------------------------------
>
>                 Key: YARN-11537
>                 URL: https://issues.apache.org/jira/browse/YARN-11537
>             Project: Hadoop YARN
>          Issue Type: Sub-task
>          Components: federation
>    Affects Versions: 3.4.0
>            Reporter: Shilun Fan
>            Assignee: Shilun Fan
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 3.4.0
>
>
> In this jira, we will support list SubClusterPolicyConfiguration information 
> on the command line.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

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

Reply via email to