public virtual ContainerInfo GetContainer(HttpServletRequest req, HttpServletResponse res, string appId, string appAttemptId, string containerId) { UserGroupInformation callerUGI = GetUser(req); ApplicationId aid = ParseApplicationId(appId); ApplicationAttemptId aaid = ParseApplicationAttemptId(appAttemptId); ContainerId cid = ParseContainerId(containerId); ValidateIds(aid, aaid, cid); ContainerReport container = null; try { if (callerUGI == null) { GetContainerReportRequest request = GetContainerReportRequest.NewInstance(cid); container = appBaseProt.GetContainerReport(request).GetContainerReport(); } else { container = callerUGI.DoAs(new _PrivilegedExceptionAction_368(this, cid)); } } catch (Exception e) { RewrapAndThrowException(e); } if (container == null) { throw new NotFoundException("container with id: " + containerId + " not found"); } return(new ContainerInfo(container)); }
protected internal virtual 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").().().Tbody(); StringBuilder attemptsTableData = new StringBuilder("[\n"); foreach (ApplicationAttemptReport appAttemptReport in attempts) { AppAttemptInfo appAttempt = new AppAttemptInfo(appAttemptReport); ContainerReport containerReport; try { GetContainerReportRequest request = GetContainerReportRequest.NewInstance(appAttemptReport .GetAMContainerId()); if (callerUGI == null) { containerReport = appBaseProt.GetContainerReport(request).GetContainerReport(); } else { containerReport = callerUGI.DoAs(new _PrivilegedExceptionAction_242(this, request )); } } 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(); } attemptsTableData.Append("[\"<a href='").Append(Url("appattempt", appAttempt.GetAppAttemptId ())).Append("'>").Append(appAttempt.GetAppAttemptId()).Append("</a>\",\"").Append (startTime).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>\"],\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.().(); }