예제 #1
0
        /// <exception cref="System.IO.IOException"/>
        private void InitializeNodeLabels()
        {
            RMContext rmContext = distShellTest.yarnCluster.GetResourceManager(0).GetRMContext
                                      ();
            // Setup node labels
            RMNodeLabelsManager  labelsMgr = rmContext.GetNodeLabelManager();
            ICollection <string> labels    = new HashSet <string>();

            labels.AddItem("x");
            labelsMgr.AddToCluserNodeLabels(labels);
            // Setup queue access to node labels
            distShellTest.conf.Set("yarn.scheduler.capacity.root.accessible-node-labels", "x"
                                   );
            distShellTest.conf.Set("yarn.scheduler.capacity.root.accessible-node-labels.x.capacity"
                                   , "100");
            distShellTest.conf.Set("yarn.scheduler.capacity.root.default.accessible-node-labels"
                                   , "x");
            distShellTest.conf.Set("yarn.scheduler.capacity.root.default.accessible-node-labels.x.capacity"
                                   , "100");
            rmContext.GetScheduler().Reinitialize(distShellTest.conf, rmContext);
            // Fetch node-ids from yarn cluster
            NodeId[] nodeIds = new NodeId[NumNms];
            for (int i = 0; i < NumNms; i++)
            {
                NodeManager mgr = distShellTest.yarnCluster.GetNodeManager(i);
                nodeIds[i] = mgr.GetNMContext().GetNodeId();
            }
            // Set label x to NM[1]
            labelsMgr.AddLabelsToNode(ImmutableMap.Of(nodeIds[1], labels));
        }
예제 #2
0
        public virtual void TestQueueParsingReinitializeWithLabels()
        {
            nodeLabelManager.AddToCluserNodeLabels(ImmutableSet.Of("red", "blue"));
            CapacitySchedulerConfiguration csConf = new CapacitySchedulerConfiguration();

            SetupQueueConfigurationWithoutLabels(csConf);
            YarnConfiguration conf = new YarnConfiguration(csConf);
            CapacityScheduler capacityScheduler = new CapacityScheduler();
            RMContextImpl     rmContext         = new RMContextImpl(null, null, null, null, null, null, new
                                                                    RMContainerTokenSecretManager(conf), new NMTokenSecretManagerInRM(conf), new ClientToAMTokenSecretManagerInRM
                                                                        (), null);

            rmContext.SetNodeLabelManager(nodeLabelManager);
            capacityScheduler.SetConf(conf);
            capacityScheduler.SetRMContext(rmContext);
            capacityScheduler.Init(conf);
            capacityScheduler.Start();
            csConf = new CapacitySchedulerConfiguration();
            SetupQueueConfigurationWithLabels(csConf);
            conf = new YarnConfiguration(csConf);
            capacityScheduler.Reinitialize(conf, rmContext);
            CheckQueueLabels(capacityScheduler);
            ServiceOperations.StopQuietly(capacityScheduler);
        }