コード例 #1
0
        public virtual void TestInitialize()
        {
            ReservationSystemTestUtil testUtil     = new ReservationSystemTestUtil();
            CapacityScheduler         capScheduler = null;

            try
            {
                capScheduler = testUtil.MockCapacityScheduler(10);
            }
            catch (IOException e)
            {
                NUnit.Framework.Assert.Fail(e.Message);
            }
            CapacityReservationSystem reservationSystem = new CapacityReservationSystem();

            reservationSystem.SetRMContext(capScheduler.GetRMContext());
            try
            {
                reservationSystem.Reinitialize(capScheduler.GetConf(), capScheduler.GetRMContext(
                                                   ));
            }
            catch (YarnException e)
            {
                NUnit.Framework.Assert.Fail(e.Message);
            }
            string planQName = testUtil.GetreservationQueueName();

            ReservationSystemTestUtil.ValidateReservationQueue(reservationSystem, planQName);
        }
コード例 #2
0
        public virtual void TestReinitialize()
        {
            ReservationSystemTestUtil testUtil     = new ReservationSystemTestUtil();
            CapacityScheduler         capScheduler = null;

            try
            {
                capScheduler = testUtil.MockCapacityScheduler(10);
            }
            catch (IOException e)
            {
                NUnit.Framework.Assert.Fail(e.Message);
            }
            CapacityReservationSystem      reservationSystem = new CapacityReservationSystem();
            CapacitySchedulerConfiguration conf = capScheduler.GetConfiguration();
            RMContext mockContext = capScheduler.GetRMContext();

            reservationSystem.SetRMContext(mockContext);
            try
            {
                reservationSystem.Reinitialize(capScheduler.GetConfiguration(), mockContext);
            }
            catch (YarnException e)
            {
                NUnit.Framework.Assert.Fail(e.Message);
            }
            // Assert queue in original config
            string planQName = testUtil.GetreservationQueueName();

            ReservationSystemTestUtil.ValidateReservationQueue(reservationSystem, planQName);
            // Dynamically add a plan
            string newQ = "reservation";

            NUnit.Framework.Assert.IsNull(reservationSystem.GetPlan(newQ));
            testUtil.UpdateQueueConfiguration(conf, newQ);
            try
            {
                capScheduler.Reinitialize(conf, mockContext);
            }
            catch (IOException e)
            {
                NUnit.Framework.Assert.Fail(e.Message);
            }
            try
            {
                reservationSystem.Reinitialize(conf, mockContext);
            }
            catch (YarnException e)
            {
                NUnit.Framework.Assert.Fail(e.Message);
            }
            ReservationSystemTestUtil.ValidateNewReservationQueue(reservationSystem, newQ);
        }
コード例 #3
0
        /// <exception cref="Org.Apache.Hadoop.Yarn.Server.Resourcemanager.Reservation.Exceptions.PlanningException
        ///     "/>
        /// <exception cref="System.IO.IOException"/>
        public virtual void TestStress(int numJobs)
        {
            long timeWindow = 1000000L;

            Org.Apache.Hadoop.Yarn.Api.Records.Resource clusterCapacity = Org.Apache.Hadoop.Yarn.Api.Records.Resource
                                                                          .NewInstance(500 * 100 * 1024, 500 * 32);
            step = 1000L;
            ReservationSystemTestUtil testUtil  = new ReservationSystemTestUtil();
            CapacityScheduler         scheduler = testUtil.MockCapacityScheduler(500 * 100);
            string reservationQ   = testUtil.GetFullReservationQueueName();
            float  instConstraint = 100;
            float  avgConstraint  = 100;
            ReservationSchedulerConfiguration conf = ReservationSystemTestUtil.CreateConf(reservationQ
                                                                                          , timeWindow, instConstraint, avgConstraint);
            CapacityOverTimePolicy policy = new CapacityOverTimePolicy();

            policy.Init(reservationQ, conf);
            plan = new InMemoryPlan(scheduler.GetRootQueueMetrics(), policy, agent, clusterCapacity
                                    , step, res, minAlloc, maxAlloc, "dedicated", null, true);
            int acc = 0;
            IList <ReservationDefinition> list = new AList <ReservationDefinition>();

            for (long i = 0; i < numJobs; i++)
            {
                list.AddItem(ReservationSystemTestUtil.GenerateRandomRR(rand, i));
            }
            long start = Runtime.CurrentTimeMillis();

            for (int i_1 = 0; i_1 < numJobs; i_1++)
            {
                try
                {
                    if (agent.CreateReservation(ReservationSystemTestUtil.GetNewReservationId(), "u"
                                                + i_1 % 100, plan, list[i_1]))
                    {
                        acc++;
                    }
                }
                catch (PlanningException)
                {
                }
            }
            // ignore exceptions
            long end = Runtime.CurrentTimeMillis();

            System.Console.Out.WriteLine("Submitted " + numJobs + " jobs " + " accepted " + acc
                                         + " in " + (end - start) + "ms");
        }