Beispiel #1
0
 public FSQueue(string name, FairScheduler scheduler, FSParentQueue parent)
 {
     this.name      = name;
     this.scheduler = scheduler;
     this.metrics   = ((FSQueueMetrics)FSQueueMetrics.ForQueue(GetName(), parent, true,
                                                               scheduler.GetConf()));
     metrics.SetMinShare(GetMinShare());
     metrics.SetMaxShare(GetMaxShare());
     this.parent = parent;
 }
Beispiel #2
0
        public virtual void SetUp()
        {
            conf = new FairSchedulerConfiguration();
            FairScheduler           scheduler = Org.Mockito.Mockito.Mock <FairScheduler>();
            AllocationConfiguration allocConf = new AllocationConfiguration(conf);

            Org.Mockito.Mockito.When(scheduler.GetAllocationConfiguration()).ThenReturn(allocConf
                                                                                        );
            Org.Mockito.Mockito.When(scheduler.GetConf()).ThenReturn(conf);
            SystemClock clock = new SystemClock();

            Org.Mockito.Mockito.When(scheduler.GetClock()).ThenReturn(clock);
            notEmptyQueues = new HashSet <FSQueue>();
            queueManager   = new _QueueManager_47(this, scheduler);
            FSQueueMetrics.ForQueue("root", null, true, conf);
            queueManager.Initialize(conf);
        }
        public virtual void TestFairReservationSystemReinitialize()
        {
            ReservationSystemTestUtil.SetupFSAllocationFile(AllocFile);
            ReservationSystemTestUtil testUtil = new ReservationSystemTestUtil();
            // Setup
            RMContext mockRMContext = ReservationSystemTestUtil.CreateRMContext(conf);

            scheduler = ReservationSystemTestUtil.SetupFairScheduler(testUtil, mockRMContext,
                                                                     conf, 10);
            FairReservationSystem reservationSystem = new FairReservationSystem();

            reservationSystem.SetRMContext(mockRMContext);
            try
            {
                reservationSystem.Reinitialize(scheduler.GetConf(), mockRMContext);
            }
            catch (YarnException e)
            {
                NUnit.Framework.Assert.Fail(e.Message);
            }
            // Assert queue in original config
            string planQNam = testUtil.GetFullReservationQueueName();

            ReservationSystemTestUtil.ValidateReservationQueue(reservationSystem, planQNam);
            // Dynamically add a plan
            ReservationSystemTestUtil.UpdateFSAllocationFile(AllocFile);
            scheduler.Reinitialize(conf, mockRMContext);
            try
            {
                reservationSystem.Reinitialize(conf, mockRMContext);
            }
            catch (YarnException e)
            {
                NUnit.Framework.Assert.Fail(e.Message);
            }
            string newQueue = "root.reservation";

            ReservationSystemTestUtil.ValidateNewReservationQueue(reservationSystem, newQueue
                                                                  );
        }
        public virtual void Setup()
        {
            Configuration conf = new Configuration();

            clock     = new FairSchedulerTestBase.MockClock();
            scheduler = Org.Mockito.Mockito.Mock <FairScheduler>();
            Org.Mockito.Mockito.When(scheduler.GetConf()).ThenReturn(new FairSchedulerConfiguration
                                                                         (conf));
            Org.Mockito.Mockito.When(scheduler.GetClock()).ThenReturn(clock);
            AllocationConfiguration allocConf = new AllocationConfiguration(conf);

            Org.Mockito.Mockito.When(scheduler.GetAllocationConfiguration()).ThenReturn(allocConf
                                                                                        );
            queueManager = new QueueManager(scheduler);
            queueManager.Initialize(conf);
            queueMaxApps    = allocConf.queueMaxApps;
            userMaxApps     = allocConf.userMaxApps;
            maxAppsEnforcer = new MaxRunningAppsEnforcer(scheduler);
            appNum          = 0;
            rmContext       = Org.Mockito.Mockito.Mock <RMContext>();
            Org.Mockito.Mockito.When(rmContext.GetEpoch()).ThenReturn(0L);
        }
        public virtual void TestFairReservationSystemInitialize()
        {
            ReservationSystemTestUtil.SetupFSAllocationFile(AllocFile);
            ReservationSystemTestUtil testUtil = new ReservationSystemTestUtil();
            // Setup
            RMContext mockRMContext = ReservationSystemTestUtil.CreateRMContext(conf);

            scheduler = ReservationSystemTestUtil.SetupFairScheduler(testUtil, mockRMContext,
                                                                     conf, 10);
            FairReservationSystem reservationSystem = new FairReservationSystem();

            reservationSystem.SetRMContext(mockRMContext);
            try
            {
                reservationSystem.Reinitialize(scheduler.GetConf(), mockRMContext);
            }
            catch (YarnException e)
            {
                NUnit.Framework.Assert.Fail(e.Message);
            }
            ReservationSystemTestUtil.ValidateReservationQueue(reservationSystem, testUtil.GetFullReservationQueueName
                                                                   ());
        }