You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by GitBox <gi...@apache.org> on 2022/10/19 21:00:31 UTC

[GitHub] [hadoop] slfan1989 commented on a diff in pull request #5030: YARN-11345. [Federation] Refactoring Yarn Router's Application Web Page.

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


##########
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/main/java/org/apache/hadoop/yarn/server/router/webapp/AppsBlock.java:
##########
@@ -81,53 +154,53 @@ protected void render(Block html) {
 
     // Render the applications
     StringBuilder appsTableData = new StringBuilder("[\n");
-    for (AppInfo app : apps.getApps()) {
-      try {
-
-        String percent = String.format("%.1f", app.getProgress() * 100.0F);
-        String trackingURL =
-            app.getTrackingUrl() == null ? "#" : app.getTrackingUrl();
-        // AppID numerical value parsed by parseHadoopID in yarn.dt.plugins.js
-        appsTableData.append("[\"")
-            .append("<a href='").append(trackingURL).append("'>")
-            .append(app.getAppId()).append("</a>\",\"")
-            .append(escape(app.getUser())).append("\",\"")
-            .append(escape(app.getName())).append("\",\"")
-            .append(escape(app.getApplicationType())).append("\",\"")
-            .append(escape(app.getQueue())).append("\",\"")
-            .append(String.valueOf(app.getPriority())).append("\",\"")
-            .append(app.getStartTime()).append("\",\"")
-            .append(app.getFinishTime()).append("\",\"")
-            .append(app.getState()).append("\",\"")
-            .append(app.getFinalStatus()).append("\",\"")
-            // Progress bar
-            .append("<br title='").append(percent).append("'> <div class='")
-            .append(C_PROGRESSBAR).append("' title='")
-            .append(join(percent, '%')).append("'> ").append("<div class='")
-            .append(C_PROGRESSBAR_VALUE).append("' style='")
-            .append(join("width:", percent, '%')).append("'> </div> </div>")
-            // History link
-            .append("\",\"<a href='").append(trackingURL).append("'>")
-            .append("History").append("</a>");
-        appsTableData.append("\"],\n");
-
-      } catch (Exception e) {
-        LOG.info(
-            "Cannot add application {}: {}", app.getAppId(), e.getMessage());
+
+    if (appsInfo != null && CollectionUtils.isNotEmpty(appsInfo.getApps())) {
+      for (AppInfo app : appsInfo.getApps()) {
+        try {
+
+          String percent = String.format("%.1f", app.getProgress() * 100.0F);
+          String trackingURL =
+              app.getTrackingUrl() == null ? "#" : app.getTrackingUrl();
+
+          // AppID numerical value parsed by parseHadoopID in yarn.dt.plugins.js
+          appsTableData.append("[\"")
+              .append("<a href='").append(trackingURL).append("'>")
+              .append(app.getAppId()).append("</a>\",\"")
+              .append(escape(app.getUser())).append("\",\"")
+              .append(escape(app.getName())).append("\",\"")
+              .append(escape(app.getApplicationType())).append("\",\"")
+              .append(escape(app.getQueue())).append("\",\"")
+              .append(app.getPriority()).append("\",\"")
+              .append(app.getStartTime()).append("\",\"")
+              .append(app.getFinishTime()).append("\",\"")
+              .append(app.getState()).append("\",\"")
+              .append(app.getFinalStatus()).append("\",\"")
+              // Progress bar
+              .append("<br title='").append(percent).append("'> <div class='")
+              .append(C_PROGRESSBAR).append("' title='")
+              .append(join(percent, '%')).append("'> ").append("<div class='")
+              .append(C_PROGRESSBAR_VALUE).append("' style='")
+              .append(join("width:", percent, '%')).append("'> </div> </div>")
+              // History link
+              .append("\",\"<a href='").append(trackingURL).append("'>")
+              .append("History").append("</a>");
+          appsTableData.append("\"],\n");
+
+        } catch (Exception e) {
+          LOG.info(

Review Comment:
   I will fix it.



-- 
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: common-issues-unsubscribe@hadoop.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org