Esempio n. 1
0
        public virtual void TestFifoSchedulerCapacityWhenNoNMs()
        {
            FifoScheduler scheduler = new FifoScheduler();
            QueueInfo     queueInfo = scheduler.GetQueueInfo(null, false, false);

            NUnit.Framework.Assert.AreEqual(0.0f, queueInfo.GetCurrentCapacity(), 0.0f);
        }
Esempio n. 2
0
        /// <exception cref="System.Exception"/>
        public virtual void TestAppAttemptMetrics()
        {
            AsyncDispatcher            dispatcher = new InlineDispatcher();
            FifoScheduler              scheduler  = new FifoScheduler();
            RMApplicationHistoryWriter writer     = Org.Mockito.Mockito.Mock <RMApplicationHistoryWriter
                                                                              >();
            RMContext rmContext = new RMContextImpl(dispatcher, null, null, null, null, null,
                                                    null, null, null, scheduler);

            ((RMContextImpl)rmContext).SetSystemMetricsPublisher(Org.Mockito.Mockito.Mock <SystemMetricsPublisher
                                                                                           >());
            Configuration conf = new Configuration();

            scheduler.SetRMContext(rmContext);
            scheduler.Init(conf);
            scheduler.Start();
            scheduler.Reinitialize(conf, rmContext);
            QueueMetrics         metrics             = scheduler.GetRootQueueMetrics();
            int                  beforeAppsSubmitted = metrics.GetAppsSubmitted();
            ApplicationId        appId        = BuilderUtils.NewApplicationId(200, 1);
            ApplicationAttemptId appAttemptId = BuilderUtils.NewApplicationAttemptId(appId, 1
                                                                                     );
            SchedulerEvent appEvent = new AppAddedSchedulerEvent(appId, "queue", "user");

            scheduler.Handle(appEvent);
            SchedulerEvent attemptEvent = new AppAttemptAddedSchedulerEvent(appAttemptId, false
                                                                            );

            scheduler.Handle(attemptEvent);
            appAttemptId = BuilderUtils.NewApplicationAttemptId(appId, 2);
            SchedulerEvent attemptEvent2 = new AppAttemptAddedSchedulerEvent(appAttemptId, false
                                                                             );

            scheduler.Handle(attemptEvent2);
            int afterAppsSubmitted = metrics.GetAppsSubmitted();

            NUnit.Framework.Assert.AreEqual(1, afterAppsSubmitted - beforeAppsSubmitted);
            scheduler.Stop();
        }
Esempio n. 3
0
        public virtual void TestBlackListNodes()
        {
            Configuration conf = new Configuration();

            conf.SetClass(YarnConfiguration.RmScheduler, typeof(FifoScheduler), typeof(ResourceScheduler
                                                                                       ));
            MockRM rm = new MockRM(conf);

            rm.Start();
            FifoScheduler fs   = (FifoScheduler)rm.GetResourceScheduler();
            string        host = "127.0.0.1";
            RMNode        node = MockNodes.NewNodeInfo(0, MockNodes.NewResource(4 * Gb), 1, host);

            fs.Handle(new NodeAddedSchedulerEvent(node));
            ApplicationId        appId        = BuilderUtils.NewApplicationId(100, 1);
            ApplicationAttemptId appAttemptId = BuilderUtils.NewApplicationAttemptId(appId, 1
                                                                                     );

            CreateMockRMApp(appAttemptId, rm.GetRMContext());
            SchedulerEvent appEvent = new AppAddedSchedulerEvent(appId, "default", "user");

            fs.Handle(appEvent);
            SchedulerEvent attemptEvent = new AppAttemptAddedSchedulerEvent(appAttemptId, false
                                                                            );

            fs.Handle(attemptEvent);
            // Verify the blacklist can be updated independent of requesting containers
            fs.Allocate(appAttemptId, Sharpen.Collections.EmptyList <ResourceRequest>(), Sharpen.Collections
                        .EmptyList <ContainerId>(), Sharpen.Collections.SingletonList(host), null);
            NUnit.Framework.Assert.IsTrue(fs.GetApplicationAttempt(appAttemptId).IsBlacklisted
                                              (host));
            fs.Allocate(appAttemptId, Sharpen.Collections.EmptyList <ResourceRequest>(), Sharpen.Collections
                        .EmptyList <ContainerId>(), null, Sharpen.Collections.SingletonList(host));
            NUnit.Framework.Assert.IsFalse(fs.GetApplicationAttempt(appAttemptId).IsBlacklisted
                                               (host));
            rm.Stop();
        }
