Пример #1
0
 private void UpdateDemandForApp(FSAppAttempt sched, Org.Apache.Hadoop.Yarn.Api.Records.Resource
                                 maxRes)
 {
     sched.UpdateDemand();
     Org.Apache.Hadoop.Yarn.Api.Records.Resource toAdd = sched.GetDemand();
     if (Log.IsDebugEnabled())
     {
         Log.Debug("Counting resource from " + sched.GetName() + " " + toAdd + "; Total resource consumption for "
                   + GetName() + " now " + demand);
     }
     demand = Resources.Add(demand, toAdd);
     demand = Resources.ComponentwiseMin(demand, maxRes);
 }
Пример #2
0
        public virtual void TestUpdateDemand()
        {
            conf.Set(FairSchedulerConfiguration.AssignMultiple, "false");
            resourceManager = new MockRM(conf);
            resourceManager.Start();
            scheduler           = (FairScheduler)resourceManager.GetResourceScheduler();
            scheduler.allocConf = Org.Mockito.Mockito.Mock <AllocationConfiguration>();
            string queueName = "root.queue1";

            Org.Mockito.Mockito.When(scheduler.allocConf.GetMaxResources(queueName)).ThenReturn
                (maxResource);
            Org.Mockito.Mockito.When(scheduler.allocConf.GetMinResources(queueName)).ThenReturn
                (Resources.None());
            FSLeafQueue  schedulable = new FSLeafQueue(queueName, scheduler, null);
            FSAppAttempt app         = Org.Mockito.Mockito.Mock <FSAppAttempt>();

            Org.Mockito.Mockito.When(app.GetDemand()).ThenReturn(maxResource);
            schedulable.AddAppSchedulable(app);
            schedulable.AddAppSchedulable(app);
            schedulable.UpdateDemand();
            NUnit.Framework.Assert.IsTrue("Demand is greater than max allowed ", Resources.Equals
                                              (schedulable.GetDemand(), maxResource));
        }