Search in sources :

Example 1 with UnvalidIdStrException

use of com.tencent.angel.exception.UnvalidIdStrException in project angel by Tencent.

the class TaskCountersBlock method render.

@Override
protected void render(Block html) {
    set(TITLE, join("Angel TaskCountersBlock", $(TASK_ID)));
    String taskIdSr = $(TASK_ID);
    html.h1(taskIdSr);
    try {
        TaskId taskId = new TaskId(taskIdSr);
        String taskCounters = amContext.getTaskManager().getTask(taskId).getMetrics().get("taskCounters");
        html.pre()._(taskCounters)._();
    } catch (UnvalidIdStrException e) {
        LOG.error("unvalid id string ", e);
    }
}
Also used : TaskId(com.tencent.angel.worker.task.TaskId) UnvalidIdStrException(com.tencent.angel.exception.UnvalidIdStrException)

Example 2 with UnvalidIdStrException

use of com.tencent.angel.exception.UnvalidIdStrException in project angel by Tencent.

the class WorkerBlock method render.

@Override
protected void render(Block html) {
    set(TITLE, join("Angel Worker Attempt ", $(WORKER_ATTEMPT_ID)));
    String workerAttemptIdStr = $(WORKER_ATTEMPT_ID);
    if (workerAttemptIdStr == null || workerAttemptIdStr.isEmpty()) {
        html.p()._("Sorry, can't do anything without a WorkerId.")._();
        return;
    }
    WorkerAttemptId workerAttemptId = null;
    try {
        workerAttemptId = new WorkerAttemptId(workerAttemptIdStr);
    } catch (UnvalidIdStrException e) {
        LOG.error("unvalid id string, ", e);
        return;
    }
    AMWorker worker;
    worker = amContext.getWorkerManager().getWorker(workerAttemptId.getWorkerId());
    if (worker == null) {
        html.p()._("Sorry, can't find worker " + workerAttemptId.getWorkerId())._();
        return;
    }
    WorkerAttempt workerAttempt = worker.getWorkerAttempt(workerAttemptId);
    TABLE<DIV<Hamlet>> table = html.div(_INFO_WRAP).table("#job");
    TR<THEAD<TABLE<DIV<Hamlet>>>> headTr = table.thead().tr();
    headTr.th(_TH, "taskid").th(_TH, "state").th(_TH, "current iteration").th(_TH, "current iteration bar").th(_TH, "current progress").th(_TH, "current progress bar").th(_TH, "taskcounters");
    headTr._()._();
    float current_iteration_progress = (float) 0.0;
    float current_clock_progress = (float) 0.0;
    TBODY<TABLE<DIV<Hamlet>>> tbody = table.tbody();
    for (AMTask task : workerAttempt.getTaskMap().values()) {
        if (task.getProgress() >= 0 && task.getProgress() <= 1)
            current_iteration_progress = task.getProgress();
        current_clock_progress = ((float) task.getIteration()) / ((float) amContext.getTotalIterationNum());
        TR<TBODY<TABLE<DIV<Hamlet>>>> tr = tbody.tr();
        tr.td(task.getTaskId().toString()).td(task.getState().toString()).td(String.valueOf(task.getIteration()) + "/" + amContext.getTotalIterationNum()).td().div(_PROGRESSBAR).$title(// tooltip
        join(String.valueOf(current_clock_progress * 100), '%')).div(_PROGRESSBAR_VALUE).$style(join("width:", String.valueOf(current_clock_progress * 100), '%'))._()._()._().td(String.valueOf(current_iteration_progress)).td().div(_PROGRESSBAR).$title(join(String.valueOf(current_iteration_progress * 100), '%')).div(_PROGRESSBAR_VALUE).$style(join("width:", String.valueOf(current_iteration_progress * 100), '%'))._()._()._().td().a(url("angel/taskCountersPage/", task.getTaskId().toString()), "taskcounters")._();
        tr._();
    }
    tbody._()._()._();
}
Also used : Hamlet(org.apache.hadoop.yarn.webapp.hamlet.Hamlet) WorkerAttemptId(com.tencent.angel.worker.WorkerAttemptId) UnvalidIdStrException(com.tencent.angel.exception.UnvalidIdStrException) AMWorker(com.tencent.angel.master.worker.worker.AMWorker) WorkerAttempt(com.tencent.angel.master.worker.attempt.WorkerAttempt) AMTask(com.tencent.angel.master.task.AMTask)

Example 3 with UnvalidIdStrException

use of com.tencent.angel.exception.UnvalidIdStrException in project angel by Tencent.

the class WorkerThreadStackBlock method render.

