Example #1
0
        /// <exception cref="Org.Apache.Hadoop.Yarn.Exceptions.YarnException"/>
        /// <exception cref="Org.Apache.Hadoop.Ipc.StandbyException"/>
        public virtual RefreshQueuesResponse RefreshQueues(RefreshQueuesRequest request)
        {
            string argName            = "refreshQueues";
            string msg                = "refresh queues.";
            UserGroupInformation user = CheckAcls(argName);

            CheckRMStatus(user.GetShortUserName(), argName, msg);
            RefreshQueuesResponse response = recordFactory.NewRecordInstance <RefreshQueuesResponse
                                                                              >();

            try
            {
                rmContext.GetScheduler().Reinitialize(GetConfig(), this.rmContext);
                // refresh the reservation system
                ReservationSystem rSystem = rmContext.GetReservationSystem();
                if (rSystem != null)
                {
                    rSystem.Reinitialize(GetConfig(), rmContext);
                }
                RMAuditLogger.LogSuccess(user.GetShortUserName(), argName, "AdminService");
                return(response);
            }
            catch (IOException ioe)
            {
                throw LogAndWrapException(ioe, user.GetShortUserName(), argName, msg);
            }
        }
Example #2
0
        public virtual void TestAdminRefreshQueuesWithFileSystemBasedConfigurationProvider
            ()
        {
            configuration.Set(YarnConfiguration.RmConfigurationProviderClass, "org.apache.hadoop.yarn.FileSystemBasedConfigurationProvider"
                              );
            //upload default configurations
            UploadDefaultConfiguration();
            try
            {
                rm = new MockRM(configuration);
                rm.Init(configuration);
                rm.Start();
            }
            catch (Exception)
            {
                NUnit.Framework.Assert.Fail("Should not get any exceptions");
            }
            CapacityScheduler cs = (CapacityScheduler)rm.GetRMContext().GetScheduler();
            int maxAppsBefore    = cs.GetConfiguration().GetMaximumSystemApplications();
            CapacitySchedulerConfiguration csConf = new CapacitySchedulerConfiguration();

            csConf.Set("yarn.scheduler.capacity.maximum-applications", "5000");
            UploadConfiguration(csConf, "capacity-scheduler.xml");
            rm.adminService.RefreshQueues(RefreshQueuesRequest.NewInstance());
            int maxAppsAfter = cs.GetConfiguration().GetMaximumSystemApplications();

            NUnit.Framework.Assert.AreEqual(maxAppsAfter, 5000);
            NUnit.Framework.Assert.IsTrue(maxAppsAfter != maxAppsBefore);
        }
Example #3
0
        public virtual void TestRefreshQueues()
        {
            RefreshQueuesRequest request = recordFactory.NewRecordInstance <RefreshQueuesRequest
                                                                            >();
            RefreshQueuesResponse response = client.RefreshQueues(request);

            NUnit.Framework.Assert.IsNotNull(response);
        }
Example #4
0
        /// <exception cref="System.IO.IOException"/>
        /// <exception cref="Org.Apache.Hadoop.Yarn.Exceptions.YarnException"/>
        private int RefreshQueues()
        {
            // Refresh the queue properties
            ResourceManagerAdministrationProtocol adminProtocol = CreateAdminProtocol();
            RefreshQueuesRequest request = recordFactory.NewRecordInstance <RefreshQueuesRequest
                                                                            >();

            adminProtocol.RefreshQueues(request);
            return(0);
        }
Example #5
0
 /// <exception cref="Org.Apache.Hadoop.Yarn.Exceptions.YarnException"/>
 /// <exception cref="System.IO.IOException"/>
 public virtual RefreshQueuesResponse RefreshQueues(RefreshQueuesRequest request)
 {
     YarnServerResourceManagerServiceProtos.RefreshQueuesRequestProto requestProto = (
         (RefreshQueuesRequestPBImpl)request).GetProto();
     try
     {
         return(new RefreshQueuesResponsePBImpl(proxy.RefreshQueues(null, requestProto)));
     }
     catch (ServiceException e)
     {
         RPCUtil.UnwrapAndThrowException(e);
         return(null);
     }
 }
Example #6
0
 /// <exception cref="Org.Apache.Hadoop.HA.ServiceFailedException"/>
 private void RefreshAll()
 {
     try
     {
         RefreshQueues(RefreshQueuesRequest.NewInstance());
         RefreshNodes(RefreshNodesRequest.NewInstance());
         RefreshSuperUserGroupsConfiguration(RefreshSuperUserGroupsConfigurationRequest.NewInstance
                                                 ());
         RefreshUserToGroupsMappings(RefreshUserToGroupsMappingsRequest.NewInstance());
         if (GetConfig().GetBoolean(CommonConfigurationKeysPublic.HadoopSecurityAuthorization
                                    , false))
         {
             RefreshServiceAcls(RefreshServiceAclsRequest.NewInstance());
         }
     }
     catch (Exception ex)
     {
         throw new ServiceFailedException(ex.Message);
     }
 }
