use of com.tencent.angel.exception.UnvalidIdStrException in project angel by Tencent.
the class WorkerGroupBlock method render.
@Override
protected void render(Block html) {
String workerGroupIdSr = $(WORKERGROUP_ID);
if (workerGroupIdSr.isEmpty()) {
html.p()._("Sorry, can't do anything without a WorkerGroupId.")._();
return;
}
WorkerGroupId workerGroupId;
try {
workerGroupId = new WorkerGroupId(workerGroupIdSr);
} catch (UnvalidIdStrException e) {
LOG.error("unvalid id string, ", e);
return;
}
AMWorkerGroup workerGroup = amContext.getWorkerManager().getWorkerGroup(workerGroupId);
if (workerGroup == null) {
html.p()._("Sorry, can't find group " + workerGroupId)._();
return;
}
set(TITLE, join("Angel WorkerGroup ", $(WORKERGROUP_ID)));
html.h1(workerGroupIdSr);
TABLE<DIV<Hamlet>> table = html.div(_INFO_WRAP).table("#job");
TR<THEAD<TABLE<DIV<Hamlet>>>> headTr = table.thead().tr();
headTr.th(_TH, "id").th(_TH, "state").th(_TH, "node address").th(_TH, "start time").th(_TH, "end time").th(_TH, "elapsed time").th(_TH, "log").th(_TH, "threadstack").th(_TH, "workercounter");
headTr._()._();
TBODY<TABLE<DIV<Hamlet>>> tbody = table.tbody();
for (AMWorker worker : workerGroup.getWorkerSet()) {
Map<WorkerAttemptId, WorkerAttempt> workerAttempts = worker.getAttempts();
for (WorkerAttempt workerAttempt : workerAttempts.values()) {
TR<TBODY<TABLE<DIV<Hamlet>>>> tr = tbody.tr();
long elaspedTs = 0;
if (workerAttempt.getLaunchTime() != 0 && workerAttempt.getFinishTime() != 0) {
elaspedTs = workerAttempt.getFinishTime() - workerAttempt.getLaunchTime();
} else if (workerAttempt.getLaunchTime() != 0 && workerAttempt.getFinishTime() == 0) {
elaspedTs = System.currentTimeMillis() - workerAttempt.getLaunchTime();
}
if (workerAttempt.getNodeHttpAddr() == null) {
tr.td().a(url("angel/workerPage", workerAttempt.getId().toString()), workerAttempt.getId().toString())._().td(workerAttempt.getState().toString()).td("N/A").td((workerAttempt.getLaunchTime() == 0) ? "N/A" : new Date(workerAttempt.getLaunchTime()).toString()).td((workerAttempt.getFinishTime() == 0) ? "N/A" : new Date(workerAttempt.getFinishTime()).toString()).td((elaspedTs == 0) ? "N/A" : StringUtils.formatTime(elaspedTs)).td("N/A").td("N/A").td("N/A");
} else {
tr.td().a(url("angel/workerPage", workerAttempt.getId().toString()), workerAttempt.getId().toString())._().td(workerAttempt.getState().toString()).td().a(url(MRWebAppUtil.getYARNWebappScheme(), workerAttempt.getNodeHttpAddr()), workerAttempt.getNodeHttpAddr())._().td((workerAttempt.getLaunchTime() == 0) ? "N/A" : new Date(workerAttempt.getLaunchTime()).toString()).td((workerAttempt.getFinishTime() == 0) ? "N/A" : new Date(workerAttempt.getFinishTime()).toString()).td((elaspedTs == 0) ? "N/A" : StringUtils.formatTime(elaspedTs)).td().a(url(MRWebAppUtil.getYARNWebappScheme(), workerAttempt.getNodeHttpAddr(), "node", "containerlogs", workerAttempt.getContainerIdStr(), amContext.getUser().toString()), "log")._().td().a(url("angel/workerThreadStackPage/", workerAttempt.getId().toString()), "workerthreadstack")._().td().a(url("angel/workerCounterPage/", workerAttempt.getId().toString()), "workercounter")._();
}
tr._();
}
}
tbody._()._()._();
}
Aggregations