示例#1
0
 /// <exception cref="Org.Apache.Hadoop.Yarn.Exceptions.YarnException"/>
 /// <exception cref="System.IO.IOException"/>
 public override ApplicationAttemptReport GetApplicationAttemptReport(ApplicationAttemptId
                                                                      appAttemptId)
 {
     try
     {
         GetApplicationAttemptReportRequest request = Org.Apache.Hadoop.Yarn.Util.Records.
                                                      NewRecord <GetApplicationAttemptReportRequest>();
         request.SetApplicationAttemptId(appAttemptId);
         GetApplicationAttemptReportResponse response = rmClient.GetApplicationAttemptReport
                                                            (request);
         return(response.GetApplicationAttemptReport());
     }
     catch (YarnException e)
     {
         if (!historyServiceEnabled)
         {
             // Just throw it as usual if historyService is not enabled.
             throw;
         }
         // Even if history-service is enabled, treat all exceptions still the same
         // except the following
         if (e.GetType() != typeof(ApplicationNotFoundException))
         {
             throw;
         }
         return(historyClient.GetApplicationAttemptReport(appAttemptId));
     }
 }
示例#2
0
        public virtual AppAttemptInfo GetAppAttempt(HttpServletRequest req, HttpServletResponse
                                                    res, string appId, string appAttemptId)
        {
            UserGroupInformation callerUGI = GetUser(req);
            ApplicationId        aid       = ParseApplicationId(appId);
            ApplicationAttemptId aaid      = ParseApplicationAttemptId(appAttemptId);

            ValidateIds(aid, aaid, null);
            ApplicationAttemptReport appAttempt = null;

            try
            {
                if (callerUGI == null)
                {
                    GetApplicationAttemptReportRequest request = GetApplicationAttemptReportRequest.NewInstance
                                                                     (aaid);
                    appAttempt = appBaseProt.GetApplicationAttemptReport(request).GetApplicationAttemptReport
                                     ();
                }
                else
                {
                    appAttempt = callerUGI.DoAs(new _PrivilegedExceptionAction_298(this, aaid));
                }
            }
            catch (Exception e)
            {
                RewrapAndThrowException(e);
            }
            if (appAttempt == null)
            {
                throw new NotFoundException("app attempt with id: " + appAttemptId + " not found"
                                            );
            }
            return(new AppAttemptInfo(appAttempt));
        }
示例#3
0
        public virtual void TestApplicationAttemptNotFound()
        {
            ApplicationId        appId        = ApplicationId.NewInstance(0, 1);
            ApplicationAttemptId appAttemptId = ApplicationAttemptId.NewInstance(appId, MaxApps
                                                                                 + 1);
            GetApplicationAttemptReportRequest request = GetApplicationAttemptReportRequest.NewInstance
                                                             (appAttemptId);

            try
            {
                GetApplicationAttemptReportResponse response = clientService.GetApplicationAttemptReport
                                                                   (request);
                NUnit.Framework.Assert.Fail("Exception should have been thrown before we reach here."
                                            );
            }
            catch (ApplicationAttemptNotFoundException e)
            {
                //This Exception is expected
                System.Console.Out.WriteLine(e.Message);
                NUnit.Framework.Assert.IsTrue(e.Message.Contains("doesn't exist in the timeline store"
                                                                 ));
            }
            catch (Exception)
            {
                NUnit.Framework.Assert.Fail("Undesired exception caught");
            }
        }
示例#4
0
            /// <exception cref="System.Exception"/>
            public ApplicationAttemptReport Run()
            {
                GetApplicationAttemptReportRequest request = GetApplicationAttemptReportRequest.NewInstance
                                                                 (aaid);

                return(this._enclosing.appBaseProt.GetApplicationAttemptReport(request).GetApplicationAttemptReport
                           ());
            }
示例#5
0
        /// <exception cref="Org.Apache.Hadoop.Yarn.Exceptions.YarnException"/>
        /// <exception cref="System.IO.IOException"/>
        public override ApplicationAttemptReport GetApplicationAttemptReport(ApplicationAttemptId
                                                                             applicationAttemptId)
        {
            GetApplicationAttemptReportRequest request = GetApplicationAttemptReportRequest.NewInstance
                                                             (applicationAttemptId);
            GetApplicationAttemptReportResponse response = ahsClient.GetApplicationAttemptReport
                                                               (request);

            return(response.GetApplicationAttemptReport());
        }