Example #7
0
        public virtual void TestAdminRefreshQueuesWithLocalConfigurationProvider()
        {
            rm = new MockRM(configuration);
            rm.Init(configuration);
            rm.Start();
            CapacityScheduler cs = (CapacityScheduler)rm.GetRMContext().GetScheduler();
            int maxAppsBefore    = cs.GetConfiguration().GetMaximumSystemApplications();

            try
            {
                rm.adminService.RefreshQueues(RefreshQueuesRequest.NewInstance());
                NUnit.Framework.Assert.AreEqual(maxAppsBefore, cs.GetConfiguration().GetMaximumSystemApplications
                                                    ());
            }
            catch (Exception)
            {
                NUnit.Framework.Assert.Fail("Using localConfigurationProvider. Should not get any exception."
                                            );
            }
        }
Example #8
0
        public virtual void TestRMHAWithFileSystemBasedConfiguration()
        {
            HAServiceProtocol.StateChangeRequestInfo requestInfo = new HAServiceProtocol.StateChangeRequestInfo
                                                                       (HAServiceProtocol.RequestSource.RequestByUser);
            configuration.Set(YarnConfiguration.RmConfigurationProviderClass, "org.apache.hadoop.yarn.FileSystemBasedConfigurationProvider"
                              );
            configuration.SetBoolean(YarnConfiguration.RmHaEnabled, true);
            configuration.SetBoolean(YarnConfiguration.AutoFailoverEnabled, false);
            configuration.Set(YarnConfiguration.RmHaIds, "rm1,rm2");
            int @base = 100;

            foreach (string confKey in YarnConfiguration.GetServiceAddressConfKeys(configuration
                                                                                   ))
            {
                configuration.Set(HAUtil.AddSuffix(confKey, "rm1"), "0.0.0.0:" + (@base + 20));
                configuration.Set(HAUtil.AddSuffix(confKey, "rm2"), "0.0.0.0:" + (@base + 40));
                @base = @base * 2;
            }
            Configuration conf1 = new Configuration(configuration);

            conf1.Set(YarnConfiguration.RmHaId, "rm1");
            Configuration conf2 = new Configuration(configuration);

            conf2.Set(YarnConfiguration.RmHaId, "rm2");
            // upload default configurations
            UploadDefaultConfiguration();
            MockRM rm1 = null;
            MockRM rm2 = null;

            try
            {
                rm1 = new MockRM(conf1);
                rm1.Init(conf1);
                rm1.Start();
                NUnit.Framework.Assert.IsTrue(rm1.GetRMContext().GetHAServiceState() == HAServiceProtocol.HAServiceState
                                              .Standby);
                rm2 = new MockRM(conf2);
                rm2.Init(conf1);
                rm2.Start();
                NUnit.Framework.Assert.IsTrue(rm2.GetRMContext().GetHAServiceState() == HAServiceProtocol.HAServiceState
                                              .Standby);
                rm1.adminService.TransitionToActive(requestInfo);
                NUnit.Framework.Assert.IsTrue(rm1.GetRMContext().GetHAServiceState() == HAServiceProtocol.HAServiceState
                                              .Active);
                CapacitySchedulerConfiguration csConf = new CapacitySchedulerConfiguration();
                csConf.Set("yarn.scheduler.capacity.maximum-applications", "5000");
                UploadConfiguration(csConf, "capacity-scheduler.xml");
                rm1.adminService.RefreshQueues(RefreshQueuesRequest.NewInstance());
                int maxApps = ((CapacityScheduler)rm1.GetRMContext().GetScheduler()).GetConfiguration
                                  ().GetMaximumSystemApplications();
                NUnit.Framework.Assert.AreEqual(maxApps, 5000);
                // Before failover happens, the maxApps is
                // still the default value on the standby rm : rm2
                int maxAppsBeforeFailOver = ((CapacityScheduler)rm2.GetRMContext().GetScheduler()
                                             ).GetConfiguration().GetMaximumSystemApplications();
                NUnit.Framework.Assert.AreEqual(maxAppsBeforeFailOver, 10000);
                // Do the failover
                rm1.adminService.TransitionToStandby(requestInfo);
                rm2.adminService.TransitionToActive(requestInfo);
                NUnit.Framework.Assert.IsTrue(rm1.GetRMContext().GetHAServiceState() == HAServiceProtocol.HAServiceState
                                              .Standby);
                NUnit.Framework.Assert.IsTrue(rm2.GetRMContext().GetHAServiceState() == HAServiceProtocol.HAServiceState
                                              .Active);
                int maxAppsAfter = ((CapacityScheduler)rm2.GetRMContext().GetScheduler()).GetConfiguration
                                       ().GetMaximumSystemApplications();
                NUnit.Framework.Assert.AreEqual(maxAppsAfter, 5000);
            }
            finally
            {
                if (rm1 != null)
                {
                    rm1.Stop();
                }
                if (rm2 != null)
                {
                    rm2.Stop();
                }
            }
        }