Search in sources :

Example 1 with AMWorkerGroupState

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._()._();
}
Also used : Hamlet(org.apache.hadoop.yarn.webapp.hamlet.Hamlet) AMWorkerGroup(com.tencent.angel.master.worker.workergroup.AMWorkerGroup) TBODY(org.apache.hadoop.yarn.webapp.hamlet.Hamlet.TBODY) Date(java.util.Date) TABLE(org.apache.hadoop.yarn.webapp.hamlet.Hamlet.TABLE) THEAD(org.apache.hadoop.yarn.webapp.hamlet.Hamlet.THEAD) AMWorkerGroupState(com.tencent.angel.master.worker.workergroup.AMWorkerGroupState)

Aggregations

AMWorkerGroup (com.tencent.angel.master.worker.workergroup.AMWorkerGroup)1 AMWorkerGroupState (com.tencent.angel.master.worker.workergroup.AMWorkerGroupState)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