Search in sources :

Example 1 with PSAttemptStateInternal

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._()._();
}
Also used : Hamlet(org.apache.hadoop.yarn.webapp.hamlet.Hamlet) AMParameterServer(com.tencent.angel.master.ps.ps.AMParameterServer) TBODY(org.apache.hadoop.yarn.webapp.hamlet.Hamlet.TBODY) PSAttemptStateInternal(com.tencent.angel.master.ps.attempt.PSAttemptStateInternal) Date(java.util.Date) TABLE(org.apache.hadoop.yarn.webapp.hamlet.Hamlet.TABLE) PSAttemptId(com.tencent.angel.ps.PSAttemptId) THEAD(org.apache.hadoop.yarn.webapp.hamlet.Hamlet.THEAD) PSAttempt(com.tencent.angel.master.ps.attempt.PSAttempt)

Aggregations

PSAttempt (com.tencent.angel.master.ps.attempt.PSAttempt)1 PSAttemptStateInternal (com.tencent.angel.master.ps.attempt.PSAttemptStateInternal)1 AMParameterServer (com.tencent.angel.master.ps.ps.AMParameterServer)1 PSAttemptId (com.tencent.angel.ps.PSAttemptId)1 Date (java.util.Date)1 Hamlet (org.apache.hadoop.yarn.webapp.hamlet.Hamlet)1 TABLE (org.apache.hadoop.yarn.webapp.hamlet.Hamlet.TABLE)1 TBODY (org.apache.hadoop.yarn.webapp.hamlet.Hamlet.TBODY)1 THEAD (org.apache.hadoop.yarn.webapp.hamlet.Hamlet.THEAD)1