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

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

slfan1989 commented on code in PR #5716:
URL: https://github.com/apache/hadoop/pull/5716#discussion_r1226777843


##########
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/util/FormattingCLIUtils.java:
##########
@@ -0,0 +1,185 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.yarn.client.util;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public final class FormattingCLIUtils {
+  private String title;
+  private TableRowType lastTableRowType;
+  private StringBuilder join;
+  private List<TableRow> tableRows;
+  private Map<Integer, Integer> maxColMap;
+  public FormattingCLIUtils() {
+    this.init();
+  }
+  public FormattingCLIUtils(String title) {
+    this.init();
+    this.title = title;
+  }
+  private void init() {
+    this.join = new StringBuilder();
+    this.tableRows = new ArrayList<>();
+    this.maxColMap = new HashMap<>();
+  }
+  public FormattingCLIUtils addHeaders(List<?> headers) {
+    return this.appendRows(TableRowType.HEADER, headers.toArray());
+  }
+  public FormattingCLIUtils addHeaders(Object... objects) {
+    return this.appendRows(TableRowType.HEADER, objects);
+  }
+  public FormattingCLIUtils addDatas(List<?> datas) {
+    return this.appendRows(TableRowType.DATA, datas.toArray());
+  }
+  public FormattingCLIUtils addDatas(Object... objects) {
+    return this.appendRows(TableRowType.DATA, objects);
+  }
+  private FormattingCLIUtils appendRows(TableRowType tableRowType, Object... 
objects) {

Review Comment:
   Can we add some comments to the method?





> The formatted yarn queue list is displayed on the command line
> --------------------------------------------------------------
>
>                 Key: YARN-11506
>                 URL: https://issues.apache.org/jira/browse/YARN-11506
>             Project: Hadoop YARN
>          Issue Type: Improvement
>    Affects Versions: 3.3.4
>            Reporter: Lu Yuan
>            Priority: Minor
>              Labels: pull-request-available
>
> h4. In the issue list YARN-11474, the printed information is not aligned,This 
> issue fixes the yarn queue display formatting problem



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

---------------------------------------------------------------------
To unsubscribe, e-mail: yarn-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: yarn-issues-h...@hadoop.apache.org

Reply via email to