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);
}
}
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._()._()._();
}
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);
}
}
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);
}
}
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);
}
}
Aggregations