diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/conf/RemoteConfiguration.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/conf/RemoteConfiguration.java new file mode 100644 index 0000000..ba187bd --- /dev/null +++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/conf/RemoteConfiguration.java @@ -0,0 +1,64 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.hadoop.yarn.conf; + +import java.io.IOException; + +import org.apache.hadoop.classification.InterfaceAudience.Private; +import org.apache.hadoop.classification.InterfaceStability.Unstable; +import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.yarn.exceptions.YarnException; + +@Private +@Unstable +/** + * Base class to implement remoteConfiguration. + * Real remoteConfiguration implementations need to derive from it and + * implement load methods to actually load the remoteConfiguration. + */ +public abstract class RemoteConfiguration extends Configuration { + + public void init(Configuration conf) throws Exception { + initInternal(conf); + } + + public void close() throws Exception { + closeInternal(); + } + + /** + * Get the remote configuration. + * @param name The configuration file name + * @return remoteConfiguration + * @throws YarnException + * @throws IOException + */ + public abstract Configuration getConfiguration(String name) + throws YarnException, IOException; + + /** + * Derived classes initialize themselves using this method. + */ + public abstract void initInternal(Configuration conf) throws Exception; + + /** + * Derived classes close themselves using this method. + */ + public abstract void closeInternal() throws Exception; +} diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/conf/RemoteConfigurationFactory.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/conf/RemoteConfigurationFactory.java new file mode 100644 index 0000000..32683fe --- /dev/null +++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/conf/RemoteConfigurationFactory.java @@ -0,0 +1,57 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.hadoop.yarn.conf; + +import org.apache.hadoop.classification.InterfaceAudience.Private; +import org.apache.hadoop.classification.InterfaceStability.Unstable; +import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.util.ReflectionUtils; +import org.apache.hadoop.yarn.exceptions.YarnRuntimeException; + +@Private +@Unstable +/** + * Factory for {@link RemoteConfiguration} implementations. + */ +public class RemoteConfigurationFactory { + + /** + * Creates an instance of {@link RemoteConfiguration} using given + * configuration. + * @param conf + * @return remoteConfiguration + */ + @SuppressWarnings("unchecked") + public static RemoteConfiguration getRemoteConfiguration(Configuration conf) { + Class defaultProviderClass; + try { + defaultProviderClass = (Class) + Class.forName( + YarnConfiguration.DEFAULT_RM_REMOTE_CONFIGURATION); + } catch (Exception e) { + throw new YarnRuntimeException("Invalid default remote configuration " + + "class" + YarnConfiguration.DEFAULT_RM_REMOTE_CONFIGURATION, e); + } + RemoteConfiguration remoteConfiguration = + ReflectionUtils.newInstance( + conf.getClass(YarnConfiguration.RM_REMOTE_CONFIGURATION, + defaultProviderClass, RemoteConfiguration.class), conf); + return remoteConfiguration; + } +} diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/conf/YarnConfiguration.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/conf/YarnConfiguration.java index 32665d7..0bd893a 100644 --- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/conf/YarnConfiguration.java +++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/conf/YarnConfiguration.java @@ -37,6 +37,8 @@ @Evolving public class YarnConfiguration extends Configuration { + public static final String CS_CONFIGURATION_FILE= "capacity-scheduler.xml"; + private static final String YARN_DEFAULT_XML_FILE = "yarn-default.xml"; private static final String YARN_SITE_XML_FILE = "yarn-site.xml"; @@ -329,6 +331,22 @@ public static final String RM_HA_IDS = RM_HA_PREFIX + "rm-ids"; public static final String RM_HA_ID = RM_HA_PREFIX + "id"; + /** Store the related configuration files in File System */ + public static final String FS_RM_CONF_STORE = RM_PREFIX + + "remote-configuration.store"; + public static final String DEFAULT_FS_RM_CONF_STORE = "/yarn/conf"; + + public static final String RM_REMOTE_CONFIGURATION = RM_PREFIX + + "remote-configuration.class"; + public static final String DEFAULT_RM_REMOTE_CONFIGURATION = + "org.apache.hadoop.yarn.FileSystemBasedRemoteConfiguration"; + + @Private + public static final String RM_HA_REMOTE_CONFIGURATION_ENABLED = RM_HA_PREFIX + + "remote-configuration.enabled"; + public static final boolean DEFAULT_RM_HA_REMOTE_CONFIGURATION_ENABLED = + false; + @Private public static final List RM_SERVICES_ADDRESS_CONF_KEYS = Collections.unmodifiableList(Arrays.asList( diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/TestRMFailover.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/TestRMFailover.java index 8900b16..b568c25 100644 --- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/TestRMFailover.java +++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/TestRMFailover.java @@ -23,6 +23,9 @@ import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; +import java.io.DataOutputStream; +import java.io.File; +import java.io.FileOutputStream; import java.io.IOException; import java.net.HttpURLConnection; import java.net.URL; @@ -30,6 +33,9 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.fs.FileStatus; +import org.apache.hadoop.fs.FileSystem; +import org.apache.hadoop.fs.Path; import org.apache.hadoop.ha.ClientBaseWithFixes; import org.apache.hadoop.ha.HAServiceProtocol; import org.apache.hadoop.ha.proto.HAServiceProtocolProtos; @@ -41,7 +47,10 @@ import org.apache.hadoop.yarn.exceptions.ApplicationNotFoundException; import org.apache.hadoop.yarn.exceptions.YarnException; import org.apache.hadoop.yarn.server.MiniYARNCluster; +import org.apache.hadoop.yarn.server.api.protocolrecords.RefreshQueuesRequest; import org.apache.hadoop.yarn.server.resourcemanager.AdminService; +import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacityScheduler; +import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacitySchedulerConfiguration; import org.apache.hadoop.yarn.server.webproxy.WebAppProxyServer; import org.junit.After; import org.junit.Assert; @@ -63,6 +72,8 @@ private Configuration conf; private MiniYARNCluster cluster; private ApplicationId fakeAppId; + private FileSystem fs; + private Path workingPath; private void setConfForRM(String rmId, String prefix, String value) { @@ -98,6 +109,9 @@ public void setup() throws IOException { conf.setBoolean(YarnConfiguration.YARN_MINICLUSTER_FIXED_PORTS, true); conf.setBoolean(YarnConfiguration.YARN_MINICLUSTER_USE_RPC, true); + fs = FileSystem.get(conf); + workingPath = new Path(fs.getHomeDirectory(), "confStore"); + conf.set(YarnConfiguration.FS_RM_CONF_STORE, workingPath.toString()); cluster = new MiniYARNCluster(TestRMFailover.class.getName(), 2, 1, 1, 1); } @@ -252,4 +266,113 @@ private void verifyExpectedException(String exceptionMessage){ .contains("Application with id '" + fakeAppId + "' " + "doesn't exist in RM.")); } + + @Test + public void testAdminRefreshQueuesWithRemoteConfigurationSwitchOff() + throws IOException, YarnException { + cluster.init(conf); + cluster.start(); + getAdminService(0).transitionToActive(req); + assertFalse("RM never turned active", -1 == cluster.getActiveRMIndex()); + + // clean the remoteDirectory + cleanRemoteDirectory(); + + CapacityScheduler cs = + (CapacityScheduler) cluster.getResourceManager(0).getRMContext() + .getScheduler(); + int maxAppsBefore = cs.getConfiguration().getMaximumSystemApplications(); + + // the default value of RM_HA_REMOTE_CONFIGURATION_ENABLED is false. + // Even in HA, it will still use local configuration to do the refresh. + try { + getAdminService(0).refreshQueues(RefreshQueuesRequest.newInstance()); + Assert.assertEquals(maxAppsBefore, cs.getConfiguration() + .getMaximumSystemApplications()); + } catch (Exception ex) { + fail("The HA is enabled, but RM_HA_REMOTE_CONFIGURATION_ENABLED" + + " is set as false. Should not get any exception" + ex.getMessage()); + } + } + + @Test + public void testAdminRefreshQueuesWithRemoteConfigurationSwitchOn() + throws IOException, YarnException { + // switch RM_HA_REMOTE_CONFIGURATION_ENABLED to true + conf.setBoolean(YarnConfiguration.RM_HA_REMOTE_CONFIGURATION_ENABLED, true); + cluster.init(conf); + cluster.start(); + getAdminService(0).transitionToActive(req); + assertFalse("RM never turned active", -1 == cluster.getActiveRMIndex()); + + // clean the remoteDirectory + cleanRemoteDirectory(); + + CapacityScheduler cs = + (CapacityScheduler) cluster.getResourceManager(0).getRMContext() + .getScheduler(); + int maxAppsBefore = cs.getConfiguration().getMaximumSystemApplications(); + + try { + getAdminService(0).refreshQueues(RefreshQueuesRequest.newInstance()); + fail("The HA is enabled. The remote configuration has not been set." + + " Should get an exception here"); + } catch (Exception ex) { + Assert.assertTrue(ex.getMessage().contains( + "Can not find Configuration: capacity-scheduler.xml")); + } + + CapacitySchedulerConfiguration csConf = + new CapacitySchedulerConfiguration(); + csConf.set("yarn.scheduler.capacity.maximum-applications", "5000"); + String csConfFile = writeConfigurationXML(csConf, + "capacity-scheduler.xml"); + + // upload the file into Remote File System + uploadToRemoteFileSystem(new Path(csConfFile)); + + getAdminService(0).refreshQueues(RefreshQueuesRequest.newInstance()); + + int maxAppsAfter = cs.getConfiguration().getMaximumSystemApplications(); + Assert.assertEquals(maxAppsAfter, 5000); + Assert.assertTrue(maxAppsAfter != maxAppsBefore); + } + private String writeConfigurationXML(Configuration conf, String confXMLName) + throws IOException { + DataOutputStream output = null; + try { + final File basedir = + new File("target", TestRMFailover.class.getName()); + final File tmpDir = new File(basedir, "tmpDir"); + tmpDir.mkdirs(); + final File confFile = new File(tmpDir, confXMLName); + if (confFile.exists()) { + confFile.delete(); + } + if (!confFile.createNewFile()) { + Assert.fail("Can not create " + confXMLName); + } + output = new DataOutputStream( + new FileOutputStream(confFile)); + conf.writeXml(output); + return confFile.getAbsolutePath(); + } finally { + if (output != null) { + output.close(); + } + } + } + + private void uploadToRemoteFileSystem(Path filePath) + throws IOException { + fs.copyFromLocalFile(filePath, workingPath); + } + + private void cleanRemoteDirectory() throws IOException { + if (fs.exists(workingPath)) { + for (FileStatus file : fs.listStatus(workingPath)) { + fs.delete(file.getPath(), true); + } + } + } } diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/FileSystemBasedRemoteConfiguration.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/FileSystemBasedRemoteConfiguration.java new file mode 100644 index 0000000..7797b59 --- /dev/null +++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/FileSystemBasedRemoteConfiguration.java @@ -0,0 +1,71 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.hadoop.yarn; + +import java.io.IOException; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.hadoop.classification.InterfaceAudience.Private; +import org.apache.hadoop.classification.InterfaceStability.Unstable; +import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.fs.FileSystem; +import org.apache.hadoop.fs.Path; +import org.apache.hadoop.yarn.conf.RemoteConfiguration; +import org.apache.hadoop.yarn.conf.YarnConfiguration; +import org.apache.hadoop.yarn.exceptions.YarnException; + +@Private +@Unstable +public class FileSystemBasedRemoteConfiguration extends RemoteConfiguration { + + private static final Log LOG = LogFactory + .getLog(FileSystemBasedRemoteConfiguration.class); + private FileSystem fs; + private Path remoteConfigDir; + + @Override + public synchronized Configuration getConfiguration(String name) + throws IOException, YarnException { + Path remoteConfigPath = new Path(this.remoteConfigDir, name); + if (!fs.exists(remoteConfigPath)) { + throw new YarnException("Can not find Configuration: " + name + " in " + + remoteConfigDir); + } + Configuration remoteConfig = new Configuration(false); + remoteConfig.addResource(fs.open(remoteConfigPath)); + return remoteConfig; + } + + @Override + public synchronized void initInternal(Configuration conf) throws Exception { + remoteConfigDir = + new Path(conf.get(YarnConfiguration.FS_RM_CONF_STORE, + YarnConfiguration.DEFAULT_FS_RM_CONF_STORE)); + fs = remoteConfigDir.getFileSystem(conf); + if (!fs.exists(remoteConfigDir)) { + fs.mkdirs(remoteConfigDir); + } + } + + @Override + public synchronized void closeInternal() throws Exception { + fs.close(); + } +} diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/AdminService.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/AdminService.java index 971603a..10d6856 100644 --- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/AdminService.java +++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/AdminService.java @@ -48,6 +48,8 @@ import org.apache.hadoop.yarn.api.records.NodeId; import org.apache.hadoop.yarn.api.records.ResourceOption; import org.apache.hadoop.yarn.conf.HAUtil; +import org.apache.hadoop.yarn.conf.RemoteConfiguration; +import org.apache.hadoop.yarn.conf.RemoteConfigurationFactory; import org.apache.hadoop.yarn.conf.YarnConfiguration; import org.apache.hadoop.yarn.exceptions.YarnException; import org.apache.hadoop.yarn.factories.RecordFactory; @@ -89,6 +91,9 @@ private InetSocketAddress masterServiceAddress; private AccessControlList adminAcl; + private RemoteConfiguration remoteConfiguration = null; + private boolean remoteConfigurationEnabled = false; + private final RecordFactory recordFactory = RecordFactoryProvider.getRecordFactory(null); @@ -107,6 +112,14 @@ public synchronized void serviceInit(Configuration conf) throws Exception { addIfService(createEmbeddedElectorService()); } } + remoteConfigurationEnabled = + conf.getBoolean(YarnConfiguration.RM_HA_REMOTE_CONFIGURATION_ENABLED, + YarnConfiguration.DEFAULT_RM_HA_REMOTE_CONFIGURATION_ENABLED); + if (remoteConfigurationEnabled) { + remoteConfiguration = + RemoteConfigurationFactory.getRemoteConfiguration(conf); + remoteConfiguration.init(conf); + } } masterServiceAddress = conf.getSocketAddr( @@ -129,6 +142,9 @@ protected synchronized void serviceStart() throws Exception { @Override protected synchronized void serviceStop() throws Exception { stopServer(); + if (remoteConfiguration != null) { + remoteConfiguration.close(); + } super.serviceStop(); } @@ -295,23 +311,28 @@ public synchronized HAServiceStatus getServiceStatus() throws IOException { @Override public RefreshQueuesResponse refreshQueues(RefreshQueuesRequest request) throws YarnException, StandbyException { - UserGroupInformation user = checkAcls("refreshQueues"); + String argName = "refreshQueues"; + UserGroupInformation user = checkAcls(argName); if (!isRMActive()) { - RMAuditLogger.logFailure(user.getShortUserName(), "refreshQueues", + RMAuditLogger.logFailure(user.getShortUserName(), argName, adminAcl.toString(), "AdminService", "ResourceManager is not active. Can not refresh queues."); throwStandbyException(); } + RefreshQueuesResponse response = + recordFactory.newRecordInstance(RefreshQueuesResponse.class); try { - rmContext.getScheduler().reinitialize(getConfig(), this.rmContext); - RMAuditLogger.logSuccess(user.getShortUserName(), "refreshQueues", + Configuration conf = + getConfiguration(YarnConfiguration.CS_CONFIGURATION_FILE); + rmContext.getScheduler().reinitialize(conf, this.rmContext); + RMAuditLogger.logSuccess(user.getShortUserName(), argName, "AdminService"); - return recordFactory.newRecordInstance(RefreshQueuesResponse.class); + return response; } catch (IOException ioe) { LOG.info("Exception refreshing queues ", ioe); - RMAuditLogger.logFailure(user.getShortUserName(), "refreshQueues", + RMAuditLogger.logFailure(user.getShortUserName(), argName, adminAcl.toString(), "AdminService", "Exception refreshing queues"); throw RPCUtil.getRemoteException(ioe); @@ -483,5 +504,12 @@ public UpdateNodeResourceResponse updateNodeResource( UpdateNodeResourceResponse.class); return response; } - + + private synchronized Configuration getConfiguration(String confFileName) + throws YarnException, IOException { + if (!this.rmContext.isHAEnabled() || ! remoteConfigurationEnabled) { + return new Configuration(); + } + return remoteConfiguration.getConfiguration(confFileName); + } } diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/CapacityScheduler.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/CapacityScheduler.java index 0197c5b..7a99fe4 100644 --- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/CapacityScheduler.java +++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/CapacityScheduler.java @@ -104,6 +104,8 @@ private CSQueue root; + private boolean remoteConfigurationEnabled = false; + private final static List EMPTY_CONTAINER_LIST = new ArrayList(); @@ -261,6 +263,9 @@ public Resource getClusterResources() { public synchronized void reinitialize(Configuration conf, RMContext rmContext) throws IOException { if (!initialized) { + remoteConfigurationEnabled = conf.getBoolean( + YarnConfiguration.RM_HA_REMOTE_CONFIGURATION_ENABLED, + YarnConfiguration.DEFAULT_RM_HA_REMOTE_CONFIGURATION_ENABLED); this.conf = new CapacitySchedulerConfiguration(conf); validateConf(this.conf); this.minimumAllocation = this.conf.getMinimumAllocation(); @@ -281,7 +286,8 @@ public Resource getClusterResources() { } else { CapacitySchedulerConfiguration oldConf = this.conf; - this.conf = new CapacitySchedulerConfiguration(conf); + this.conf = new CapacitySchedulerConfiguration(conf, + this.rmContext.isHAEnabled() && remoteConfigurationEnabled); validateConf(this.conf); try { LOG.info("Re-initializing queues..."); diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/CapacitySchedulerConfiguration.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/CapacitySchedulerConfiguration.java index 6fceabf..75f1d73 100644 --- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/CapacitySchedulerConfiguration.java +++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/CapacitySchedulerConfiguration.java @@ -140,10 +140,17 @@ public CapacitySchedulerConfiguration() { } public CapacitySchedulerConfiguration(Configuration configuration) { + this(configuration, false); + } + + public CapacitySchedulerConfiguration(Configuration configuration, + boolean useRemoteConfiguration) { super(configuration); - addResource(CS_CONFIGURATION_FILE); + if (! useRemoteConfiguration) { + addResource(CS_CONFIGURATION_FILE); + } } - + private String getQueuePrefix(String queue) { String queueName = PREFIX + queue + DOT; return queueName;