protected override void GenerateApplicationTable(HtmlBlock.Block html, UserGroupInformation callerUGI, ICollection <ApplicationAttemptReport> attempts) { // Application Attempt Table Hamlet.TBODY <Hamlet.TABLE <Org.Apache.Hadoop.Yarn.Webapp.Hamlet.Hamlet> > tbody = html .Table("#attempts").Thead().Tr().Th(".id", "Attempt ID").Th(".started", "Started" ).Th(".node", "Node").Th(".logs", "Logs").Th(".blacklistednodes", "Blacklisted Nodes" ).().().Tbody(); RMApp rmApp = this.rm.GetRMContext().GetRMApps()[this.appID]; if (rmApp == null) { return; } StringBuilder attemptsTableData = new StringBuilder("[\n"); foreach (ApplicationAttemptReport appAttemptReport in attempts) { RMAppAttempt rmAppAttempt = rmApp.GetRMAppAttempt(appAttemptReport.GetApplicationAttemptId ()); if (rmAppAttempt == null) { continue; } AppAttemptInfo attemptInfo = new AppAttemptInfo(this.rm, rmAppAttempt, rmApp.GetUser (), WebAppUtils.GetHttpSchemePrefix(conf)); string blacklistedNodesCount = "N/A"; ICollection <string> nodes = RMAppAttemptBlock.GetBlacklistedNodes(rm, rmAppAttempt .GetAppAttemptId()); if (nodes != null) { blacklistedNodesCount = nodes.Count.ToString(); } string nodeLink = attemptInfo.GetNodeHttpAddress(); if (nodeLink != null) { nodeLink = WebAppUtils.GetHttpSchemePrefix(conf) + nodeLink; } string logsLink = attemptInfo.GetLogsLink(); attemptsTableData.Append("[\"<a href='").Append(Url("appattempt", rmAppAttempt.GetAppAttemptId ().ToString())).Append("'>").Append(rmAppAttempt.GetAppAttemptId().ToString()).Append ("</a>\",\"").Append(attemptInfo.GetStartTime()).Append("\",\"<a ").Append(nodeLink == null ? "#" : "href='" + nodeLink).Append("'>").Append(nodeLink == null ? "N/A" : StringEscapeUtils.EscapeJavaScript(StringEscapeUtils.EscapeHtml(nodeLink))).Append ("</a>\",\"<a ").Append(logsLink == null ? "#" : "href='" + logsLink).Append("'>" ).Append(logsLink == null ? "N/A" : "Logs").Append("</a>\",").Append("\"").Append (blacklistedNodesCount).Append("\"],\n"); } if (attemptsTableData[attemptsTableData.Length - 2] == ',') { attemptsTableData.Delete(attemptsTableData.Length - 2, attemptsTableData.Length - 1); } attemptsTableData.Append("]"); html.Script().$type("text/javascript").("var attemptsTableData=" + attemptsTableData ).(); tbody.().(); }
protected override void RenderData(HtmlBlock.Block html) { Hamlet.TBODY <Hamlet.TABLE <Org.Apache.Hadoop.Yarn.Webapp.Hamlet.Hamlet> > tbody = html .Table("#apps").Thead().Tr().Th(".id", "ID").Th(".user", "User").Th(".name", "Name" ).Th(".type", "Application Type").Th(".queue", "Queue").Th(".starttime", "StartTime" ).Th(".finishtime", "FinishTime").Th(".state", "State").Th(".finalstatus", "FinalStatus" ).Th(".progress", "Progress").Th(".ui", "Tracking UI").Th(".blacklisted", "Blacklisted Nodes" ).().().Tbody(); StringBuilder appsTableData = new StringBuilder("[\n"); foreach (ApplicationReport appReport in appReports) { // TODO: remove the following condition. It is still here because // the history side implementation of ApplicationBaseProtocol // hasn't filtering capability (YARN-1819). if (!reqAppStates.IsEmpty() && !reqAppStates.Contains(appReport.GetYarnApplicationState ())) { continue; } AppInfo app = new AppInfo(appReport); string blacklistedNodesCount = "N/A"; ICollection <string> nodes = RMAppAttemptBlock.GetBlacklistedNodes(rm, ConverterUtils .ToApplicationAttemptId(app.GetCurrentAppAttemptId())); if (nodes != null) { blacklistedNodesCount = nodes.Count.ToString(); } string percent = string.Format("%.1f", app.GetProgress()); // AppID numerical value parsed by parseHadoopID in yarn.dt.plugins.js appsTableData.Append("[\"<a href='").Append(Url("app", app.GetAppId())).Append("'>" ).Append(app.GetAppId()).Append("</a>\",\"").Append(StringEscapeUtils.EscapeJavaScript (StringEscapeUtils.EscapeHtml(app.GetUser()))).Append("\",\"").Append(StringEscapeUtils .EscapeJavaScript(StringEscapeUtils.EscapeHtml(app.GetName()))).Append("\",\""). Append(StringEscapeUtils.EscapeJavaScript(StringEscapeUtils.EscapeHtml(app.GetType ()))).Append("\",\"").Append(StringEscapeUtils.EscapeJavaScript(StringEscapeUtils .EscapeHtml(app.GetQueue()))).Append("\",\"").Append(app.GetStartedTime()).Append ("\",\"").Append(app.GetFinishedTime()).Append("\",\"").Append(app.GetAppState() == null ? Unavailable : app.GetAppState()).Append("\",\"").Append(app.GetFinalAppStatus ()).Append("\",\"").Append("<br title='").Append(percent).Append("'> <div class='" ).Append(JQueryUI.CProgressbar).Append("' title='").Append(StringHelper.Join(percent , '%')).Append("'> ").Append("<div class='").Append(JQueryUI.CProgressbarValue). Append("' style='").Append(StringHelper.Join("width:", percent, '%')).Append("'> </div> </div>" ).Append("\",\"<a "); // Progress bar string trackingURL = app.GetTrackingUrl() == null || app.GetTrackingUrl().Equals( Unavailable) ? null : app.GetTrackingUrl(); string trackingUI = app.GetTrackingUrl() == null || app.GetTrackingUrl().Equals(Unavailable ) ? "Unassigned" : app.GetAppState() == YarnApplicationState.Finished || app.GetAppState () == YarnApplicationState.Failed || app.GetAppState() == YarnApplicationState.Killed ? "History" : "ApplicationMaster"; appsTableData.Append(trackingURL == null ? "#" : "href='" + trackingURL).Append("'>" ).Append(trackingUI).Append("</a>\",").Append("\"").Append(blacklistedNodesCount ).Append("\"],\n"); } if (appsTableData[appsTableData.Length - 2] == ',') { appsTableData.Delete(appsTableData.Length - 2, appsTableData.Length - 1); } appsTableData.Append("]"); html.Script().$type("text/javascript").("var appsTableData=" + appsTableData).(); tbody.().(); }