You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by ji...@apache.org on 2015/05/01 09:02:01 UTC
[44/50] [abbrv] hadoop git commit: YARN-3544. Got back AM logs link
on the RM web UI for a completed app. Contributed by Xuan Gong.
YARN-3544. Got back AM logs link on the RM web UI for a completed app. Contributed by Xuan Gong.
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/7e8639fd
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/7e8639fd
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/7e8639fd
Branch: refs/heads/HDFS-7240
Commit: 7e8639fda40c13fe163128d7a725fcd0f2fce3c5
Parents: e2e8f77
Author: Zhijie Shen <zj...@apache.org>
Authored: Wed Apr 29 17:12:52 2015 -0700
Committer: Zhijie Shen <zj...@apache.org>
Committed: Thu Apr 30 13:05:55 2015 -0700
----------------------------------------------------------------------
hadoop-yarn-project/CHANGES.txt | 3 +
.../resourcemanager/webapp/RMAppBlock.java | 83 +++++++-------------
2 files changed, 30 insertions(+), 56 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hadoop/blob/7e8639fd/hadoop-yarn-project/CHANGES.txt
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt
index cf3d910..28fcae4 100644
--- a/hadoop-yarn-project/CHANGES.txt
+++ b/hadoop-yarn-project/CHANGES.txt
@@ -321,6 +321,9 @@ Release 2.7.1 - UNRELEASED
YARN-3485. FairScheduler headroom calculation doesn't consider
maxResources for Fifo and FairShare policies. (kasha)
+ YARN-3544. Got back AM logs link on the RM web UI for a completed app.
+ (Xuan Gong via zjshen)
+
Release 2.7.0 - 2015-04-20
INCOMPATIBLE CHANGES
http://git-wip-us.apache.org/repos/asf/hadoop/blob/7e8639fd/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RMAppBlock.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RMAppBlock.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RMAppBlock.java
index 3779b91..43e26be 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RMAppBlock.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RMAppBlock.java
@@ -25,28 +25,24 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.security.UserGroupInformation;
-import org.apache.hadoop.yarn.api.protocolrecords.GetContainerReportRequest;
import org.apache.hadoop.yarn.api.records.ApplicationAttemptReport;
-import org.apache.hadoop.yarn.api.records.ContainerId;
-import org.apache.hadoop.yarn.api.records.ContainerReport;
import org.apache.hadoop.yarn.api.records.Resource;
-import org.apache.hadoop.yarn.exceptions.ContainerNotFoundException;
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.RMAppMetrics;
+import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttempt;
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttemptMetrics;
+import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.AppAttemptInfo;
import org.apache.hadoop.yarn.server.webapp.AppBlock;
-import org.apache.hadoop.yarn.server.webapp.dao.AppAttemptInfo;
-import org.apache.hadoop.yarn.server.webapp.dao.ContainerInfo;
-import org.apache.hadoop.yarn.util.ConverterUtils;
+import org.apache.hadoop.yarn.util.Times;
import org.apache.hadoop.yarn.util.resource.Resources;
import org.apache.hadoop.yarn.webapp.hamlet.Hamlet;
import org.apache.hadoop.yarn.webapp.hamlet.Hamlet.DIV;
+import org.apache.hadoop.yarn.webapp.util.WebAppUtils;
import org.apache.hadoop.yarn.webapp.view.InfoBlock;
import com.google.inject.Inject;
-import java.security.PrivilegedExceptionAction;
import java.util.Collection;
import java.util.Set;
@@ -54,11 +50,13 @@ public class RMAppBlock extends AppBlock{
private static final Log LOG = LogFactory.getLog(RMAppBlock.class);
private final ResourceManager rm;
+ private final Configuration conf;
@Inject
RMAppBlock(ViewContext ctx, Configuration conf, ResourceManager rm) {
super(rm.getClientRMService(), ctx, conf);
+ this.conf = conf;
this.rm = rm;
}
@@ -120,65 +118,38 @@ public class RMAppBlock extends AppBlock{
.th(".started", "Started").th(".node", "Node").th(".logs", "Logs")
.th(".blacklistednodes", "Blacklisted Nodes")._()._().tbody();
+ RMApp rmApp = this.rm.getRMContext().getRMApps().get(this.appID);
+ if (rmApp == null) {
+ return;
+ }
StringBuilder attemptsTableData = new StringBuilder("[\n");
for (final ApplicationAttemptReport appAttemptReport : attempts) {
- AppAttemptInfo appAttempt = new AppAttemptInfo(appAttemptReport);
- ContainerReport containerReport = null;
- try {
- // AM container is always the first container of the attempt
- final GetContainerReportRequest request =
- GetContainerReportRequest.newInstance(ContainerId.newContainerId(
- appAttemptReport.getApplicationAttemptId(), 1));
- if (callerUGI == null) {
- containerReport =
- appBaseProt.getContainerReport(request).getContainerReport();
- } else {
- containerReport = callerUGI.doAs(
- new PrivilegedExceptionAction<ContainerReport>() {
- @Override
- public ContainerReport run() throws Exception {
- ContainerReport report = null;
- try {
- report = appBaseProt.getContainerReport(request)
- .getContainerReport();
- } catch (ContainerNotFoundException ex) {
- LOG.warn(ex.getMessage());
- }
- return report;
- }
- });
- }
- } catch (Exception e) {
- String message =
- "Failed to read the AM container of the application attempt "
- + appAttemptReport.getApplicationAttemptId() + ".";
- LOG.error(message, e);
- html.p()._(message)._();
- return;
- }
- long startTime = 0L;
- String logsLink = null;
- String nodeLink = null;
- if (containerReport != null) {
- ContainerInfo container = new ContainerInfo(containerReport);
- startTime = container.getStartedTime();
- logsLink = containerReport.getLogUrl();
- nodeLink = containerReport.getNodeHttpAddress();
+ RMAppAttempt rmAppAttempt =
+ rmApp.getRMAppAttempt(appAttemptReport.getApplicationAttemptId());
+ if (rmAppAttempt == null) {
+ continue;
}
+ AppAttemptInfo attemptInfo =
+ new AppAttemptInfo(this.rm, rmAppAttempt, rmApp.getUser());
String blacklistedNodesCount = "N/A";
- Set<String> nodes = RMAppAttemptBlock.getBlacklistedNodes(rm,
- ConverterUtils.toApplicationAttemptId(appAttempt.getAppAttemptId()));
+ Set<String> nodes =
+ RMAppAttemptBlock.getBlacklistedNodes(rm,
+ rmAppAttempt.getAppAttemptId());
if(nodes != null) {
blacklistedNodesCount = String.valueOf(nodes.size());
}
-
+ String nodeLink = attemptInfo.getNodeHttpAddress();
+ if (nodeLink != null) {
+ nodeLink = WebAppUtils.getHttpSchemePrefix(conf) + nodeLink;
+ }
+ String logsLink = attemptInfo.getLogsLink();
attemptsTableData
.append("[\"<a href='")
- .append(url("appattempt", appAttempt.getAppAttemptId()))
+ .append(url("appattempt", rmAppAttempt.getAppAttemptId().toString()))
.append("'>")
- .append(appAttempt.getAppAttemptId())
+ .append(String.valueOf(rmAppAttempt.getAppAttemptId()))
.append("</a>\",\"")
- .append(startTime)
+ .append(attemptInfo.getStartTime())
.append("\",\"<a ")
.append(nodeLink == null ? "#" : "href='" + nodeLink)
.append("'>")