Ejemplo n.º 1
0
        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.();
        }
Ejemplo n.º 2
0
        protected internal override void Render(HtmlBlock.Block html)
        {
            Hamlet.TABLE <Hamlet.DIV <Org.Apache.Hadoop.Yarn.Webapp.Hamlet.Hamlet> > table = html
                                                                                             .Div(JQueryUI.InfoWrap).Table(JQueryUI.Info).Tr().Th().$class(JQueryUI.CTh).$colspan
                                                                                                 (2).(info.About()).().();
            int i = 0;

            foreach (ResponseInfo.Item item in info)
            {
                Hamlet.TR <Hamlet.TABLE <Hamlet.DIV <Org.Apache.Hadoop.Yarn.Webapp.Hamlet.Hamlet> > >
                       tr    = table.Tr((++i % 2 != 0) ? JQueryUI.Odd : JQueryUI.Even).Th(item.key);
                string value = item.value.ToString();
                if (item.url == null)
                {
                    if (!item.isRaw)
                    {
                        Hamlet.TD <Hamlet.TR <Hamlet.TABLE <Hamlet.DIV <Org.Apache.Hadoop.Yarn.Webapp.Hamlet.Hamlet
                                                                        > > > > td = tr.Td();
                        if (value.LastIndexOf('\n') > 0)
                        {
                            string[] lines = value.Split("\n");
                            Hamlet.DIV <Hamlet.TD <Hamlet.TR <Hamlet.TABLE <Hamlet.DIV <Org.Apache.Hadoop.Yarn.Webapp.Hamlet.Hamlet
                                                                                        > > > > > singleLineDiv;
                            foreach (string line in lines)
                            {
                                singleLineDiv = td.Div();
                                singleLineDiv.(line);
                                singleLineDiv.();
                            }
                        }
                        else
                        {
                            td.(value);
                        }
                        td.();
                    }
                    else
                    {
                        tr.Td()._r(value).();
                    }
                }
                else
                {
                    tr.Td().A(Url(item.url), value).();
                }
                tr.();
            }
            table.().();
        }
Ejemplo n.º 3
0
            protected override void Render(HtmlBlock.Block html)
            {
                ApplicationId applicationID = ConverterUtils.ToApplicationId(this.recordFactory,
                                                                             $(ApplicationId));

                Org.Apache.Hadoop.Yarn.Server.Nodemanager.Containermanager.Application.Application
                        app  = this.nmContext.GetApplications()[applicationID];
                AppInfo info = new AppInfo(app);

                Info("Application's information").("ApplicationId", info.GetId()).("ApplicationState"
                                                                                   , info.GetState()).("User", info.GetUser());
                Hamlet.TABLE <Org.Apache.Hadoop.Yarn.Webapp.Hamlet.Hamlet> containersListBody = html
                                                                                                .(typeof(InfoBlock)).Table("#containers");
                foreach (string containerIdStr in info.GetContainers())
                {
                    containersListBody.Tr().Td().A(Url("container", containerIdStr), containerIdStr).
                    ().();
                }
                containersListBody.();
            }
Ejemplo n.º 4
0
        private void CreateContainerLocalityTable(HtmlBlock.Block html)
        {
            RMAppAttemptMetrics attemptMetrics = null;
            RMAppAttempt        attempt        = GetRMAppAttempt();

            if (attempt != null)
            {
                attemptMetrics = attempt.GetRMAppAttemptMetrics();
            }
            if (attemptMetrics == null)
            {
                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 Allocated Containers: " + attemptMetrics.GetTotalAllocatedContainers(
                                                                                                     )).H3("Each table cell" + " represents the number of NodeLocal/RackLocal/OffSwitch containers"
                                                                                                           + " satisfied by NodeLocal/RackLocal/OffSwitch resource requests.").Table("#containerLocality"
                                                                                                                                                                                     );
            table.Tr().Th(JQueryUI.Th, string.Empty).Th(JQueryUI.Th, "Node Local Request").Th
                (JQueryUI.Th, "Rack Local Request").Th(JQueryUI.Th, "Off Switch Request").();
            string[] containersType = new string[] { "Num Node Local Containers (satisfied by)"
                                                     , "Num Rack Local Containers (satisfied by)", "Num Off Switch Containers (satisfied by)" };
            bool odd = false;

            for (int i = 0; i < attemptMetrics.GetLocalityStatistics().Length; i++)
            {
                table.Tr((odd = !odd) ? JQueryUI.Odd : JQueryUI.Even).Td(containersType[i]).Td(attemptMetrics
                                                                                               .GetLocalityStatistics()[i][0].ToString()).Td(i == 0 ? string.Empty : attemptMetrics
                                                                                                                                             .GetLocalityStatistics()[i][1].ToString()).Td(i <= 1 ? string.Empty : attemptMetrics
                                                                                                                                                                                           .GetLocalityStatistics()[i][2].ToString()).();
            }
            table.();
            div.();
        }
