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) { 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.().(); }
/* * (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); } }
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) { 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 <Org.Apache.Hadoop.Yarn.Webapp.Hamlet.Hamlet> > tbody = html .Table("#userinfo").Thead().$class("ui-widget-header").Tr().Th().$class("ui-state-default" ).("User Name").().Th().$class("ui-state-default").("Max Resource").().Th().$class ("ui-state-default").("Used Resource").().Th().$class("ui-state-default").("Max AM Resource" ).().Th().$class("ui-state-default").("Used AM Resource").().Th().$class("ui-state-default" ).("Schedulable Apps").().Th().$class("ui-state-default").("Non-Schedulable Apps" ).().().().Tbody(); AList <UserInfo> users = lqinfo.GetUsers().GetUsersList(); foreach (UserInfo userInfo in users) { tbody.Tr().Td(userInfo.GetUsername()).Td(userInfo.GetUserResourceLimit().ToString ()).Td(userInfo.GetResourcesUsed().ToString()).Td(lqinfo.GetUserAMResourceLimit( ).ToString()).Td(userInfo.GetAMResourcesUsed().ToString()).Td(Sharpen.Extensions.ToString (userInfo.GetNumActiveApplications())).Td(Sharpen.Extensions.ToString(userInfo.GetNumPendingApplications ())).(); } html.Div().$class("usersinfo").H5("Active Users Info").(); tbody.().(); }
protected override void Render(HtmlBlock.Block html) { if (job == null) { html.P().("Sorry, no counters for nonexistent", $(AMParams.JobId, "job")).(); return; } if (!$(AMParams.TaskId).IsEmpty() && task == null) { html.P().("Sorry, no counters for nonexistent", $(AMParams.TaskId, "task")).(); return; } string columnType = task == null ? "Task" : "Task Attempt"; Hamlet.TBODY <Hamlet.TABLE <Hamlet.DIV <Org.Apache.Hadoop.Yarn.Webapp.Hamlet.Hamlet> > > tbody = html.Div(JQueryUI.InfoWrap).Table("#singleCounter").Thead().Tr().Th(".ui-state-default" , columnType).Th(".ui-state-default", "Value").().().Tbody(); foreach (KeyValuePair <string, long> entry in values) { Hamlet.TR <Hamlet.TBODY <Hamlet.TABLE <Hamlet.DIV <Org.Apache.Hadoop.Yarn.Webapp.Hamlet.Hamlet > > > > row = tbody.Tr(); string id = entry.Key; string val = entry.Value.ToString(); if (task != null) { row.Td(id); row.Td().Br().$title(val).().(val).(); } else { row.Td().A(Url("singletaskcounter", entry.Key, $(AMParams.CounterGroup), $(AMParams .CounterName)), id).(); row.Td().Br().$title(val).().A(Url("singletaskcounter", entry.Key, $(AMParams.CounterGroup ), $(AMParams.CounterName)), val).(); } row.(); } tbody.().().(); }
protected override void Render(HtmlBlock.Block html) { if (job == null) { html.P().("Sorry, no counters for nonexistent", $(AMParams.JobId, "job")).(); return; } if (!$(AMParams.TaskId).IsEmpty() && task == null) { html.P().("Sorry, no counters for nonexistent", $(AMParams.TaskId, "task")).(); return; } if (total == null || total.GetGroupNames() == null || total.CountCounters() == 0) { string type = $(AMParams.TaskId); if (type == null || type.IsEmpty()) { type = $(AMParams.JobId, "the job"); } html.P().("Sorry it looks like ", type, " has no counters.").(); return; } string urlBase; string urlId; if (task != null) { urlBase = "singletaskcounter"; urlId = MRApps.ToString(task.GetID()); } else { urlBase = "singlejobcounter"; urlId = MRApps.ToString(job.GetID()); } int numGroups = 0; Hamlet.TBODY <Hamlet.TABLE <Hamlet.DIV <Org.Apache.Hadoop.Yarn.Webapp.Hamlet.Hamlet> > > tbody = html.Div(JQueryUI.InfoWrap).Table("#counters").Thead().Tr().Th(".group.ui-state-default" , "Counter Group").Th(".ui-state-default", "Counters").().().Tbody(); foreach (CounterGroup g in total) { CounterGroup mg = map == null ? null : map.GetGroup(g.GetName()); CounterGroup rg = reduce == null ? null : reduce.GetGroup(g.GetName()); ++numGroups; // This is mostly for demonstration :) Typically we'd introduced // a CounterGroup block to reduce the verbosity. OTOH, this // serves as an indicator of where we're in the tag hierarchy. Hamlet.TR <Hamlet.THEAD <Hamlet.TABLE <Hamlet.TD <Hamlet.TR <Hamlet.TBODY <Hamlet.TABLE <Hamlet.DIV <Org.Apache.Hadoop.Yarn.Webapp.Hamlet.Hamlet> > > > > > > > groupHeadRow = tbody .Tr().Th().$title(g.GetName()).$class("ui-state-default").(FixGroupDisplayName(g .GetDisplayName())).().Td().$class(JQueryUI.CTable).Table(".dt-counters").$id(job .GetID() + "." + g.GetName()).Thead().Tr().Th(".name", "Name"); if (map != null) { groupHeadRow.Th("Map").Th("Reduce"); } // Ditto Hamlet.TBODY <Hamlet.TABLE <Hamlet.TD <Hamlet.TR <Hamlet.TBODY <Hamlet.TABLE <Hamlet.DIV <Org.Apache.Hadoop.Yarn.Webapp.Hamlet.Hamlet> > > > > > > group = groupHeadRow.Th(map == null ? "Value" : "Total").().().Tbody(); foreach (Counter counter in g) { // Ditto Hamlet.TR <Hamlet.TBODY <Hamlet.TABLE <Hamlet.TD <Hamlet.TR <Hamlet.TBODY <Hamlet.TABLE <Hamlet.DIV <Org.Apache.Hadoop.Yarn.Webapp.Hamlet.Hamlet> > > > > > > > groupRow = group .Tr(); if (task == null && mg == null && rg == null) { groupRow.Td().$title(counter.GetName()).(counter.GetDisplayName()).(); } else { groupRow.Td().$title(counter.GetName()).A(Url(urlBase, urlId, g.GetName(), counter .GetName()), counter.GetDisplayName()).(); } if (map != null) { Counter mc = mg == null ? null : mg.FindCounter(counter.GetName()); Counter rc = rg == null ? null : rg.FindCounter(counter.GetName()); groupRow.Td(mc == null ? "0" : string.Format("%,d", mc.GetValue())).Td(rc == null ? "0" : string.Format("%,d", rc.GetValue())); } groupRow.Td(string.Format("%,d", counter.GetValue())).(); } group.().().().(); } tbody.().().(); }
protected override void Render(HtmlBlock.Block html) { html.(typeof(MetricsOverviewTable)); ResourceScheduler sched = rm.GetResourceScheduler(); string type = $(YarnWebParams.NodeState); string labelFilter = $(YarnWebParams.NodeLabel, CommonNodeLabelsManager.Any).Trim (); Hamlet.TBODY <Hamlet.TABLE <Org.Apache.Hadoop.Yarn.Webapp.Hamlet.Hamlet> > tbody = html .Table("#nodes").Thead().Tr().Th(".nodelabels", "Node Labels").Th(".rack", "Rack" ).Th(".state", "Node State").Th(".nodeaddress", "Node Address").Th(".nodehttpaddress" , "Node HTTP Address").Th(".lastHealthUpdate", "Last health-update").Th(".healthReport" , "Health-report").Th(".containers", "Containers").Th(".mem", "Mem Used").Th(".mem" , "Mem Avail").Th(".vcores", "VCores Used").Th(".vcores", "VCores Avail").Th(".nodeManagerVersion" , "Version").().().Tbody(); NodeState stateFilter = null; if (type != null && !type.IsEmpty()) { stateFilter = NodeState.ValueOf(StringUtils.ToUpperCase(type)); } ICollection <RMNode> rmNodes = this.rm.GetRMContext().GetRMNodes().Values; bool isInactive = false; if (stateFilter != null) { switch (stateFilter) { case NodeState.Decommissioned: case NodeState.Lost: case NodeState.Rebooted: { rmNodes = this.rm.GetRMContext().GetInactiveRMNodes().Values; isInactive = true; break; } default: { Log.Debug("Unexpected state filter for inactive RM node"); break; } } } foreach (RMNode ni in rmNodes) { if (stateFilter != null) { NodeState state = ni.GetState(); if (!stateFilter.Equals(state)) { continue; } } else { // No filter. User is asking for all nodes. Make sure you skip the // unhealthy nodes. if (ni.GetState() == NodeState.Unhealthy) { continue; } } // Besides state, we need to filter label as well. if (!labelFilter.Equals(RMNodeLabelsManager.Any)) { if (labelFilter.IsEmpty()) { // Empty label filter means only shows nodes without label if (!ni.GetNodeLabels().IsEmpty()) { continue; } } else { if (!ni.GetNodeLabels().Contains(labelFilter)) { // Only nodes have given label can show on web page. continue; } } } NodeInfo info = new NodeInfo(ni, sched); int usedMemory = (int)info.GetUsedMemory(); int availableMemory = (int)info.GetAvailableMemory(); Hamlet.TR <Hamlet.TBODY <Hamlet.TABLE <Org.Apache.Hadoop.Yarn.Webapp.Hamlet.Hamlet> > > row = tbody.Tr().Td(StringUtils.Join(",", info.GetNodeLabels())).Td(info.GetRack ()).Td(info.GetState()).Td(info.GetNodeId()); if (isInactive) { row.Td().("N/A").(); } else { string httpAddress = info.GetNodeHTTPAddress(); row.Td().A("//" + httpAddress, httpAddress).(); } row.Td().Br().$title(info.GetLastHealthUpdate().ToString()).().(Times.Format(info .GetLastHealthUpdate())).().Td(info.GetHealthReport()).Td(info.GetNumContainers( ).ToString()).Td().Br().$title(usedMemory.ToString()).().(StringUtils.ByteDesc(usedMemory * BytesInMb)).().Td().Br().$title(availableMemory.ToString()).().(StringUtils.ByteDesc (availableMemory * BytesInMb)).().Td(info.GetUsedVirtualCores().ToString()).Td(info .GetAvailableVirtualCores().ToString()).Td(ni.GetNodeManagerVersion()).(); } tbody.().(); }