Exemplo n.º 1
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));
     }
 }
Exemplo n.º 2
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());
        }
Exemplo n.º 3
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
                                                       ()));
 }
Exemplo n.º 4
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;
            }
        }
        /// <exception cref="Com.Google.Protobuf.ServiceException"/>
        public virtual YarnServiceProtos.GetContainerReportResponseProto GetContainerReport
            (RpcController controller, YarnServiceProtos.GetContainerReportRequestProto proto
            )
        {
            GetContainerReportRequestPBImpl request = new GetContainerReportRequestPBImpl(proto
                                                                                          );

            try
            {
                GetContainerReportResponse response = real.GetContainerReport(request);
                return(((GetContainerReportResponsePBImpl)response).GetProto());
            }
            catch (YarnException e)
            {
                throw new ServiceException(e);
            }
            catch (IOException e)
            {
                throw new ServiceException(e);
            }
        }
Exemplo n.º 7
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");
            }
        }