Ejemplo n.º 5
0
        /*
         * (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 j = appContext.GetJob(jobID);
            if (j == null)
            {
                html.P().("Sorry, ", jid, " not found.").();
                return;
            }
            IList <AMInfo> amInfos   = j.GetAMInfos();
            JobInfo        job       = new JobInfo(j);
            ResponseInfo   infoBlock = Info("Job Overview").("Job Name:", job.GetName()).("User Name:"
                                                                                          , job.GetUserName()).("Queue:", job.GetQueueName()).("State:", job.GetState()).(
                "Uberized:", job.IsUber()).("Submitted:", Sharpen.Extensions.CreateDate(job.GetSubmitTime
                                                                                            ())).("Started:", Sharpen.Extensions.CreateDate(job.GetStartTime())).("Finished:"
                                                                                                                                                                  , Sharpen.Extensions.CreateDate(job.GetFinishTime())).("Elapsed:", StringUtils.FormatTime
                                                                                                                                                                                                                             (Times.Elapsed(job.GetStartTime(), job.GetFinishTime(), false)));
            string amString = amInfos.Count == 1 ? "ApplicationMaster" : "ApplicationMasters";
            // todo - switch to use JobInfo
            IList <string> diagnostics = j.GetDiagnostics();

            if (diagnostics != null && !diagnostics.IsEmpty())
            {
                StringBuilder b = new StringBuilder();
                foreach (string diag in diagnostics)
                {
                    b.Append(diag);
                }
                infoBlock.("Diagnostics:", b.ToString());
            }
            if (job.GetNumMaps() > 0)
            {
                infoBlock.("Average Map Time", StringUtils.FormatTime(job.GetAvgMapTime()));
            }
            if (job.GetNumReduces() > 0)
            {
                infoBlock.("Average Shuffle Time", StringUtils.FormatTime(job.GetAvgShuffleTime()
                                                                          ));
                infoBlock.("Average Merge Time", StringUtils.FormatTime(job.GetAvgMergeTime()));
                infoBlock.("Average Reduce Time", StringUtils.FormatTime(job.GetAvgReduceTime()));
            }
            foreach (ConfEntryInfo entry in job.GetAcls())
            {
                infoBlock.("ACL " + entry.GetName() + ":", entry.GetValue());
            }
            Hamlet.DIV <Org.Apache.Hadoop.Yarn.Webapp.Hamlet.Hamlet> div = html.(typeof(InfoBlock
                                                                                        )).Div(JQueryUI.InfoWrap);
            // MRAppMasters Table
            Hamlet.TABLE <Hamlet.DIV <Org.Apache.Hadoop.Yarn.Webapp.Hamlet.Hamlet> > table = div
                                                                                             .Table("#job");
            table.Tr().Th(amString).().Tr().Th(JQueryUI.Th, "Attempt Number").Th(JQueryUI.Th,
                                                                                 "Start Time").Th(JQueryUI.Th, "Node").Th(JQueryUI.Th, "Logs").();
            bool odd = false;

            foreach (AMInfo amInfo in amInfos)
            {
                AMAttemptInfo attempt = new AMAttemptInfo(amInfo, job.GetId(), job.GetUserName(),
                                                          string.Empty, string.Empty);
                table.Tr((odd = !odd) ? JQueryUI.Odd : JQueryUI.Even).Td(attempt.GetAttemptId().ToString
                                                                             ()).Td(Sharpen.Extensions.CreateDate(attempt.GetStartTime()).ToString()).Td().A(
                    ".nodelink", Url(MRWebAppUtil.GetYARNWebappScheme(), attempt.GetNodeHttpAddress(
                                         )), attempt.GetNodeHttpAddress()).().Td().A(".logslink", Url(attempt.GetShortLogsLink
                                                                                                          ()), "logs").().();
            }
            table.();
            div.();
            html.Div(JQueryUI.InfoWrap).Table("#job").Tr().Th(JQueryUI.Th, "Task Type").Th(JQueryUI
                                                                                           .Th, "Total").Th(JQueryUI.Th, "Complete").().Tr(JQueryUI.Odd).Th().A(Url("tasks"
                                                                                                                                                                    , jid, "m"), "Map").().Td(job.GetMapsTotal().ToString().ToString()).Td(job.GetMapsCompleted
                                                                                                                                                                                                                                               ().ToString().ToString()).().Tr(JQueryUI.Even).Th().A(Url("tasks", jid, "r"), "Reduce"
                                                                                                                                                                                                                                                                                                     ).().Td(job.GetReducesTotal().ToString().ToString()).Td(job.GetReducesCompleted(
                                                                                                                                                                                                                                                                                                                                                                 ).ToString().ToString()).().().Table("#job").Tr().Th(JQueryUI.Th, "Attempt Type"
                                                                                                                                                                                                                                                                                                                                                                                                                      ).Th(JQueryUI.Th, "Failed").Th(JQueryUI.Th, "Killed").Th(JQueryUI.Th, "Successful"
                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ).().Tr(JQueryUI.Odd).Th("Maps").Td().A(Url("attempts", jid, "m", MRApps.TaskAttemptStateUI
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           .Failed.ToString()), job.GetFailedMapAttempts().ToString()).().Td().A(Url("attempts"
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     , jid, "m", MRApps.TaskAttemptStateUI.Killed.ToString()), job.GetKilledMapAttempts
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     ().ToString()).().Td().A(Url("attempts", jid, "m", MRApps.TaskAttemptStateUI.Successful
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  .ToString()), job.GetSuccessfulMapAttempts().ToString()).().().Tr(JQueryUI.Even)
            .Th("Reduces").Td().A(Url("attempts", jid, "r", MRApps.TaskAttemptStateUI.Failed
                                      .ToString()), job.GetFailedReduceAttempts().ToString()).().Td().A(Url("attempts"
                                                                                                            , jid, "r", MRApps.TaskAttemptStateUI.Killed.ToString()), job.GetKilledReduceAttempts
                                                                                                            ().ToString()).().Td().A(Url("attempts", jid, "r", MRApps.TaskAttemptStateUI.Successful
                                                                                                                                         .ToString()), job.GetSuccessfulReduceAttempts().ToString()).().().().();
        }
Ejemplo n.º 6
0
        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;
            }
            IList <AMInfo> amInfos  = job.GetAMInfos();
            string         amString = amInfos.Count == 1 ? "ApplicationMaster" : "ApplicationMasters";
            JobInfo        jinfo    = new JobInfo(job, true);

            Info("Job Overview").("Job Name:", jinfo.GetName()).("State:", jinfo.GetState()).
            ("Uberized:", jinfo.IsUberized()).("Started:", Sharpen.Extensions.CreateDate(jinfo
                                                                                         .GetStartTime())).("Elapsed:", StringUtils.FormatTime(jinfo.GetElapsedTime()));
            Hamlet.DIV <Org.Apache.Hadoop.Yarn.Webapp.Hamlet.Hamlet> div = html.(typeof(InfoBlock
                                                                                        )).Div(JQueryUI.InfoWrap);
            // MRAppMasters Table
            Hamlet.TABLE <Hamlet.DIV <Org.Apache.Hadoop.Yarn.Webapp.Hamlet.Hamlet> > table = div
                                                                                             .Table("#job");
            table.Tr().Th(amString).().Tr().Th(JQueryUI.Th, "Attempt Number").Th(JQueryUI.Th,
                                                                                 "Start Time").Th(JQueryUI.Th, "Node").Th(JQueryUI.Th, "Logs").();
            foreach (AMInfo amInfo in amInfos)
            {
                AMAttemptInfo attempt = new AMAttemptInfo(amInfo, jinfo.GetId(), jinfo.GetUserName
                                                              ());
                table.Tr().Td(attempt.GetAttemptId().ToString()).Td(Sharpen.Extensions.CreateDate
                                                                        (attempt.GetStartTime()).ToString()).Td().A(".nodelink", Url(MRWebAppUtil.GetYARNWebappScheme
                                                                                                                                         (), attempt.GetNodeHttpAddress()), attempt.GetNodeHttpAddress()).().Td().A(".logslink"
                                                                                                                                                                                                                    , Url(attempt.GetLogsLink()), "logs").().();
            }
            table.();
            div.();
            html.Div(JQueryUI.InfoWrap).Table("#job").Tr().Th(JQueryUI.Th, "Task Type").Th(JQueryUI
                                                                                           .Th, "Progress").Th(JQueryUI.Th, "Total").Th(JQueryUI.Th, "Pending").Th(JQueryUI
                                                                                                                                                                   .Th, "Running").Th(JQueryUI.Th, "Complete").().Tr(JQueryUI.Odd).Th("Map").Td().Div
                (JQueryUI.Progressbar).$title(StringHelper.Join(jinfo.GetMapProgressPercent(), '%'
                                                                )).Div(JQueryUI.ProgressbarValue).$style(StringHelper.Join("width:", jinfo.GetMapProgressPercent
                                                                                                                               (), '%')).().().().Td().A(Url("tasks", jid, "m", "ALL"), jinfo.GetMapsTotal().ToString
                                                                                                                                                             ()).().Td().A(Url("tasks", jid, "m", "PENDING"), jinfo.GetMapsPending().ToString
                                                                                                                                                                               ()).().Td().A(Url("tasks", jid, "m", "RUNNING"), jinfo.GetMapsRunning().ToString
                                                                                                                                                                                                 ()).().Td().A(Url("tasks", jid, "m", "COMPLETED"), jinfo.GetMapsCompleted().ToString
                                                                                                                                                                                                                   ()).().().Tr(JQueryUI.Even).Th("Reduce").Td().Div(JQueryUI.Progressbar).$title(StringHelper.Join
                                                                                                                                                                                                                                                                                                      (jinfo.GetReduceProgressPercent(), '%')).Div(JQueryUI.ProgressbarValue).$style(StringHelper.Join
                                                                                                                                                                                                                                                                                                                                                                                         ("width:", jinfo.GetReduceProgressPercent(), '%')).().().().Td().A(Url("tasks",
                                                                                                                                                                                                                                                                                                                                                                                                                                                                jid, "r", "ALL"), jinfo.GetReducesTotal().ToString()).().Td().A(Url("tasks", jid
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    , "r", "PENDING"), jinfo.GetReducesPending().ToString()).().Td().A(Url("tasks",
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           jid, "r", "RUNNING"), jinfo.GetReducesRunning().ToString()).().Td().A(Url("tasks"
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     , jid, "r", "COMPLETED"), jinfo.GetReducesCompleted().ToString()).().().().Table
                ("#job").Tr().Th(JQueryUI.Th, "Attempt Type").Th(JQueryUI.Th, "New").Th(JQueryUI
                                                                                        .Th, "Running").Th(JQueryUI.Th, "Failed").Th(JQueryUI.Th, "Killed").Th(JQueryUI.
                                                                                                                                                               Th, "Successful").().Tr(JQueryUI.Odd).Th("Maps").Td().A(Url("attempts", jid, "m"
                                                                                                                                                                                                                           , MRApps.TaskAttemptStateUI.New.ToString()), jinfo.GetNewMapAttempts().ToString(
                                                                                                                                                                                                                           )).().Td().A(Url("attempts", jid, "m", MRApps.TaskAttemptStateUI.Running.ToString
                                                                                                                                                                                                                                                ()), jinfo.GetRunningMapAttempts().ToString()).().Td().A(Url("attempts", jid, "m"
                                                                                                                                                                                                                                                                                                             , MRApps.TaskAttemptStateUI.Failed.ToString()), jinfo.GetFailedMapAttempts().ToString
                                                                                                                                                                                                                                                                                                             ()).().Td().A(Url("attempts", jid, "m", MRApps.TaskAttemptStateUI.Killed.ToString
                                                                                                                                                                                                                                                                                                                                   ()), jinfo.GetKilledMapAttempts().ToString()).().Td().A(Url("attempts", jid, "m"
                                                                                                                                                                                                                                                                                                                                                                                               , MRApps.TaskAttemptStateUI.Successful.ToString()), jinfo.GetSuccessfulMapAttempts
                                                                                                                                                                                                                                                                                                                                                                                               ().ToString()).().().Tr(JQueryUI.Even).Th("Reduces").Td().A(Url("attempts", jid,
                                                                                                                                                                                                                                                                                                                                                                                                                                                               "r", MRApps.TaskAttemptStateUI.New.ToString()), jinfo.GetNewReduceAttempts().ToString
                                                                                                                                                                                                                                                                                                                                                                                                                                                               ()).().Td().A(Url("attempts", jid, "r", MRApps.TaskAttemptStateUI.Running.ToString
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     ()), jinfo.GetRunningReduceAttempts().ToString()).().Td().A(Url("attempts", jid,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     "r", MRApps.TaskAttemptStateUI.Failed.ToString()), jinfo.GetFailedReduceAttempts
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     ().ToString()).().Td().A(Url("attempts", jid, "r", MRApps.TaskAttemptStateUI.Killed
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  .ToString()), jinfo.GetKilledReduceAttempts().ToString()).().Td().A(Url("attempts"
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          , jid, "r", MRApps.TaskAttemptStateUI.Successful.ToString()), jinfo.GetSuccessfulReduceAttempts
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          ().ToString()).().().().();
        }