Ejemplo n.º 1
0
        public virtual void SetUp()
        {
            scheduler = new FairScheduler();
            Configuration conf = new YarnConfiguration();

            conf.SetClass(YarnConfiguration.RmScheduler, typeof(FairScheduler), typeof(ResourceScheduler
                                                                                       ));
            conf.Set("yarn.scheduler.fair.event-log-enabled", "true");
            // All tests assume only one assignment per node update
            conf.Set(FairSchedulerConfiguration.AssignMultiple, "false");
            resourceManager = new ResourceManager();
            resourceManager.Init(conf);
            ((AsyncDispatcher)resourceManager.GetRMContext().GetDispatcher()).Start();
            scheduler.Init(conf);
            scheduler.Start();
            scheduler.Reinitialize(conf, resourceManager.GetRMContext());
        }
        /// <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);
        }