Esempio n. 1
0
        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"
                                                                                                                              ).().().();
        }
Esempio n. 2
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.();
        }
Esempio n. 3
0
            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));
            }
Esempio n. 4
0
        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.();
                }
            }
        }
Esempio 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)
 {
     Hamlet.DIV <Org.Apache.Hadoop.Yarn.Webapp.Hamlet.Hamlet> nav = html.Div("#nav").H3
                                                                        ("Application").Ul().Li().A(Url("about"), "About").().Li().A(Url("app"), "Jobs")
                                                                    .().();
     if (app.GetJob() != null)
     {
         string jobid = MRApps.ToString(app.GetJob().GetID());
         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"
                                                                                                                                                                                                                 ).().();
         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"
                                                                                                                       ).().().();
 }
Esempio n. 6
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.();
        }
Esempio n. 7
0
        protected override void CreateApplicationMetricsTable(HtmlBlock.Block html)
        {
            RMApp        rmApp      = this.rm.GetRMContext().GetRMApps()[appID];
            RMAppMetrics appMetrics = rmApp == null ? null : rmApp.GetRMAppMetrics();
            // Get attempt metrics and fields, it is possible currentAttempt of RMApp is
            // null. In that case, we will assume resource preempted and number of Non
            // AM container preempted on that attempt is 0
            RMAppAttemptMetrics attemptMetrics;

            if (rmApp == null || null == rmApp.GetCurrentAppAttempt())
            {
                attemptMetrics = null;
            }
            else
            {
                attemptMetrics = rmApp.GetCurrentAppAttempt().GetRMAppAttemptMetrics();
            }
            Org.Apache.Hadoop.Yarn.Api.Records.Resource attemptResourcePreempted = attemptMetrics
                                                                                   == null?Resources.None() : attemptMetrics.GetResourcePreempted();

            int attemptNumNonAMContainerPreempted = attemptMetrics == null ? 0 : attemptMetrics
                                                    .GetNumNonAMContainersPreempted();

            Hamlet.DIV <Org.Apache.Hadoop.Yarn.Webapp.Hamlet.Hamlet> pdiv = html.(typeof(InfoBlock
                                                                                         )).Div(JQueryUI.InfoWrap);
            Info("Application Overview").Clear();
            Info("Application Metrics").("Total Resource Preempted:", appMetrics == null ? "N/A"
                                 : appMetrics.GetResourcePreempted()).("Total Number of Non-AM Containers Preempted:"
                                                                       , appMetrics == null ? "N/A" : appMetrics.GetNumNonAMContainersPreempted()).("Total Number of AM Containers Preempted:"
                                                                                                                                                    , appMetrics == null ? "N/A" : appMetrics.GetNumAMContainersPreempted()).("Resource Preempted from Current Attempt:"
                                                                                                                                                                                                                              , attemptResourcePreempted).("Number of Non-AM Containers Preempted from Current Attempt:"
                                                                                                                                                                                                                                                           , attemptNumNonAMContainerPreempted).("Aggregate Resource Allocation:", string.Format
                                                                                                                                                                                                                                                                                                     ("%d MB-seconds, %d vcore-seconds", appMetrics == null ? "N/A" : appMetrics.GetMemorySeconds
                                                                                                                                                                                                                                                                                                         (), appMetrics == null ? "N/A" : appMetrics.GetVcoreSeconds()));
            pdiv.();
        }
