Ejemplo n.º 1
0
            /// <exception cref="System.Exception"/>
            public ContainerReport Run()
            {
                GetContainerReportRequest request = GetContainerReportRequest.NewInstance(cid);

                return(this._enclosing.appBaseProt.GetContainerReport(request).GetContainerReport
                           ());
            }
Ejemplo n.º 2
0
 /// <exception cref="Org.Apache.Hadoop.Yarn.Exceptions.YarnException"/>
 /// <exception cref="System.IO.IOException"/>
 public override ContainerReport GetContainerReport(ContainerId containerId)
 {
     try
     {
         GetContainerReportRequest request = Org.Apache.Hadoop.Yarn.Util.Records.NewRecord
                                             <GetContainerReportRequest>();
         request.SetContainerId(containerId);
         GetContainerReportResponse response = rmClient.GetContainerReport(request);
         return(response.GetContainerReport());
     }
     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) && e.GetType() != typeof(
                 ContainerNotFoundException))
         {
             throw;
         }
         return(historyClient.GetContainerReport(containerId));
     }
 }
Ejemplo n.º 3
0
        public virtual ContainerInfo GetContainer(HttpServletRequest req, HttpServletResponse
                                                  res, string appId, string appAttemptId, string containerId)
        {
            UserGroupInformation callerUGI = GetUser(req);
            ApplicationId        aid       = ParseApplicationId(appId);
            ApplicationAttemptId aaid      = ParseApplicationAttemptId(appAttemptId);
            ContainerId          cid       = ParseContainerId(containerId);

            ValidateIds(aid, aaid, cid);
            ContainerReport container = null;

            try
            {
                if (callerUGI == null)
                {
                    GetContainerReportRequest request = GetContainerReportRequest.NewInstance(cid);
                    container = appBaseProt.GetContainerReport(request).GetContainerReport();
                }
                else
                {
                    container = callerUGI.DoAs(new _PrivilegedExceptionAction_368(this, cid));
                }
            }
            catch (Exception e)
            {
                RewrapAndThrowException(e);
            }
            if (container == null)
            {
                throw new NotFoundException("container with id: " + containerId + " not found");
            }
            return(new ContainerInfo(container));
        }
Ejemplo n.º 4
0
        /// <exception cref="Org.Apache.Hadoop.Yarn.Exceptions.YarnException"/>
        /// <exception cref="System.IO.IOException"/>
        public override ContainerReport GetContainerReport(ContainerId containerId)
        {
            GetContainerReportRequest request = GetContainerReportRequest.NewInstance(containerId
                                                                                      );
            GetContainerReportResponse response = ahsClient.GetContainerReport(request);

            return(response.GetContainerReport());
        }
Ejemplo n.º 5
0
 /// <exception cref="Org.Apache.Hadoop.Yarn.Exceptions.YarnException"/>
 /// <exception cref="System.IO.IOException"/>
 public override GetContainerReportResponse GetContainerReport(GetContainerReportRequest
                                                               request)
 {
     this._enclosing.ResetStartFailoverFlag(true);
     // make sure failover has been triggered
     NUnit.Framework.Assert.IsTrue(this._enclosing.WaittingForFailOver());
     // return fake containerReport
     return(GetContainerReportResponse.NewInstance(this._enclosing.CreateFakeContainerReport
                                                       ()));
 }
 /// <exception cref="Org.Apache.Hadoop.Yarn.Exceptions.YarnException"/>
 /// <exception cref="System.IO.IOException"/>
 public virtual GetContainerReportResponse GetContainerReport(GetContainerReportRequest
                                                              request)
 {
     YarnServiceProtos.GetContainerReportRequestProto requestProto = ((GetContainerReportRequestPBImpl
                                                                       )request).GetProto();
     try
     {
         return(new GetContainerReportResponsePBImpl(proxy.GetContainerReport(null, requestProto
                                                                              )));
     }
     catch (ServiceException e)
     {
         RPCUtil.UnwrapAndThrowException(e);
         return(null);
     }
 }
