From 85588e5ce98d3b9adbc97f5e57f84fd96beaaf14 Mon Sep 17 00:00:00 2001 From: Vinod Kumar Vavilapalli Date: Wed, 12 Oct 2011 06:23:20 +0000 Subject: [PATCH] MAPREDUCE-3140. Fixed the invalid JobHistory URL for failed applications. Contributed by Subroto Sanyal. git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1182216 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-mapreduce-project/CHANGES.txt | 3 +++ .../yarn/server/resourcemanager/webapp/AppsBlock.java | 6 +++--- .../yarn/server/resourcemanager/webapp/AppsList.java | 8 ++++---- .../server/resourcemanager/webapp/RmController.java | 10 +++++----- 4 files changed, 15 insertions(+), 12 deletions(-) diff --git a/hadoop-mapreduce-project/CHANGES.txt b/hadoop-mapreduce-project/CHANGES.txt index ead27387966..fab9c467f63 100644 --- a/hadoop-mapreduce-project/CHANGES.txt +++ b/hadoop-mapreduce-project/CHANGES.txt @@ -1582,6 +1582,9 @@ Release 0.23.0 - Unreleased MAPREDUCE-3126. Fixed a corner case in CapacityScheduler where headroom wasn't updated on changes to cluster size. (acmurthy) + MAPREDUCE-3140. Fixed the invalid JobHistory URL for failed + applications. (Subroto Sanyal via vinodkv) + Release 0.22.0 - Unreleased INCOMPATIBLE CHANGES diff --git a/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/AppsBlock.java b/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/AppsBlock.java index 41ed833a992..1e9215f0b8b 100644 --- a/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/AppsBlock.java +++ b/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/AppsBlock.java @@ -23,7 +23,6 @@ import static org.apache.hadoop.yarn.webapp.view.JQueryUI._PROGRESSBAR; import static org.apache.hadoop.yarn.webapp.view.JQueryUI._PROGRESSBAR_VALUE; import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMApp; -import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppState; import org.apache.hadoop.yarn.webapp.hamlet.Hamlet; import org.apache.hadoop.yarn.webapp.hamlet.Hamlet.TABLE; import org.apache.hadoop.yarn.webapp.hamlet.Hamlet.TBODY; @@ -59,7 +58,8 @@ class AppsBlock extends HtmlBlock { for (RMApp app : list.apps.values()) { String appId = app.getApplicationId().toString(); String trackingUrl = app.getTrackingUrl(); - String ui = trackingUrl == null || trackingUrl.isEmpty() ? "UNASSIGNED" : + boolean trackingUrlIsNotReady = trackingUrl == null || trackingUrl.isEmpty() || "N/A".equalsIgnoreCase(trackingUrl); + String ui = trackingUrlIsNotReady ? "UNASSIGNED" : (app.getFinishTime() == 0 ? "ApplicationMaster" : "History"); String percent = String.format("%.1f", app.getProgress() * 100); @@ -80,7 +80,7 @@ class AppsBlock extends HtmlBlock { div(_PROGRESSBAR_VALUE). $style(join("width:", percent, '%'))._()._()._(). td(). - a(trackingUrl == null || trackingUrl.isEmpty() || "N/A".equalsIgnoreCase(trackingUrl) ? + a(trackingUrlIsNotReady ? "#" : join("http://", trackingUrl), ui)._(). td(app.getDiagnostics().toString())._(); if (list.rendering != Render.HTML && ++i >= 20) break; diff --git a/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/AppsList.java b/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/AppsList.java index def6011d4f0..3d01c1f2241 100644 --- a/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/AppsList.java +++ b/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/AppsList.java @@ -31,7 +31,6 @@ import java.util.concurrent.ConcurrentMap; import org.apache.hadoop.yarn.api.records.ApplicationId; import org.apache.hadoop.yarn.server.resourcemanager.RMContext; import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMApp; -import org.apache.hadoop.yarn.util.Apps; import org.apache.hadoop.yarn.webapp.Controller.RequestContext; import org.apache.hadoop.yarn.webapp.ToJSON; import org.apache.hadoop.yarn.webapp.view.JQueryUI.Render; @@ -62,8 +61,9 @@ class AppsList implements ToJSON { } String appID = app.getApplicationId().toString(); String trackingUrl = app.getTrackingUrl(); - String ui = trackingUrl == null || trackingUrl.isEmpty() || "N/A".equalsIgnoreCase(trackingUrl) ? - "UNASSIGNED" : (app.getFinishTime() == 0 ? "ApplicationMaster" : "JobHistory"); + boolean trackingUrlIsNotReady = trackingUrl == null || trackingUrl.isEmpty() || "N/A".equalsIgnoreCase(trackingUrl); + String ui = trackingUrlIsNotReady ? + "UNASSIGNED" : (app.getFinishTime() == 0 ? "ApplicationMaster" : "History"); out.append("[\""); appendSortable(out, app.getApplicationId().getId()); appendLink(out, appID, rc.prefix(), "app", appID).append(_SEP). @@ -73,7 +73,7 @@ class AppsList implements ToJSON { append(app.getState().toString()).append(_SEP); appendProgressBar(out, app.getProgress()).append(_SEP); appendLink(out, ui, rc.prefix(), - trackingUrl == null || trackingUrl.isEmpty() || "N/A".equalsIgnoreCase(trackingUrl) ? + trackingUrlIsNotReady ? "#" : "http://", trackingUrl). append(_SEP).append(escapeJavaScript(escapeHtml( app.getDiagnostics().toString()))). diff --git a/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RmController.java b/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RmController.java index 2da95158c16..f5d50e6bbbf 100644 --- a/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RmController.java +++ b/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RmController.java @@ -30,7 +30,6 @@ import org.apache.hadoop.yarn.api.records.Container; import org.apache.hadoop.yarn.server.resourcemanager.RMContext; import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager; import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMApp; -import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppState; import org.apache.hadoop.yarn.server.resourcemanager.scheduler.ResourceScheduler; import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacityScheduler; import org.apache.hadoop.yarn.util.Apps; @@ -73,8 +72,9 @@ public class RmController extends Controller { } setTitle(join("Application ", aid)); String trackingUrl = app.getTrackingUrl(); - String ui = trackingUrl == null ? "UNASSIGNED" : - (app.getFinishTime() == 0 ? "ApplicationMaster" : "JobHistory"); + boolean trackingUrlIsNotReady = trackingUrl == null || trackingUrl.isEmpty() || "N/A".equalsIgnoreCase(trackingUrl); + String ui = trackingUrlIsNotReady ? "UNASSIGNED" : + (app.getFinishTime() == 0 ? "ApplicationMaster" : "History"); ResponseInfo info = info("Application Overview"). _("User:", app.getUser()). @@ -84,8 +84,8 @@ public class RmController extends Controller { _("Started:", Times.format(app.getStartTime())). _("Elapsed:", StringUtils.formatTime( Times.elapsed(app.getStartTime(), app.getFinishTime()))). - _("Tracking URL:", trackingUrl == null ? "#" : - join("http://", trackingUrl), ui). + _("Tracking URL:", trackingUrlIsNotReady ? + "#" : join("http://", trackingUrl), ui). _("Diagnostics:", app.getDiagnostics()); Container masterContainer = app.getCurrentAppAttempt() .getMasterContainer();