public virtual void TestRefreshNodesWithLocalConfigurationProvider() { rm = new MockRM(configuration); rm.Init(configuration); rm.Start(); try { rm.adminService.RefreshNodes(RefreshNodesRequest.NewInstance()); } catch (Exception) { NUnit.Framework.Assert.Fail("Using localConfigurationProvider. Should not get any exception." ); } }
public virtual void TestRefreshNodesWithFileSystemBasedConfigurationProvider() { 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"); } FilePath excludeHostsFile = new FilePath(tmpDir.ToString(), "excludeHosts"); if (excludeHostsFile.Exists()) { excludeHostsFile.Delete(); } if (!excludeHostsFile.CreateNewFile()) { NUnit.Framework.Assert.Fail("Can not create " + "excludeHosts"); } PrintWriter fileWriter = new PrintWriter(excludeHostsFile); fileWriter.Write("0.0.0.0:123"); fileWriter.Close(); UploadToRemoteFileSystem(new Path(excludeHostsFile.GetAbsolutePath())); Configuration yarnConf = new YarnConfiguration(); yarnConf.Set(YarnConfiguration.RmNodesExcludeFilePath, this.workingPath + "/excludeHosts" ); UploadConfiguration(yarnConf, YarnConfiguration.YarnSiteConfigurationFile); rm.adminService.RefreshNodes(RefreshNodesRequest.NewInstance()); ICollection <string> excludeHosts = rm.GetNodesListManager().GetHostsReader().GetExcludedHosts (); NUnit.Framework.Assert.IsTrue(excludeHosts.Count == 1); NUnit.Framework.Assert.IsTrue(excludeHosts.Contains("0.0.0.0:123")); }
/// <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); } }