Java Code Examples for org.apache.hadoop.yarn.webapp.hamlet.Hamlet.TABLE#_
The following examples show how to use
org.apache.hadoop.yarn.webapp.hamlet.Hamlet.TABLE#_ .
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: ApplicationPage.java From hadoop with Apache License 2.0 | 6 votes |
@Override protected void render(Block html) { ApplicationId applicationID = ConverterUtils.toApplicationId(this.recordFactory, $(APPLICATION_ID)); Application app = this.nmContext.getApplications().get(applicationID); AppInfo info = new AppInfo(app); info("Application's information") ._("ApplicationId", info.getId()) ._("ApplicationState", info.getState()) ._("User", info.getUser()); TABLE<Hamlet> containersListBody = html._(InfoBlock.class) .table("#containers"); for (String containerIdStr : info.getContainers()) { containersListBody .tr().td() .a(url("container", containerIdStr), containerIdStr) ._()._(); } containersListBody._(); }
Example 2
Source File: ApplicationPage.java From big-c with Apache License 2.0 | 6 votes |
@Override protected void render(Block html) { ApplicationId applicationID = ConverterUtils.toApplicationId(this.recordFactory, $(APPLICATION_ID)); Application app = this.nmContext.getApplications().get(applicationID); AppInfo info = new AppInfo(app); info("Application's information") ._("ApplicationId", info.getId()) ._("ApplicationState", info.getState()) ._("User", info.getUser()); TABLE<Hamlet> containersListBody = html._(InfoBlock.class) .table("#containers"); for (String containerIdStr : info.getContainers()) { containersListBody .tr().td() .a(url("container", containerIdStr), containerIdStr) ._()._(); } containersListBody._(); }
Example 3
Source File: RMAppAttemptBlock.java From hadoop with Apache License 2.0 | 5 votes |
private void createContainerLocalityTable(Block html) { RMAppAttemptMetrics attemptMetrics = null; RMAppAttempt attempt = getRMAppAttempt(); if (attempt != null) { attemptMetrics = attempt.getRMAppAttemptMetrics(); } if (attemptMetrics == null) { return; } DIV<Hamlet> div = html.div(_INFO_WRAP); TABLE<DIV<Hamlet>> table = div.h3( "Total Allocated Containers: " + attemptMetrics.getTotalAllocatedContainers()).h3("Each table cell" + " represents the number of NodeLocal/RackLocal/OffSwitch containers" + " satisfied by NodeLocal/RackLocal/OffSwitch resource requests.").table( "#containerLocality"); table. tr(). th(_TH, ""). th(_TH, "Node Local Request"). th(_TH, "Rack Local Request"). th(_TH, "Off Switch Request"). _(); String[] containersType = { "Num Node Local Containers (satisfied by)", "Num Rack Local Containers (satisfied by)", "Num Off Switch Containers (satisfied by)" }; boolean odd = false; for (int i = 0; i < attemptMetrics.getLocalityStatistics().length; i++) { table.tr((odd = !odd) ? _ODD : _EVEN).td(containersType[i]) .td(String.valueOf(attemptMetrics.getLocalityStatistics()[i][0])) .td(i == 0 ? "" : String.valueOf(attemptMetrics.getLocalityStatistics()[i][1])) .td(i <= 1 ? "" : String.valueOf(attemptMetrics.getLocalityStatistics()[i][2]))._(); } table._(); div._(); }
Example 4
Source File: RMAppAttemptBlock.java From big-c with Apache License 2.0 | 5 votes |
private void createContainerLocalityTable(Block html) { RMAppAttemptMetrics attemptMetrics = null; RMAppAttempt attempt = getRMAppAttempt(); if (attempt != null) { attemptMetrics = attempt.getRMAppAttemptMetrics(); } if (attemptMetrics == null) { return; } DIV<Hamlet> div = html.div(_INFO_WRAP); TABLE<DIV<Hamlet>> table = div.h3( "Total Allocated Containers: " + attemptMetrics.getTotalAllocatedContainers()).h3("Each table cell" + " represents the number of NodeLocal/RackLocal/OffSwitch containers" + " satisfied by NodeLocal/RackLocal/OffSwitch resource requests.").table( "#containerLocality"); table. tr(). th(_TH, ""). th(_TH, "Node Local Request"). th(_TH, "Rack Local Request"). th(_TH, "Off Switch Request"). _(); String[] containersType = { "Num Node Local Containers (satisfied by)", "Num Rack Local Containers (satisfied by)", "Num Off Switch Containers (satisfied by)" }; boolean odd = false; for (int i = 0; i < attemptMetrics.getLocalityStatistics().length; i++) { table.tr((odd = !odd) ? _ODD : _EVEN).td(containersType[i]) .td(String.valueOf(attemptMetrics.getLocalityStatistics()[i][0])) .td(i == 0 ? "" : String.valueOf(attemptMetrics.getLocalityStatistics()[i][1])) .td(i <= 1 ? "" : String.valueOf(attemptMetrics.getLocalityStatistics()[i][2]))._(); } table._(); div._(); }
Example 5
Source File: RMAppAttemptBlock.java From hadoop with Apache License 2.0 | 4 votes |
private void createResourceRequestsTable(Block html) { AppInfo app = new AppInfo(rm, rm.getRMContext().getRMApps() .get(this.appAttemptId.getApplicationId()), true, WebAppUtils.getHttpSchemePrefix(conf)); List<ResourceRequest> resourceRequests = app.getResourceRequests(); if (resourceRequests == null || resourceRequests.isEmpty()) { return; } DIV<Hamlet> div = html.div(_INFO_WRAP); TABLE<DIV<Hamlet>> table = div.h3("Total Outstanding Resource Requests: " + getTotalResource(resourceRequests)).table( "#ResourceRequests"); table.tr(). th(_TH, "Priority"). th(_TH, "ResourceName"). th(_TH, "Capability"). th(_TH, "NumContainers"). th(_TH, "RelaxLocality"). th(_TH, "NodeLabelExpression"). _(); boolean odd = false; for (ResourceRequest request : resourceRequests) { if (request.getNumContainers() == 0) { continue; } table.tr((odd = !odd) ? _ODD : _EVEN) .td(String.valueOf(request.getPriority())) .td(request.getResourceName()) .td(String.valueOf(request.getCapability())) .td(String.valueOf(request.getNumContainers())) .td(String.valueOf(request.getRelaxLocality())) .td(request.getNodeLabelExpression() == null ? "N/A" : request .getNodeLabelExpression())._(); } table._(); div._(); }
Example 6
Source File: RMAppAttemptBlock.java From big-c with Apache License 2.0 | 4 votes |
private void createResourceRequestsTable(Block html) { AppInfo app = new AppInfo(rm, rm.getRMContext().getRMApps() .get(this.appAttemptId.getApplicationId()), true, WebAppUtils.getHttpSchemePrefix(conf)); List<ResourceRequest> resourceRequests = app.getResourceRequests(); if (resourceRequests == null || resourceRequests.isEmpty()) { return; } DIV<Hamlet> div = html.div(_INFO_WRAP); TABLE<DIV<Hamlet>> table = div.h3("Total Outstanding Resource Requests: " + getTotalResource(resourceRequests)).table( "#ResourceRequests"); table.tr(). th(_TH, "Priority"). th(_TH, "ResourceName"). th(_TH, "Capability"). th(_TH, "NumContainers"). th(_TH, "RelaxLocality"). th(_TH, "NodeLabelExpression"). _(); boolean odd = false; for (ResourceRequest request : resourceRequests) { if (request.getNumContainers() == 0) { continue; } table.tr((odd = !odd) ? _ODD : _EVEN) .td(String.valueOf(request.getPriority())) .td(request.getResourceName()) .td(String.valueOf(request.getCapability())) .td(String.valueOf(request.getNumContainers())) .td(String.valueOf(request.getRelaxLocality())) .td(request.getNodeLabelExpression() == null ? "N/A" : request .getNodeLabelExpression())._(); } table._(); div._(); }