use of org.apache.hadoop.yarn.webapp.hamlet.Hamlet.TABLE in project hadoop by apache.
the class TasksBlock method render.
@Override
protected void render(Block html) {
if (app.getJob() == null) {
html.h2($(TITLE));
return;
}
TaskType type = null;
String symbol = $(TASK_TYPE);
if (!symbol.isEmpty()) {
type = MRApps.taskType(symbol);
}
TBODY<TABLE<Hamlet>> tbody = html.table("#tasks").thead().tr().th("Task").th("Progress").th("Status").th("State").th("Start Time").th("Finish Time").th("Elapsed Time")._()._().tbody();
StringBuilder tasksTableData = new StringBuilder("[\n");
for (Task task : app.getJob().getTasks().values()) {
if (type != null && task.getType() != type) {
continue;
}
String taskStateStr = $(TASK_STATE);
if (taskStateStr == null || taskStateStr.trim().equals("")) {
taskStateStr = "ALL";
}
if (!taskStateStr.equalsIgnoreCase("ALL")) {
try {
// get stateUI enum
MRApps.TaskStateUI stateUI = MRApps.taskState(taskStateStr);
if (!stateUI.correspondsTo(task.getState())) {
continue;
}
} catch (IllegalArgumentException e) {
// not supported state, ignore
continue;
}
}
TaskInfo info = new TaskInfo(task);
String tid = info.getId();
String pct = StringUtils.format("%.2f", info.getProgress());
tasksTableData.append("[\"<a href='").append(url("task", tid)).append("'>").append(tid).append("</a>\",\"").append("<br title='").append(pct).append("'> <div class='").append(C_PROGRESSBAR).append("' title='").append(join(pct, '%')).append("'> ").append("<div class='").append(C_PROGRESSBAR_VALUE).append("' style='").append(join("width:", pct, '%')).append("'> </div> </div>\",\"").append(StringEscapeUtils.escapeJavaScript(StringEscapeUtils.escapeHtml(info.getStatus()))).append("\",\"").append(info.getState()).append("\",\"").append(info.getStartTime()).append("\",\"").append(info.getFinishTime()).append("\",\"").append(info.getElapsedTime()).append("\"],\n");
}
//Remove the last comma and close off the array of arrays
if (tasksTableData.charAt(tasksTableData.length() - 2) == ',') {
tasksTableData.delete(tasksTableData.length() - 2, tasksTableData.length() - 1);
}
tasksTableData.append("]");
html.script().$type("text/javascript")._("var tasksTableData=" + tasksTableData)._();
tbody._()._();
}
use of org.apache.hadoop.yarn.webapp.hamlet.Hamlet.TABLE 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").th(_TH, "total rpc").th(_TH, "request size(MB)").th(_TH, "data size(MB)");
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())) {
String totalRPC = psAttempt.getMetrices().get("totalRPC");
String requestSize = psAttempt.getMetrices().get("requestSize");
String dataSize = psAttempt.getMetrices().get("dataSize");
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").td("N/A").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")._().td(totalRPC).td(requestSize).td(dataSize);
tr._();
}
}
}
}
tbody._()._();
}
use of org.apache.hadoop.yarn.webapp.hamlet.Hamlet.TABLE in project angel by Tencent.
the class EnvironmentBlock method render.
@Override
protected void render(Block html) {
set(TITLE, join("Angel Environment"));
html.h1("Runtime Information");
TABLE<Hamlet> run_info_table = html.table();
String UsrHome = System.getProperty("user.home");
String UsrDir = System.getProperty("user.dir");
String UsrName = System.getProperty("user.name");
String JavaHome = System.getProperty("java.home");
String OsNmae = System.getProperty("os.name");
String JavaVersion = System.getProperty("java.version");
run_info_table.tr().th(_TH, "NAME").th(_TH, "VALUE")._();
run_info_table.tr().td("UsrHome").td(UsrHome)._().tr().td("UsrDir").td(UsrDir)._().tr().td("UsrName").td(UsrName)._().tr().td("JavaHome").td(JavaHome)._().tr().td("OsNmae").td(OsNmae)._().tr().td("JavaVersion").td(JavaVersion)._();
run_info_table._();
html.h1(" ");
html.h1("Angel Properties");
TABLE<Hamlet> angel_properties_table = html.table();
angel_properties_table.tr().th(_TH, "NAME").th(_TH, "VALUE")._();
AngelConf angelConfiguration = new AngelConf(this.amContext.getConf());
Properties propertiesConfiguration = angelConfiguration.getAngelProps();
SortedMap sortedMap = new TreeMap(propertiesConfiguration);
Set<Object> set = sortedMap.keySet();
Iterator<Object> propertiesSortedKeys = set.iterator();
Object key;
while (propertiesSortedKeys.hasNext()) {
key = propertiesSortedKeys.next();
angel_properties_table.tr().td(String.valueOf(key)).td((String) propertiesConfiguration.get(key))._();
}
angel_properties_table._();
html.h1(" ");
TBODY<TABLE<Hamlet>> tbody = html.h1("System Properties").table("#jobs").thead().tr().th(_TH, "NAME").th(_TH, "VALUE")._()._().tbody();
Properties properties = System.getProperties();
String propertiesName;
String propertiesValue;
for (Iterator<?> names = (Iterator<?>) properties.propertyNames(); names.hasNext(); ) {
propertiesName = (String) names.next();
propertiesValue = properties.getProperty(propertiesName);
tbody.tr().td(propertiesName).td(propertiesValue).td().span().$title(propertiesName)._()._().td().span().$title(propertiesValue)._()._()._();
}
tbody._()._();
}
use of org.apache.hadoop.yarn.webapp.hamlet.Hamlet.TABLE in project angel by Tencent.
the class ExecutorsBlock method render.
@Override
protected void render(Block html) {
set(TITLE, join("Angel ExecutorsBlock"));
TBODY<TABLE<Hamlet>> tbody = html.h1("ExecutorsBlock").table("#jobs").thead().tr().th(_TH, "id").th(_TH, "name").th(_TH, "state").th(_TH, "stacktrace")._()._().tbody();
ThreadMXBean threadMXBean = ManagementFactory.getThreadMXBean();
ThreadInfo[] threadInfo = threadMXBean.dumpAllThreads(true, true);
StringBuilder stackTraceString;
for (ThreadInfo t : threadInfo) {
stackTraceString = new StringBuilder();
StackTraceElement[] stackTrace = t.getStackTrace();
for (StackTraceElement s : stackTrace) {
stackTraceString.append(s.toString()).append("\n");
}
tbody.tr().td(String.valueOf(t.getThreadId())).td(String.valueOf(t.getThreadName())).td(String.valueOf(t.getThreadState())).td(String.valueOf(stackTraceString.toString()))._();
}
tbody._()._();
}
use of org.apache.hadoop.yarn.webapp.hamlet.Hamlet.TABLE in project hadoop by apache.
the class FairSchedulerAppsBlock method render.
@Override
public void render(Block html) {
TBODY<TABLE<Hamlet>> tbody = html.table("#apps").thead().tr().th(".id", "ID").th(".user", "User").th(".name", "Name").th(".type", "Application Type").th(".queue", "Queue").th(".fairshare", "Fair Share").th(".starttime", "StartTime").th(".finishtime", "FinishTime").th(".state", "State").th(".finalstatus", "FinalStatus").th(".runningcontainer", "Running Containers").th(".allocatedCpu", "Allocated CPU VCores").th(".allocatedMemory", "Allocated Memory MB").th(".progress", "Progress").th(".ui", "Tracking UI")._()._().tbody();
Collection<YarnApplicationState> reqAppStates = null;
String reqStateString = $(APP_STATE);
if (reqStateString != null && !reqStateString.isEmpty()) {
String[] appStateStrings = reqStateString.split(",");
reqAppStates = new HashSet<YarnApplicationState>(appStateStrings.length);
for (String stateString : appStateStrings) {
reqAppStates.add(YarnApplicationState.valueOf(stateString));
}
}
StringBuilder appsTableData = new StringBuilder("[\n");
for (RMApp app : apps.values()) {
if (reqAppStates != null && !reqAppStates.contains(app.createApplicationState())) {
continue;
}
AppInfo appInfo = new AppInfo(rm, app, true, WebAppUtils.getHttpSchemePrefix(conf));
String percent = StringUtils.format("%.1f", appInfo.getProgress());
ApplicationAttemptId attemptId = app.getCurrentAppAttempt().getAppAttemptId();
long fairShare = fsinfo.getAppFairShare(attemptId);
if (fairShare == FairSchedulerInfo.INVALID_FAIR_SHARE) {
// FairScheduler#applications don't have the entry. Skip it.
continue;
}
appsTableData.append("[\"<a href='").append(url("app", appInfo.getAppId())).append("'>").append(appInfo.getAppId()).append("</a>\",\"").append(StringEscapeUtils.escapeJavaScript(StringEscapeUtils.escapeHtml(appInfo.getUser()))).append("\",\"").append(StringEscapeUtils.escapeJavaScript(StringEscapeUtils.escapeHtml(appInfo.getName()))).append("\",\"").append(StringEscapeUtils.escapeJavaScript(StringEscapeUtils.escapeHtml(appInfo.getApplicationType()))).append("\",\"").append(StringEscapeUtils.escapeJavaScript(StringEscapeUtils.escapeHtml(appInfo.getQueue()))).append("\",\"").append(fairShare).append("\",\"").append(appInfo.getStartTime()).append("\",\"").append(appInfo.getFinishTime()).append("\",\"").append(appInfo.getState()).append("\",\"").append(appInfo.getFinalStatus()).append("\",\"").append(appInfo.getRunningContainers() == -1 ? "N/A" : String.valueOf(appInfo.getRunningContainers())).append("\",\"").append(appInfo.getAllocatedVCores() == -1 ? "N/A" : String.valueOf(appInfo.getAllocatedVCores())).append("\",\"").append(appInfo.getAllocatedMB() == -1 ? "N/A" : String.valueOf(appInfo.getAllocatedMB())).append("\",\"").append("<br title='").append(percent).append("'> <div class='").append(C_PROGRESSBAR).append("' title='").append(join(percent, '%')).append("'> ").append("<div class='").append(C_PROGRESSBAR_VALUE).append("' style='").append(join("width:", percent, '%')).append("'> </div> </div>").append("\",\"<a href='");
String trackingURL = !appInfo.isTrackingUrlReady() ? "#" : appInfo.getTrackingUrlPretty();
appsTableData.append(trackingURL).append("'>").append(appInfo.getTrackingUI()).append("</a>\"],\n");
}
if (appsTableData.charAt(appsTableData.length() - 2) == ',') {
appsTableData.delete(appsTableData.length() - 2, appsTableData.length() - 1);
}
appsTableData.append("]");
html.script().$type("text/javascript")._("var appsTableData=" + appsTableData)._();
tbody._()._();
}
Aggregations