Exemplo n.º 1
0
        public virtual void TestCompareRMNodeAfterReconnect()
        {
            Configuration     yarnConf  = new YarnConfiguration();
            CapacityScheduler scheduler = new CapacityScheduler();

            scheduler.SetConf(yarnConf);
            ConfigurationProvider configurationProvider = ConfigurationProviderFactory.GetConfigurationProvider
                                                              (yarnConf);

            configurationProvider.Init(yarnConf);
            context.SetConfigurationProvider(configurationProvider);
            RMNodeLabelsManager nlm = new RMNodeLabelsManager();

            nlm.Init(yarnConf);
            nlm.Start();
            context.SetNodeLabelManager(nlm);
            scheduler.SetRMContext(context);
            scheduler.Init(yarnConf);
            scheduler.Start();
            dispatcher.Register(typeof(SchedulerEventType), scheduler);
            string   hostname1  = "localhost1";
            Resource capability = BuilderUtils.NewResource(4096, 4);
            RegisterNodeManagerRequest request1 = recordFactory.NewRecordInstance <RegisterNodeManagerRequest
                                                                                   >();
            NodeId nodeId1 = NodeId.NewInstance(hostname1, 0);

            request1.SetNodeId(nodeId1);
            request1.SetHttpPort(0);
            request1.SetResource(capability);
            resourceTrackerService.RegisterNodeManager(request1);
            NUnit.Framework.Assert.IsNotNull(context.GetRMNodes()[nodeId1]);
            // verify Scheduler and RMContext use same RMNode reference.
            NUnit.Framework.Assert.IsTrue(scheduler.GetSchedulerNode(nodeId1).GetRMNode() ==
                                          context.GetRMNodes()[nodeId1]);
            NUnit.Framework.Assert.AreEqual(context.GetRMNodes()[nodeId1].GetTotalCapability(
                                                ), capability);
            Resource capability1 = BuilderUtils.NewResource(2048, 2);

            request1.SetResource(capability1);
            resourceTrackerService.RegisterNodeManager(request1);
            NUnit.Framework.Assert.IsNotNull(context.GetRMNodes()[nodeId1]);
            // verify Scheduler and RMContext use same RMNode reference
            // after reconnect.
            NUnit.Framework.Assert.IsTrue(scheduler.GetSchedulerNode(nodeId1).GetRMNode() ==
                                          context.GetRMNodes()[nodeId1]);
            // verify RMNode's capability is changed.
            NUnit.Framework.Assert.AreEqual(context.GetRMNodes()[nodeId1].GetTotalCapability(
                                                ), capability1);
            nlm.Stop();
            scheduler.Stop();
        }
Exemplo n.º 2
0
 public virtual void Setup()
 {
     nodeLabelManager = new NullRMNodeLabelsManager();
     nodeLabelManager.Init(new YarnConfiguration());
     nodeLabelManager.Start();
 }