|
@@ -32,7 +32,6 @@ import org.apache.commons.lang.StringEscapeUtils;
|
|
|
import org.apache.hadoop.conf.Configuration;
|
|
|
import org.apache.hadoop.fs.CommonConfigurationKeys;
|
|
|
import org.apache.hadoop.security.UserGroupInformation;
|
|
|
-import org.apache.hadoop.security.authentication.client.AuthenticationException;
|
|
|
import org.apache.hadoop.security.http.RestCsrfPreventionFilter;
|
|
|
import org.apache.hadoop.util.StringUtils;
|
|
|
import org.apache.hadoop.yarn.api.ApplicationBaseProtocol;
|
|
@@ -110,8 +109,8 @@ public class AppBlock extends HtmlBlock {
|
|
|
final GetApplicationReportRequest request =
|
|
|
GetApplicationReportRequest.newInstance(appID);
|
|
|
if (callerUGI == null) {
|
|
|
- throw new AuthenticationException(
|
|
|
- "Failed to get user name from request");
|
|
|
+ appReport =
|
|
|
+ appBaseProt.getApplicationReport(request).getApplicationReport();
|
|
|
} else {
|
|
|
appReport = callerUGI.doAs(
|
|
|
new PrivilegedExceptionAction<ApplicationReport> () {
|
|
@@ -205,55 +204,36 @@ public class AppBlock extends HtmlBlock {
|
|
|
String schedulerPath = WebAppUtils.getResolvedRMWebAppURLWithScheme(conf) +
|
|
|
"/cluster/scheduler?openQueues=" + app.getQueue();
|
|
|
|
|
|
- generateOverviewTable(app, schedulerPath, webUiType, appReport);
|
|
|
-
|
|
|
- createApplicationMetricsTable(html);
|
|
|
-
|
|
|
- html.__(InfoBlock.class);
|
|
|
-
|
|
|
- generateApplicationTable(html, callerUGI, attempts);
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * Generate overview table for app web page.
|
|
|
- * @param app app info.
|
|
|
- * @param schedulerPath schedule path.
|
|
|
- * @param webUiType web ui type.
|
|
|
- * @param appReport app report.
|
|
|
- */
|
|
|
- private void generateOverviewTable(AppInfo app, String schedulerPath,
|
|
|
- String webUiType, ApplicationReport appReport) {
|
|
|
ResponseInfo overviewTable = info("Application Overview")
|
|
|
- .__("User:", schedulerPath, app.getUser())
|
|
|
- .__("Name:", app.getName())
|
|
|
- .__("Application Type:", app.getType())
|
|
|
- .__("Application Tags:",
|
|
|
- app.getApplicationTags() == null ? "" : app.getApplicationTags())
|
|
|
- .__("Application Priority:", clarifyAppPriority(app.getPriority()))
|
|
|
- .__(
|
|
|
- "YarnApplicationState:",
|
|
|
- app.getAppState() == null ? UNAVAILABLE : clarifyAppState(app
|
|
|
- .getAppState()))
|
|
|
- .__("Queue:", schedulerPath, app.getQueue())
|
|
|
- .__("FinalStatus Reported by AM:",
|
|
|
- clairfyAppFinalStatus(app.getFinalAppStatus()))
|
|
|
- .__("Started:", Times.format(app.getStartedTime()))
|
|
|
- .__(
|
|
|
- "Elapsed:",
|
|
|
- StringUtils.formatTime(Times.elapsed(app.getStartedTime(),
|
|
|
- app.getFinishedTime())))
|
|
|
- .__(
|
|
|
- "Tracking URL:",
|
|
|
- app.getTrackingUrl() == null
|
|
|
- || app.getTrackingUrl().equals(UNAVAILABLE) ? null : root_url(app
|
|
|
- .getTrackingUrl()),
|
|
|
- app.getTrackingUrl() == null
|
|
|
- || app.getTrackingUrl().equals(UNAVAILABLE) ? "Unassigned" : app
|
|
|
- .getAppState() == YarnApplicationState.FINISHED
|
|
|
- || app.getAppState() == YarnApplicationState.FAILED
|
|
|
- || app.getAppState() == YarnApplicationState.KILLED ? "History"
|
|
|
- : "ApplicationMaster");
|
|
|
+ .__("User:", schedulerPath, app.getUser())
|
|
|
+ .__("Name:", app.getName())
|
|
|
+ .__("Application Type:", app.getType())
|
|
|
+ .__("Application Tags:",
|
|
|
+ app.getApplicationTags() == null ? "" : app.getApplicationTags())
|
|
|
+ .__("Application Priority:", clarifyAppPriority(app.getPriority()))
|
|
|
+ .__(
|
|
|
+ "YarnApplicationState:",
|
|
|
+ app.getAppState() == null ? UNAVAILABLE : clarifyAppState(app
|
|
|
+ .getAppState()))
|
|
|
+ .__("Queue:", schedulerPath, app.getQueue())
|
|
|
+ .__("FinalStatus Reported by AM:",
|
|
|
+ clairfyAppFinalStatus(app.getFinalAppStatus()))
|
|
|
+ .__("Started:", Times.format(app.getStartedTime()))
|
|
|
+ .__(
|
|
|
+ "Elapsed:",
|
|
|
+ StringUtils.formatTime(Times.elapsed(app.getStartedTime(),
|
|
|
+ app.getFinishedTime())))
|
|
|
+ .__(
|
|
|
+ "Tracking URL:",
|
|
|
+ app.getTrackingUrl() == null
|
|
|
+ || app.getTrackingUrl().equals(UNAVAILABLE) ? null : root_url(app
|
|
|
+ .getTrackingUrl()),
|
|
|
+ app.getTrackingUrl() == null
|
|
|
+ || app.getTrackingUrl().equals(UNAVAILABLE) ? "Unassigned" : app
|
|
|
+ .getAppState() == YarnApplicationState.FINISHED
|
|
|
+ || app.getAppState() == YarnApplicationState.FAILED
|
|
|
+ || app.getAppState() == YarnApplicationState.KILLED ? "History"
|
|
|
+ : "ApplicationMaster");
|
|
|
if (webUiType != null
|
|
|
&& webUiType.equals(YarnWebParams.RM_WEB_UI)) {
|
|
|
LogAggregationStatus status = getLogAggregationStatus();
|
|
@@ -285,6 +265,37 @@ public class AppBlock extends HtmlBlock {
|
|
|
overviewTable.__("AM container Node Label expression:",
|
|
|
app.getAmNodeLabelExpression() == null ? "<Not set>"
|
|
|
: app.getAmNodeLabelExpression());
|
|
|
+
|
|
|
+ try {
|
|
|
+ final GetApplicationAttemptsRequest request =
|
|
|
+ GetApplicationAttemptsRequest.newInstance(appID);
|
|
|
+ if (callerUGI == null) {
|
|
|
+ attempts = appBaseProt.getApplicationAttempts(request)
|
|
|
+ .getApplicationAttemptList();
|
|
|
+ } else {
|
|
|
+ attempts = callerUGI.doAs(
|
|
|
+ new PrivilegedExceptionAction<Collection<ApplicationAttemptReport>> () {
|
|
|
+ @Override
|
|
|
+ public Collection<ApplicationAttemptReport> run() throws Exception {
|
|
|
+ return appBaseProt.getApplicationAttempts(request)
|
|
|
+ .getApplicationAttemptList();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ String message =
|
|
|
+ "Failed to read the attempts of the application " + appID + ".";
|
|
|
+ LOG.error(message, e);
|
|
|
+ html.p().__(message).__();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ createApplicationMetricsTable(html);
|
|
|
+
|
|
|
+ html.__(InfoBlock.class);
|
|
|
+
|
|
|
+ generateApplicationTable(html, callerUGI, attempts);
|
|
|
+
|
|
|
}
|
|
|
|
|
|
protected void generateApplicationTable(Block html,
|