protected override void Render(HtmlBlock.Block html) { string rmweb = $(AMParams.RmWeb); Hamlet.DIV <Org.Apache.Hadoop.Yarn.Webapp.Hamlet.Hamlet> nav = html.Div("#nav").H3 ("Cluster").Ul().Li().A(Url(rmweb, "cluster", "cluster"), "About").().Li().A(Url (rmweb, "cluster", "apps"), "Applications").().Li().A(Url(rmweb, "cluster", "scheduler" ), "Scheduler").().().H3("Application").Ul().Li().A(Url("app/info"), "About").() .Li().A(Url("app"), "Jobs").().(); if (app.GetJob() != null) { string jobid = MRApps.ToString(app.GetJob().GetID()); IList <AMInfo> amInfos = app.GetJob().GetAMInfos(); AMInfo thisAmInfo = amInfos[amInfos.Count - 1]; string nodeHttpAddress = thisAmInfo.GetNodeManagerHost() + ":" + thisAmInfo.GetNodeManagerHttpPort (); nav.H3("Job").Ul().Li().A(Url("job", jobid), "Overview").().Li().A(Url("jobcounters" , jobid), "Counters").().Li().A(Url("conf", jobid), "Configuration").().Li().A(Url ("tasks", jobid, "m"), "Map tasks").().Li().A(Url("tasks", jobid, "r"), "Reduce tasks" ).().Li().A(".logslink", Url(MRWebAppUtil.GetYARNWebappScheme(), nodeHttpAddress , "node", "containerlogs", thisAmInfo.GetContainerId().ToString(), app.GetJob(). GetUserName()), "AM Logs").().(); if (app.GetTask() != null) { string taskid = MRApps.ToString(app.GetTask().GetID()); nav.H3("Task").Ul().Li().A(Url("task", taskid), "Task Overview").().Li().A(Url("taskcounters" , taskid), "Counters").().(); } } nav.H3("Tools").Ul().Li().A("/conf", "Configuration").().Li().A("/logs", "Local logs" ).().Li().A("/stacks", "Server stacks").().Li().A("/jmx?qry=Hadoop:*", "Server metrics" ).().().(); }
protected override void Render(HtmlBlock.Block html) { html.(typeof(MetricsOverviewTable)); Hamlet.UL <Hamlet.DIV <Hamlet.DIV <Org.Apache.Hadoop.Yarn.Webapp.Hamlet.Hamlet> > > ul = html.Div("#cs-wrapper.ui-widget").Div(".ui-widget-header.ui-corner-top").("Application Queues" ).().Div("#cs.ui-widget-content.ui-corner-bottom").Ul(); if (fs == null) { ul.Li().A(Q).$style(Width(QMaxWidth)).Span().$style(QEnd).("100% ").().Span(".q", "default").().(); } else { FairSchedulerInfo sinfo = new FairSchedulerInfo(fs); fsqinfo.qinfo = sinfo.GetRootQueueInfo(); float used = fsqinfo.qinfo.GetUsedMemoryFraction(); ul.Li().$style("margin-bottom: 1em").Span().$style("font-weight: bold").("Legend:" ).().Span().$class("qlegend ui-corner-all").$style(QGiven).$title("The steady fair shares consider all queues, " + "both active (with running applications) and inactive.").(SteadyFairShare).() .Span().$class("qlegend ui-corner-all").$style(QInstantaneousFs).$title("The instantaneous fair shares consider only active " + "queues (with running applications).").(InstantaneousFairShare).().Span().$class ("qlegend ui-corner-all").$style(QUnder).("Used").().Span().$class("qlegend ui-corner-all" ).$style(QOver).("Used (over fair share)").().Span().$class("qlegend ui-corner-all ui-state-default" ).("Max Capacity").().().Li().A(Q).$style(Width(QMaxWidth)).Span().$style(StringHelper.Join (Width(used), ";left:0%;", used > 1 ? QOver : QUnder)).(".").().Span(".q", "root" ).().Span().$class("qstats").$style(Left(QStatsPos)).(StringHelper.Join(Percent( used), " used")).().(typeof(FairSchedulerPage.QueueBlock)).(); } ul.().().Script().$type("text/javascript").("$('#cs').hide();").().().(typeof(FairSchedulerAppsBlock )); }
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) { html.(typeof(MetricsOverviewTable)); Hamlet.UL <Hamlet.DIV <Hamlet.DIV <Org.Apache.Hadoop.Yarn.Webapp.Hamlet.Hamlet> > > ul = html.Div("#cs-wrapper.ui-widget").Div(".ui-widget-header.ui-corner-top").("FifoScheduler Queue" ).().Div("#cs.ui-widget-content.ui-corner-bottom").Ul(); if (fs == null) { ul.Li().A(Q).$style(Width(WidthF)).Span().$style(QEnd).("100% ").().Span(".q", "default" ).().(); } else { float used = sinfo.GetUsedCapacity(); float set = sinfo.GetCapacity(); float delta = Math.Abs(set - used) + 0.001f; ul.Li().A(Q).$style(Width(WidthF)).$title(StringHelper.Join("used:", Percent(used ))).Span().$style(QEnd).("100%").().Span().$style(StringHelper.Join(Width(delta) , ';', used > set ? Over : Under, ';', used > set ? Left(set) : Left(used))).("." ).().Span(".q", sinfo.GetQueueName()).().(typeof(DefaultSchedulerPage.QueueInfoBlock )).(); } ul.().().Script().$type("text/javascript").("$('#cs').hide();").().().(typeof(AppsBlock )); }
protected override void Render(HtmlBlock.Block html) { ICollection <FairSchedulerQueueInfo> subQueues = fsqinfo.qinfo.GetChildQueues(); Hamlet.UL <Org.Apache.Hadoop.Yarn.Webapp.Hamlet.Hamlet> ul = html.Ul("#pq"); foreach (FairSchedulerQueueInfo info in subQueues) { float capacity = info.GetMaxResourcesFraction(); float steadyFairShare = info.GetSteadyFairShareMemoryFraction(); float instantaneousFairShare = info.GetFairShareMemoryFraction(); float used = info.GetUsedMemoryFraction(); Hamlet.LI <Hamlet.UL <Org.Apache.Hadoop.Yarn.Webapp.Hamlet.Hamlet> > li = ul.Li().A( Q).$style(Width(capacity * QMaxWidth)).$title(StringHelper.Join(StringHelper.Join (SteadyFairShare + ":", Percent(steadyFairShare)), StringHelper.Join(" " + InstantaneousFairShare + ":", Percent(instantaneousFairShare)))).Span().$style(StringHelper.Join(QGiven , ";font-size:1px;", Width(steadyFairShare / capacity))).('.').().Span().$style( StringHelper.Join(QInstantaneousFs, ";font-size:1px;", Width(instantaneousFairShare / capacity))).('.').().Span().$style(StringHelper.Join(Width(used / capacity), ";font-size:1px;left:0%;", used > instantaneousFairShare ? QOver : QUnder)).('.' ).().Span(".q", info.GetQueueName()).().Span().$class("qstats").$style(Left(QStatsPos )).(StringHelper.Join(Percent(used), " used")).(); fsqinfo.qinfo = info; if (info is FairSchedulerLeafQueueInfo) { li.Ul("#lq").Li().(typeof(FairSchedulerPage.LeafQueueBlock)).().(); } else { li.(typeof(FairSchedulerPage.QueueBlock)); } li.(); } ul.(); }
protected override void Render(HtmlBlock.Block html) { AList <CapacitySchedulerQueueInfo> subQueues = (csqinfo.qinfo == null) ? csqinfo.csinfo .GetQueues().GetQueueInfoList() : csqinfo.qinfo.GetQueues().GetQueueInfoList(); Hamlet.UL <Org.Apache.Hadoop.Yarn.Webapp.Hamlet.Hamlet> ul = html.Ul("#pq"); foreach (CapacitySchedulerQueueInfo info in subQueues) { float used = info.GetUsedCapacity() / 100; float absCap = info.GetAbsoluteCapacity() / 100; float absMaxCap = info.GetAbsoluteMaxCapacity() / 100; float absUsedCap = info.GetAbsoluteUsedCapacity() / 100; Hamlet.LI <Hamlet.UL <Org.Apache.Hadoop.Yarn.Webapp.Hamlet.Hamlet> > li = ul.Li().A( Q).$style(Width(absMaxCap * QMaxWidth)).$title(StringHelper.Join("Absolute Capacity:" , Percent(absCap))).Span().$style(StringHelper.Join(QGiven, ";font-size:1px;", Width (absCap / absMaxCap))).('.').().Span().$style(StringHelper.Join(Width(absUsedCap / absMaxCap), ";font-size:1px;left:0%;", absUsedCap > absCap ? QOver : QUnder)) .('.').().Span(".q", Sharpen.Runtime.Substring(info.GetQueuePath(), 5)).().Span( ).$class("qstats").$style(Left(QStatsPos)).(StringHelper.Join(Percent(used), " used" )).(); csqinfo.qinfo = info; if (info.GetQueues() == null) { li.Ul("#lq").Li().(typeof(CapacitySchedulerPage.LeafQueueInfoBlock)).().(); li.Ul("#lq").Li().(typeof(CapacitySchedulerPage.QueueUsersInfoBlock)).().(); } else { li.(typeof(CapacitySchedulerPage.QueueBlock)); } li.(); } ul.(); }
protected override void Render(HtmlBlock.Block html) { html.(typeof(MetricsOverviewTable)); Hamlet.UL <Hamlet.DIV <Hamlet.DIV <Org.Apache.Hadoop.Yarn.Webapp.Hamlet.Hamlet> > > ul = html.Div("#cs-wrapper.ui-widget").Div(".ui-widget-header.ui-corner-top").("Application Queues" ).().Div("#cs.ui-widget-content.ui-corner-bottom").Ul(); if (cs == null) { ul.Li().A(Q).$style(Width(QMaxWidth)).Span().$style(QEnd).("100% ").().Span(".q", "default").().(); } else { CSQueue root = cs.GetRootQueue(); CapacitySchedulerInfo sinfo = new CapacitySchedulerInfo(root); csqinfo.csinfo = sinfo; csqinfo.qinfo = null; float used = sinfo.GetUsedCapacity() / 100; ul.Li().$style("margin-bottom: 1em").Span().$style("font-weight: bold").("Legend:" ).().Span().$class("qlegend ui-corner-all").$style(QGiven).("Capacity").().Span( ).$class("qlegend ui-corner-all").$style(QUnder).("Used").().Span().$class("qlegend ui-corner-all" ).$style(QOver).("Used (over capacity)").().Span().$class("qlegend ui-corner-all ui-state-default" ).("Max Capacity").().().Li().A(Q).$style(Width(QMaxWidth)).Span().$style(StringHelper.Join (Width(used), ";left:0%;", used > 1 ? QOver : QUnder)).(".").().Span(".q", "root" ).().Span().$class("qstats").$style(Left(QStatsPos)).(StringHelper.Join(Percent( used), " used")).().(typeof(CapacitySchedulerPage.QueueBlock)).(); } ul.().().Script().$type("text/javascript").("$('#cs').hide();").().().(typeof(RMAppsBlock )); }
protected override void Render(HtmlBlock.Block html) { ContainerId containerID; try { containerID = ConverterUtils.ToContainerId($(ContainerId)); } catch (ArgumentException) { html.P().("Invalid containerId " + $(ContainerId)).(); return; } Hamlet.DIV <Org.Apache.Hadoop.Yarn.Webapp.Hamlet.Hamlet> div = html.Div("#content" ); Org.Apache.Hadoop.Yarn.Server.Nodemanager.Containermanager.Container.Container container = this.nmContext.GetContainers()[containerID]; if (container == null) { div.H1("Unknown Container. Container might have completed, " + "please go back to the previous page and retry." ).(); return; } ContainerInfo info = new ContainerInfo(this.nmContext, container); Info("Container information").("ContainerID", info.GetId()).("ContainerState", info .GetState()).("ExitStatus", info.GetExitStatus()).("Diagnostics", info.GetDiagnostics ()).("User", info.GetUser()).("TotalMemoryNeeded", info.GetMemoryNeeded()).("TotalVCoresNeeded" , info.GetVCoresNeeded()).("logs", info.GetShortLogLink(), "Link to logs"); html.(typeof(InfoBlock)); }
protected override void Render(HtmlBlock.Block html) { ResponseInfo ri = Info("\'" + Sharpen.Runtime.Substring(lqinfo.GetQueuePath(), 5) + "\' Queue Status").("Queue State:", lqinfo.GetQueueState()).("Used Capacity:" , Percent(lqinfo.GetUsedCapacity() / 100)).("Absolute Used Capacity:", Percent(lqinfo .GetAbsoluteUsedCapacity() / 100)).("Absolute Capacity:", Percent(lqinfo.GetAbsoluteCapacity () / 100)).("Absolute Max Capacity:", Percent(lqinfo.GetAbsoluteMaxCapacity() / 100)).("Used Resources:", lqinfo.GetResourcesUsed().ToString()).("Num Schedulable Applications:" , Sharpen.Extensions.ToString(lqinfo.GetNumActiveApplications())).("Num Non-Schedulable Applications:" , Sharpen.Extensions.ToString(lqinfo.GetNumPendingApplications())).("Num Containers:" , Sharpen.Extensions.ToString(lqinfo.GetNumContainers())).("Max Applications:", Sharpen.Extensions.ToString(lqinfo.GetMaxApplications())).("Max Applications Per User:"******"Max Application Master Resources:" , lqinfo.GetAMResourceLimit().ToString()).("Used Application Master Resources:", lqinfo.GetUsedAMResource().ToString()).("Max Application Master Resources Per User:"******"Configured Capacity:", Percent(lqinfo .GetCapacity() / 100)).("Configured Max Capacity:", Percent(lqinfo.GetMaxCapacity () / 100)).("Configured Minimum User Limit Percent:", Sharpen.Extensions.ToString (lqinfo.GetUserLimit()) + "%").("Configured User Limit Factor:", string.Format("%.1f" , lqinfo.GetUserLimitFactor())).("Accessible Node Labels:", StringUtils.Join("," , lqinfo.GetNodeLabels())).("Preemption:", lqinfo.GetPreemptionDisabled() ? "disabled" : "enabled"); html.(typeof(InfoBlock)); // clear the info contents so this queue's info doesn't accumulate into another queue's info ri.Clear(); }
protected override void Render(HtmlBlock.Block html) { Hamlet.TBODY <Hamlet.TABLE <Org.Apache.Hadoop.Yarn.Webapp.Hamlet.Hamlet> > tbody = html .Table("#nodelabels").Thead().Tr().Th(".name", "Label Name").Th(".numOfActiveNMs" , "Num Of Active NMs").Th(".totalResource", "Total Resource").().().Tbody(); RMNodeLabelsManager nlm = rm.GetRMContext().GetNodeLabelManager(); foreach (NodeLabel info in nlm.PullRMNodeLabelsInfo()) { Hamlet.TR <Hamlet.TBODY <Hamlet.TABLE <Org.Apache.Hadoop.Yarn.Webapp.Hamlet.Hamlet> > > row = tbody.Tr().Td(info.GetLabelName().IsEmpty() ? "<NO_LABEL>" : info.GetLabelName ()); int nActiveNMs = info.GetNumActiveNMs(); if (nActiveNMs > 0) { row = row.Td().A(Url("nodes", "?" + YarnWebParams.NodeLabel + "=" + info.GetLabelName ()), nActiveNMs.ToString()).(); } else { row = row.Td(nActiveNMs.ToString()); } row.Td(info.GetResource().ToString()).(); } tbody.().(); }
private void CreateResourceRequestsTable(HtmlBlock.Block html) { AppInfo app = new AppInfo(rm, rm.GetRMContext().GetRMApps()[this.appAttemptId.GetApplicationId ()], true, WebAppUtils.GetHttpSchemePrefix(conf)); IList <ResourceRequest> resourceRequests = app.GetResourceRequests(); if (resourceRequests == null || resourceRequests.IsEmpty()) { return; } Hamlet.DIV <Org.Apache.Hadoop.Yarn.Webapp.Hamlet.Hamlet> div = html.Div(JQueryUI.InfoWrap ); Hamlet.TABLE <Hamlet.DIV <Org.Apache.Hadoop.Yarn.Webapp.Hamlet.Hamlet> > table = div .H3("Total Outstanding Resource Requests: " + GetTotalResource(resourceRequests) ).Table("#ResourceRequests"); table.Tr().Th(JQueryUI.Th, "Priority").Th(JQueryUI.Th, "ResourceName").Th(JQueryUI .Th, "Capability").Th(JQueryUI.Th, "NumContainers").Th(JQueryUI.Th, "RelaxLocality" ).Th(JQueryUI.Th, "NodeLabelExpression").(); bool odd = false; foreach (ResourceRequest request in resourceRequests) { if (request.GetNumContainers() == 0) { continue; } table.Tr((odd = !odd) ? JQueryUI.Odd : JQueryUI.Even).Td(request.GetPriority().ToString ()).Td(request.GetResourceName()).Td(request.GetCapability().ToString()).Td(request .GetNumContainers().ToString()).Td(request.GetRelaxLocality().ToString()).Td(request .GetNodeLabelExpression() == null ? "N/A" : request.GetNodeLabelExpression()).(); } table.(); div.(); }
protected override void Render(HtmlBlock.Block html) { html.Div("#nav").H3("Application History").Ul().Li().A(Url("apps"), "Applications" ).Ul().Li().A(Url("apps", YarnApplicationState.Finished.ToString()), YarnApplicationState .Finished.ToString()).().Li().A(Url("apps", YarnApplicationState.Failed.ToString ()), YarnApplicationState.Failed.ToString()).().Li().A(Url("apps", YarnApplicationState .Killed.ToString()), YarnApplicationState.Killed.ToString()).().().().().(); }
protected override void GenerateApplicationTable(HtmlBlock.Block html, UserGroupInformation callerUGI, ICollection <ApplicationAttemptReport> attempts) { // Application Attempt Table Hamlet.TBODY <Hamlet.TABLE <Org.Apache.Hadoop.Yarn.Webapp.Hamlet.Hamlet> > tbody = html .Table("#attempts").Thead().Tr().Th(".id", "Attempt ID").Th(".started", "Started" ).Th(".node", "Node").Th(".logs", "Logs").Th(".blacklistednodes", "Blacklisted Nodes" ).().().Tbody(); RMApp rmApp = this.rm.GetRMContext().GetRMApps()[this.appID]; if (rmApp == null) { return; } StringBuilder attemptsTableData = new StringBuilder("[\n"); foreach (ApplicationAttemptReport appAttemptReport in attempts) { RMAppAttempt rmAppAttempt = rmApp.GetRMAppAttempt(appAttemptReport.GetApplicationAttemptId ()); if (rmAppAttempt == null) { continue; } AppAttemptInfo attemptInfo = new AppAttemptInfo(this.rm, rmAppAttempt, rmApp.GetUser (), WebAppUtils.GetHttpSchemePrefix(conf)); string blacklistedNodesCount = "N/A"; ICollection <string> nodes = RMAppAttemptBlock.GetBlacklistedNodes(rm, rmAppAttempt .GetAppAttemptId()); if (nodes != null) { blacklistedNodesCount = nodes.Count.ToString(); } string nodeLink = attemptInfo.GetNodeHttpAddress(); if (nodeLink != null) { nodeLink = WebAppUtils.GetHttpSchemePrefix(conf) + nodeLink; } string logsLink = attemptInfo.GetLogsLink(); attemptsTableData.Append("[\"<a href='").Append(Url("appattempt", rmAppAttempt.GetAppAttemptId ().ToString())).Append("'>").Append(rmAppAttempt.GetAppAttemptId().ToString()).Append ("</a>\",\"").Append(attemptInfo.GetStartTime()).Append("\",\"<a ").Append(nodeLink == null ? "#" : "href='" + nodeLink).Append("'>").Append(nodeLink == null ? "N/A" : StringEscapeUtils.EscapeJavaScript(StringEscapeUtils.EscapeHtml(nodeLink))).Append ("</a>\",\"<a ").Append(logsLink == null ? "#" : "href='" + logsLink).Append("'>" ).Append(logsLink == null ? "N/A" : "Logs").Append("</a>\",").Append("\"").Append (blacklistedNodesCount).Append("\"],\n"); } if (attemptsTableData[attemptsTableData.Length - 2] == ',') { attemptsTableData.Delete(attemptsTableData.Length - 2, attemptsTableData.Length - 1); } attemptsTableData.Append("]"); html.Script().$type("text/javascript").("var attemptsTableData=" + attemptsTableData ).(); 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) { string jid = $(AMParams.JobId); if (jid.IsEmpty()) { html.P().("Sorry, can't do anything without a JobID.").(); return; } JobId jobID = MRApps.ToJobID(jid); Org.Apache.Hadoop.Mapreduce.V2.App.Job.Job job = appContext.GetJob(jobID); if (job == null) { html.P().("Sorry, ", jid, " not found.").(); return; } Path confPath = job.GetConfFile(); try { ConfInfo info = new ConfInfo(job); html.Div().H3(confPath.ToString()).(); Hamlet.TBODY <Hamlet.TABLE <Org.Apache.Hadoop.Yarn.Webapp.Hamlet.Hamlet> > tbody = html .Table("#conf").Thead().Tr().Th(JQueryUI.Th, "key").Th(JQueryUI.Th, "value").Th( JQueryUI.Th, "source chain").().().Tbody(); // Tasks table foreach (ConfEntryInfo entry in info.GetProperties()) { StringBuilder buffer = new StringBuilder(); string[] sources = entry.GetSource(); //Skip the last entry, because it is always the same HDFS file, and // output them in reverse order so most recent is output first bool first = true; for (int i = (sources.Length - 2); i >= 0; i--) { if (!first) { // \u2B05 is an arrow <-- buffer.Append(" \u2B05 "); } first = false; buffer.Append(sources[i]); } tbody.Tr().Td(entry.GetName()).Td(entry.GetValue()).Td(buffer.ToString()).(); } tbody.().Tfoot().Tr().Th().Input("search_init").$type(HamletSpec.InputType.text). $name("key").$value("key").().().Th().Input("search_init").$type(HamletSpec.InputType .text).$name("value").$value("value").().().Th().Input("search_init").$type(HamletSpec.InputType .text).$name("source chain").$value("source chain").().().().().(); } catch (IOException e) { Log.Error("Error while reading " + confPath, e); html.P().("Sorry got an error while reading conf file. ", confPath); } }
private string VerifyAndGetAppOwner(HtmlBlock.Block html) { string appOwner = $(YarnWebParams.AppOwner); if (appOwner == null || appOwner.IsEmpty()) { html.H1().("Cannot get container logs without an app owner").(); } return(appOwner); }
protected override void Render(HtmlBlock.Block html) { string RMWebAppURL = WebAppUtils.GetResolvedRemoteRMWebAppURLWithScheme(this.conf ); html.Div("#nav").H3().("ResourceManager").().Ul().Li().A(RMWebAppURL, "RM Home"). ().().H3().("NodeManager").().Ul().Li().A(Url("node"), "Node Information").().Li ().A(Url("allApplications"), "List of Applications").().Li().A(Url("allContainers" ), "List of Containers").().().H3("Tools").Ul().Li().A("/conf", "Configuration") .().Li().A("/logs", "Local logs").().Li().A("/stacks", "Server stacks").().Li(). A("/jmx?qry=Hadoop:*", "Server metrics").().().(); }
/* * (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").().().().().(); }
protected override void Render(HtmlBlock.Block html) { Info("\'" + sinfo.GetQueueName() + "\' Queue Status").("Queue State:", sinfo.GetState ()).("Minimum Queue Memory Capacity:", Sharpen.Extensions.ToString(sinfo.GetMinQueueMemoryCapacity ())).("Maximum Queue Memory Capacity:", Sharpen.Extensions.ToString(sinfo.GetMaxQueueMemoryCapacity ())).("Number of Nodes:", Sharpen.Extensions.ToString(sinfo.GetNumNodes())).("Used Node Capacity:" , Sharpen.Extensions.ToString(sinfo.GetUsedNodeCapacity())).("Available Node Capacity:" , Sharpen.Extensions.ToString(sinfo.GetAvailNodeCapacity())).("Total Node Capacity:" , Sharpen.Extensions.ToString(sinfo.GetTotalNodeCapacity())).("Number of Node Containers:" , Sharpen.Extensions.ToString(sinfo.GetNumContainers())); html.(typeof(InfoBlock)); }
protected internal virtual void RenderData(HtmlBlock.Block html) { Hamlet.TBODY <Hamlet.TABLE <Org.Apache.Hadoop.Yarn.Webapp.Hamlet.Hamlet> > tbody = html .Table("#apps").Thead().Tr().Th(".id", "ID").Th(".user", "User").Th(".name", "Name" ).Th(".type", "Application Type").Th(".queue", "Queue").Th(".starttime", "StartTime" ).Th(".finishtime", "FinishTime").Th(".state", "State").Th(".finalstatus", "FinalStatus" ).Th(".progress", "Progress").Th(".ui", "Tracking UI").().().Tbody(); StringBuilder appsTableData = new StringBuilder("[\n"); foreach (ApplicationReport appReport in appReports) { // TODO: remove the following condition. It is still here because // the history side implementation of ApplicationBaseProtocol // hasn't filtering capability (YARN-1819). if (!reqAppStates.IsEmpty() && !reqAppStates.Contains(appReport.GetYarnApplicationState ())) { continue; } AppInfo app = new AppInfo(appReport); string percent = string.Format("%.1f", app.GetProgress()); appsTableData.Append("[\"<a href='").Append(Url("app", app.GetAppId())).Append("'>" ).Append(app.GetAppId()).Append("</a>\",\"").Append(StringEscapeUtils.EscapeJavaScript (StringEscapeUtils.EscapeHtml(app.GetUser()))).Append("\",\"").Append(StringEscapeUtils .EscapeJavaScript(StringEscapeUtils.EscapeHtml(app.GetName()))).Append("\",\""). Append(StringEscapeUtils.EscapeJavaScript(StringEscapeUtils.EscapeHtml(app.GetType ()))).Append("\",\"").Append(StringEscapeUtils.EscapeJavaScript(StringEscapeUtils .EscapeHtml(app.GetQueue()))).Append("\",\"").Append(app.GetStartedTime()).Append ("\",\"").Append(app.GetFinishedTime()).Append("\",\"").Append(app.GetAppState() == null ? Unavailable : app.GetAppState()).Append("\",\"").Append(app.GetFinalAppStatus ()).Append("\",\"").Append("<br title='").Append(percent).Append("'> <div class='" ).Append(JQueryUI.CProgressbar).Append("' title='").Append(StringHelper.Join(percent , '%')).Append("'> ").Append("<div class='").Append(JQueryUI.CProgressbarValue). Append("' style='").Append(StringHelper.Join("width:", percent, '%')).Append("'> </div> </div>" ).Append("\",\"<a "); // Progress bar string trackingURL = app.GetTrackingUrl() == null || app.GetTrackingUrl().Equals( Unavailable) ? null : app.GetTrackingUrl(); string trackingUI = app.GetTrackingUrl() == null || app.GetTrackingUrl().Equals(Unavailable ) ? "Unassigned" : app.GetAppState() == YarnApplicationState.Finished || app.GetAppState () == YarnApplicationState.Failed || app.GetAppState() == YarnApplicationState.Killed ? "History" : "ApplicationMaster"; appsTableData.Append(trackingURL == null ? "#" : "href='" + trackingURL).Append("'>" ).Append(trackingUI).Append("</a>\"],\n"); } if (appsTableData[appsTableData.Length - 2] == ',') { appsTableData.Delete(appsTableData.Length - 2, appsTableData.Length - 1); } appsTableData.Append("]"); html.Script().$type("text/javascript").("var appsTableData=" + appsTableData).(); tbody.().(); }
protected override void Render(HtmlBlock.Block html) { SCMMetricsInfo metricsInfo = new SCMMetricsInfo(CleanerMetrics.GetInstance(), ClientSCMMetrics .GetInstance(), SharedCacheUploaderMetrics.GetInstance()); Info("Shared Cache Manager overview").("Started on:", Times.Format(scm.GetStartTime ())).("Cache hits: ", metricsInfo.GetCacheHits()).("Cache misses: ", metricsInfo .GetCacheMisses()).("Cache releases: ", metricsInfo.GetCacheReleases()).("Accepted uploads: " , metricsInfo.GetAcceptedUploads()).("Rejected uploads: ", metricsInfo.GetRejectUploads ()).("Deleted files by the cleaner: ", metricsInfo.GetTotalDeletedFiles()).("Processed files by the cleaner: " , metricsInfo.GetTotalProcessedFiles()); html.(typeof(InfoBlock)); }
private void ReopenQueue(HtmlBlock.Block html) { html.Script().$type("text/javascript").("function reopenQueryNodes() {", " var currentParam = window.location.href.split('?');" , " var tmpCurrentParam = currentParam;", " var queryQueuesString = '';", " if (tmpCurrentParam.length > 1) {" , " // openQueues=q1#q2¶m1=value1¶m2=value2", " tmpCurrentParam = tmpCurrentParam[1];" , " if (tmpCurrentParam.indexOf('openQueues=') != -1 ) {", " tmpCurrentParam = tmpCurrentParam.split('openQueues=')[1].split('&')[0];" , " queryQueuesString = tmpCurrentParam;", " }", " }", " if (queryQueuesString != '') {" , " queueArray = queryQueuesString.split('#');", " $('#cs .q').each(function() {" , " var name = $(this).html();", " if (name != 'root' && $.inArray(name, queueArray) != -1) {" , " $(this).closest('li').removeClass('jstree-closed').addClass('jstree-open'); " , " }", " });", " }", " $('#cs').bind( {", " 'open_node.jstree' :function(e, data) { storeExpandedQueue(e, data); }," , " 'close_node.jstree':function(e, data) { storeExpandedQueue(e, data); }" , " });", "}").(); }
protected override void Render(HtmlBlock.Block html) { Hamlet.TBODY <Hamlet.TABLE <Hamlet.BODY <Org.Apache.Hadoop.Yarn.Webapp.Hamlet.Hamlet > > > tableBody = html.Body().Table("#containers").Thead().Tr().Td().("ContainerId" ).().Td().("ContainerState").().Td().("logs").().().().Tbody(); foreach (KeyValuePair <ContainerId, Org.Apache.Hadoop.Yarn.Server.Nodemanager.Containermanager.Container.Container > entry in this.nmContext.GetContainers()) { ContainerInfo info = new ContainerInfo(this.nmContext, entry.Value); tableBody.Tr().Td().A(Url("container", info.GetId()), info.GetId()).().Td().(info .GetState()).().Td().A(Url(info.GetShortLogLink()), "logs").().(); } tableBody.().().(); }
protected override void Render(HtmlBlock.Block html) { Hamlet.TBODY <Hamlet.TABLE <Hamlet.BODY <Org.Apache.Hadoop.Yarn.Webapp.Hamlet.Hamlet > > > tableBody = html.Body().Table("#applications").Thead().Tr().Td().("ApplicationId" ).().Td().("ApplicationState").().().().Tbody(); foreach (KeyValuePair <ApplicationId, Org.Apache.Hadoop.Yarn.Server.Nodemanager.Containermanager.Application.Application > entry in this.nmContext.GetApplications()) { AppInfo info = new AppInfo(entry.Value); tableBody.Tr().Td().A(Url("application", info.GetId()), info.GetId()).().Td().(info .GetState()).().(); } tableBody.().().(); }
protected override void Render(HtmlBlock.Block html) { html.(typeof(MetricsOverviewTable)); ResourceManager rm = GetInstance <ResourceManager>(); ClusterInfo cinfo = new ClusterInfo(rm); Info("Cluster overview").("Cluster ID:", cinfo.GetClusterId()).("ResourceManager state:" , cinfo.GetState()).("ResourceManager HA state:", cinfo.GetHAState()).("ResourceManager HA zookeeper connection state:" , cinfo.GetHAZookeeperConnectionState()).("ResourceManager RMStateStore:", cinfo .GetRMStateStore()).("ResourceManager started on:", Times.Format(cinfo.GetStartedOn ())).("ResourceManager version:", cinfo.GetRMBuildVersion() + " on " + cinfo.GetRMVersionBuiltOn ()).("Hadoop version:", cinfo.GetHadoopBuildVersion() + " on " + cinfo.GetHadoopVersionBuiltOn ()); html.(typeof(InfoBlock)); }
protected override void Render(HtmlBlock.Block html) { NodeInfo info = new NodeInfo(this.context, this.resourceView); Info("NodeManager information").("Total Vmem allocated for Containers", StringUtils .ByteDesc(info.GetTotalVmemAllocated() * BytesInMb)).("Vmem enforcement enabled" , info.IsVmemCheckEnabled()).("Total Pmem allocated for Container", StringUtils. ByteDesc(info.GetTotalPmemAllocated() * BytesInMb)).("Pmem enforcement enabled", info.IsPmemCheckEnabled()).("Total VCores allocated for Containers", info.GetTotalVCoresAllocated ().ToString()).("NodeHealthyStatus", info.GetHealthStatus()).("LastNodeHealthTime" , Sharpen.Extensions.CreateDate(info.GetLastNodeUpdateTime())).("NodeHealthReport" , info.GetHealthReport()).("Node Manager Version:", info.GetNMBuildVersion() + " on " + info.GetNMVersionBuiltOn()).("Hadoop Version:", info.GetHadoopBuildVersion() + " on " + info.GetHadoopVersionBuiltOn()); html.(typeof(InfoBlock)); }
protected override void Render(HtmlBlock.Block html) { SetTitle("Applications"); try { FetchData(); } catch (Exception e) { string message = "Failed to read the applications."; Log.Error(message, e); html.P().(message).(); return; } RenderData(html); }
protected override void Render(HtmlBlock.Block html) { Hamlet.UL <Hamlet.DIV <Org.Apache.Hadoop.Yarn.Webapp.Hamlet.Hamlet> > mainList = html .Div("#nav").H3("Cluster").Ul().Li().A(Url("cluster"), "About").().Li().A(Url("nodes" ), "Nodes").().Li().A(Url("nodelabels"), "Node Labels").(); Hamlet.UL <Hamlet.LI <Hamlet.UL <Hamlet.DIV <Org.Apache.Hadoop.Yarn.Webapp.Hamlet.Hamlet > > > > subAppsList = mainList.Li().A(Url("apps"), "Applications").Ul(); subAppsList.Li().(); foreach (YarnApplicationState state in YarnApplicationState.Values()) { subAppsList.Li().A(Url("apps", state.ToString()), state.ToString()).(); } subAppsList.().(); mainList.Li().A(Url("scheduler"), "Scheduler").().().H3("Tools").Ul().Li().A("/conf" , "Configuration").().Li().A("/logs", "Local logs").().Li().A("/stacks", "Server stacks" ).().Li().A("/jmx?qry=Hadoop:*", "Server metrics").().().(); }
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.().(); }
private void StoreExpandedQueue(HtmlBlock.Block html) { html.Script().$type("text/javascript").("function storeExpandedQueue(e, data) {", " var OPEN_QUEUES = 'openQueues';", " var ACTION_OPEN = 'open';", " var ACTION_CLOSED = 'closed';" , " var $li = $(data.args[0]);", " var action = ACTION_CLOSED; //closed or open" , " var queueName = ''", " if ($li.hasClass('jstree-open')) {", " action=ACTION_OPEN;" , " }", " queueName = $li.find('.q').html();", " // http://localhost:8088/cluster/scheduler?openQueues=q1#q2¶m1=value1¶m2=value2 " , " // ==> [http://localhost:8088/cluster/scheduler , openQueues=q1#q2¶m1=value1¶m2=value2]" , " var currentParam = window.location.href.split('?');", " var tmpCurrentParam = currentParam;" , " var queryString = '';", " if (tmpCurrentParam.length > 1) {", " // openQueues=q1#q2¶m1=value1¶m2=value2" , " tmpCurrentParam = tmpCurrentParam[1];", " currentParam = tmpCurrentParam;" , " tmpCurrentParam = tmpCurrentParam.split('&');", " var len = tmpCurrentParam.length;" , " var paramExist = false;", " if (len > 1) { // Currently no query param are present but in future if any are added for that handling it now" , " queryString = '';", " for (var i = 0 ; i < len ; i++) { // searching for param openQueues" , " if (tmpCurrentParam[i].substr(0,11) == OPEN_QUEUES + '=') {", " if (action == ACTION_OPEN) {" , " tmpCurrentParam[i] = addQueueName(tmpCurrentParam[i],queueName);" , " }", " else if (action == ACTION_CLOSED) {", " tmpCurrentParam[i] = removeQueueName(tmpCurrentParam[i] , queueName);" , " }", " paramExist = true;", " }", " if (i > 0) {" , " queryString += '&';", " }", " queryString += tmpCurrentParam[i];" , " }", " // If in existing query string OPEN_QUEUES param is not present" , " if (action == ACTION_OPEN && !paramExist) {", " queryString = currentParam + '&' + OPEN_QUEUES + '=' + queueName;" , " }", " } ", " // Only one param is present in current query string" , " else {", " tmpCurrentParam=tmpCurrentParam[0];", " // checking if the only param present in query string is OPEN_QUEUES or not and making queryString accordingly" , " if (tmpCurrentParam.substr(0,11) == OPEN_QUEUES + '=') {", " if (action == ACTION_OPEN) {" , " queryString = addQueueName(tmpCurrentParam,queueName);", " }" , " else if (action == ACTION_CLOSED) {", " queryString = removeQueueName(tmpCurrentParam , queueName);" , " }", " }", " else {", " if (action == ACTION_OPEN) {" , " queryString = tmpCurrentParam + '&' + OPEN_QUEUES + '=' + queueName;" , " }", " }", " }", " } else {", " if (action == ACTION_OPEN) {" , " tmpCurrentParam = '';", " currentParam = tmpCurrentParam;", " queryString = OPEN_QUEUES+'='+queueName;" , " }", " }", " if (queryString != '') {", " queryString = '?' + queryString;" , " }", " var url = window.location.protocol + '//' + window.location.host + window.location.pathname + queryString;" , " window.history.pushState( { path : url }, '', url);", "};", string.Empty, "function removeQueueName(queryString, queueName) {" , " var index = queryString.indexOf(queueName);", " // Finding if queue is present in query param then only remove it" , " if (index != -1) {", " // removing openQueues=", " var tmp = queryString.substr(11, queryString.length);" , " tmp = tmp.split('#');", " var len = tmp.length;", " var newQueryString = '';" , " for (var i = 0 ; i < len ; i++) {", " if (tmp[i] != queueName) {", " if (newQueryString != '') {" , " newQueryString += '#';", " }", " newQueryString += tmp[i];" , " }", " }", " queryString = newQueryString;", " if (newQueryString != '') {" , " queryString = 'openQueues=' + newQueryString;", " }", " }", " return queryString;" , "}", string.Empty, "function addQueueName(queryString, queueName) {", " queueArray = queryString.split('#');" , " if ($.inArray(queueArray, queueName) == -1) {", " queryString = queryString + '#' + queueName;" , " }", " return queryString;", "}").(); }
protected override void CreateAttemptHeadRoomTable(HtmlBlock.Block html) { RMAppAttempt attempt = GetRMAppAttempt(); if (attempt != null) { if (!IsApplicationInFinalState(YarnApplicationAttemptState.ValueOf(attempt.GetAppAttemptState ().ToString()))) { RMAppAttemptMetrics metrics = attempt.GetRMAppAttemptMetrics(); Hamlet.DIV <Org.Apache.Hadoop.Yarn.Webapp.Hamlet.Hamlet> pdiv = html.(typeof(InfoBlock )).Div(JQueryUI.InfoWrap); Info("Application Attempt Overview").Clear(); Info("Application Attempt Metrics").("Application Attempt Headroom : ", metrics == null ? "N/A" : metrics.GetApplicationAttemptHeadroom()); pdiv.(); } } }