@Override public RefreshClusterMaxPriorityResponse refreshClusterMaxPriority( RefreshClusterMaxPriorityRequest request) throws YarnException, IOException { final String operation = "refreshClusterMaxPriority"; final String msg = "refresh cluster max priority"; UserGroupInformation user = checkAcls(operation); checkRMStatus(user.getShortUserName(), operation, msg); try { refreshClusterMaxPriority(); RMAuditLogger .logSuccess(user.getShortUserName(), operation, "AdminService"); return recordFactory .newRecordInstance(RefreshClusterMaxPriorityResponse.class); } catch (YarnException e) { throw logAndWrapException(e, user.getShortUserName(), operation, msg); } }
@VisibleForTesting void refreshAll() throws ServiceFailedException { try { checkAcls("refreshAll"); if (isSchedulerMutable()) { try { ((MutableConfScheduler) rm.getRMContext().getScheduler()) .getMutableConfProvider().reloadConfigurationFromStore(); } catch (Exception e) { throw new IOException("Failed to refresh configuration:", e); } } refreshQueues(); refreshNodes(); refreshSuperUserGroupsConfiguration(); refreshUserToGroupsMappings(); if (getConfig().getBoolean( CommonConfigurationKeysPublic.HADOOP_SECURITY_AUTHORIZATION, false)) { refreshServiceAcls(); } refreshClusterMaxPriority(); } catch (Exception ex) { throw new ServiceFailedException("RefreshAll operation failed", ex); } }
@Test(timeout = 30000) public void testAdminRefreshClusterMaxPriority() throws Exception, YarnException { configuration.set(YarnConfiguration.RM_CONFIGURATION_PROVIDER_CLASS, "org.apache.hadoop.yarn.FileSystemBasedConfigurationProvider"); uploadDefaultConfiguration(); YarnConfiguration yarnConf = new YarnConfiguration(); yarnConf.set(YarnConfiguration.MAX_CLUSTER_LEVEL_APPLICATION_PRIORITY, "5"); uploadConfiguration(yarnConf, "yarn-site.xml"); rm = new MockRM(configuration); rm.init(configuration); rm.start(); CapacityScheduler cs = (CapacityScheduler) rm.getRMContext().getScheduler(); Assert.assertEquals(5, cs.getMaxClusterLevelAppPriority().getPriority()); yarnConf = new YarnConfiguration(); yarnConf .set(YarnConfiguration.MAX_CLUSTER_LEVEL_APPLICATION_PRIORITY, "10"); uploadConfiguration(yarnConf, "yarn-site.xml"); try { rm.adminService .refreshClusterMaxPriority(RefreshClusterMaxPriorityRequest .newInstance()); Assert.assertEquals(10, cs.getMaxClusterLevelAppPriority().getPriority()); } catch (Exception ex) { fail("Could not refresh cluster max priority."); } }