public virtual void Setup()
        {
            // 24h window
            timeWindow = 86400000L;
            // 1 sec step
            step = 1000L;
            // 25% avg cap on capacity
            avgConstraint = 25;
            // 70% instantaneous cap on capacity
            instConstraint = 70;
            initTime       = Runtime.CurrentTimeMillis();
            minAlloc       = Org.Apache.Hadoop.Yarn.Api.Records.Resource.NewInstance(1024, 1);
            res            = new DefaultResourceCalculator();
            maxAlloc       = Org.Apache.Hadoop.Yarn.Api.Records.Resource.NewInstance(1024 * 8, 8);
            mAgent         = Org.Mockito.Mockito.Mock <ReservationAgent>();
            ReservationSystemTestUtil testUtil = new ReservationSystemTestUtil();
            QueueMetrics rootQueueMetrics      = Org.Mockito.Mockito.Mock <QueueMetrics>();
            string       reservationQ          = testUtil.GetFullReservationQueueName();

            Org.Apache.Hadoop.Yarn.Api.Records.Resource clusterResource = ReservationSystemTestUtil
                                                                          .CalculateClusterResource(totCont);
            ReservationSchedulerConfiguration conf = ReservationSystemTestUtil.CreateConf(reservationQ
                                                                                          , timeWindow, instConstraint, avgConstraint);
            CapacityOverTimePolicy policy = new CapacityOverTimePolicy();

            policy.Init(reservationQ, conf);
            plan = new InMemoryPlan(rootQueueMetrics, policy, mAgent, clusterResource, step,
                                    res, minAlloc, maxAlloc, "dedicated", null, true);
        }
        /// <exception cref="System.IO.IOException"/>
        public static FairScheduler SetupFairScheduler(ReservationSystemTestUtil testUtil
                                                       , RMContext rmContext, Configuration conf, int numContainers)
        {
            FairScheduler scheduler = new FairScheduler();

            scheduler.SetRMContext(rmContext);
            Org.Mockito.Mockito.When(rmContext.GetScheduler()).ThenReturn(scheduler);
            scheduler.Init(conf);
            scheduler.Start();
            scheduler.Reinitialize(conf, rmContext);
            Resource resource = ReservationSystemTestUtil.CalculateClusterResource(numContainers
                                                                                   );
            RMNode node1 = MockNodes.NewNodeInfo(1, resource, 1, "127.0.0.1");
            NodeAddedSchedulerEvent nodeEvent1 = new NodeAddedSchedulerEvent(node1);

            scheduler.Handle(nodeEvent1);
            return(scheduler);
        }
Beispiel #3
0
        public virtual void Setup()
        {
            // 1 sec step
            step     = 1000L;
            initTime = Runtime.CurrentTimeMillis();
            minAlloc = Org.Apache.Hadoop.Yarn.Api.Records.Resource.NewInstance(1024, 1);
            res      = new DefaultResourceCalculator();
            maxAlloc = Org.Apache.Hadoop.Yarn.Api.Records.Resource.NewInstance(1024 * 8, 8);
            mAgent   = Org.Mockito.Mockito.Mock <ReservationAgent>();
            ReservationSystemTestUtil testUtil = new ReservationSystemTestUtil();
            string       reservationQ          = testUtil.GetFullReservationQueueName();
            QueueMetrics rootQueueMetrics      = Org.Mockito.Mockito.Mock <QueueMetrics>();

            Org.Apache.Hadoop.Yarn.Api.Records.Resource clusterResource = ReservationSystemTestUtil
                                                                          .CalculateClusterResource(totCont);
            ReservationSchedulerConfiguration conf = Org.Mockito.Mockito.Mock <ReservationSchedulerConfiguration
                                                                               >();
            NoOverCommitPolicy policy = new NoOverCommitPolicy();

            policy.Init(reservationQ, conf);
            plan = new InMemoryPlan(rootQueueMetrics, policy, mAgent, clusterResource, step,
                                    res, minAlloc, maxAlloc, "dedicated", null, true);
        }