Ejemplo n.º 1
0
        public AMAttemptInfo(AMInfo amInfo, string jobId, string user, string host, string
                             pathPrefix)
        {
            this.nodeHttpAddress = string.Empty;
            this.nodeId          = string.Empty;
            string nmHost     = amInfo.GetNodeManagerHost();
            int    nmHttpPort = amInfo.GetNodeManagerHttpPort();
            int    nmPort     = amInfo.GetNodeManagerPort();

            if (nmHost != null)
            {
                this.nodeHttpAddress = nmHost + ":" + nmHttpPort;
                NodeId nodeId = NodeId.NewInstance(nmHost, nmPort);
                this.nodeId = nodeId.ToString();
            }
            this.id            = amInfo.GetAppAttemptId().GetAttemptId();
            this.startTime     = amInfo.GetStartTime();
            this.containerId   = string.Empty;
            this.logsLink      = string.Empty;
            this.shortLogsLink = string.Empty;
            ContainerId containerId = amInfo.GetContainerId();

            if (containerId != null)
            {
                this.containerId = containerId.ToString();
                this.logsLink    = StringHelper.Join(host, pathPrefix, StringHelper.Ujoin("logs", this
                                                                                          .nodeId, this.containerId, jobId, user));
                this.shortLogsLink = StringHelper.Ujoin("logs", this.nodeId, this.containerId, jobId
                                                        , user);
            }
        }
Ejemplo n.º 2
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"
                                                                                                                              ).().().();
        }
Ejemplo n.º 3
0
        public AMAttemptInfo(AMInfo amInfo, string jobId, string user)
        {
            this.nodeHttpAddress = string.Empty;
            this.nodeId          = string.Empty;
            string nmHost     = amInfo.GetNodeManagerHost();
            int    nmHttpPort = amInfo.GetNodeManagerHttpPort();
            int    nmPort     = amInfo.GetNodeManagerPort();

            if (nmHost != null)
            {
                this.nodeHttpAddress = nmHost + ":" + nmHttpPort;
                NodeId nodeId = NodeId.NewInstance(nmHost, nmPort);
                this.nodeId = nodeId.ToString();
            }
            this.id          = amInfo.GetAppAttemptId().GetAttemptId();
            this.startTime   = amInfo.GetStartTime();
            this.containerId = string.Empty;
            this.logsLink    = string.Empty;
            ContainerId containerId = amInfo.GetContainerId();

            if (containerId != null)
            {
                this.containerId = containerId.ToString();
                this.logsLink    = StringHelper.Join(MRWebAppUtil.GetYARNWebappScheme() + nodeHttpAddress
                                                     , StringHelper.Ujoin("node", "containerlogs", this.containerId, user));
            }
        }
Ejemplo n.º 4
0
        // pass
        private void VerifyJobReport(JobReport jr)
        {
            NUnit.Framework.Assert.IsNotNull("JobReport is null", jr);
            IList <AMInfo> amInfos = jr.GetAMInfos();

            NUnit.Framework.Assert.AreEqual(1, amInfos.Count);
            NUnit.Framework.Assert.AreEqual(JobState.Running, jr.GetJobState());
            AMInfo amInfo = amInfos[0];

            NUnit.Framework.Assert.AreEqual(MRApp.NmHost, amInfo.GetNodeManagerHost());
            NUnit.Framework.Assert.AreEqual(MRApp.NmPort, amInfo.GetNodeManagerPort());
            NUnit.Framework.Assert.AreEqual(MRApp.NmHttpPort, amInfo.GetNodeManagerHttpPort()
                                            );
            NUnit.Framework.Assert.AreEqual(1, amInfo.GetAppAttemptId().GetAttemptId());
            NUnit.Framework.Assert.AreEqual(1, amInfo.GetContainerId().GetApplicationAttemptId
                                                ().GetAttemptId());
            NUnit.Framework.Assert.IsTrue(amInfo.GetStartTime() > 0);
            NUnit.Framework.Assert.AreEqual(false, jr.IsUber());
        }
Ejemplo n.º 5
0
        /// <exception cref="System.IO.IOException"/>
        public virtual LogParams GetLogFilePath(JobID oldJobID, TaskAttemptID oldTaskAttemptID
                                                )
        {
            JobId jobId = TypeConverter.ToYarn(oldJobID);
            GetJobReportRequest request = recordFactory.NewRecordInstance <GetJobReportRequest
                                                                           >();

            request.SetJobId(jobId);
            JobReport report = ((GetJobReportResponse)Invoke("getJobReport", typeof(GetJobReportRequest
                                                                                    ), request)).GetJobReport();

            if (EnumSet.Of(JobState.Succeeded, JobState.Failed, JobState.Killed, JobState.Error
                           ).Contains(report.GetJobState()))
            {
                if (oldTaskAttemptID != null)
                {
                    GetTaskAttemptReportRequest taRequest = recordFactory.NewRecordInstance <GetTaskAttemptReportRequest
                                                                                             >();
                    taRequest.SetTaskAttemptId(TypeConverter.ToYarn(oldTaskAttemptID));
                    TaskAttemptReport taReport = ((GetTaskAttemptReportResponse)Invoke("getTaskAttemptReport"
                                                                                       , typeof(GetTaskAttemptReportRequest), taRequest)).GetTaskAttemptReport();
                    if (taReport.GetContainerId() == null || taReport.GetNodeManagerHost() == null)
                    {
                        throw new IOException("Unable to get log information for task: " + oldTaskAttemptID
                                              );
                    }
                    return(new LogParams(taReport.GetContainerId().ToString(), taReport.GetContainerId
                                             ().GetApplicationAttemptId().GetApplicationId().ToString(), NodeId.NewInstance(taReport
                                                                                                                            .GetNodeManagerHost(), taReport.GetNodeManagerPort()).ToString(), report.GetUser
                                             ()));
                }
                else
                {
                    if (report.GetAMInfos() == null || report.GetAMInfos().Count == 0)
                    {
                        throw new IOException("Unable to get log information for job: " + oldJobID);
                    }
                    AMInfo amInfo = report.GetAMInfos()[report.GetAMInfos().Count - 1];
                    return(new LogParams(amInfo.GetContainerId().ToString(), amInfo.GetAppAttemptId()
                                         .GetApplicationId().ToString(), NodeId.NewInstance(amInfo.GetNodeManagerHost(),
                                                                                            amInfo.GetNodeManagerPort()).ToString(), report.GetUser()));
                }
            }
            else
            {
                throw new IOException("Cannot get log path for a in-progress job");
            }
        }