本文整理汇总了Java中org.apache.hadoop.yarn.webapp.hamlet.Hamlet.TR类的典型用法代码示例。如果您正苦于以下问题:Java TR类的具体用法?Java TR怎么用?Java TR使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TR类属于org.apache.hadoop.yarn.webapp.hamlet.Hamlet包,在下文中一共展示了TR类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: render
import org.apache.hadoop.yarn.webapp.hamlet.Hamlet.TR; //导入依赖的package包/类
@Override
protected void render(Block html) {
TBODY<TABLE<Hamlet>> tbody = html.table("#nodelabels").
thead().
tr().
th(".name", "Label Name").
th(".numOfActiveNMs", "Num Of Active NMs").
th(".totalResource", "Total Resource").
_()._().
tbody();
RMNodeLabelsManager nlm = rm.getRMContext().getNodeLabelManager();
for (NodeLabel info : nlm.pullRMNodeLabelsInfo()) {
TR<TBODY<TABLE<Hamlet>>> row =
tbody.tr().td(
info.getLabelName().isEmpty() ? "<NO_LABEL>" : info
.getLabelName());
int nActiveNMs = info.getNumActiveNMs();
if (nActiveNMs > 0) {
row = row.td()
.a(url("nodes",
"?" + YarnWebParams.NODE_LABEL + "=" + info.getLabelName()),
String.valueOf(nActiveNMs))
._();
} else {
row = row.td(String.valueOf(nActiveNMs));
}
row.td(info.getResource().toString())._();
}
tbody._()._();
}
示例2: render
import org.apache.hadoop.yarn.webapp.hamlet.Hamlet.TR; //导入依赖的package包/类
@Override protected void render(Block html) {
if (job == null) {
html.
p()._("Sorry, no counters for nonexistent", $(JOB_ID, "job"))._();
return;
}
if (!$(TASK_ID).isEmpty() && task == null) {
html.
p()._("Sorry, no counters for nonexistent", $(TASK_ID, "task"))._();
return;
}
String columnType = task == null ? "Task" : "Task Attempt";
TBODY<TABLE<DIV<Hamlet>>> tbody = html.
div(_INFO_WRAP).
table("#singleCounter").
thead().
tr().
th(".ui-state-default", columnType).
th(".ui-state-default", "Value")._()._().
tbody();
for (Map.Entry<String, Long> entry : values.entrySet()) {
TR<TBODY<TABLE<DIV<Hamlet>>>> row = tbody.tr();
String id = entry.getKey();
String val = entry.getValue().toString();
if(task != null) {
row.td(id);
row.td().br().$title(val)._()._(val)._();
} else {
row.td().a(url("singletaskcounter",entry.getKey(),
$(COUNTER_GROUP), $(COUNTER_NAME)), id)._();
row.td().br().$title(val)._().a(url("singletaskcounter",entry.getKey(),
$(COUNTER_GROUP), $(COUNTER_NAME)), val)._();
}
row._();
}
tbody._()._()._();
}
示例3: render
import org.apache.hadoop.yarn.webapp.hamlet.Hamlet.TR; //导入依赖的package包/类
@Override
protected void render(Block html) {
TBODY<TABLE<Hamlet>> tbody = html.table("#nodelabels").
thead().
tr().
th(".name", "Label Name").
th(".type", "Label Type").
th(".numOfActiveNMs", "Num Of Active NMs").
th(".totalResource", "Total Resource").
_()._().
tbody();
RMNodeLabelsManager nlm = rm.getRMContext().getNodeLabelManager();
for (RMNodeLabel info : nlm.pullRMNodeLabelsInfo()) {
TR<TBODY<TABLE<Hamlet>>> row =
tbody.tr().td(info.getLabelName().isEmpty()
? NodeLabel.DEFAULT_NODE_LABEL_PARTITION : info.getLabelName());
String type =
(info.getIsExclusive()) ? "Exclusive Partition"
: "Non Exclusive Partition";
row = row.td(type);
int nActiveNMs = info.getNumActiveNMs();
if (nActiveNMs > 0) {
row = row.td()
.a(url("nodes",
"?" + YarnWebParams.NODE_LABEL + "=" + info.getLabelName()),
String.valueOf(nActiveNMs))
._();
} else {
row = row.td(String.valueOf(nActiveNMs));
}
row.td(info.getResource().toString())._();
}
tbody._()._();
}
示例4: generateRoleDetails
import org.apache.hadoop.yarn.webapp.hamlet.Hamlet.TR; //导入依赖的package包/类
/**
* 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._();
}
示例5: render
import org.apache.hadoop.yarn.webapp.hamlet.Hamlet.TR; //导入依赖的package包/类
@Override
protected void render(Block html) {
set(TITLE, join("Angel WorkerGroups ", $(WORKERGROUP_STATE)));
TABLE<Hamlet> table = html.table("#job");
TR<THEAD<TABLE<Hamlet>>> tr = table.thead().tr();
tr.th(_TH, "id").th(_TH, "state").th(_TH, "leader").th(_TH, "start time").th(_TH, "end time")
.th(_TH, "elapsed time");
tr._()._();
Set<AMWorkerGroupState> stateSet = transformToInternalState($(WORKERGROUP_STATE));
TBODY<TABLE<Hamlet>> tbody = table.tbody();
LOG.info("before get groups, group size is "
+ amContext.getWorkerManager().getWorkerGroupMap().size());
for (AMWorkerGroupState s : stateSet) {
LOG.info("s = " + s);
}
for (AMWorkerGroup workerGroup : amContext.getWorkerManager().getWorkerGroupMap().values()) {
LOG.info("group state is " + workerGroup.getState());
if (stateSet.contains(workerGroup.getState())) {
TR<TBODY<TABLE<Hamlet>>> tr1 = tbody.tr();
long elaspedTs = 0;
if (workerGroup.getLaunchTime() != 0 && workerGroup.getFinishTime() != 0) {
elaspedTs = workerGroup.getFinishTime() - workerGroup.getLaunchTime();
} else if (workerGroup.getLaunchTime() != 0 && workerGroup.getFinishTime() == 0) {
elaspedTs = System.currentTimeMillis() - workerGroup.getLaunchTime();
}
tr1.td()
.a(url("angel/workerGroupPage/", workerGroup.getId().toString()),
workerGroup.getId().toString())
._()
.td($(WORKERGROUP_STATE))
.td(workerGroup.getLeader().toString())
.td(workerGroup.getLaunchTime() == 0 ? "N/A" : new Date(workerGroup.getLaunchTime())
.toString())
.td(workerGroup.getFinishTime() == 0 ? "N/A" : new Date(workerGroup.getFinishTime())
.toString()).td(elaspedTs == 0 ? "N/A" : StringUtils.formatTime(elaspedTs));
tr1._();
}
}
tbody._()._();
}
示例6: render
import org.apache.hadoop.yarn.webapp.hamlet.Hamlet.TR; //导入依赖的package包/类
@Override
protected void render(Block html) {
html._(MetricsOverviewTable.class);
ResourceScheduler sched = rm.getResourceScheduler();
String type = $(NODE_STATE);
TBODY<TABLE<Hamlet>> tbody = html.table("#nodes").
thead().
tr().
th(".rack", "Rack").
th(".state", "Node State").
th(".nodeaddress", "Node Address").
th(".nodehttpaddress", "Node HTTP Address").
th(".lastHealthUpdate", "Last health-update").
th(".healthReport", "Health-report").
th(".containers", "Containers").
th(".mem", "Mem Used").
th(".mem", "Mem Avail").
_()._().
tbody();
NodeState stateFilter = null;
if(type != null && !type.isEmpty()) {
stateFilter = NodeState.valueOf(type.toUpperCase());
}
Collection<RMNode> rmNodes = this.rmContext.getRMNodes().values();
boolean isInactive = false;
if (stateFilter != null) {
switch (stateFilter) {
case DECOMMISSIONED:
case LOST:
case REBOOTED:
rmNodes = this.rmContext.getInactiveRMNodes().values();
isInactive = true;
break;
}
}
for (RMNode ni : rmNodes) {
if(stateFilter != null) {
NodeState state = ni.getState();
if(!stateFilter.equals(state)) {
continue;
}
} else {
// No filter. User is asking for all nodes. Make sure you skip the
// unhealthy nodes.
if (ni.getState() == NodeState.UNHEALTHY) {
continue;
}
}
NodeInfo info = new NodeInfo(ni, sched);
int usedMemory = (int)info.getUsedMemory();
int availableMemory = (int)info.getAvailableMemory();
TR<TBODY<TABLE<Hamlet>>> row = tbody.tr().
td(info.getRack()).
td(info.getState()).
td(info.getNodeId());
if (isInactive) {
row.td()._("N/A")._();
} else {
String httpAddress = info.getNodeHTTPAddress();
row.td().a(HttpConfig.getSchemePrefix() + httpAddress,
httpAddress)._();
}
row.td().br().$title(String.valueOf(info.getLastHealthUpdate()))._().
_(Times.format(info.getLastHealthUpdate()))._().
td(info.getHealthReport()).
td(String.valueOf(info.getNumContainers())).
td().br().$title(String.valueOf(usedMemory))._().
_(StringUtils.byteDesc(usedMemory * BYTES_IN_MB))._().
td().br().$title(String.valueOf(usedMemory))._().
_(StringUtils.byteDesc(availableMemory * BYTES_IN_MB))._().
_();
}
tbody._()._();
}
示例7: render
import org.apache.hadoop.yarn.webapp.hamlet.Hamlet.TR; //导入依赖的package包/类
@Override
protected void render(Block html) {
html._(MetricsOverviewTable.class);
ResourceScheduler sched = rm.getResourceScheduler();
String type = $(NODE_STATE);
TBODY<TABLE<Hamlet>> tbody = html.table("#nodes").
thead().
tr().
th(".rack", "Rack").
th(".state", "Node State").
th(".nodeaddress", "Node Address").
th(".nodehttpaddress", "Node HTTP Address").
th(".lastHealthUpdate", "Last health-update").
th(".healthReport", "Health-report").
th(".containers", "Containers").
th(".mem", "Mem Used").
th(".mem", "Mem Avail").
_()._().
tbody();
NodeState stateFilter = null;
if(type != null && !type.isEmpty()) {
stateFilter = NodeState.valueOf(type.toUpperCase());
}
Collection<RMNode> rmNodes = this.rmContext.getRMNodes().values();
boolean isInactive = false;
if (stateFilter != null) {
switch (stateFilter) {
case DECOMMISSIONED:
case LOST:
case REBOOTED:
rmNodes = this.rmContext.getInactiveRMNodes().values();
isInactive = true;
break;
}
}
for (RMNode ni : rmNodes) {
if(stateFilter != null) {
NodeState state = ni.getState();
if(!stateFilter.equals(state)) {
continue;
}
} else {
// No filter. User is asking for all nodes. Make sure you skip the
// unhealthy nodes.
//Add by ME
if (ni.getState() == NodeState.UNHEALTHY || ni.getState() == NodeState.UNTRUST) {
continue;
}
}
NodeInfo info = new NodeInfo(ni, sched);
int usedMemory = (int)info.getUsedMemory();
int availableMemory = (int)info.getAvailableMemory();
TR<TBODY<TABLE<Hamlet>>> row = tbody.tr().
td(info.getRack()).
td(info.getState()).
td(info.getNodeId());
if (isInactive) {
row.td()._("N/A")._();
} else {
String httpAddress = info.getNodeHTTPAddress();
row.td().a(HttpConfig.getSchemePrefix() + httpAddress,
httpAddress)._();
}
row.td().br().$title(String.valueOf(info.getLastHealthUpdate()))._().
_(Times.format(info.getLastHealthUpdate()))._().
td(info.getHealthReport()).
td(String.valueOf(info.getNumContainers())).
td().br().$title(String.valueOf(usedMemory))._().
_(StringUtils.byteDesc(usedMemory * BYTES_IN_MB))._().
td().br().$title(String.valueOf(usedMemory))._().
_(StringUtils.byteDesc(availableMemory * BYTES_IN_MB))._().
_();
}
tbody._()._();
}
示例8: printCell
import org.apache.hadoop.yarn.webapp.hamlet.Hamlet.TR; //导入依赖的package包/类
@Override
public void printCell(TR<?> tableRow) {
tableRow.td().a(anchorUrl, getCell())._();
}
示例9: render
import org.apache.hadoop.yarn.webapp.hamlet.Hamlet.TR; //导入依赖的package包/类
@Override
protected void render(Block html) {
html._(MetricsOverviewTable.class);
ResourceScheduler sched = rm.getResourceScheduler();
String type = $(NODE_STATE);
TBODY<TABLE<Hamlet>> tbody = html.table("#nodes").
thead().
tr().
th(".rack", "Rack").
th(".state", "Node State").
th(".nodeaddress", "Node Address").
th(".nodehttpaddress", "Node HTTP Address").
th(".lastHealthUpdate", "Last health-update").
th(".healthReport", "Health-report").
th(".containers", "Containers").
th(".mem", "Mem Used").
th(".mem", "Mem Avail").
th(".nodeManagerVersion", "Version").
_()._().
tbody();
NodeState stateFilter = null;
if(type != null && !type.isEmpty()) {
stateFilter = NodeState.valueOf(type.toUpperCase());
}
Collection<RMNode> rmNodes = this.rmContext.getRMNodes().values();
boolean isInactive = false;
if (stateFilter != null) {
switch (stateFilter) {
case DECOMMISSIONED:
case LOST:
case REBOOTED:
rmNodes = this.rmContext.getInactiveRMNodes().values();
isInactive = true;
break;
}
}
for (RMNode ni : rmNodes) {
if(stateFilter != null) {
NodeState state = ni.getState();
if(!stateFilter.equals(state)) {
continue;
}
} else {
// No filter. User is asking for all nodes. Make sure you skip the
// unhealthy nodes.
if (ni.getState() == NodeState.UNHEALTHY) {
continue;
}
}
NodeInfo info = new NodeInfo(ni, sched);
int usedMemory = (int)info.getUsedMemory();
int availableMemory = (int)info.getAvailableMemory();
TR<TBODY<TABLE<Hamlet>>> row = tbody.tr().
td(info.getRack()).
td(info.getState()).
td(info.getNodeId());
if (isInactive) {
row.td()._("N/A")._();
} else {
String httpAddress = info.getNodeHTTPAddress();
row.td().a("//" + httpAddress,
httpAddress)._();
}
row.td().br().$title(String.valueOf(info.getLastHealthUpdate()))._().
_(Times.format(info.getLastHealthUpdate()))._().
td(info.getHealthReport()).
td(String.valueOf(info.getNumContainers())).
td().br().$title(String.valueOf(usedMemory))._().
_(StringUtils.byteDesc(usedMemory * BYTES_IN_MB))._().
td().br().$title(String.valueOf(usedMemory))._().
_(StringUtils.byteDesc(availableMemory * BYTES_IN_MB))._().
td(ni.getNodeManagerVersion()).
_();
}
tbody._()._();
}