Esempio n. 4
0
 public _Queue_124(FifoScheduler _enclosing)
 {
     this._enclosing = _enclosing;
 }
Esempio n. 5
0
        /// <exception cref="System.Exception"/>
        public virtual void TestNodeLocalAssignment()
        {
            AsyncDispatcher dispatcher = new InlineDispatcher();
            Configuration   conf       = new Configuration();
            RMContainerTokenSecretManager containerTokenSecretManager = new RMContainerTokenSecretManager
                                                                            (conf);

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

            nmTokenSecretManager.RollMasterKey();
            RMApplicationHistoryWriter writer = Org.Mockito.Mockito.Mock <RMApplicationHistoryWriter
                                                                          >();
            FifoScheduler scheduler = new FifoScheduler();
            RMContext     rmContext = new RMContextImpl(dispatcher, null, null, null, null, null,
                                                        containerTokenSecretManager, nmTokenSecretManager, null, scheduler);

            rmContext.SetSystemMetricsPublisher(Org.Mockito.Mockito.Mock <SystemMetricsPublisher
                                                                          >());
            rmContext.SetRMApplicationHistoryWriter(Org.Mockito.Mockito.Mock <RMApplicationHistoryWriter
                                                                              >());
            ((RMContextImpl)rmContext).SetYarnConfiguration(new YarnConfiguration());
            scheduler.SetRMContext(rmContext);
            scheduler.Init(conf);
            scheduler.Start();
            scheduler.Reinitialize(new Configuration(), rmContext);
            RMNode node0 = MockNodes.NewNodeInfo(1, Resources.CreateResource(1024 * 64), 1, "127.0.0.1"
                                                 );
            NodeAddedSchedulerEvent nodeEvent1 = new NodeAddedSchedulerEvent(node0);

            scheduler.Handle(nodeEvent1);
            int _appId        = 1;
            int _appAttemptId = 1;
            ApplicationAttemptId appAttemptId = CreateAppAttemptId(_appId, _appAttemptId);

            CreateMockRMApp(appAttemptId, rmContext);
            AppAddedSchedulerEvent appEvent = new AppAddedSchedulerEvent(appAttemptId.GetApplicationId
                                                                             (), "queue1", "user1");

            scheduler.Handle(appEvent);
            AppAttemptAddedSchedulerEvent attemptEvent = new AppAttemptAddedSchedulerEvent(appAttemptId
                                                                                           , false);

            scheduler.Handle(attemptEvent);
            int memory   = 64;
            int nConts   = 3;
            int priority = 20;
            IList <ResourceRequest> ask       = new AList <ResourceRequest>();
            ResourceRequest         nodeLocal = CreateResourceRequest(memory, node0.GetHostName(), priority
                                                                      , nConts);
            ResourceRequest rackLocal = CreateResourceRequest(memory, node0.GetRackName(), priority
                                                              , nConts);
            ResourceRequest any = CreateResourceRequest(memory, ResourceRequest.Any, priority
                                                        , nConts);

            ask.AddItem(nodeLocal);
            ask.AddItem(rackLocal);
            ask.AddItem(any);
            scheduler.Allocate(appAttemptId, ask, new AList <ContainerId>(), null, null);
            NodeUpdateSchedulerEvent node0Update = new NodeUpdateSchedulerEvent(node0);

            // Before the node update event, there are 3 local requests outstanding
            NUnit.Framework.Assert.AreEqual(3, nodeLocal.GetNumContainers());
            scheduler.Handle(node0Update);
            // After the node update event, check that there are no more local requests
            // outstanding
            NUnit.Framework.Assert.AreEqual(0, nodeLocal.GetNumContainers());
            //Also check that the containers were scheduled
            SchedulerAppReport info = scheduler.GetSchedulerAppInfo(appAttemptId);

            NUnit.Framework.Assert.AreEqual(3, info.GetLiveContainers().Count);
            scheduler.Stop();
        }