예제 #1
0
        protected internal virtual void CreateApplicationWithAMResource(ApplicationAttemptId
                                                                        attId, string queue, string user, Resource amResource)
        {
            RMContext rmContext = resourceManager.GetRMContext();
            RMApp     rmApp     = new RMAppImpl(attId.GetApplicationId(), rmContext, conf, null, null
                                                , null, ApplicationSubmissionContext.NewInstance(null, null, null, null, null, false
                                                                                                 , false, 0, amResource, null), null, null, 0, null, null, null);

            rmContext.GetRMApps()[attId.GetApplicationId()] = rmApp;
            AppAddedSchedulerEvent appAddedEvent = new AppAddedSchedulerEvent(attId.GetApplicationId
                                                                                  (), queue, user);

            scheduler.Handle(appAddedEvent);
            AppAttemptAddedSchedulerEvent attempAddedEvent = new AppAttemptAddedSchedulerEvent
                                                                 (attId, false);

            scheduler.Handle(attempAddedEvent);
        }
        /// <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);
        }