/// <summary> /// Test init a queue configuration, children's capacity for a given label /// doesn't equals to 100%. /// </summary> /// <remarks> /// Test init a queue configuration, children's capacity for a given label /// doesn't equals to 100%. This expect IllegalArgumentException thrown. /// </remarks> /// <exception cref="System.IO.IOException"/> public virtual void TestQueueParsingWithSumOfChildLabelCapacityNot100PercentWithWildCard () { nodeLabelManager.AddToCluserNodeLabels(ImmutableSet.Of("red", "blue")); YarnConfiguration conf = new YarnConfiguration(); CapacitySchedulerConfiguration csConf = new CapacitySchedulerConfiguration(conf); SetupQueueConfigurationWithLabels(csConf); csConf.SetCapacityByLabel(CapacitySchedulerConfiguration.Root + ".b.b3", "red", 24 ); csConf.SetAccessibleNodeLabels(CapacitySchedulerConfiguration.Root, ImmutableSet. Of(RMNodeLabelsManager.Any)); csConf.SetAccessibleNodeLabels(CapacitySchedulerConfiguration.Root + ".b", ImmutableSet .Of(RMNodeLabelsManager.Any)); CapacityScheduler capacityScheduler = new CapacityScheduler(); RMContextImpl rmContext = new RMContextImpl(null, null, null, null, null, null, new RMContainerTokenSecretManager(csConf), new NMTokenSecretManagerInRM(csConf), new ClientToAMTokenSecretManagerInRM(), null); rmContext.SetNodeLabelManager(nodeLabelManager); capacityScheduler.SetConf(csConf); capacityScheduler.SetRMContext(rmContext); capacityScheduler.Init(csConf); capacityScheduler.Start(); ServiceOperations.StopQuietly(capacityScheduler); }
/// <exception cref="System.IO.IOException"/> public virtual void TestQueueParsingWithMoveQueue() { YarnConfiguration conf = new YarnConfiguration(); CapacitySchedulerConfiguration csConf = new CapacitySchedulerConfiguration(conf); csConf.SetQueues("root", new string[] { "a" }); csConf.SetQueues("root.a", new string[] { "x", "y" }); csConf.SetCapacity("root.a", 100); csConf.SetCapacity("root.a.x", 50); csConf.SetCapacity("root.a.y", 50); CapacityScheduler capacityScheduler = new CapacityScheduler(); RMContextImpl rmContext = new RMContextImpl(null, null, null, null, null, null, new RMContainerTokenSecretManager(csConf), new NMTokenSecretManagerInRM(csConf), new ClientToAMTokenSecretManagerInRM(), null); rmContext.SetNodeLabelManager(nodeLabelManager); capacityScheduler.SetConf(csConf); capacityScheduler.SetRMContext(rmContext); capacityScheduler.Init(csConf); capacityScheduler.Start(); csConf.SetQueues("root", new string[] { "a", "x" }); csConf.SetQueues("root.a", new string[] { "y" }); csConf.SetCapacity("root.x", 50); csConf.SetCapacity("root.a", 50); csConf.SetCapacity("root.a.y", 100); capacityScheduler.Reinitialize(csConf, rmContext); }
public virtual void SetUp() { Configuration conf = new Configuration(); // Dispatcher that processes events inline dispatcher = new InlineDispatcher(); dispatcher.Register(typeof(RMNodeEventType), new TestNMReconnect.TestRMNodeEventDispatcher (this)); context = new RMContextImpl(dispatcher, null, null, null, null, null, null, null, null, null); dispatcher.Register(typeof(SchedulerEventType), new InlineDispatcher.EmptyEventHandler ()); dispatcher.Register(typeof(RMNodeEventType), new ResourceManager.NodeEventDispatcher (context)); NMLivelinessMonitor nmLivelinessMonitor = new NMLivelinessMonitor(dispatcher); nmLivelinessMonitor.Init(conf); nmLivelinessMonitor.Start(); NodesListManager nodesListManager = new NodesListManager(context); nodesListManager.Init(conf); RMContainerTokenSecretManager containerTokenSecretManager = new RMContainerTokenSecretManager (conf); containerTokenSecretManager.Start(); NMTokenSecretManagerInRM nmTokenSecretManager = new NMTokenSecretManagerInRM(conf ); nmTokenSecretManager.Start(); resourceTrackerService = new ResourceTrackerService(context, nodesListManager, nmLivelinessMonitor , containerTokenSecretManager, nmTokenSecretManager); resourceTrackerService.Init(conf); resourceTrackerService.Start(); }
/// <summary> /// Get a mock /// <see cref="Org.Apache.Hadoop.Yarn.Server.Resourcemanager.RMContext"/> /// for use in test cases. /// </summary> /// <returns> /// a mock /// <see cref="Org.Apache.Hadoop.Yarn.Server.Resourcemanager.RMContext"/> /// for use in test cases /// </returns> public static RMContext GetMockRMContext() { // Null dispatcher Dispatcher nullDispatcher = new _Dispatcher_73(); // No op ContainerAllocationExpirer cae = new ContainerAllocationExpirer(nullDispatcher); Configuration conf = new Configuration(); RMApplicationHistoryWriter writer = Org.Mockito.Mockito.Mock <RMApplicationHistoryWriter >(); RMContextImpl rmContext = new RMContextImpl(nullDispatcher, cae, null, null, null , new AMRMTokenSecretManager(conf, null), new RMContainerTokenSecretManager(conf ), new NMTokenSecretManagerInRM(conf), new ClientToAMTokenSecretManagerInRM()); RMNodeLabelsManager nlm = Org.Mockito.Mockito.Mock <RMNodeLabelsManager>(); Org.Mockito.Mockito.When(nlm.GetQueueResource(Matchers.Any <string>(), Matchers.Any <Set>(), Matchers.Any <Resource>())).ThenAnswer(new _Answer_105()); Org.Mockito.Mockito.When(nlm.GetResourceByLabel(Matchers.Any <string>(), Matchers.Any <Resource>())).ThenAnswer(new _Answer_114()); rmContext.SetNodeLabelManager(nlm); rmContext.SetSystemMetricsPublisher(Org.Mockito.Mockito.Mock <SystemMetricsPublisher >()); rmContext.SetRMApplicationHistoryWriter(Org.Mockito.Mockito.Mock <RMApplicationHistoryWriter >()); return(rmContext); }
public virtual void TestQueueParsingWithUnusedLabels() { ImmutableSet <string> labels = ImmutableSet.Of("red", "blue"); // Initialize a cluster with labels, but doesn't use them, reinitialize // shouldn't fail nodeLabelManager.AddToCluserNodeLabels(labels); CapacitySchedulerConfiguration csConf = new CapacitySchedulerConfiguration(); SetupQueueConfiguration(csConf); csConf.SetAccessibleNodeLabels(CapacitySchedulerConfiguration.Root, labels); YarnConfiguration conf = new YarnConfiguration(csConf); CapacityScheduler capacityScheduler = new CapacityScheduler(); capacityScheduler.SetConf(conf); RMContextImpl rmContext = new RMContextImpl(null, null, null, null, null, null, new RMContainerTokenSecretManager(csConf), new NMTokenSecretManagerInRM(csConf), new ClientToAMTokenSecretManagerInRM(), null); rmContext.SetNodeLabelManager(nodeLabelManager); capacityScheduler.SetRMContext(rmContext); capacityScheduler.Init(conf); capacityScheduler.Start(); capacityScheduler.Reinitialize(conf, rmContext); // check root queue's capacity by label -- they should be all zero CSQueue root = capacityScheduler.GetQueue(CapacitySchedulerConfiguration.Root); NUnit.Framework.Assert.AreEqual(0, root.GetQueueCapacities().GetCapacity("red"), Delta); NUnit.Framework.Assert.AreEqual(0, root.GetQueueCapacities().GetCapacity("blue"), Delta); CSQueue a = capacityScheduler.GetQueue("a"); NUnit.Framework.Assert.AreEqual(0.10, a.GetAbsoluteCapacity(), Delta); NUnit.Framework.Assert.AreEqual(0.15, a.GetAbsoluteMaximumCapacity(), Delta); CSQueue b1 = capacityScheduler.GetQueue("b1"); NUnit.Framework.Assert.AreEqual(0.2 * 0.5, b1.GetAbsoluteCapacity(), Delta); NUnit.Framework.Assert.AreEqual("Parent B has no MAX_CAP", 0.85, b1.GetAbsoluteMaximumCapacity (), Delta); CSQueue c12 = capacityScheduler.GetQueue("c12"); NUnit.Framework.Assert.AreEqual(0.7 * 0.5 * 0.45, c12.GetAbsoluteCapacity(), Delta ); NUnit.Framework.Assert.AreEqual(0.7 * 0.55 * 0.7, c12.GetAbsoluteMaximumCapacity( ), Delta); capacityScheduler.Stop(); }
/// <exception cref="System.IO.IOException"/> public static CapacityScheduler MockCapacityScheduler() { // stolen from TestCapacityScheduler CapacitySchedulerConfiguration conf = new CapacitySchedulerConfiguration(); SetupQueueConfiguration(conf); CapacityScheduler cs = new CapacityScheduler(); cs.SetConf(new YarnConfiguration()); RMContext rmContext = new RMContextImpl(null, null, null, null, null, null, new RMContainerTokenSecretManager (conf), new NMTokenSecretManagerInRM(conf), new ClientToAMTokenSecretManagerInRM (), null); rmContext.SetNodeLabelManager(new NullRMNodeLabelsManager()); cs.SetRMContext(rmContext); cs.Init(conf); return(cs); }
public virtual void TestQueueParsingWithLabelsInherit() { nodeLabelManager.AddToCluserNodeLabels(ImmutableSet.Of("red", "blue")); YarnConfiguration conf = new YarnConfiguration(); CapacitySchedulerConfiguration csConf = new CapacitySchedulerConfiguration(conf); SetupQueueConfigurationWithLabelsInherit(csConf); CapacityScheduler capacityScheduler = new CapacityScheduler(); RMContextImpl rmContext = new RMContextImpl(null, null, null, null, null, null, new RMContainerTokenSecretManager(csConf), new NMTokenSecretManagerInRM(csConf), new ClientToAMTokenSecretManagerInRM(), null); rmContext.SetNodeLabelManager(nodeLabelManager); capacityScheduler.SetConf(csConf); capacityScheduler.SetRMContext(rmContext); capacityScheduler.Init(csConf); capacityScheduler.Start(); CheckQueueLabelsInheritConfig(capacityScheduler); ServiceOperations.StopQuietly(capacityScheduler); }
/// <summary> /// Test init a queue configuration, children's capacity for a given label /// doesn't equals to 100%. /// </summary> /// <remarks> /// Test init a queue configuration, children's capacity for a given label /// doesn't equals to 100%. This expect IllegalArgumentException thrown. /// </remarks> /// <exception cref="System.IO.IOException"/> public virtual void TestQueueParsingFailWhenSumOfChildrenNonLabeledCapacityNot100Percent () { nodeLabelManager.AddToCluserNodeLabels(ImmutableSet.Of("red", "blue")); YarnConfiguration conf = new YarnConfiguration(); CapacitySchedulerConfiguration csConf = new CapacitySchedulerConfiguration(conf); SetupQueueConfiguration(csConf); csConf.SetCapacity(CapacitySchedulerConfiguration.Root + ".c.c2", 5); CapacityScheduler capacityScheduler = new CapacityScheduler(); RMContextImpl rmContext = new RMContextImpl(null, null, null, null, null, null, new RMContainerTokenSecretManager(csConf), new NMTokenSecretManagerInRM(csConf), new ClientToAMTokenSecretManagerInRM(), null); rmContext.SetNodeLabelManager(nodeLabelManager); capacityScheduler.SetConf(csConf); capacityScheduler.SetRMContext(rmContext); capacityScheduler.Init(csConf); capacityScheduler.Start(); ServiceOperations.StopQuietly(capacityScheduler); }
public virtual void TestQueueParsingWhenLabelsNotExist() { YarnConfiguration conf = new YarnConfiguration(); CapacitySchedulerConfiguration csConf = new CapacitySchedulerConfiguration(conf); SetupQueueConfigurationWithLabels(csConf); CapacityScheduler capacityScheduler = new CapacityScheduler(); RMContextImpl rmContext = new RMContextImpl(null, null, null, null, null, null, new RMContainerTokenSecretManager(csConf), new NMTokenSecretManagerInRM(csConf), new ClientToAMTokenSecretManagerInRM(), null); RMNodeLabelsManager nodeLabelsManager = new NullRMNodeLabelsManager(); nodeLabelsManager.Init(conf); nodeLabelsManager.Start(); rmContext.SetNodeLabelManager(nodeLabelsManager); capacityScheduler.SetConf(csConf); capacityScheduler.SetRMContext(rmContext); capacityScheduler.Init(csConf); capacityScheduler.Start(); ServiceOperations.StopQuietly(capacityScheduler); ServiceOperations.StopQuietly(nodeLabelsManager); }
/// <exception cref="System.Exception"/> public virtual void TestAppAttemptMetrics() { AsyncDispatcher dispatcher = new InlineDispatcher(); FifoScheduler scheduler = new FifoScheduler(); RMApplicationHistoryWriter writer = Org.Mockito.Mockito.Mock <RMApplicationHistoryWriter >(); RMContext rmContext = new RMContextImpl(dispatcher, null, null, null, null, null, null, null, null, scheduler); ((RMContextImpl)rmContext).SetSystemMetricsPublisher(Org.Mockito.Mockito.Mock <SystemMetricsPublisher >()); Configuration conf = new Configuration(); scheduler.SetRMContext(rmContext); scheduler.Init(conf); scheduler.Start(); scheduler.Reinitialize(conf, rmContext); QueueMetrics metrics = scheduler.GetRootQueueMetrics(); int beforeAppsSubmitted = metrics.GetAppsSubmitted(); ApplicationId appId = BuilderUtils.NewApplicationId(200, 1); ApplicationAttemptId appAttemptId = BuilderUtils.NewApplicationAttemptId(appId, 1 ); SchedulerEvent appEvent = new AppAddedSchedulerEvent(appId, "queue", "user"); scheduler.Handle(appEvent); SchedulerEvent attemptEvent = new AppAttemptAddedSchedulerEvent(appAttemptId, false ); scheduler.Handle(attemptEvent); appAttemptId = BuilderUtils.NewApplicationAttemptId(appId, 2); SchedulerEvent attemptEvent2 = new AppAttemptAddedSchedulerEvent(appAttemptId, false ); scheduler.Handle(attemptEvent2); int afterAppsSubmitted = metrics.GetAppsSubmitted(); NUnit.Framework.Assert.AreEqual(1, afterAppsSubmitted - beforeAppsSubmitted); scheduler.Stop(); }
public virtual void TestAppsRace() { // mock up an RM that returns app reports for apps that don't exist // in the RMApps list ApplicationId appId = ApplicationId.NewInstance(1, 1); ApplicationReport mockReport = Org.Mockito.Mockito.Mock <ApplicationReport>(); Org.Mockito.Mockito.When(mockReport.GetApplicationId()).ThenReturn(appId); GetApplicationsResponse mockAppsResponse = Org.Mockito.Mockito.Mock <GetApplicationsResponse >(); Org.Mockito.Mockito.When(mockAppsResponse.GetApplicationList()).ThenReturn(Arrays .AsList(new ApplicationReport[] { mockReport })); ClientRMService mockClientSvc = Org.Mockito.Mockito.Mock <ClientRMService>(); Org.Mockito.Mockito.When(mockClientSvc.GetApplications(Matchers.IsA <GetApplicationsRequest >(), Matchers.AnyBoolean())).ThenReturn(mockAppsResponse); ResourceManager mockRM = Org.Mockito.Mockito.Mock <ResourceManager>(); RMContextImpl rmContext = new RMContextImpl(null, null, null, null, null, null, null , null, null, null); Org.Mockito.Mockito.When(mockRM.GetRMContext()).ThenReturn(rmContext); Org.Mockito.Mockito.When(mockRM.GetClientRMService()).ThenReturn(mockClientSvc); RMWebServices webSvc = new RMWebServices(mockRM, new Configuration(), Org.Mockito.Mockito.Mock <HttpServletResponse>()); ICollection <string> emptySet = Collections.UnmodifiableSet(Collections.EmptySet <string >()); // verify we don't get any apps when querying HttpServletRequest mockHsr = Org.Mockito.Mockito.Mock <HttpServletRequest>(); AppsInfo appsInfo = webSvc.GetApps(mockHsr, null, emptySet, null, null, null, null , null, null, null, null, emptySet, emptySet); NUnit.Framework.Assert.IsTrue(appsInfo.GetApps().IsEmpty()); // verify we don't get an NPE when specifying a final status query appsInfo = webSvc.GetApps(mockHsr, null, emptySet, "FAILED", null, null, null, null , null, null, null, emptySet, emptySet); NUnit.Framework.Assert.IsTrue(appsInfo.GetApps().IsEmpty()); }
public virtual void SetUp() { Configuration conf = new Configuration(); // Dispatcher that processes events inline Dispatcher dispatcher = new InlineDispatcher(); dispatcher.Register(typeof(SchedulerEventType), new _EventHandler_65()); // ignore RMContext context = new RMContextImpl(dispatcher, null, null, null, null, null, new RMContainerTokenSecretManager(conf), new NMTokenSecretManagerInRM(conf), null, null ); dispatcher.Register(typeof(RMNodeEventType), new ResourceManager.NodeEventDispatcher (context)); NodesListManager nodesListManager = new NodesListManager(context); nodesListManager.Init(conf); context.GetContainerTokenSecretManager().RollMasterKey(); context.GetNMTokenSecretManager().RollMasterKey(); resourceTrackerService = new ResourceTrackerService(context, nodesListManager, new NMLivelinessMonitor(dispatcher), context.GetContainerTokenSecretManager(), context .GetNMTokenSecretManager()); resourceTrackerService.Init(conf); }
public TestRMSecretManagerService(TestContainerAllocation _enclosing, Configuration conf, RMContextImpl rmContext) : base(conf, rmContext) { this._enclosing = _enclosing; }
/// <exception cref="System.Exception"/> public virtual void TestUpdateResourceOnNode() { AsyncDispatcher dispatcher = new InlineDispatcher(); Configuration conf = new Configuration(); RMContainerTokenSecretManager containerTokenSecretManager = new RMContainerTokenSecretManager (conf); containerTokenSecretManager.RollMasterKey(); NMTokenSecretManagerInRM nmTokenSecretManager = new NMTokenSecretManagerInRM(conf ); nmTokenSecretManager.RollMasterKey(); RMApplicationHistoryWriter writer = Org.Mockito.Mockito.Mock <RMApplicationHistoryWriter >(); FifoScheduler scheduler = new _FifoScheduler_275(this); RMContext rmContext = new RMContextImpl(dispatcher, null, null, null, null, null, containerTokenSecretManager, nmTokenSecretManager, null, scheduler); rmContext.SetSystemMetricsPublisher(Org.Mockito.Mockito.Mock <SystemMetricsPublisher >()); rmContext.SetRMApplicationHistoryWriter(Org.Mockito.Mockito.Mock <RMApplicationHistoryWriter >()); ((RMContextImpl)rmContext).SetYarnConfiguration(new YarnConfiguration()); scheduler.SetRMContext(rmContext); scheduler.Init(conf); scheduler.Start(); scheduler.Reinitialize(new Configuration(), rmContext); RMNode node0 = MockNodes.NewNodeInfo(1, Resources.CreateResource(2048, 4), 1, "127.0.0.1" ); NodeAddedSchedulerEvent nodeEvent1 = new NodeAddedSchedulerEvent(node0); scheduler.Handle(nodeEvent1); MethodInfo method = Sharpen.Runtime.GetDeclaredMethod(scheduler.GetType(), "getNodes" ); IDictionary <NodeId, FiCaSchedulerNode> schedulerNodes = (IDictionary <NodeId, FiCaSchedulerNode >)method.Invoke(scheduler); NUnit.Framework.Assert.AreEqual(schedulerNodes.Values.Count, 1); Org.Apache.Hadoop.Yarn.Api.Records.Resource newResource = Resources.CreateResource (1024, 4); NodeResourceUpdateSchedulerEvent node0ResourceUpdate = new NodeResourceUpdateSchedulerEvent (node0, ResourceOption.NewInstance(newResource, RMNode.OverCommitTimeoutMillisDefault )); scheduler.Handle(node0ResourceUpdate); // SchedulerNode's total resource and available resource are changed. NUnit.Framework.Assert.AreEqual(schedulerNodes[node0.GetNodeID()].GetTotalResource ().GetMemory(), 1024); NUnit.Framework.Assert.AreEqual(schedulerNodes[node0.GetNodeID()].GetAvailableResource ().GetMemory(), 1024); QueueInfo queueInfo = scheduler.GetQueueInfo(null, false, false); NUnit.Framework.Assert.AreEqual(0.0f, queueInfo.GetCurrentCapacity(), 0.0f); int _appId = 1; int _appAttemptId = 1; ApplicationAttemptId appAttemptId = CreateAppAttemptId(_appId, _appAttemptId); CreateMockRMApp(appAttemptId, rmContext); AppAddedSchedulerEvent appEvent = new AppAddedSchedulerEvent(appAttemptId.GetApplicationId (), "queue1", "user1"); scheduler.Handle(appEvent); AppAttemptAddedSchedulerEvent attemptEvent = new AppAttemptAddedSchedulerEvent(appAttemptId , false); scheduler.Handle(attemptEvent); int memory = 1024; int priority = 1; IList <ResourceRequest> ask = new AList <ResourceRequest>(); ResourceRequest nodeLocal = CreateResourceRequest(memory, node0.GetHostName(), priority , 1); ResourceRequest rackLocal = CreateResourceRequest(memory, node0.GetRackName(), priority , 1); ResourceRequest any = CreateResourceRequest(memory, ResourceRequest.Any, priority , 1); ask.AddItem(nodeLocal); ask.AddItem(rackLocal); ask.AddItem(any); scheduler.Allocate(appAttemptId, ask, new AList <ContainerId>(), null, null); // Before the node update event, there are one local request NUnit.Framework.Assert.AreEqual(1, nodeLocal.GetNumContainers()); NodeUpdateSchedulerEvent node0Update = new NodeUpdateSchedulerEvent(node0); // Now schedule. scheduler.Handle(node0Update); // After the node update event, check no local request NUnit.Framework.Assert.AreEqual(0, nodeLocal.GetNumContainers()); // Also check that one container was scheduled SchedulerAppReport info = scheduler.GetSchedulerAppInfo(appAttemptId); NUnit.Framework.Assert.AreEqual(1, info.GetLiveContainers().Count); // And check the default Queue now is full. queueInfo = scheduler.GetQueueInfo(null, false, false); NUnit.Framework.Assert.AreEqual(1.0f, queueInfo.GetCurrentCapacity(), 0.0f); }
/// <exception cref="System.Exception"/> public virtual void TestNodeLocalAssignment() { AsyncDispatcher dispatcher = new InlineDispatcher(); Configuration conf = new Configuration(); RMContainerTokenSecretManager containerTokenSecretManager = new RMContainerTokenSecretManager (conf); containerTokenSecretManager.RollMasterKey(); NMTokenSecretManagerInRM nmTokenSecretManager = new NMTokenSecretManagerInRM(conf ); nmTokenSecretManager.RollMasterKey(); RMApplicationHistoryWriter writer = Org.Mockito.Mockito.Mock <RMApplicationHistoryWriter >(); FifoScheduler scheduler = new FifoScheduler(); RMContext rmContext = new RMContextImpl(dispatcher, null, null, null, null, null, containerTokenSecretManager, nmTokenSecretManager, null, scheduler); rmContext.SetSystemMetricsPublisher(Org.Mockito.Mockito.Mock <SystemMetricsPublisher >()); rmContext.SetRMApplicationHistoryWriter(Org.Mockito.Mockito.Mock <RMApplicationHistoryWriter >()); ((RMContextImpl)rmContext).SetYarnConfiguration(new YarnConfiguration()); scheduler.SetRMContext(rmContext); scheduler.Init(conf); scheduler.Start(); scheduler.Reinitialize(new Configuration(), rmContext); RMNode node0 = MockNodes.NewNodeInfo(1, Resources.CreateResource(1024 * 64), 1, "127.0.0.1" ); NodeAddedSchedulerEvent nodeEvent1 = new NodeAddedSchedulerEvent(node0); scheduler.Handle(nodeEvent1); int _appId = 1; int _appAttemptId = 1; ApplicationAttemptId appAttemptId = CreateAppAttemptId(_appId, _appAttemptId); CreateMockRMApp(appAttemptId, rmContext); AppAddedSchedulerEvent appEvent = new AppAddedSchedulerEvent(appAttemptId.GetApplicationId (), "queue1", "user1"); scheduler.Handle(appEvent); AppAttemptAddedSchedulerEvent attemptEvent = new AppAttemptAddedSchedulerEvent(appAttemptId , false); scheduler.Handle(attemptEvent); int memory = 64; int nConts = 3; int priority = 20; IList <ResourceRequest> ask = new AList <ResourceRequest>(); ResourceRequest nodeLocal = CreateResourceRequest(memory, node0.GetHostName(), priority , nConts); ResourceRequest rackLocal = CreateResourceRequest(memory, node0.GetRackName(), priority , nConts); ResourceRequest any = CreateResourceRequest(memory, ResourceRequest.Any, priority , nConts); ask.AddItem(nodeLocal); ask.AddItem(rackLocal); ask.AddItem(any); scheduler.Allocate(appAttemptId, ask, new AList <ContainerId>(), null, null); NodeUpdateSchedulerEvent node0Update = new NodeUpdateSchedulerEvent(node0); // Before the node update event, there are 3 local requests outstanding NUnit.Framework.Assert.AreEqual(3, nodeLocal.GetNumContainers()); scheduler.Handle(node0Update); // After the node update event, check that there are no more local requests // outstanding NUnit.Framework.Assert.AreEqual(0, nodeLocal.GetNumContainers()); //Also check that the containers were scheduled SchedulerAppReport info = scheduler.GetSchedulerAppInfo(appAttemptId); NUnit.Framework.Assert.AreEqual(3, info.GetLiveContainers().Count); scheduler.Stop(); }
public _RMSecretManagerService_357(AtomicReference <AMRMTokenSecretManager> spySecretMgrRef , Configuration baseArg1, RMContextImpl baseArg2) : base(baseArg1, baseArg2) { this.spySecretMgrRef = spySecretMgrRef; }
public _RMSecretManagerService_169(Configuration baseArg1, RMContextImpl baseArg2 ) : base(baseArg1, baseArg2) { }