use of com.tencent.angel.master.ps.attempt.PSAttemptStateInternal in project angel by Tencent.
the class ParameterServersBlock method render.
@Override
protected void render(Block html) {
set(TITLE, join("Angel ParameterServers"));
TABLE<Hamlet> table = html.table("#job");
TR<THEAD<TABLE<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");
headTr._()._();
Set<PSAttemptStateInternal> stateSet = transformToInternalState($(PARAMETERSERVER_STATE));
TBODY<TABLE<Hamlet>> tbody = table.tbody();
for (AMParameterServer ps : amContext.getParameterServerManager().getParameterServerMap().values()) {
Map<PSAttemptId, PSAttempt> psAttempts = ps.getPSAttempts();
for (PSAttempt psAttempt : psAttempts.values()) {
if (stateSet.contains(psAttempt.getInternalState())) {
TR<TBODY<TABLE<Hamlet>>> tr = tbody.tr();
long elaspedTs = 0;
if (psAttempt.getLaunchTime() != 0 && psAttempt.getFinishTime() != 0) {
elaspedTs = psAttempt.getFinishTime() - psAttempt.getLaunchTime();
} else if (psAttempt.getLaunchTime() != 0 && psAttempt.getFinishTime() == 0) {
elaspedTs = System.currentTimeMillis() - psAttempt.getLaunchTime();
}
if (psAttempt.getNodeHttpAddr() == null) {
tr.td(psAttempt.getId().toString()).td($(PARAMETERSERVER_STATE)).td("N/A").td(psAttempt.getLaunchTime() == 0 ? "N/A" : new Date(psAttempt.getLaunchTime()).toString()).td(psAttempt.getFinishTime() == 0 ? "N/A" : new Date(psAttempt.getFinishTime()).toString()).td(elaspedTs == 0 ? "N/A" : new Date(elaspedTs).toString()).td("N/A").td("N/A");
tr._();
} else {
tr.td(psAttempt.getId().toString()).td($(PARAMETERSERVER_STATE)).td().a(url(MRWebAppUtil.getYARNWebappScheme(), psAttempt.getNodeHttpAddr()), psAttempt.getNodeHttpAddr())._().td(psAttempt.getLaunchTime() == 0 ? "N/A" : new Date(psAttempt.getLaunchTime()).toString()).td(psAttempt.getFinishTime() == 0 ? "N/A" : new Date(psAttempt.getFinishTime()).toString()).td(elaspedTs == 0 ? "N/A" : StringUtils.formatTime(elaspedTs)).td().a(url(MRWebAppUtil.getYARNWebappScheme(), psAttempt.getNodeHttpAddr(), "node", "containerlogs", psAttempt.getContainerIdStr(), amContext.getUser().toString()), "log")._().td().a(url("/angel/parameterServerThreadStackPage/", psAttempt.getId().toString()), "psthreadstack")._();
tr._();
}
}
}
}
tbody._()._();
}
Aggregations