/// <exception cref="System.Exception"/> public ContainerReport Run() { GetContainerReportRequest request = GetContainerReportRequest.NewInstance(cid); return(this._enclosing.appBaseProt.GetContainerReport(request).GetContainerReport ()); }
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)); }
/// <exception cref="Org.Apache.Hadoop.Yarn.Exceptions.YarnException"/> /// <exception cref="System.IO.IOException"/> public override ContainerReport GetContainerReport(ContainerId containerId) { GetContainerReportRequest request = GetContainerReportRequest.NewInstance(containerId ); GetContainerReportResponse response = ahsClient.GetContainerReport(request); return(response.GetContainerReport()); }
public virtual void TestContainerReport() { ApplicationId appId = ApplicationId.NewInstance(0, 1); ApplicationAttemptId appAttemptId = ApplicationAttemptId.NewInstance(appId, 1); ContainerId containerId = ContainerId.NewContainerId(appAttemptId, 1); GetContainerReportRequest request = GetContainerReportRequest.NewInstance(containerId ); GetContainerReportResponse response = clientService.GetContainerReport(request); ContainerReport container = response.GetContainerReport(); NUnit.Framework.Assert.IsNotNull(container); NUnit.Framework.Assert.AreEqual(containerId, container.GetContainerId()); NUnit.Framework.Assert.AreEqual("http://0.0.0.0:8188/applicationhistory/logs/" + "test host:100/container_0_0001_01_000001/" + "container_0_0001_01_000001/user1" , container.GetLogUrl()); }
public virtual void TestContainerNotFound() { ApplicationId appId = ApplicationId.NewInstance(0, 1); ApplicationAttemptId appAttemptId = ApplicationAttemptId.NewInstance(appId, 1); ContainerId containerId = ContainerId.NewContainerId(appAttemptId, MaxApps + 1); GetContainerReportRequest request = GetContainerReportRequest.NewInstance(containerId ); try { GetContainerReportResponse response = clientService.GetContainerReport(request); } catch (ContainerNotFoundException e) { //This exception is expected NUnit.Framework.Assert.IsTrue(e.Message.Contains("doesn't exist in the timeline store" )); } catch (Exception) { NUnit.Framework.Assert.Fail("Undesired exception caught"); } }
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.().(); }
protected override void Render(HtmlBlock.Block html) { string containerid = $(YarnWebParams.ContainerId); if (containerid.IsEmpty()) { Puts("Bad request: requires container ID"); return; } ContainerId containerId = null; try { containerId = ConverterUtils.ToContainerId(containerid); } catch (ArgumentException) { Puts("Invalid container ID: " + containerid); return; } UserGroupInformation callerUGI = GetCallerUGI(); ContainerReport containerReport = null; try { GetContainerReportRequest request = GetContainerReportRequest.NewInstance(containerId ); if (callerUGI == null) { containerReport = appBaseProt.GetContainerReport(request).GetContainerReport(); } else { containerReport = callerUGI.DoAs(new _PrivilegedExceptionAction_78(this, request) ); } } catch (Exception e) { string message = "Failed to read the container " + containerid + "."; Log.Error(message, e); html.P().(message).(); return; } if (containerReport == null) { Puts("Container not found: " + containerid); return; } ContainerInfo container = new ContainerInfo(containerReport); SetTitle(StringHelper.Join("Container ", containerid)); Info("Container Overview").("Container State:", container.GetContainerState() == null ? Unavailable : container.GetContainerState()).("Exit Status:", container.GetContainerExitStatus ()).("Node:", container.GetNodeHttpAddress() == null ? "#" : container.GetNodeHttpAddress (), container.GetNodeHttpAddress() == null ? "N/A" : container.GetNodeHttpAddress ()).("Priority:", container.GetPriority()).("Started:", Times.Format(container.GetStartedTime ())).("Elapsed:", StringUtils.FormatTime(Times.Elapsed(container.GetStartedTime( ), container.GetFinishedTime()))).("Resource:", container.GetAllocatedMB() + " Memory, " + container.GetAllocatedVCores() + " VCores").("Logs:", container.GetLogUrl() == null ? "#" : container.GetLogUrl(), container.GetLogUrl() == null ? "N/A" : "Logs" ).("Diagnostics:", container.GetDiagnosticsInfo() == null ? string.Empty : container .GetDiagnosticsInfo()); html.(typeof(InfoBlock)); }