示例#6
0
        public virtual void TestApplicationAttemptReport()
        {
            ApplicationId        appId                 = ApplicationId.NewInstance(0, 1);
            ApplicationAttemptId appAttemptId          = ApplicationAttemptId.NewInstance(appId, 1);
            GetApplicationAttemptReportRequest request = GetApplicationAttemptReportRequest.NewInstance
                                                             (appAttemptId);
            GetApplicationAttemptReportResponse response = clientService.GetApplicationAttemptReport
                                                               (request);
            ApplicationAttemptReport attemptReport = response.GetApplicationAttemptReport();

            NUnit.Framework.Assert.IsNotNull(attemptReport);
            NUnit.Framework.Assert.AreEqual("appattempt_0_0001_000001", attemptReport.GetApplicationAttemptId
                                                ().ToString());
        }
 /// <exception cref="Org.Apache.Hadoop.Yarn.Exceptions.YarnException"/>
 /// <exception cref="System.IO.IOException"/>
 public virtual GetApplicationAttemptReportResponse GetApplicationAttemptReport(GetApplicationAttemptReportRequest
                                                                                request)
 {
     YarnServiceProtos.GetApplicationAttemptReportRequestProto requestProto = ((GetApplicationAttemptReportRequestPBImpl
                                                                                )request).GetProto();
     try
     {
         return(new GetApplicationAttemptReportResponsePBImpl(proxy.GetApplicationAttemptReport
                                                                  (null, requestProto)));
     }
     catch (ServiceException e)
     {
         RPCUtil.UnwrapAndThrowException(e);
         return(null);
     }
 }
        /// <exception cref="Org.Apache.Hadoop.Yarn.Exceptions.YarnException"/>
        /// <exception cref="System.IO.IOException"/>
        public virtual GetApplicationAttemptReportResponse GetApplicationAttemptReport(GetApplicationAttemptReportRequest
                                                                                       request)
        {
            ApplicationAttemptId appAttemptId = request.GetApplicationAttemptId();

            try
            {
                GetApplicationAttemptReportResponse response = GetApplicationAttemptReportResponse
                                                               .NewInstance(history.GetApplicationAttempt(appAttemptId));
                return(response);
            }
            catch (IOException e)
            {
                Log.Error(e.Message, e);
                throw;
            }
        }
示例#9
0
 /// <exception cref="Org.Apache.Hadoop.Yarn.Exceptions.YarnException"/>
 /// <exception cref="System.IO.IOException"/>
 public override GetApplicationAttemptReportResponse GetApplicationAttemptReport(GetApplicationAttemptReportRequest
                                                                                 request)
 {
     this._enclosing.ResetStartFailoverFlag(true);
     // make sure failover has been triggered
     NUnit.Framework.Assert.IsTrue(this._enclosing.WaittingForFailOver());
     // return fake ApplicationAttemptReport
     return(GetApplicationAttemptReportResponse.NewInstance(this._enclosing.CreateFakeApplicationAttemptReport
                                                                ()));
 }
