本文整理汇总了Java中org.apache.hadoop.yarn.webapp.hamlet.Hamlet.DIV._属性的典型用法代码示例。如果您正苦于以下问题:Java DIV._属性的具体用法?Java DIV._怎么用?Java DIV._使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.apache.hadoop.yarn.webapp.hamlet.Hamlet.DIV
的用法示例。
在下文中一共展示了DIV._属性的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createAttemptHeadRoomTable
@Override
protected void createAttemptHeadRoomTable(Block html) {
RMAppAttempt attempt = getRMAppAttempt();
if (attempt != null) {
if (!isApplicationInFinalState(YarnApplicationAttemptState
.valueOf(attempt.getAppAttemptState().toString()))) {
RMAppAttemptMetrics metrics = attempt.getRMAppAttemptMetrics();
DIV<Hamlet> pdiv = html._(InfoBlock.class).div(_INFO_WRAP);
info("Application Attempt Overview").clear();
info("Application Attempt Metrics")._(
"Application Attempt Headroom : ", metrics == null ? "N/A" :
metrics.getApplicationAttemptHeadroom());
pdiv._();
}
}
}
示例2: createContainerLocalityTable
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._();
}
示例3: generateRoleDetails
/**
* Given a div, a name for this data, and some pairs of data, generate a nice HTML table. If contents is empty (of size zero), then a mesage will be printed
* that there were no items instead of an empty table.
*
* @param div
* @param detailsName
* @param contents
*/
protected <T1 extends TableContent,T2> void generateRoleDetails(DIV<Hamlet> parent, String divSelector, String detailsName, Iterable<Entry<T1,T2>> contents) {
final DIV<DIV<Hamlet>> div = parent.div(divSelector).h3(BOLD, detailsName);
int offset = 0;
TABLE<DIV<DIV<Hamlet>>> table = null;
TBODY<TABLE<DIV<DIV<Hamlet>>>> tbody = null;
for (Entry<T1,T2> content : contents) {
if (null == table) {
table = div.table("ui-widget-content ui-corner-bottom");
tbody = table.tbody();
}
TR<TBODY<TABLE<DIV<DIV<Hamlet>>>>> row = tbody.tr(offset % 2 == 0 ? EVEN : ODD);
// Defer to the implementation of the TableContent for what the cell should contain
content.getKey().printCell(row);
// Only add the second column if the element is non-null
// This also lets us avoid making a second method if we're only making a one-column table
if (null != content.getValue()) {
row.td(content.getValue().toString());
}
row._();
offset++;
}
// If we made a table, close it out
if (null != table) {
tbody._()._();
} else {
// Otherwise, throw in a nice "no content" message
div.p("no-table-contents")._("None")._();
}
// Close out the initial div
div._();
}
示例4: render
@Override protected void render(Block html) {
DIV<Hamlet> nav = html.
div("#nav").
a(url("/"), "Index").
span(" ").
a(url("/monitor"), "Monitor").
span(" ").
a(url("../ws/monitor"), "Rest Monitor");
nav._();
}
示例5: createResourceRequestsTable
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._();
}
示例6: createApplicationMetricsTable
@Override
protected void createApplicationMetricsTable(Block html){
RMApp rmApp = this.rm.getRMContext().getRMApps().get(appID);
RMAppMetrics appMetrics = rmApp == null ? null : rmApp.getRMAppMetrics();
// Get attempt metrics and fields, it is possible currentAttempt of RMApp is
// null. In that case, we will assume resource preempted and number of Non
// AM container preempted on that attempt is 0
RMAppAttemptMetrics attemptMetrics;
if (rmApp == null || null == rmApp.getCurrentAppAttempt()) {
attemptMetrics = null;
} else {
attemptMetrics = rmApp.getCurrentAppAttempt().getRMAppAttemptMetrics();
}
Resource attemptResourcePreempted =
attemptMetrics == null ? Resources.none() : attemptMetrics
.getResourcePreempted();
int attemptNumNonAMContainerPreempted =
attemptMetrics == null ? 0 : attemptMetrics
.getNumNonAMContainersPreempted();
DIV<Hamlet> pdiv = html.
_(InfoBlock.class).
div(_INFO_WRAP);
info("Application Overview").clear();
info("Application Metrics")
._("Total Resource Preempted:",
appMetrics == null ? "N/A" : appMetrics.getResourcePreempted())
._("Total Number of Non-AM Containers Preempted:",
appMetrics == null ? "N/A"
: appMetrics.getNumNonAMContainersPreempted())
._("Total Number of AM Containers Preempted:",
appMetrics == null ? "N/A"
: appMetrics.getNumAMContainersPreempted())
._("Resource Preempted from Current Attempt:",
attemptResourcePreempted)
._("Number of Non-AM Containers Preempted from Current Attempt:",
attemptNumNonAMContainerPreempted)
._("Aggregate Resource Allocation:",
String.format("%d MB-seconds, %d vcore-seconds, %d gcore-seconds",
appMetrics == null ? "N/A" : appMetrics.getMemorySeconds(),
appMetrics == null ? "N/A" : appMetrics.getVcoreSeconds(),
appMetrics == null ? "N/A" : appMetrics.getGcoreSeconds()));
pdiv._();
}
示例7: createApplicationMetricsTable
@Override
protected void createApplicationMetricsTable(Block html){
RMApp rmApp = this.rm.getRMContext().getRMApps().get(appID);
RMAppMetrics appMetrics = rmApp == null ? null : rmApp.getRMAppMetrics();
// Get attempt metrics and fields, it is possible currentAttempt of RMApp is
// null. In that case, we will assume resource preempted and number of Non
// AM container preempted on that attempt is 0
RMAppAttemptMetrics attemptMetrics;
if (rmApp == null || null == rmApp.getCurrentAppAttempt()) {
attemptMetrics = null;
} else {
attemptMetrics = rmApp.getCurrentAppAttempt().getRMAppAttemptMetrics();
}
Resource attemptResourcePreempted =
attemptMetrics == null ? Resources.none() : attemptMetrics
.getResourcePreempted();
int attemptNumNonAMContainerPreempted =
attemptMetrics == null ? 0 : attemptMetrics
.getNumNonAMContainersPreempted();
DIV<Hamlet> pdiv = html.
_(InfoBlock.class).
div(_INFO_WRAP);
info("Application Overview").clear();
info("Application Metrics")
._("Total Resource Preempted:",
appMetrics == null ? "N/A" : appMetrics.getResourcePreempted())
._("Total Number of Non-AM Containers Preempted:",
appMetrics == null ? "N/A"
: appMetrics.getNumNonAMContainersPreempted())
._("Total Number of AM Containers Preempted:",
appMetrics == null ? "N/A"
: appMetrics.getNumAMContainersPreempted())
._("Resource Preempted from Current Attempt:",
attemptResourcePreempted)
._("Number of Non-AM Containers Preempted from Current Attempt:",
attemptNumNonAMContainerPreempted)
._("Aggregate Resource Allocation:",
String.format("%d MB-seconds, %d vcore-seconds",
appMetrics == null ? "N/A" : appMetrics.getMemorySeconds(),
appMetrics == null ? "N/A" : appMetrics.getVcoreSeconds()));
pdiv._();
}
示例8: createApplicationMetricsTable
@Override
protected void createApplicationMetricsTable(Block html){
RMApp rmApp = this.rm.getRMContext().getRMApps().get(appID);
RMAppMetrics appMetrics = rmApp == null ? null : rmApp.getRMAppMetrics();
// Get attempt metrics and fields, it is possible currentAttempt of RMApp is
// null. In that case, we will assume resource preempted and number of Non
// AM container preempted on that attempt is 0
RMAppAttemptMetrics attemptMetrics;
if (rmApp == null || null == rmApp.getCurrentAppAttempt()) {
attemptMetrics = null;
} else {
attemptMetrics = rmApp.getCurrentAppAttempt().getRMAppAttemptMetrics();
}
Resource attemptResourcePreempted =
attemptMetrics == null ? Resources.none() : attemptMetrics
.getResourcePreempted();
int attemptNumNonAMContainerPreempted =
attemptMetrics == null ? 0 : attemptMetrics
.getNumNonAMContainersPreempted();
DIV<Hamlet> pdiv = html.
_(InfoBlock.class).
div(_INFO_WRAP);
info("Application Overview").clear();
info("Application Metrics")
._("Total Resource Preempted:",
appMetrics == null ? "N/A" : appMetrics.getResourcePreempted())
._("Total Number of Non-AM Containers Preempted:",
appMetrics == null ? "N/A"
: appMetrics.getNumNonAMContainersPreempted())
._("Total Number of AM Containers Preempted:",
appMetrics == null ? "N/A"
: appMetrics.getNumAMContainersPreempted())
._("Resource Preempted from Current Attempt:",
attemptResourcePreempted)
._("Number of Non-AM Containers Preempted from Current Attempt:",
attemptNumNonAMContainerPreempted)
._("Aggregate Resource Allocation:",
String.format("%d MB-seconds, %d vcore-seconds, %d gpu-seconds",
appMetrics == null ? "N/A" : appMetrics.getMemorySeconds(),
appMetrics == null ? "N/A" : appMetrics.getVcoreSeconds(),
appMetrics == null ? "N/A" : appMetrics.getGPUSeconds()))
._("Aggregate Preempted Resource Allocation:",
String.format("%d MB-seconds, %d vcore-seconds, %d gpu-seconds",
appMetrics == null ? "N/A" : appMetrics.getPreemptedMemorySeconds(),
appMetrics == null ? "N/A" :
appMetrics.getPreemptedVcoreSeconds(),
appMetrics == null ? "N/A" :
appMetrics.getPreemptedGPUSeconds()));
pdiv._();
}
示例9: render
@Override
protected void render(Block html) {
// TODO Probably better to just get a copy of this list for us to avoid the repeated synchronization?
// does this change if we have 50 node, 100node, 500 node clusters?
final Map<String,RoleInstance> containerInstances = getContainerInstances(slider.getAppState().cloneOwnedContainerList());
for (Entry<String,RoleStatus> entry : slider.getRoleStatusByName().entrySet()) {
final String name = entry.getKey();
final RoleStatus roleStatus = entry.getValue();
DIV<Hamlet> div = html.div("role-info ui-widget-content ui-corner-all");
List<ClusterNode> nodesInRole;
try {
nodesInRole = clusterOps.listClusterNodesInRole(name);
} catch (Exception e) {
log.error("Could not fetch containers for role: " + name, e);
nodesInRole = Collections.emptyList();
}
div.h2(BOLD, StringUtils.capitalize(name));
// Generate the details on this role
Iterable<Entry<String,Integer>> stats = roleStatus.buildStatistics().entrySet();
generateRoleDetails(div,"role-stats-wrap", "Specifications", Iterables.transform(stats, stringIntPairFunc));
// Sort the ClusterNodes by their name (containerid)
Collections.sort(nodesInRole, new ClusterNodeNameComparator());
// Generate the containers running this role
generateRoleDetails(div, "role-stats-containers", "Containers",
Iterables.transform(nodesInRole, new Function<ClusterNode,Entry<TableContent,String>>() {
@Override
public Entry<TableContent,String> apply(ClusterNode input) {
final String containerId = input.name;
if (containerInstances.containsKey(containerId)) {
RoleInstance roleInst = containerInstances.get(containerId);
if (roleInst.container.getNodeHttpAddress() != null) {
return Maps.<TableContent,String> immutableEntry(
new TableAnchorContent(containerId, buildNodeUrlForContainer(roleInst.container.getNodeHttpAddress(), containerId)), null);
}
}
return Maps.immutableEntry(new TableContent(input.name), null);
}
}));
ClusterDescription desc = slider.getAppState().getClusterStatus();
Map<String,String> options = desc.getRole(name);
Iterable<Entry<TableContent,String>> tableContent;
// Generate the pairs of data in the expected form
if (null != options) {
tableContent = Iterables.transform(options.entrySet(), stringStringPairFunc);
} else {
// Or catch that we have no options and provide "empty"
tableContent = Collections.<Entry<TableContent,String>> emptySet();
}
// Generate the options used by this role
generateRoleDetails(div, "role-options-wrap", "Role Options", tableContent);
// Close the div for this role
div._();
}
}