use of com.tencent.angel.master.worker.workergroup.AMWorkerGroupState in project angel by Tencent.
the class WorkerGroupsBlock method render.
@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._()._();
}
Aggregations