Ejemplo n.º 1
0
        public virtual void SetUp()
        {
            Configuration conf = new Configuration();

            // Dispatcher that processes events inline
            dispatcher = new InlineDispatcher();
            dispatcher.Register(typeof(RMNodeEventType), new TestNMReconnect.TestRMNodeEventDispatcher
                                    (this));
            context = new RMContextImpl(dispatcher, null, null, null, null, null, null, null,
                                        null, null);
            dispatcher.Register(typeof(SchedulerEventType), new InlineDispatcher.EmptyEventHandler
                                    ());
            dispatcher.Register(typeof(RMNodeEventType), new ResourceManager.NodeEventDispatcher
                                    (context));
            NMLivelinessMonitor nmLivelinessMonitor = new NMLivelinessMonitor(dispatcher);

            nmLivelinessMonitor.Init(conf);
            nmLivelinessMonitor.Start();
            NodesListManager nodesListManager = new NodesListManager(context);

            nodesListManager.Init(conf);
            RMContainerTokenSecretManager containerTokenSecretManager = new RMContainerTokenSecretManager
                                                                            (conf);

            containerTokenSecretManager.Start();
            NMTokenSecretManagerInRM nmTokenSecretManager = new NMTokenSecretManagerInRM(conf
                                                                                         );

            nmTokenSecretManager.Start();
            resourceTrackerService = new ResourceTrackerService(context, nodesListManager, nmLivelinessMonitor
                                                                , containerTokenSecretManager, nmTokenSecretManager);
            resourceTrackerService.Init(conf);
            resourceTrackerService.Start();
        }
Ejemplo n.º 2
0
 public CustomedResourceTrackerService(MiniYARNClusterForHATesting _enclosing, RMContext
                                       rmContext, NodesListManager nodesListManager, NMLivelinessMonitor nmLivelinessMonitor
                                       , RMContainerTokenSecretManager containerTokenSecretManager, NMTokenSecretManagerInRM
                                       nmTokenSecretManager)
     : base(rmContext, nodesListManager, nmLivelinessMonitor, containerTokenSecretManager
            , nmTokenSecretManager)
 {
     this._enclosing = _enclosing;
 }
Ejemplo n.º 3
0
        public virtual void SetUp()
        {
            Configuration conf = new Configuration();
            // Dispatcher that processes events inline
            Dispatcher dispatcher = new InlineDispatcher();

            dispatcher.Register(typeof(SchedulerEventType), new _EventHandler_65());
            // ignore
            RMContext context = new RMContextImpl(dispatcher, null, null, null, null, null, new
                                                  RMContainerTokenSecretManager(conf), new NMTokenSecretManagerInRM(conf), null, null
                                                  );

            dispatcher.Register(typeof(RMNodeEventType), new ResourceManager.NodeEventDispatcher
                                    (context));
            NodesListManager nodesListManager = new NodesListManager(context);

            nodesListManager.Init(conf);
            context.GetContainerTokenSecretManager().RollMasterKey();
            context.GetNMTokenSecretManager().RollMasterKey();
            resourceTrackerService = new ResourceTrackerService(context, nodesListManager, new
                                                                NMLivelinessMonitor(dispatcher), context.GetContainerTokenSecretManager(), context
                                                                .GetNMTokenSecretManager());
            resourceTrackerService.Init(conf);
        }
Ejemplo n.º 4
0
        // To hold list of application for which event was received
        /// <exception cref="System.Exception"/>
        public virtual void TestNodeUsableEvent()
        {
            Logger rootLogger = LogManager.GetRootLogger();

            rootLogger.SetLevel(Level.Debug);
            Dispatcher        dispatcher = GetDispatcher();
            YarnConfiguration conf       = new YarnConfiguration();
            MockRM            rm         = new _MockRM_62(dispatcher, conf);

            rm.Start();
            MockNM           nm1 = rm.RegisterNode("h1:1234", 28000);
            NodesListManager nodesListManager = rm.GetNodesListManager();
            Resource         clusterResource  = Resource.NewInstance(28000, 8);
            RMNode           rmnode           = MockNodes.NewNodeInfo(1, clusterResource);
            // Create killing APP
            RMApp killrmApp = rm.SubmitApp(200);

            rm.KillApp(killrmApp.GetApplicationId());
            rm.WaitForState(killrmApp.GetApplicationId(), RMAppState.Killed);
            // Create finish APP
            RMApp finshrmApp = rm.SubmitApp(2000);

            nm1.NodeHeartbeat(true);
            RMAppAttempt attempt = finshrmApp.GetCurrentAppAttempt();
            MockAM       am      = rm.SendAMLaunched(attempt.GetAppAttemptId());

            am.RegisterAppAttempt();
            am.UnregisterAppAttempt();
            nm1.NodeHeartbeat(attempt.GetAppAttemptId(), 1, ContainerState.Complete);
            am.WaitForState(RMAppAttemptState.Finished);
            // Create submitted App
            RMApp subrmApp = rm.SubmitApp(200);

            // Fire Event for NODE_USABLE
            nodesListManager.Handle(new NodesListManagerEvent(NodesListManagerEventType.NodeUsable
                                                              , rmnode));
            if (applist.Count > 0)
            {
                NUnit.Framework.Assert.IsTrue("Event based on running app expected " + subrmApp.GetApplicationId
                                                  (), applist.Contains(subrmApp.GetApplicationId()));
                NUnit.Framework.Assert.IsFalse("Event based on finish app not expected " + finshrmApp
                                               .GetApplicationId(), applist.Contains(finshrmApp.GetApplicationId()));
                NUnit.Framework.Assert.IsFalse("Event based on killed app not expected " + killrmApp
                                               .GetApplicationId(), applist.Contains(killrmApp.GetApplicationId()));
            }
            else
            {
                NUnit.Framework.Assert.Fail("Events received should have beeen more than 1");
            }
            applist.Clear();
            // Fire Event for NODE_UNUSABLE
            nodesListManager.Handle(new NodesListManagerEvent(NodesListManagerEventType.NodeUnusable
                                                              , rmnode));
            if (applist.Count > 0)
            {
                NUnit.Framework.Assert.IsTrue("Event based on running app expected " + subrmApp.GetApplicationId
                                                  (), applist.Contains(subrmApp.GetApplicationId()));
                NUnit.Framework.Assert.IsFalse("Event based on finish app not expected " + finshrmApp
                                               .GetApplicationId(), applist.Contains(finshrmApp.GetApplicationId()));
                NUnit.Framework.Assert.IsFalse("Event based on killed app not expected " + killrmApp
                                               .GetApplicationId(), applist.Contains(killrmApp.GetApplicationId()));
            }
            else
            {
                NUnit.Framework.Assert.Fail("Events received should have beeen more than 1");
            }
        }