org.apache.hadoop.yarn.server.webapp.dao.AppAttemptInfo Java Examples
The following examples show how to use
org.apache.hadoop.yarn.server.webapp.dao.AppAttemptInfo.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AHSWebServices.java From hadoop with Apache License 2.0 | 5 votes |
@GET @Path("/apps/{appid}/appattempts/{appattemptid}") @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) @Override public AppAttemptInfo getAppAttempt(@Context HttpServletRequest req, @Context HttpServletResponse res, @PathParam("appid") String appId, @PathParam("appattemptid") String appAttemptId) { init(res); return super.getAppAttempt(req, res, appId, appAttemptId); }
Example #2
Source File: AHSWebServices.java From big-c with Apache License 2.0 | 5 votes |
@GET @Path("/apps/{appid}/appattempts/{appattemptid}") @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) @Override public AppAttemptInfo getAppAttempt(@Context HttpServletRequest req, @Context HttpServletResponse res, @PathParam("appid") String appId, @PathParam("appattemptid") String appAttemptId) { init(res); return super.getAppAttempt(req, res, appId, appAttemptId); }
Example #3
Source File: AppBlock.java From hadoop with Apache License 2.0 | 4 votes |
protected void createApplicationAttemptTable(Block html, Collection<ApplicationAttemptReport> attempts) { TBODY<TABLE<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"); for (final ApplicationAttemptReport appAttemptReport : attempts) { AppAttemptInfo appAttempt = new AppAttemptInfo(appAttemptReport); ContainerReport containerReport = null; try { final GetContainerReportRequest request = GetContainerReportRequest.newInstance( appAttemptReport.getAMContainerId()); if (callerUGI == null) { containerReport = appBaseProt.getContainerReport(request).getContainerReport(); } else { containerReport = callerUGI.doAs( new PrivilegedExceptionAction<ContainerReport> () { @Override public ContainerReport run() throws Exception { ContainerReport report = null; try { report = appBaseProt.getContainerReport(request) .getContainerReport(); } catch (ContainerNotFoundException ex) { LOG.warn(ex.getMessage()); } return report; } }); } } 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.charAt(attemptsTableData.length() - 2) == ',') { attemptsTableData.delete(attemptsTableData.length() - 2, attemptsTableData.length() - 1); } attemptsTableData.append("]"); html.script().$type("text/javascript") ._("var attemptsTableData=" + attemptsTableData)._(); tbody._()._(); }
Example #4
Source File: AppBlock.java From big-c with Apache License 2.0 | 4 votes |
protected void createApplicationAttemptTable(Block html, Collection<ApplicationAttemptReport> attempts) { TBODY<TABLE<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"); for (final ApplicationAttemptReport appAttemptReport : attempts) { AppAttemptInfo appAttempt = new AppAttemptInfo(appAttemptReport); ContainerReport containerReport = null; try { // AM container is always the first container of the attempt final GetContainerReportRequest request = GetContainerReportRequest.newInstance(ContainerId.newContainerId( appAttemptReport.getApplicationAttemptId(), 1)); if (callerUGI == null) { containerReport = appBaseProt.getContainerReport(request).getContainerReport(); } else { containerReport = callerUGI.doAs( new PrivilegedExceptionAction<ContainerReport> () { @Override public ContainerReport run() throws Exception { ContainerReport report = null; try { report = appBaseProt.getContainerReport(request) .getContainerReport(); } catch (ContainerNotFoundException ex) { LOG.warn(ex.getMessage()); } return report; } }); } } 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.charAt(attemptsTableData.length() - 2) == ',') { attemptsTableData.delete(attemptsTableData.length() - 2, attemptsTableData.length() - 1); } attemptsTableData.append("]"); html.script().$type("text/javascript") ._("var attemptsTableData=" + attemptsTableData)._(); tbody._()._(); }