本文整理汇总了Java中org.apache.hadoop.yarn.webapp.hamlet.Hamlet类的典型用法代码示例。如果您正苦于以下问题:Java Hamlet类的具体用法?Java Hamlet怎么用?Java Hamlet使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Hamlet类属于org.apache.hadoop.yarn.webapp.hamlet包,在下文中一共展示了Hamlet类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: render
import org.apache.hadoop.yarn.webapp.hamlet.Hamlet; //导入依赖的package包/类
@Override
protected void render(Block html) {
set(TITLE, join("Angel WorkerCounterBlock", $(WORKER_ATTEMPT_ID)));
try {
WorkerAttemptId workerAttemptId = new WorkerAttemptId($(WORKER_ATTEMPT_ID));
Map<String, String> metricsMap =
amContext.getWorkerManager().getWorker(workerAttemptId.getWorkerId())
.getWorkerAttempt(workerAttemptId).getMetrics();
TABLE<Hamlet> worker_metrics_table = html.table();
html.h6($(WORKER_ATTEMPT_ID));
worker_metrics_table.tr().th(_TH, "NAME").th(_TH, "VALUE")._();
for (String key : metricsMap.keySet()) {
String value = metricsMap.get(key);
worker_metrics_table.tr().td(String.valueOf(key)).td(value)._();
}
worker_metrics_table._();
} catch (UnvalidIdStrException e) {
LOG.error("unvalid id string, ", e);
}
}
示例2: render
import org.apache.hadoop.yarn.webapp.hamlet.Hamlet; //导入依赖的package包/类
@Override
protected void render(Block html) {
set(TITLE, join("Angel ExecutorsBlock"));
TBODY<TABLE<Hamlet>> tbody =
html.h1("ExecutorsBlock").table("#jobs").thead().tr().th(_TH, "id").th(_TH, "name")
.th(_TH, "state").th(_TH, "stacktrace")._()._().tbody();
ThreadMXBean threadMXBean = ManagementFactory.getThreadMXBean();
ThreadInfo[] threadInfo = threadMXBean.dumpAllThreads(true, true);
StringBuilder stackTraceString;
for (ThreadInfo t : threadInfo) {
stackTraceString = new StringBuilder();
StackTraceElement[] stackTrace = t.getStackTrace();
for (StackTraceElement s : stackTrace) {
stackTraceString.append(s.toString()).append("\n");
}
tbody.tr().td(String.valueOf(t.getThreadId())).td(String.valueOf(t.getThreadName()))
.td(String.valueOf(t.getThreadState())).td(String.valueOf(stackTraceString.toString()))._();
}
tbody._()._();
}
示例3: testTable
import org.apache.hadoop.yarn.webapp.hamlet.Hamlet; //导入依赖的package包/类
@Test public void testTable() {
Hamlet h = newHamlet().
title("test table").
link("style.css");
TABLE t = h.table("#id");
for (int i = 0; i < 3; ++i) {
t.tr().td("1").td("2")._();
}
t._();
PrintWriter out = h.getWriter();
out.flush();
assertEquals(0, h.nestLevel);
verify(out).print("<table");
verify(out).print("</table>");
verify(out, atLeast(1)).print("</td>");
verify(out, atLeast(1)).print("</tr>");
}
示例4: testEnumAttrs
import org.apache.hadoop.yarn.webapp.hamlet.Hamlet; //导入依赖的package包/类
@Test public void testEnumAttrs() {
Hamlet h = newHamlet().
meta_http("Content-type", "text/html; charset=utf-8").
title("test enum attrs").
link().$rel("stylesheet").
$media(EnumSet.of(Media.screen, Media.print)).
$type("text/css").$href("style.css")._().
link().$rel(EnumSet.of(LinkType.index, LinkType.start)).
$href("index.html")._();
h.div("#content")._("content")._();
PrintWriter out = h.getWriter();
out.flush();
assertEquals(0, h.nestLevel);
verify(out).print(" media=\"screen, print\"");
verify(out).print(" rel=\"start index\"");
}
示例5: render
import org.apache.hadoop.yarn.webapp.hamlet.Hamlet; //导入依赖的package包/类
@Override
protected void render(Block html) {
TBODY<TABLE<BODY<Hamlet>>> tableBody =
html
.body()
.table("#applications")
.thead()
.tr()
.td()._("ApplicationId")._()
.td()._("ApplicationState")._()
._()
._()
.tbody();
for (Entry<ApplicationId, Application> entry : this.nmContext
.getApplications().entrySet()) {
AppInfo info = new AppInfo(entry.getValue());
tableBody
.tr()
.td().a(url("application", info.getId()), info.getId())._()
.td()._(info.getState())
._()
._();
}
tableBody._()._()._();
}
示例6: render
import org.apache.hadoop.yarn.webapp.hamlet.Hamlet; //导入依赖的package包/类
@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._();
}
示例7: render
import org.apache.hadoop.yarn.webapp.hamlet.Hamlet; //导入依赖的package包/类
@Override
protected void render(Block html) {
TBODY<TABLE<BODY<Hamlet>>> tableBody = html.body()
.table("#containers")
.thead()
.tr()
.td()._("ContainerId")._()
.td()._("ContainerState")._()
.td()._("logs")._()
._()
._().tbody();
for (Entry<ContainerId, Container> entry : this.nmContext
.getContainers().entrySet()) {
ContainerInfo info = new ContainerInfo(this.nmContext, entry.getValue());
tableBody
.tr()
.td().a(url("container", info.getId()), info.getId())
._()
.td()._(info.getState())._()
.td()
.a(url(info.getShortLogLink()), "logs")._()
._();
}
tableBody._()._()._();
}
示例8: render
import org.apache.hadoop.yarn.webapp.hamlet.Hamlet; //导入依赖的package包/类
@Override public void render(Block html) {
UL<DIV<Hamlet>> mainList = html.
div("#nav").
h3("Cluster").
ul().
li().a(url("cluster"), "About")._().
li().a(url("nodes"), "Nodes")._().
li().a(url("nodelabels"), "Node Labels")._();
UL<LI<UL<DIV<Hamlet>>>> subAppsList = mainList.
li().a(url("apps"), "Applications").
ul();
subAppsList.li()._();
for (YarnApplicationState state : YarnApplicationState.values()) {
subAppsList.
li().a(url("apps", state.toString()), state.toString())._();
}
subAppsList._()._();
mainList.
li().a(url("scheduler"), "Scheduler")._()._().
h3("Tools").
ul().
li().a("/conf", "Configuration")._().
li().a("/logs", "Local logs")._().
li().a("/stacks", "Server stacks")._().
li().a("/jmx?qry=Hadoop:*", "Server metrics")._()._()._();
}
示例9: createAttemptHeadRoomTable
import org.apache.hadoop.yarn.webapp.hamlet.Hamlet; //导入依赖的package包/类
@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._();
}
}
}
示例10: render
import org.apache.hadoop.yarn.webapp.hamlet.Hamlet; //导入依赖的package包/类
@Override
protected void render(Block html) {
Log log = LogFactory.getLog(ErrorsAndWarningsBlock.class);
if (log instanceof Log4JLogger) {
Hamlet.DIV<Hamlet> div =
html.div().$class("metrics").$style("padding-bottom: 20px");
div.h3(tableHeading).table("#metricsoverview").thead()
.$class("ui-widget-header").tr().th().$class("ui-state-default")
._("Last 1 minute")._().th().$class("ui-state-default")
._("Last 5 minutes")._().th().$class("ui-state-default")
._("Last 15 minutes")._().th().$class("ui-state-default")
._("Last 1 hour")._().th().$class("ui-state-default")
._("Last 6 hours")._().th().$class("ui-state-default")
._("Last 12 hours")._().th().$class("ui-state-default")
._("Last 24 hours")._()._()._().tbody().$class("ui-widget-content")
.tr().td(String.valueOf(values.get(0)))
.td(String.valueOf(values.get(1))).td(String.valueOf(values.get(2)))
.td(String.valueOf(values.get(3))).td(String.valueOf(values.get(4)))
.td(String.valueOf(values.get(5))).td(String.valueOf(values.get(6)))
._()._()._();
div._();
}
}
示例11: render
import org.apache.hadoop.yarn.webapp.hamlet.Hamlet; //导入依赖的package包/类
@Override public void render(Block html) {
UL<DIV<Hamlet>> mainList = html.
div("#nav").
h3("Cluster").
ul().
li().a(url("cluster"), "About")._().
li().a(url("nodes"), "Nodes")._();
UL<LI<UL<DIV<Hamlet>>>> subAppsList = mainList.
li().a(url("apps"), "Applications").
ul();
subAppsList.li()._();
for (YarnApplicationState state : YarnApplicationState.values()) {
subAppsList.
li().a(url("apps", state.toString()), state.toString())._();
}
subAppsList._()._();
mainList.
li().a(url("scheduler"), "Scheduler")._()._().
h3("Tools").
ul().
li().a("/conf", "Configuration")._().
li().a("/logs", "Local logs")._().
li().a("/stacks", "Server stacks")._().
li().a("/metrics", "Server metrics")._()._()._();
}
示例12: testTable
import org.apache.hadoop.yarn.webapp.hamlet.Hamlet; //导入依赖的package包/类
@Test public void testTable() {
Hamlet h = newHamlet().
title("test table").
link("style.css");
TABLE t = h.table("#id");
for (int i = 0; i < 3; ++i) {
t.tr().td("1").td("2")._();
}
t._();
PrintWriter out = h.getWriter();
out.flush();
assertEquals(0, h.nestLevel);
verify(out).print("<table");
verify(out).print("</table>");
verify(out, never()).print("</td>");
verify(out, never()).print("</tr>");
}
示例13: render
import org.apache.hadoop.yarn.webapp.hamlet.Hamlet; //导入依赖的package包/类
@Override public void render(Block html) {
UL<DIV<Hamlet>> mainList = html.
div("#nav").
h3("Cluster").
ul().
li().a(url("cluster"), "About")._().
li().a(url("nodes"), "Nodes")._();
UL<LI<UL<DIV<Hamlet>>>> subAppsList = mainList.
li().a(url("apps"), "Applications").
ul();
subAppsList.li()._();
for (RMAppState state : RMAppState.values()) {
subAppsList.
li().a(url("apps", state.toString()), state.toString())._();
}
subAppsList._()._();
mainList.
li().a(url("scheduler"), "Scheduler")._()._().
h3("Tools").
ul().
li().a("/conf", "Configuration")._().
li().a("/logs", "Local logs")._().
li().a("/stacks", "Server stacks")._().
li().a("/metrics", "Server metrics")._()._()._();
}
示例14: render
import org.apache.hadoop.yarn.webapp.hamlet.Hamlet; //导入依赖的package包/类
@Override
protected void render(Block html) {
ApplicationId applicationID = ApplicationId.fromString($(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._();
}