Example #1
0
        public virtual void TestApplications()
        {
            ApplicationId appId = null;

            appId = ApplicationId.NewInstance(0, 1);
            ApplicationId             appId1    = ApplicationId.NewInstance(0, 2);
            GetApplicationsRequest    request   = GetApplicationsRequest.NewInstance();
            GetApplicationsResponse   response  = clientService.GetApplications(request);
            IList <ApplicationReport> appReport = response.GetApplicationList();

            NUnit.Framework.Assert.IsNotNull(appReport);
            NUnit.Framework.Assert.AreEqual(appId, appReport[1].GetApplicationId());
            NUnit.Framework.Assert.AreEqual(appId1, appReport[0].GetApplicationId());
            // Create a historyManager, and set the max_apps can be loaded
            // as 1.
            Configuration conf = new YarnConfiguration();

            conf.SetLong(YarnConfiguration.ApplicationHistoryMaxApps, 1);
            ApplicationHistoryManagerOnTimelineStore historyManager2 = new ApplicationHistoryManagerOnTimelineStore
                                                                           (dataManager, new ApplicationACLsManager(conf));

            historyManager2.Init(conf);
            historyManager2.Start();
            ApplicationHistoryClientService clientService2 = new ApplicationHistoryClientService
                                                                 (historyManager2);

            response  = clientService2.GetApplications(request);
            appReport = response.GetApplicationList();
            NUnit.Framework.Assert.IsNotNull(appReport);
            NUnit.Framework.Assert.IsTrue(appReport.Count == 1);
            // Expected to get the appReport for application with appId1
            NUnit.Framework.Assert.AreEqual(appId1, appReport[0].GetApplicationId());
        }
        // simple test init/start/stop ApplicationHistoryServer. Status should change.
        /// <exception cref="System.Exception"/>
        public virtual void TestStartStopServer()
        {
            ApplicationHistoryServer historyServer = new ApplicationHistoryServer();
            Configuration            config        = new YarnConfiguration();

            config.SetClass(YarnConfiguration.TimelineServiceStore, typeof(MemoryTimelineStore
                                                                           ), typeof(TimelineStore));
            config.SetClass(YarnConfiguration.TimelineServiceStateStoreClass, typeof(MemoryTimelineStateStore
                                                                                     ), typeof(TimelineStateStore));
            config.Set(YarnConfiguration.TimelineServiceWebappAddress, "localhost:0");
            try
            {
                try
                {
                    historyServer.Init(config);
                    config.SetInt(YarnConfiguration.TimelineServiceHandlerThreadCount, 0);
                    historyServer.Start();
                    NUnit.Framework.Assert.Fail();
                }
                catch (ArgumentException e)
                {
                    NUnit.Framework.Assert.IsTrue(e.Message.Contains(YarnConfiguration.TimelineServiceHandlerThreadCount
                                                                     ));
                }
                config.SetInt(YarnConfiguration.TimelineServiceHandlerThreadCount, YarnConfiguration
                              .DefaultTimelineServiceClientThreadCount);
                historyServer = new ApplicationHistoryServer();
                historyServer.Init(config);
                NUnit.Framework.Assert.AreEqual(Service.STATE.Inited, historyServer.GetServiceState
                                                    ());
                NUnit.Framework.Assert.AreEqual(5, historyServer.GetServices().Count);
                ApplicationHistoryClientService historyService = historyServer.GetClientService();
                NUnit.Framework.Assert.IsNotNull(historyServer.GetClientService());
                NUnit.Framework.Assert.AreEqual(Service.STATE.Inited, historyService.GetServiceState
                                                    ());
                historyServer.Start();
                NUnit.Framework.Assert.AreEqual(Service.STATE.Started, historyServer.GetServiceState
                                                    ());
                NUnit.Framework.Assert.AreEqual(Service.STATE.Started, historyService.GetServiceState
                                                    ());
                historyServer.Stop();
                NUnit.Framework.Assert.AreEqual(Service.STATE.Stopped, historyServer.GetServiceState
                                                    ());
            }
            finally
            {
                historyServer.Stop();
            }
        }
Example #3
0
        public static void Setup()
        {
            Configuration conf  = new YarnConfiguration();
            TimelineStore store = TestApplicationHistoryManagerOnTimelineStore.CreateStore(MaxApps
                                                                                           );
            TimelineACLsManager aclsManager = new TimelineACLsManager(conf);

            dataManager = new TimelineDataManager(store, aclsManager);
            ApplicationACLsManager appAclsManager = new ApplicationACLsManager(conf);
            ApplicationHistoryManagerOnTimelineStore historyManager = new ApplicationHistoryManagerOnTimelineStore
                                                                          (dataManager, appAclsManager);

            historyManager.Init(conf);
            historyManager.Start();
            clientService = new ApplicationHistoryClientService(historyManager);
        }
 /// <exception cref="System.Exception"/>
 protected override void ServiceInit(Configuration conf)
 {
     // init timeline services first
     timelineStore = CreateTimelineStore(conf);
     AddIfService(timelineStore);
     secretManagerService = CreateTimelineDelegationTokenSecretManagerService(conf);
     AddService(secretManagerService);
     timelineDataManager = CreateTimelineDataManager(conf);
     AddService(timelineDataManager);
     // init generic history service afterwards
     aclsManager      = CreateApplicationACLsManager(conf);
     historyManager   = CreateApplicationHistoryManager(conf);
     ahsClientService = CreateApplicationHistoryClientService(historyManager);
     AddService(ahsClientService);
     AddService((Org.Apache.Hadoop.Service.Service)historyManager);
     DefaultMetricsSystem.Initialize("ApplicationHistoryServer");
     JvmMetrics.InitSingleton("ApplicationHistoryServer", null);
     base.ServiceInit(conf);
 }