示例#10
0
        protected override void Render(HtmlBlock.Block html)
        {
            string attemptid = $(YarnWebParams.ApplicationAttemptId);

            if (attemptid.IsEmpty())
            {
                Puts("Bad request: requires application attempt ID");
                return;
            }
            try
            {
                appAttemptId = ConverterUtils.ToApplicationAttemptId(attemptid);
            }
            catch (ArgumentException)
            {
                Puts("Invalid application attempt ID: " + attemptid);
                return;
            }
            UserGroupInformation     callerUGI = GetCallerUGI();
            ApplicationAttemptReport appAttemptReport;

            try
            {
                GetApplicationAttemptReportRequest request = GetApplicationAttemptReportRequest.NewInstance
                                                                 (appAttemptId);
                if (callerUGI == null)
                {
                    appAttemptReport = appBaseProt.GetApplicationAttemptReport(request).GetApplicationAttemptReport
                                           ();
                }
                else
                {
                    appAttemptReport = callerUGI.DoAs(new _PrivilegedExceptionAction_85(this, request
                                                                                        ));
                }
            }
            catch (Exception e)
            {
                string message = "Failed to read the application attempt " + appAttemptId + ".";
                Log.Error(message, e);
                html.P().(message).();
                return;
            }
            if (appAttemptReport == null)
            {
                Puts("Application Attempt not found: " + attemptid);
                return;
            }
            bool exceptionWhenGetContainerReports    = false;
            ICollection <ContainerReport> containers = null;

            try
            {
                GetContainersRequest request = GetContainersRequest.NewInstance(appAttemptId);
                if (callerUGI == null)
                {
                    containers = appBaseProt.GetContainers(request).GetContainerList();
                }
                else
                {
                    containers = callerUGI.DoAs(new _PrivilegedExceptionAction_115(this, request));
                }
            }
            catch (RuntimeException)
            {
                // have this block to suppress the findbugs warning
                exceptionWhenGetContainerReports = true;
            }
            catch (Exception)
            {
                exceptionWhenGetContainerReports = true;
            }
            AppAttemptInfo appAttempt = new AppAttemptInfo(appAttemptReport);

            SetTitle(StringHelper.Join("Application Attempt ", attemptid));
            string node = "N/A";

            if (appAttempt.GetHost() != null && appAttempt.GetRpcPort() >= 0 && appAttempt.GetRpcPort
                    () < 65536)
            {
                node = appAttempt.GetHost() + ":" + appAttempt.GetRpcPort();
            }
            GenerateOverview(appAttemptReport, containers, appAttempt, node);
            if (exceptionWhenGetContainerReports)
            {
                html.P().("Sorry, Failed to get containers for application attempt" + attemptid +
                          ".").();
                return;
            }
            CreateAttemptHeadRoomTable(html);
            html.(typeof(InfoBlock));
            CreateTablesForAttemptMetrics(html);
            // Container Table
            Hamlet.TBODY <Hamlet.TABLE <Org.Apache.Hadoop.Yarn.Webapp.Hamlet.Hamlet> > tbody = html
                                                                                               .Table("#containers").Thead().Tr().Th(".id", "Container ID").Th(".node", "Node")
                                                                                               .Th(".exitstatus", "Container Exit Status").Th(".logs", "Logs").().().Tbody();
            StringBuilder containersTableData = new StringBuilder("[\n");

            foreach (ContainerReport containerReport in containers)
            {
                ContainerInfo container = new ContainerInfo(containerReport);
                containersTableData.Append("[\"<a href='").Append(Url("container", container.GetContainerId
                                                                          ())).Append("'>").Append(container.GetContainerId()).Append("</a>\",\"<a ").Append
                    (container.GetNodeHttpAddress() == null ? "#" : "href='" + container.GetNodeHttpAddress
                        ()).Append("'>").Append(container.GetNodeHttpAddress() == null ? "N/A" : StringEscapeUtils
                                                .EscapeJavaScript(StringEscapeUtils.EscapeHtml(container.GetNodeHttpAddress())))
                .Append("</a>\",\"").Append(container.GetContainerExitStatus()).Append("\",\"<a href='"
                                                                                       ).Append(container.GetLogUrl() == null ? "#" : container.GetLogUrl()).Append("'>"
                                                                                                                                                                    ).Append(container.GetLogUrl() == null ? "N/A" : "Logs").Append("</a>\"],\n");
            }
            if (containersTableData[containersTableData.Length - 2] == ',')
            {
                containersTableData.Delete(containersTableData.Length - 2, containersTableData.Length
                                           - 1);
            }
            containersTableData.Append("]");
            html.Script().$type("text/javascript").("var containersTableData=" + containersTableData
                                                    ).();
            tbody.().();
        }
示例#11
0
 public _PrivilegedExceptionAction_85(AppAttemptBlock _enclosing, GetApplicationAttemptReportRequest
                                      request)
 {
     this._enclosing = _enclosing;
     this.request    = request;
 }
示例#12
0
 /// <exception cref="Org.Apache.Hadoop.Yarn.Exceptions.YarnException"/>
 /// <exception cref="System.IO.IOException"/>
 public virtual GetApplicationAttemptReportResponse GetApplicationAttemptReport(GetApplicationAttemptReportRequest
                                                                                request)
 {
     return(null);
 }