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


##########
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/main/java/org/apache/hadoop/yarn/server/router/webapp/AboutBlock.java:
##########
@@ -18,78 +18,142 @@
 
 package org.apache.hadoop.yarn.server.router.webapp;
 
-import com.sun.jersey.api.client.Client;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.time.DateFormatUtils;
 import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.util.StringUtils;
+import org.apache.hadoop.util.Time;
 import org.apache.hadoop.yarn.conf.YarnConfiguration;
-import org.apache.hadoop.yarn.server.resourcemanager.webapp.RMWSConsts;
-import 
org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.ClusterMetricsInfo;
+import org.apache.hadoop.yarn.exceptions.YarnException;
+import org.apache.hadoop.yarn.server.federation.store.FederationStateStore;
+import org.apache.hadoop.yarn.server.federation.store.records.SubClusterId;
+import org.apache.hadoop.yarn.server.federation.store.records.SubClusterInfo;
+import 
org.apache.hadoop.yarn.server.federation.store.records.SubClusterRegisterRequest;
+import org.apache.hadoop.yarn.server.federation.store.records.SubClusterState;
+import 
org.apache.hadoop.yarn.server.federation.utils.FederationStateStoreFacade;
 import org.apache.hadoop.yarn.server.router.Router;
-import org.apache.hadoop.yarn.webapp.util.WebAppUtils;
-import org.apache.hadoop.yarn.webapp.view.HtmlBlock;
+import org.apache.hadoop.yarn.server.router.webapp.dao.RouterInfo;
 import org.apache.hadoop.yarn.webapp.view.InfoBlock;
 
 import com.google.inject.Inject;
 
+import java.io.File;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
 /**
  * About block for the Router Web UI.
  */
-public class AboutBlock extends HtmlBlock {
-
-  private static final long BYTES_IN_MB = 1024 * 1024;
+public class AboutBlock extends RouterBlock {
 
   private final Router router;
 
   @Inject
   AboutBlock(Router router, ViewContext ctx) {
-    super(ctx);
+    super(router, ctx);
     this.router = router;
   }
 
   @Override
   protected void render(Block html) {
+
     Configuration conf = this.router.getConfig();
-    String webAppAddress = WebAppUtils.getRouterWebAppURLWithScheme(conf);
-    Client client = RouterWebServiceUtil.createJerseyClient(conf);
-
-    ClusterMetricsInfo metrics = RouterWebServiceUtil
-        .genericForward(webAppAddress, null, ClusterMetricsInfo.class,
-            HTTPMethods.GET,
-            RMWSConsts.RM_WEB_SERVICE_PATH + RMWSConsts.METRICS, null, null,
-            conf, client);
+    conf.setBoolean(YarnConfiguration.FEDERATION_ENABLED, true);
     boolean isEnabled = conf.getBoolean(
         YarnConfiguration.FEDERATION_ENABLED,
         YarnConfiguration.DEFAULT_FEDERATION_ENABLED);
-    info("Cluster Status").
-        __("Federation Enabled", isEnabled).
-        __("Applications Submitted", metrics.getAppsSubmitted()).
-        __("Applications Pending", metrics.getAppsPending()).
-        __("Applications Running", metrics.getAppsRunning()).
-        __("Applications Failed", metrics.getAppsFailed()).
-        __("Applications Killed", metrics.getAppsKilled()).
-        __("Applications Completed", metrics.getAppsCompleted()).
-        __("Containers Allocated", metrics.getContainersAllocated()).
-        __("Containers Reserved", metrics.getReservedContainers()).
-        __("Containers Pending", metrics.getPendingContainers()).
-        __("Available Memory",
-            StringUtils.byteDesc(metrics.getAvailableMB() * BYTES_IN_MB)).
-        __("Allocated Memory",
-            StringUtils.byteDesc(metrics.getAllocatedMB() * BYTES_IN_MB)).
-        __("Reserved Memory",
-            StringUtils.byteDesc(metrics.getReservedMB() * BYTES_IN_MB)).
-        __("Total Memory",
-            StringUtils.byteDesc(metrics.getTotalMB() * BYTES_IN_MB)).
-        __("Available VirtualCores", metrics.getAvailableVirtualCores()).
-        __("Allocated VirtualCores", metrics.getAllocatedVirtualCores()).
-        __("Reserved VirtualCores", metrics.getReservedVirtualCores()).
-        __("Total VirtualCores", metrics.getTotalVirtualCores()).
-        __("Active Nodes", metrics.getActiveNodes()).
-        __("Lost Nodes", metrics.getLostNodes()).
-        __("Available Nodes", metrics.getDecommissionedNodes()).
-        __("Unhealthy Nodes", metrics.getUnhealthyNodes()).
-        __("Rebooted Nodes", metrics.getRebootedNodes()).
-        __("Total Nodes", metrics.getTotalNodes());
 
+    FederationStateStoreFacade facade = 
FederationStateStoreFacade.getInstance();
+    try {
+      initTestFederationSubCluster(facade);
+    } catch (IOException e) {
+      e.printStackTrace();

Review Comment:
   This is the code I wrote during the self-test, I will remove this part of 
the code.



-- 
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.

To unsubscribe, e-mail: [email protected]

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