Beispiel #1
0
        protected internal virtual ApplicationAttemptId CreateSchedulingRequest(int memory
                                                                                , int vcores, string queueId, string userId, int numContainers, int priority)
        {
            ApplicationAttemptId id = CreateAppAttemptId(this.AppId++, this.AttemptId++);

            scheduler.AddApplication(id.GetApplicationId(), queueId, userId, false);
            // This conditional is for testAclSubmitApplication where app is rejected
            // and no app is added.
            if (scheduler.GetSchedulerApplications().Contains(id.GetApplicationId()))
            {
                scheduler.AddApplicationAttempt(id, false, false);
            }
            IList <ResourceRequest> ask     = new AList <ResourceRequest>();
            ResourceRequest         request = CreateResourceRequest(memory, vcores, ResourceRequest.Any
                                                                    , priority, numContainers, true);

            ask.AddItem(request);
            RMApp        rmApp        = Org.Mockito.Mockito.Mock <RMApp>();
            RMAppAttempt rmAppAttempt = Org.Mockito.Mockito.Mock <RMAppAttempt>();

            Org.Mockito.Mockito.When(rmApp.GetCurrentAppAttempt()).ThenReturn(rmAppAttempt);
            Org.Mockito.Mockito.When(rmAppAttempt.GetRMAppAttemptMetrics()).ThenReturn(new RMAppAttemptMetrics
                                                                                           (id, resourceManager.GetRMContext()));
            resourceManager.GetRMContext().GetRMApps()[id.GetApplicationId()] = rmApp;
            scheduler.Allocate(id, ask, new AList <ContainerId>(), null, null);
            return(id);
        }