@Override
protected void render(Block html) {
    set(TITLE, join("Angel WorkerThreadStack ", $(WORKER_ATTEMPT_ID)));
    try {
        WorkerAttemptId workerAttemptId = new WorkerAttemptId($(WORKER_ATTEMPT_ID));
        WorkerClient workerClient = null;
        LOG.info("start init WorkerClient");
        workerClient = new WorkerClient(amContext, workerAttemptId);
        String info = workerClient.getThreadStack();
        html.pre()._(info)._();
    } catch (IOException | UnvalidIdStrException | ServiceException e) {
        LOG.error("get stack for " + $(WORKER_ATTEMPT_ID) + " failed, ", e);
    }
}
Also used : ServiceException(com.google.protobuf.ServiceException) WorkerClient(com.tencent.angel.master.client.WorkerClient) WorkerAttemptId(com.tencent.angel.worker.WorkerAttemptId) IOException(java.io.IOException) UnvalidIdStrException(com.tencent.angel.exception.UnvalidIdStrException)

Example 4 with UnvalidIdStrException

use of com.tencent.angel.exception.UnvalidIdStrException in project angel by Tencent.

the class ParameterServerThreadStackBlock method render.

@Override
protected void render(Block html) {
    set(TITLE, join("Angel ParameterServerThread ", $(PSATTEMPT_ID)));
    PSAttemptId psAttempttId = null;
    try {
        psAttempttId = new PSAttemptId($(PSATTEMPT_ID));
    } catch (UnvalidIdStrException e) {
        LOG.error("unvalid id string, ", e);
        return;
    }
    try {
        LOG.info("start init PSClient");
        PSClient psClient = new PSClient(amContext, psAttempttId);
        String info = psClient.getThreadStack();
        html.pre()._(info)._();
    } catch (IOException | ServiceException e) {
        LOG.error("get thread stack from ps " + psAttempttId + " failed. ", e);
    }
}
Also used : PSAttemptId(com.tencent.angel.ps.PSAttemptId) ServiceException(com.google.protobuf.ServiceException) PSClient(com.tencent.angel.master.client.PSClient) IOException(java.io.IOException) UnvalidIdStrException(com.tencent.angel.exception.UnvalidIdStrException)

Example 5 with UnvalidIdStrException

use of com.tencent.angel.exception.UnvalidIdStrException in project angel by Tencent.

the class WorkerCounterBlock method render.

@Override
protected void render(Block html) {
    set(TITLE, join("Angel WorkerCounterBlock", $(WORKER_ATTEMPT_ID)));
    try {
        WorkerAttemptId workerAttemptId = new WorkerAttemptId($(WORKER_ATTEMPT_ID));
        Map<String, String> metricsMap = amContext.getWorkerManager().getWorker(workerAttemptId.getWorkerId()).getWorkerAttempt(workerAttemptId).getMetrics();
        TABLE<Hamlet> worker_metrics_table = html.table();
        html.h6($(WORKER_ATTEMPT_ID));
        worker_metrics_table.tr().th(_TH, "NAME").th(_TH, "VALUE")._();
        for (String key : metricsMap.keySet()) {
            String value = metricsMap.get(key);
            worker_metrics_table.tr().td(String.valueOf(key)).td(value)._();
        }
        worker_metrics_table._();
    } catch (UnvalidIdStrException e) {
        LOG.error("unvalid id string, ", e);
    }
}
Also used : Hamlet(org.apache.hadoop.yarn.webapp.hamlet.Hamlet) WorkerAttemptId(com.tencent.angel.worker.WorkerAttemptId) UnvalidIdStrException(com.tencent.angel.exception.UnvalidIdStrException)

Aggregations

UnvalidIdStrException (com.tencent.angel.exception.UnvalidIdStrException)6 WorkerAttemptId (com.tencent.angel.worker.WorkerAttemptId)4 Hamlet (org.apache.hadoop.yarn.webapp.hamlet.Hamlet)3 ServiceException (com.google.protobuf.ServiceException)2 WorkerAttempt (com.tencent.angel.master.worker.attempt.WorkerAttempt)2 AMWorker (com.tencent.angel.master.worker.worker.AMWorker)2 IOException (java.io.IOException)2 PSClient (com.tencent.angel.master.client.PSClient)1 WorkerClient (com.tencent.angel.master.client.WorkerClient)1 AMTask (com.tencent.angel.master.task.AMTask)1 AMWorkerGroup (com.tencent.angel.master.worker.workergroup.AMWorkerGroup)1 PSAttemptId (com.tencent.angel.ps.PSAttemptId)1 WorkerGroupId (com.tencent.angel.worker.WorkerGroupId)1 TaskId (com.tencent.angel.worker.task.TaskId)1 Date (java.util.Date)1