protected override void Render(HtmlBlock.Block html) { string webUiType = $(YarnWebParams.WebUiType); string aid = $(YarnWebParams.ApplicationId); if (aid.IsEmpty()) { Puts("Bad request: requires Application ID"); return; } try { appID = Apps.ToAppID(aid); } catch (Exception) { Puts("Invalid Application ID: " + aid); return; } UserGroupInformation callerUGI = GetCallerUGI(); ApplicationReport appReport; try { GetApplicationReportRequest request = GetApplicationReportRequest.NewInstance(appID ); if (callerUGI == null) { appReport = appBaseProt.GetApplicationReport(request).GetApplicationReport(); } else { appReport = callerUGI.DoAs(new _PrivilegedExceptionAction_99(this, request)); } } catch (Exception e) { string message = "Failed to read the application " + appID + "."; Log.Error(message, e); html.P().(message).(); return; } if (appReport == null) { Puts("Application not found: " + aid); return; } AppInfo app = new AppInfo(appReport); SetTitle(StringHelper.Join("Application ", aid)); if (webUiType != null && webUiType.Equals(YarnWebParams.RmWebUi) && conf.GetBoolean (YarnConfiguration.RmWebappUiActionsEnabled, YarnConfiguration.DefaultRmWebappUiActionsEnabled )) { // Application Kill html.Div().Button().$onclick("confirmAction()").B("Kill Application").().(); StringBuilder script = new StringBuilder(); script.Append("function confirmAction() {").Append(" b = confirm(\"Are you sure?\");" ).Append(" if (b == true) {").Append(" $.ajax({").Append(" type: 'PUT',").Append (" url: '/ws/v1/cluster/apps/").Append(aid).Append("/state',").Append(" contentType: 'application/json'," ).Append(" data: '{\"state\":\"KILLED\"}',").Append(" dataType: 'json'").Append( " }).done(function(data){").Append(" setTimeout(function(){").Append(" location.href = '/cluster/app/" ).Append(aid).Append("';").Append(" }, 1000);").Append(" }).fail(function(data){" ).Append(" console.log(data);").Append(" });").Append(" }").Append("}"); html.Script().$type("text/javascript").(script.ToString()).(); } Info("Application Overview").("User:"******"Name:", app.GetName()).("Application Type:" , app.GetType()).("Application Tags:", app.GetApplicationTags() == null ? string.Empty : app.GetApplicationTags()).("YarnApplicationState:", app.GetAppState() == null ? Unavailable : ClarifyAppState(app.GetAppState())).("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" ).("Diagnostics:", app.GetDiagnosticsInfo() == null ? string.Empty : app.GetDiagnosticsInfo ()); ICollection <ApplicationAttemptReport> attempts; try { GetApplicationAttemptsRequest request = GetApplicationAttemptsRequest.NewInstance (appID); if (callerUGI == null) { attempts = appBaseProt.GetApplicationAttempts(request).GetApplicationAttemptList( ); } else { attempts = callerUGI.DoAs(new _PrivilegedExceptionAction_196(this, request)); } } 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.(typeof(InfoBlock)); GenerateApplicationTable(html, callerUGI, attempts); }