Ejemplo n.º 7
0
        public virtual void TestContainerReport()
        {
            ApplicationId             appId        = ApplicationId.NewInstance(0, 1);
            ApplicationAttemptId      appAttemptId = ApplicationAttemptId.NewInstance(appId, 1);
            ContainerId               containerId  = ContainerId.NewContainerId(appAttemptId, 1);
            GetContainerReportRequest request      = GetContainerReportRequest.NewInstance(containerId
                                                                                           );
            GetContainerReportResponse response  = clientService.GetContainerReport(request);
            ContainerReport            container = response.GetContainerReport();

            NUnit.Framework.Assert.IsNotNull(container);
            NUnit.Framework.Assert.AreEqual(containerId, container.GetContainerId());
            NUnit.Framework.Assert.AreEqual("http://0.0.0.0:8188/applicationhistory/logs/" +
                                            "test host:100/container_0_0001_01_000001/" + "container_0_0001_01_000001/user1"
                                            , container.GetLogUrl());
        }
        /// <exception cref="Org.Apache.Hadoop.Yarn.Exceptions.YarnException"/>
        /// <exception cref="System.IO.IOException"/>
        public virtual GetContainerReportResponse GetContainerReport(GetContainerReportRequest
                                                                     request)
        {
            ContainerId containerId = request.GetContainerId();

            try
            {
                GetContainerReportResponse response = GetContainerReportResponse.NewInstance(history
                                                                                             .GetContainer(containerId));
                return(response);
            }
            catch (IOException e)
            {
                Log.Error(e.Message, e);
                throw;
            }
        }
Ejemplo n.º 9
0
        public virtual void TestContainerNotFound()
        {
            ApplicationId             appId        = ApplicationId.NewInstance(0, 1);
            ApplicationAttemptId      appAttemptId = ApplicationAttemptId.NewInstance(appId, 1);
            ContainerId               containerId  = ContainerId.NewContainerId(appAttemptId, MaxApps + 1);
            GetContainerReportRequest request      = GetContainerReportRequest.NewInstance(containerId
                                                                                           );

            try
            {
                GetContainerReportResponse response = clientService.GetContainerReport(request);
            }
            catch (ContainerNotFoundException e)
            {
                //This exception is expected
                NUnit.Framework.Assert.IsTrue(e.Message.Contains("doesn't exist in the timeline store"
                                                                 ));
            }
            catch (Exception)
            {
                NUnit.Framework.Assert.Fail("Undesired exception caught");
            }
        }
Ejemplo n.º 10
0
 public _PrivilegedExceptionAction_242(AppBlock _enclosing, GetContainerReportRequest
                                       request)
 {
     this._enclosing = _enclosing;
     this.request    = request;
 }
Ejemplo n.º 11
0
        protected internal virtual void GenerateApplicationTable(HtmlBlock.Block html, UserGroupInformation
                                                                 callerUGI, ICollection <ApplicationAttemptReport> attempts)
        {
            // Application Attempt Table
            Hamlet.TBODY <Hamlet.TABLE <Org.Apache.Hadoop.Yarn.Webapp.Hamlet.Hamlet> > tbody = html
                                                                                               .Table("#attempts").Thead().Tr().Th(".id", "Attempt ID").Th(".started", "Started"
                                                                                                                                                           ).Th(".node", "Node").Th(".logs", "Logs").().().Tbody();
            StringBuilder attemptsTableData = new StringBuilder("[\n");

            foreach (ApplicationAttemptReport appAttemptReport in attempts)
            {
                AppAttemptInfo  appAttempt = new AppAttemptInfo(appAttemptReport);
                ContainerReport containerReport;
                try
                {
                    GetContainerReportRequest request = GetContainerReportRequest.NewInstance(appAttemptReport
                                                                                              .GetAMContainerId());
                    if (callerUGI == null)
                    {
                        containerReport = appBaseProt.GetContainerReport(request).GetContainerReport();
                    }
                    else
                    {
                        containerReport = callerUGI.DoAs(new _PrivilegedExceptionAction_242(this, request
                                                                                            ));
                    }
                }
                catch (Exception e)
                {
                    string message = "Failed to read the AM container of the application attempt " +
                                     appAttemptReport.GetApplicationAttemptId() + ".";
                    Log.Error(message, e);
                    html.P().(message).();
                    return;
                }
                long   startTime = 0L;
                string logsLink  = null;
                string nodeLink  = null;
                if (containerReport != null)
                {
                    ContainerInfo container = new ContainerInfo(containerReport);
                    startTime = container.GetStartedTime();
                    logsLink  = containerReport.GetLogUrl();
                    nodeLink  = containerReport.GetNodeHttpAddress();
                }
                attemptsTableData.Append("[\"<a href='").Append(Url("appattempt", appAttempt.GetAppAttemptId
                                                                        ())).Append("'>").Append(appAttempt.GetAppAttemptId()).Append("</a>\",\"").Append
                    (startTime).Append("\",\"<a ").Append(nodeLink == null ? "#" : "href='" + nodeLink
                                                          ).Append("'>").Append(nodeLink == null ? "N/A" : StringEscapeUtils.EscapeJavaScript
                                                                                    (StringEscapeUtils.EscapeHtml(nodeLink))).Append("</a>\",\"<a ").Append(logsLink
                                                                                                                                                            == null ? "#" : "href='" + logsLink).Append("'>").Append(logsLink == null ? "N/A"
                                         : "Logs").Append("</a>\"],\n");
            }
            if (attemptsTableData[attemptsTableData.Length - 2] == ',')
            {
                attemptsTableData.Delete(attemptsTableData.Length - 2, attemptsTableData.Length -
                                         1);
            }
            attemptsTableData.Append("]");
            html.Script().$type("text/javascript").("var attemptsTableData=" + attemptsTableData
                                                    ).();
            tbody.().();
        }
