Search in sources :

Example 16 with TABLE

use of org.apache.hadoop.yarn.webapp.hamlet.Hamlet.TABLE 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

TABLE (org.apache.hadoop.yarn.webapp.hamlet.Hamlet.TABLE)16 Hamlet (org.apache.hadoop.yarn.webapp.hamlet.Hamlet)6 THEAD (org.apache.hadoop.yarn.webapp.hamlet.Hamlet.THEAD)4 Date (java.util.Date)3 Job (org.apache.hadoop.mapreduce.v2.app.job.Job)3 TBODY (org.apache.hadoop.yarn.webapp.hamlet.Hamlet.TBODY)3 PrivilegedExceptionAction (java.security.PrivilegedExceptionAction)2 TaskType (org.apache.hadoop.mapreduce.v2.api.records.TaskType)2 Task (org.apache.hadoop.mapreduce.v2.app.job.Task)2 TaskInfo (org.apache.hadoop.mapreduce.v2.app.webapp.dao.TaskInfo)2 ApplicationAttemptId (org.apache.hadoop.yarn.api.records.ApplicationAttemptId)2 ApplicationAttemptReport (org.apache.hadoop.yarn.api.records.ApplicationAttemptReport)2 ApplicationReport (org.apache.hadoop.yarn.api.records.ApplicationReport)2 ContainerReport (org.apache.hadoop.yarn.api.records.ContainerReport)2 AppInfo (org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.AppInfo)2 AppAttemptInfo (org.apache.hadoop.yarn.server.webapp.dao.AppAttemptInfo)2 AppInfo (org.apache.hadoop.yarn.server.webapp.dao.AppInfo)2 ContainerInfo (org.apache.hadoop.yarn.server.webapp.dao.ContainerInfo)2 AngelConf (com.tencent.angel.conf.AngelConf)1 PSAttempt (com.tencent.angel.master.ps.attempt.PSAttempt)1