protected override void Render(HtmlBlock.Block html) { if (!IsValidRequest()) { html.H2($(Title)); return; } Hamlet.TBODY <Hamlet.TABLE <Org.Apache.Hadoop.Yarn.Webapp.Hamlet.Hamlet> > tbody = html .Table("#attempts").Thead().Tr().Th(".id", "Attempt").Th(".progress", "Progress" ).Th(".state", "State").Th(".status", "Status").Th(".node", "Node").Th(".logs", "Logs").Th(".tsh", "Started").Th(".tsh", "Finished").Th(".tsh", "Elapsed").Th(".note" , "Note").().().Tbody(); // Write all the data into a JavaScript array of arrays for JQuery // DataTables to display StringBuilder attemptsTableData = new StringBuilder("[\n"); foreach (TaskAttempt attempt in GetTaskAttempts()) { TaskAttemptInfo ta = new TaskAttemptInfo(attempt, true); string progress = StringHelper.Percent(ta.GetProgress() / 100); string nodeHttpAddr = ta.GetNode(); string diag = ta.GetNote() == null ? string.Empty : ta.GetNote(); attemptsTableData.Append("[\"").Append(ta.GetId()).Append("\",\"").Append(progress ).Append("\",\"").Append(ta.GetState().ToString()).Append("\",\"").Append(StringEscapeUtils .EscapeJavaScript(StringEscapeUtils.EscapeHtml(ta.GetStatus()))).Append("\",\"") .Append(nodeHttpAddr == null ? "N/A" : "<a class='nodelink' href='" + MRWebAppUtil .GetYARNWebappScheme() + nodeHttpAddr + "'>" + nodeHttpAddr + "</a>").Append("\",\"" ).Append(ta.GetAssignedContainerId() == null ? "N/A" : "<a class='logslink' href='" + Url(MRWebAppUtil.GetYARNWebappScheme(), nodeHttpAddr, "node", "containerlogs" , ta.GetAssignedContainerIdStr(), app.GetJob().GetUserName()) + "'>logs</a>").Append ("\",\"").Append(ta.GetStartTime()).Append("\",\"").Append(ta.GetFinishTime()).Append ("\",\"").Append(ta.GetElapsedTime()).Append("\",\"").Append(StringEscapeUtils.EscapeJavaScript (StringEscapeUtils.EscapeHtml(diag))).Append("\"],\n"); } //Remove the last comma and close off the array of arrays if (attemptsTableData[attemptsTableData.Length - 2] == ',') { attemptsTableData.Delete(attemptsTableData.Length - 2, attemptsTableData.Length - 1); } attemptsTableData.Append("]"); html.Script().$type("text/javascript").("var attemptsTableData=" + attemptsTableData ).(); tbody.().(); }
protected override void Render(HtmlBlock.Block html) { Hamlet.TBODY <Hamlet.TABLE <Org.Apache.Hadoop.Yarn.Webapp.Hamlet.Hamlet> > tbody = html .H2("Active Jobs").Table("#jobs").Thead().Tr().Th(".id", "Job ID").Th(".name", "Name" ).Th(".state", "State").Th("Map Progress").Th("Maps Total").Th("Maps Completed") .Th("Reduce Progress").Th("Reduces Total").Th("Reduces Completed").().().Tbody(); foreach (Org.Apache.Hadoop.Mapreduce.V2.App.Job.Job j in appContext.GetAllJobs(). Values) { JobInfo job = new JobInfo(j, false); tbody.Tr().Td().Span().$title(job.GetId().ToString()).().A(Url("job", job.GetId() ), job.GetId()).().Td(job.GetName()).Td(job.GetState()).Td().Span().$title(job.GetMapProgressPercent ()).().Div(JQueryUI.Progressbar).$title(StringHelper.Join(job.GetMapProgressPercent (), '%')).Div(JQueryUI.ProgressbarValue).$style(StringHelper.Join("width:", job. GetMapProgressPercent(), '%')).().().().Td(job.GetMapsTotal().ToString()).Td(job .GetMapsCompleted().ToString()).Td().Span().$title(job.GetReduceProgressPercent( )).().Div(JQueryUI.Progressbar).$title(StringHelper.Join(job.GetReduceProgressPercent (), '%')).Div(JQueryUI.ProgressbarValue).$style(StringHelper.Join("width:", job. GetReduceProgressPercent(), '%')).().().().Td(job.GetReducesTotal().ToString()). Td(job.GetReducesCompleted().ToString()).(); } // for sorting // for sorting // tooltip // for sorting // tooltip tbody.().(); }
protected override void Render(HtmlBlock.Block html) { if (!IsValidRequest()) { html.H2($(Title)); return; } TaskType type = null; string symbol = $(AMParams.TaskType); if (!symbol.IsEmpty()) { type = MRApps.TaskType(symbol); } else { type = app.GetTask().GetType(); } Hamlet.TR <Hamlet.THEAD <Hamlet.TABLE <Org.Apache.Hadoop.Yarn.Webapp.Hamlet.Hamlet> > > headRow = html.Table("#attempts").Thead().Tr(); headRow.Th(".id", "Attempt").Th(".state", "State").Th(".status", "Status").Th(".node" , "Node").Th(".logs", "Logs").Th(".tsh", "Start Time"); if (type == TaskType.Reduce) { headRow.Th("Shuffle Finish Time"); headRow.Th("Merge Finish Time"); } headRow.Th("Finish Time"); //Attempt if (type == TaskType.Reduce) { headRow.Th("Elapsed Time Shuffle"); //Attempt headRow.Th("Elapsed Time Merge"); //Attempt headRow.Th("Elapsed Time Reduce"); } //Attempt headRow.Th("Elapsed Time").Th(".note", "Note"); Hamlet.TBODY <Hamlet.TABLE <Org.Apache.Hadoop.Yarn.Webapp.Hamlet.Hamlet> > tbody = headRow .().().Tbody(); // Write all the data into a JavaScript array of arrays for JQuery // DataTables to display StringBuilder attemptsTableData = new StringBuilder("[\n"); foreach (TaskAttempt attempt in GetTaskAttempts()) { TaskAttemptInfo ta = new TaskAttemptInfo(attempt, false); string taid = ta.GetId(); string nodeHttpAddr = ta.GetNode(); string containerIdString = ta.GetAssignedContainerIdStr(); string nodeIdString = attempt.GetAssignedContainerMgrAddress(); string nodeRackName = ta.GetRack(); long attemptStartTime = ta.GetStartTime(); long shuffleFinishTime = -1; long sortFinishTime = -1; long attemptFinishTime = ta.GetFinishTime(); long elapsedShuffleTime = -1; long elapsedSortTime = -1; long elapsedReduceTime = -1; if (type == TaskType.Reduce) { shuffleFinishTime = attempt.GetShuffleFinishTime(); sortFinishTime = attempt.GetSortFinishTime(); elapsedShuffleTime = Times.Elapsed(attemptStartTime, shuffleFinishTime, false); elapsedSortTime = Times.Elapsed(shuffleFinishTime, sortFinishTime, false); elapsedReduceTime = Times.Elapsed(sortFinishTime, attemptFinishTime, false); } long attemptElapsed = Times.Elapsed(attemptStartTime, attemptFinishTime, false); int sortId = attempt.GetID().GetId() + (attempt.GetID().GetTaskId().GetId() * 10000 ); attemptsTableData.Append("[\"").Append(sortId + " ").Append(taid).Append("\",\"") .Append(ta.GetState()).Append("\",\"").Append(StringEscapeUtils.EscapeJavaScript (StringEscapeUtils.EscapeHtml(ta.GetStatus()))).Append("\",\"").Append("<a class='nodelink' href='" + MRWebAppUtil.GetYARNWebappScheme() + nodeHttpAddr + "'>").Append(nodeRackName + "/" + nodeHttpAddr + "</a>\",\"").Append("<a class='logslink' href='").Append (Url("logs", nodeIdString, containerIdString, taid, app.GetJob().GetUserName())) .Append("'>logs</a>\",\"").Append(attemptStartTime).Append("\",\""); if (type == TaskType.Reduce) { attemptsTableData.Append(shuffleFinishTime).Append("\",\"").Append(sortFinishTime ).Append("\",\""); } attemptsTableData.Append(attemptFinishTime).Append("\",\""); if (type == TaskType.Reduce) { attemptsTableData.Append(elapsedShuffleTime).Append("\",\"").Append(elapsedSortTime ).Append("\",\"").Append(elapsedReduceTime).Append("\",\""); } attemptsTableData.Append(attemptElapsed).Append("\",\"").Append(StringEscapeUtils .EscapeJavaScript(StringEscapeUtils.EscapeHtml(ta.GetNote()))).Append("\"],\n"); } //Remove the last comma and close off the array of arrays if (attemptsTableData[attemptsTableData.Length - 2] == ',') { attemptsTableData.Delete(attemptsTableData.Length - 2, attemptsTableData.Length - 1); } attemptsTableData.Append("]"); html.Script().$type("text/javascript").("var attemptsTableData=" + attemptsTableData ).(); Hamlet.TR <Hamlet.TFOOT <Hamlet.TABLE <Org.Apache.Hadoop.Yarn.Webapp.Hamlet.Hamlet> > > footRow = tbody.().Tfoot().Tr(); footRow.Th().Input("search_init").$type(HamletSpec.InputType.text).$name("attempt_name" ).$value("Attempt").().().Th().Input("search_init").$type(HamletSpec.InputType.text ).$name("attempt_state").$value("State").().().Th().Input("search_init").$type(HamletSpec.InputType .text).$name("attempt_status").$value("Status").().().Th().Input("search_init"). $type(HamletSpec.InputType.text).$name("attempt_node").$value("Node").().().Th() .Input("search_init").$type(HamletSpec.InputType.text).$name("attempt_node").$value ("Logs").().().Th().Input("search_init").$type(HamletSpec.InputType.text).$name( "attempt_start_time").$value("Start Time").().(); if (type == TaskType.Reduce) { footRow.Th().Input("search_init").$type(HamletSpec.InputType.text).$name("shuffle_time" ).$value("Shuffle Time").().(); footRow.Th().Input("search_init").$type(HamletSpec.InputType.text).$name("merge_time" ).$value("Merge Time").().(); } footRow.Th().Input("search_init").$type(HamletSpec.InputType.text).$name("attempt_finish" ).$value("Finish Time").().(); if (type == TaskType.Reduce) { footRow.Th().Input("search_init").$type(HamletSpec.InputType.text).$name("elapsed_shuffle_time" ).$value("Elapsed Shuffle Time").().(); footRow.Th().Input("search_init").$type(HamletSpec.InputType.text).$name("elapsed_merge_time" ).$value("Elapsed Merge Time").().(); footRow.Th().Input("search_init").$type(HamletSpec.InputType.text).$name("elapsed_reduce_time" ).$value("Elapsed Reduce Time").().(); } footRow.Th().Input("search_init").$type(HamletSpec.InputType.text).$name("attempt_elapsed" ).$value("Elapsed Time").().().Th().Input("search_init").$type(HamletSpec.InputType .text).$name("note").$value("Note").().(); footRow.().().(); }
/* * (non-Javadoc) * @see org.apache.hadoop.yarn.webapp.view.HtmlBlock#render(org.apache.hadoop.yarn.webapp.view.HtmlBlock.Block) */ protected override void Render(HtmlBlock.Block html) { if (app.GetJob() == null) { html.H2($(Title)); return; } TaskType type = null; string symbol = $(AMParams.TaskType); if (!symbol.IsEmpty()) { type = MRApps.TaskType(symbol); } Hamlet.THEAD <Hamlet.TABLE <Org.Apache.Hadoop.Yarn.Webapp.Hamlet.Hamlet> > thead; if (type != null) { thead = html.Table("#" + app.GetJob().GetID() + type).$class("dt-tasks").Thead(); } else { thead = html.Table("#tasks").Thead(); } //Create the spanning row int attemptColSpan = type == TaskType.Reduce ? 8 : 3; thead.Tr().Th().$colspan(5).$class("ui-state-default").("Task").().Th().$colspan( attemptColSpan).$class("ui-state-default").("Successful Attempt").().(); Hamlet.TR <Hamlet.THEAD <Hamlet.TABLE <Org.Apache.Hadoop.Yarn.Webapp.Hamlet.Hamlet> > > theadRow = thead.Tr().Th("Name").Th("State").Th("Start Time").Th("Finish Time" ).Th("Elapsed Time").Th("Start Time"); //Attempt if (type == TaskType.Reduce) { theadRow.Th("Shuffle Finish Time"); //Attempt theadRow.Th("Merge Finish Time"); } //Attempt theadRow.Th("Finish Time"); //Attempt if (type == TaskType.Reduce) { theadRow.Th("Elapsed Time Shuffle"); //Attempt theadRow.Th("Elapsed Time Merge"); //Attempt theadRow.Th("Elapsed Time Reduce"); } //Attempt theadRow.Th("Elapsed Time"); //Attempt Hamlet.TBODY <Hamlet.TABLE <Org.Apache.Hadoop.Yarn.Webapp.Hamlet.Hamlet> > tbody = theadRow .().().Tbody(); // Write all the data into a JavaScript array of arrays for JQuery // DataTables to display StringBuilder tasksTableData = new StringBuilder("[\n"); foreach (Task task in app.GetJob().GetTasks().Values) { if (type != null && task.GetType() != type) { continue; } TaskInfo info = new TaskInfo(task); string tid = info.GetId(); long startTime = info.GetStartTime(); long finishTime = info.GetFinishTime(); long elapsed = info.GetElapsedTime(); long attemptStartTime = -1; long shuffleFinishTime = -1; long sortFinishTime = -1; long attemptFinishTime = -1; long elapsedShuffleTime = -1; long elapsedSortTime = -1; long elapsedReduceTime = -1; long attemptElapsed = -1; TaskAttempt successful = info.GetSuccessful(); if (successful != null) { TaskAttemptInfo ta; if (type == TaskType.Reduce) { ReduceTaskAttemptInfo rta = new ReduceTaskAttemptInfo(successful, type); shuffleFinishTime = rta.GetShuffleFinishTime(); sortFinishTime = rta.GetMergeFinishTime(); elapsedShuffleTime = rta.GetElapsedShuffleTime(); elapsedSortTime = rta.GetElapsedMergeTime(); elapsedReduceTime = rta.GetElapsedReduceTime(); ta = rta; } else { ta = new TaskAttemptInfo(successful, type, false); } attemptStartTime = ta.GetStartTime(); attemptFinishTime = ta.GetFinishTime(); attemptElapsed = ta.GetElapsedTime(); } tasksTableData.Append("[\"").Append("<a href='" + Url("task", tid)).Append("'>"). Append(tid).Append("</a>\",\"").Append(info.GetState()).Append("\",\"").Append(startTime ).Append("\",\"").Append(finishTime).Append("\",\"").Append(elapsed).Append("\",\"" ).Append(attemptStartTime).Append("\",\""); if (type == TaskType.Reduce) { tasksTableData.Append(shuffleFinishTime).Append("\",\"").Append(sortFinishTime).Append ("\",\""); } tasksTableData.Append(attemptFinishTime).Append("\",\""); if (type == TaskType.Reduce) { tasksTableData.Append(elapsedShuffleTime).Append("\",\"").Append(elapsedSortTime) .Append("\",\"").Append(elapsedReduceTime).Append("\",\""); } tasksTableData.Append(attemptElapsed).Append("\"],\n"); } //Remove the last comma and close off the array of arrays if (tasksTableData[tasksTableData.Length - 2] == ',') { tasksTableData.Delete(tasksTableData.Length - 2, tasksTableData.Length - 1); } tasksTableData.Append("]"); html.Script().$type("text/javascript").("var tasksTableData=" + tasksTableData).( ); Hamlet.TR <Hamlet.TFOOT <Hamlet.TABLE <Org.Apache.Hadoop.Yarn.Webapp.Hamlet.Hamlet> > > footRow = tbody.().Tfoot().Tr(); footRow.Th().Input("search_init").$type(HamletSpec.InputType.text).$name("task"). $value("ID").().().Th().Input("search_init").$type(HamletSpec.InputType.text).$name ("state").$value("State").().().Th().Input("search_init").$type(HamletSpec.InputType .text).$name("start_time").$value("Start Time").().().Th().Input("search_init"). $type(HamletSpec.InputType.text).$name("finish_time").$value("Finish Time").().( ).Th().Input("search_init").$type(HamletSpec.InputType.text).$name("elapsed_time" ).$value("Elapsed Time").().().Th().Input("search_init").$type(HamletSpec.InputType .text).$name("attempt_start_time").$value("Start Time").().(); if (type == TaskType.Reduce) { footRow.Th().Input("search_init").$type(HamletSpec.InputType.text).$name("shuffle_time" ).$value("Shuffle Time").().(); footRow.Th().Input("search_init").$type(HamletSpec.InputType.text).$name("merge_time" ).$value("Merge Time").().(); } footRow.Th().Input("search_init").$type(HamletSpec.InputType.text).$name("attempt_finish" ).$value("Finish Time").().(); if (type == TaskType.Reduce) { footRow.Th().Input("search_init").$type(HamletSpec.InputType.text).$name("elapsed_shuffle_time" ).$value("Elapsed Shuffle Time").().(); footRow.Th().Input("search_init").$type(HamletSpec.InputType.text).$name("elapsed_merge_time" ).$value("Elapsed Merge Time").().(); footRow.Th().Input("search_init").$type(HamletSpec.InputType.text).$name("elapsed_reduce_time" ).$value("Elapsed Reduce Time").().(); } footRow.Th().Input("search_init").$type(HamletSpec.InputType.text).$name("attempt_elapsed" ).$value("Elapsed Time").().(); footRow.().().(); }
protected override void Render(HtmlBlock.Block html) { if (app.GetJob() == null) { html.H2($(Title)); return; } TaskType type = null; string symbol = $(AMParams.TaskType); if (!symbol.IsEmpty()) { type = MRApps.TaskType(symbol); } Hamlet.TBODY <Hamlet.TABLE <Org.Apache.Hadoop.Yarn.Webapp.Hamlet.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"); foreach (Task task in app.GetJob().GetTasks().Values) { if (type != null && task.GetType() != type) { continue; } string taskStateStr = $(AMParams.TaskState); if (taskStateStr == null || taskStateStr.Trim().Equals(string.Empty)) { taskStateStr = "ALL"; } if (!Sharpen.Runtime.EqualsIgnoreCase(taskStateStr, "ALL")) { try { // get stateUI enum MRApps.TaskStateUI stateUI = MRApps.TaskState(taskStateStr); if (!stateUI.CorrespondsTo(task.GetState())) { continue; } } catch (ArgumentException) { continue; } } // not supported state, ignore TaskInfo info = new TaskInfo(task); string tid = info.GetId(); string pct = StringHelper.Percent(info.GetProgress() / 100); tasksTableData.Append("[\"<a href='").Append(Url("task", tid)).Append("'>").Append (tid).Append("</a>\",\"").Append("<br title='").Append(pct).Append("'> <div class='" ).Append(JQueryUI.CProgressbar).Append("' title='").Append(StringHelper.Join(pct , '%')).Append("'> ").Append("<div class='").Append(JQueryUI.CProgressbarValue). Append("' style='").Append(StringHelper.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"); } //Progress bar //Remove the last comma and close off the array of arrays if (tasksTableData[tasksTableData.Length - 2] == ',') { tasksTableData.Delete(tasksTableData.Length - 2, tasksTableData.Length - 1); } tasksTableData.Append("]"); html.Script().$type("text/javascript").("var tasksTableData=" + tasksTableData).( ); tbody.().(); }
/* * (non-Javadoc) * @see org.apache.hadoop.yarn.webapp.view.HtmlBlock#render(org.apache.hadoop.yarn.webapp.view.HtmlBlock.Block) */ protected override void Render(HtmlBlock.Block html) { Hamlet.TBODY <Hamlet.TABLE <Org.Apache.Hadoop.Yarn.Webapp.Hamlet.Hamlet> > tbody = html .H2("Retired Jobs").Table("#jobs").Thead().Tr().Th("Submit Time").Th("Start Time" ).Th("Finish Time").Th(".id", "Job ID").Th(".name", "Name").Th("User").Th("Queue" ).Th(".state", "State").Th("Maps Total").Th("Maps Completed").Th("Reduces Total" ).Th("Reduces Completed").().().Tbody(); Log.Info("Getting list of all Jobs."); // Write all the data into a JavaScript array of arrays for JQuery // DataTables to display StringBuilder jobsTableData = new StringBuilder("[\n"); foreach (Org.Apache.Hadoop.Mapreduce.V2.App.Job.Job j in appContext.GetAllJobs(). Values) { JobInfo job = new JobInfo(j); jobsTableData.Append("[\"").Append(dateFormat.Format(Sharpen.Extensions.CreateDate (job.GetSubmitTime()))).Append("\",\"").Append(dateFormat.Format(Sharpen.Extensions.CreateDate (job.GetStartTime()))).Append("\",\"").Append(dateFormat.Format(Sharpen.Extensions.CreateDate (job.GetFinishTime()))).Append("\",\"").Append("<a href='").Append(Url("job", job .GetId())).Append("'>").Append(job.GetId()).Append("</a>\",\"").Append(StringEscapeUtils .EscapeJavaScript(StringEscapeUtils.EscapeHtml(job.GetName()))).Append("\",\""). Append(StringEscapeUtils.EscapeJavaScript(StringEscapeUtils.EscapeHtml(job.GetUserName ()))).Append("\",\"").Append(StringEscapeUtils.EscapeJavaScript(StringEscapeUtils .EscapeHtml(job.GetQueueName()))).Append("\",\"").Append(job.GetState()).Append( "\",\"").Append(job.GetMapsTotal().ToString()).Append("\",\"").Append(job.GetMapsCompleted ().ToString()).Append("\",\"").Append(job.GetReducesTotal().ToString()).Append("\",\"" ).Append(job.GetReducesCompleted().ToString()).Append("\"],\n"); } //Remove the last comma and close off the array of arrays if (jobsTableData[jobsTableData.Length - 2] == ',') { jobsTableData.Delete(jobsTableData.Length - 2, jobsTableData.Length - 1); } jobsTableData.Append("]"); html.Script().$type("text/javascript").("var jobsTableData=" + jobsTableData).(); tbody.().Tfoot().Tr().Th().Input("search_init").$type(HamletSpec.InputType.text). $name("submit_time").$value("Submit Time").().().Th().Input("search_init").$type (HamletSpec.InputType.text).$name("start_time").$value("Start Time").().().Th(). Input("search_init").$type(HamletSpec.InputType.text).$name("finish_time").$value ("Finish Time").().().Th().Input("search_init").$type(HamletSpec.InputType.text) .$name("start_time").$value("Job ID").().().Th().Input("search_init").$type(HamletSpec.InputType .text).$name("start_time").$value("Name").().().Th().Input("search_init").$type( HamletSpec.InputType.text).$name("start_time").$value("User").().().Th().Input("search_init" ).$type(HamletSpec.InputType.text).$name("start_time").$value("Queue").().().Th( ).Input("search_init").$type(HamletSpec.InputType.text).$name("start_time").$value ("State").().().Th().Input("search_init").$type(HamletSpec.InputType.text).$name ("start_time").$value("Maps Total").().().Th().Input("search_init").$type(HamletSpec.InputType .text).$name("start_time").$value("Maps Completed").().().Th().Input("search_init" ).$type(HamletSpec.InputType.text).$name("start_time").$value("Reduces Total").( ).().Th().Input("search_init").$type(HamletSpec.InputType.text).$name("start_time" ).$value("Reduces Completed").().().().().(); }