Esempio n. 8
0
        protected override void Render(HtmlBlock.Block html)
        {
            //Yes this is a hack, but there is no other way to insert
            //CSS in the correct spot
            html.Style(".metrics {margin-bottom:5px}");
            ClusterMetricsInfo clusterMetrics = new ClusterMetricsInfo(this.rm);

            Hamlet.DIV <Org.Apache.Hadoop.Yarn.Webapp.Hamlet.Hamlet> div = html.Div().$class("metrics"
                                                                                             );
            div.H3("Cluster Metrics").Table("#metricsoverview").Thead().$class("ui-widget-header"
                                                                               ).Tr().Th().$class("ui-state-default").("Apps Submitted").().Th().$class("ui-state-default"
                                                                                                                                                        ).("Apps Pending").().Th().$class("ui-state-default").("Apps Running").().Th().$class
                ("ui-state-default").("Apps Completed").().Th().$class("ui-state-default").("Containers Running"
                                                                                            ).().Th().$class("ui-state-default").("Memory Used").().Th().$class("ui-state-default"
                                                                                                                                                                ).("Memory Total").().Th().$class("ui-state-default").("Memory Reserved").().Th(
                ).$class("ui-state-default").("VCores Used").().Th().$class("ui-state-default").
            ("VCores Total").().Th().$class("ui-state-default").("VCores Reserved").().Th().
            $class("ui-state-default").("Active Nodes").().Th().$class("ui-state-default").(
                "Decommissioned Nodes").().Th().$class("ui-state-default").("Lost Nodes").().Th(
                ).$class("ui-state-default").("Unhealthy Nodes").().Th().$class("ui-state-default"
                                                                                ).("Rebooted Nodes").().().().Tbody().$class("ui-widget-content").Tr().Td(clusterMetrics
                                                                                                                                                          .GetAppsSubmitted().ToString()).Td(clusterMetrics.GetAppsPending().ToString()).Td
                (clusterMetrics.GetAppsRunning().ToString()).Td((clusterMetrics.GetAppsCompleted
                                                                     () + clusterMetrics.GetAppsFailed() + clusterMetrics.GetAppsKilled()).ToString()
                                                                ).Td(clusterMetrics.GetContainersAllocated().ToString()).Td(StringUtils.ByteDesc
                                                                                                                                (clusterMetrics.GetAllocatedMB() * BytesInMb)).Td(StringUtils.ByteDesc(clusterMetrics
                                                                                                                                                                                                       .GetTotalMB() * BytesInMb)).Td(StringUtils.ByteDesc(clusterMetrics.GetReservedMB
                                                                                                                                                                                                                                                               () * BytesInMb)).Td(clusterMetrics.GetAllocatedVirtualCores().ToString()).Td(clusterMetrics
                                                                                                                                                                                                                                                                                                                                            .GetTotalVirtualCores().ToString()).Td(clusterMetrics.GetReservedVirtualCores().
                                                                                                                                                                                                                                                                                                                                                                                   ToString()).Td().A(Url("nodes"), clusterMetrics.GetActiveNodes().ToString()).().
            Td().A(Url("nodes/decommissioned"), clusterMetrics.GetDecommissionedNodes().ToString
                       ()).().Td().A(Url("nodes/lost"), clusterMetrics.GetLostNodes().ToString()).().Td
                ().A(Url("nodes/unhealthy"), clusterMetrics.GetUnhealthyNodes().ToString()).().Td
                ().A(Url("nodes/rebooted"), clusterMetrics.GetRebootedNodes().ToString()).().().
            ().();
            string user = Request().GetRemoteUser();

            if (user != null)
            {
                UserMetricsInfo userMetrics = new UserMetricsInfo(this.rm, user);
                if (userMetrics.MetricsAvailable())
                {
                    div.H3("User Metrics for " + user).Table("#usermetricsoverview").Thead().$class("ui-widget-header"
                                                                                                    ).Tr().Th().$class("ui-state-default").("Apps Submitted").().Th().$class("ui-state-default"
                                                                                                                                                                             ).("Apps Pending").().Th().$class("ui-state-default").("Apps Running").().Th().$class
                        ("ui-state-default").("Apps Completed").().Th().$class("ui-state-default").("Containers Running"
                                                                                                    ).().Th().$class("ui-state-default").("Containers Pending").().Th().$class("ui-state-default"
                                                                                                                                                                               ).("Containers Reserved").().Th().$class("ui-state-default").("Memory Used").().
                    Th().$class("ui-state-default").("Memory Pending").().Th().$class("ui-state-default"
                                                                                      ).("Memory Reserved").().Th().$class("ui-state-default").("VCores Used").().Th()
                    .$class("ui-state-default").("VCores Pending").().Th().$class("ui-state-default"
                                                                                  ).("VCores Reserved").().().().Tbody().$class("ui-widget-content").Tr().Td(userMetrics
                                                                                                                                                             .GetAppsSubmitted().ToString()).Td(userMetrics.GetAppsPending().ToString()).Td(userMetrics
                                                                                                                                                                                                                                            .GetAppsRunning().ToString()).Td((userMetrics.GetAppsCompleted() + userMetrics.GetAppsFailed
                                                                                                                                                                                                                                                                                  () + userMetrics.GetAppsKilled()).ToString()).Td(userMetrics.GetRunningContainers
                                                                                                                                                                                                                                                                                                                                       ().ToString()).Td(userMetrics.GetPendingContainers().ToString()).Td(userMetrics.
                                                                                                                                                                                                                                                                                                                                                                                                           GetReservedContainers().ToString()).Td(StringUtils.ByteDesc(userMetrics.GetAllocatedMB
                                                                                                                                                                                                                                                                                                                                                                                                                                                                           () * BytesInMb)).Td(StringUtils.ByteDesc(userMetrics.GetPendingMB() * BytesInMb)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ).Td(StringUtils.ByteDesc(userMetrics.GetReservedMB() * BytesInMb)).Td(userMetrics
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      .GetAllocatedVirtualCores().ToString()).Td(userMetrics.GetPendingVirtualCores().
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 ToString()).Td(userMetrics.GetReservedVirtualCores().ToString()).().().();
                }
            }
            SchedulerInfo schedulerInfo = new SchedulerInfo(this.rm);

            div.H3("Scheduler Metrics").Table("#schedulermetricsoverview").Thead().$class("ui-widget-header"
                                                                                          ).Tr().Th().$class("ui-state-default").("Scheduler Type").().Th().$class("ui-state-default"
                                                                                                                                                                   ).("Scheduling Resource Type").().Th().$class("ui-state-default").("Minimum Allocation"
                                                                                                                                                                                                                                      ).().Th().$class("ui-state-default").("Maximum Allocation").().().().Tbody().$class
                ("ui-widget-content").Tr().Td(schedulerInfo.GetSchedulerType().ToString()).Td(schedulerInfo
                                                                                              .GetSchedulerResourceTypes().ToString()).Td(schedulerInfo.GetMinAllocation().ToString
                                                                                                                                              ()).Td(schedulerInfo.GetMaxAllocation().ToString()).().().();
            div.();
        }
Esempio n. 9
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()).().().().();
        }
Esempio n. 10
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()).().().().();
        }