Ejemplo n.º 12
0
        protected override void Render(HtmlBlock.Block html)
        {
            string containerid = $(YarnWebParams.ContainerId);

            if (containerid.IsEmpty())
            {
                Puts("Bad request: requires container ID");
                return;
            }
            ContainerId containerId = null;

            try
            {
                containerId = ConverterUtils.ToContainerId(containerid);
            }
            catch (ArgumentException)
            {
                Puts("Invalid container ID: " + containerid);
                return;
            }
            UserGroupInformation callerUGI       = GetCallerUGI();
            ContainerReport      containerReport = null;

            try
            {
                GetContainerReportRequest request = GetContainerReportRequest.NewInstance(containerId
                                                                                          );
                if (callerUGI == null)
                {
                    containerReport = appBaseProt.GetContainerReport(request).GetContainerReport();
                }
                else
                {
                    containerReport = callerUGI.DoAs(new _PrivilegedExceptionAction_78(this, request)
                                                     );
                }
            }
            catch (Exception e)
            {
                string message = "Failed to read the container " + containerid + ".";
                Log.Error(message, e);
                html.P().(message).();
                return;
            }
            if (containerReport == null)
            {
                Puts("Container not found: " + containerid);
                return;
            }
            ContainerInfo container = new ContainerInfo(containerReport);

            SetTitle(StringHelper.Join("Container ", containerid));
            Info("Container Overview").("Container State:", container.GetContainerState() ==
                                        null ? Unavailable : container.GetContainerState()).("Exit Status:", container.GetContainerExitStatus
                                                                                                 ()).("Node:", container.GetNodeHttpAddress() == null ? "#" : container.GetNodeHttpAddress
                                                                                                          (), container.GetNodeHttpAddress() == null ? "N/A" : container.GetNodeHttpAddress
                                                                                                          ()).("Priority:", container.GetPriority()).("Started:", Times.Format(container.GetStartedTime
                                                                                                                                                                                   ())).("Elapsed:", StringUtils.FormatTime(Times.Elapsed(container.GetStartedTime(
                                                                                                                                                                                                                                              ), container.GetFinishedTime()))).("Resource:", container.GetAllocatedMB() + " Memory, "
                                                                                                                                                                                                                                                                                 + container.GetAllocatedVCores() + " VCores").("Logs:", container.GetLogUrl() ==
                                                                                                                                                                                                                                                                                                                                null ? "#" : container.GetLogUrl(), container.GetLogUrl() == null ? "N/A" : "Logs"
                                                                                                                                                                                                                                                                                                                                ).("Diagnostics:", container.GetDiagnosticsInfo() == null ? string.Empty : container
                                                                                                                                                                                                                                                                                                                                   .GetDiagnosticsInfo());
            html.(typeof(InfoBlock));
        }
Ejemplo n.º 13
0
 /// <exception cref="Org.Apache.Hadoop.Yarn.Exceptions.YarnException"/>
 /// <exception cref="System.IO.IOException"/>
 public virtual GetContainerReportResponse GetContainerReport(GetContainerReportRequest
                                                              request)
 {
     return(null);
 }