|
@@ -96,11 +96,14 @@ import org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNodeEvent;
|
|
import org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNodeEventType;
|
|
import org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNodeEventType;
|
|
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.QueueMetrics;
|
|
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.QueueMetrics;
|
|
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.ResourceScheduler;
|
|
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.ResourceScheduler;
|
|
|
|
+import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.conf.YarnConfigurationStore;
|
|
|
|
+import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.conf.YarnConfigurationStoreFactory;
|
|
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.constraint.AllocationTagsManager;
|
|
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.constraint.AllocationTagsManager;
|
|
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.constraint.MemoryPlacementConstraintManager;
|
|
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.constraint.MemoryPlacementConstraintManager;
|
|
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.constraint.PlacementConstraintManagerService;
|
|
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.constraint.PlacementConstraintManagerService;
|
|
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.event.SchedulerEvent;
|
|
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.event.SchedulerEvent;
|
|
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.event.SchedulerEventType;
|
|
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.event.SchedulerEventType;
|
|
|
|
+import org.apache.hadoop.yarn.server.resourcemanager.scheduler.MutableConfScheduler;
|
|
import org.apache.hadoop.yarn.server.resourcemanager.security.DelegationTokenRenewer;
|
|
import org.apache.hadoop.yarn.server.resourcemanager.security.DelegationTokenRenewer;
|
|
import org.apache.hadoop.yarn.server.resourcemanager.security.QueueACLsManager;
|
|
import org.apache.hadoop.yarn.server.resourcemanager.security.QueueACLsManager;
|
|
import org.apache.hadoop.yarn.server.resourcemanager.timelineservice.RMTimelineCollectorManager;
|
|
import org.apache.hadoop.yarn.server.resourcemanager.timelineservice.RMTimelineCollectorManager;
|
|
@@ -1491,6 +1494,8 @@ public class ResourceManager extends CompositeService
|
|
if (argv.length >= 1) {
|
|
if (argv.length >= 1) {
|
|
if (argv[0].equals("-format-state-store")) {
|
|
if (argv[0].equals("-format-state-store")) {
|
|
deleteRMStateStore(conf);
|
|
deleteRMStateStore(conf);
|
|
|
|
+ } else if (argv[0].equals("-format-conf-store")) {
|
|
|
|
+ deleteRMConfStore(conf);
|
|
} else if (argv[0].equals("-remove-application-from-state-store")
|
|
} else if (argv[0].equals("-remove-application-from-state-store")
|
|
&& argv.length == 2) {
|
|
&& argv.length == 2) {
|
|
removeApplication(conf, argv[1]);
|
|
removeApplication(conf, argv[1]);
|
|
@@ -1583,6 +1588,44 @@ public class ResourceManager extends CompositeService
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Deletes the YarnConfigurationStore.
|
|
|
|
+ *
|
|
|
|
+ * @param conf
|
|
|
|
+ * @throws Exception
|
|
|
|
+ */
|
|
|
|
+ @VisibleForTesting
|
|
|
|
+ static void deleteRMConfStore(Configuration conf) throws Exception {
|
|
|
|
+ ResourceManager rm = new ResourceManager();
|
|
|
|
+ rm.conf = conf;
|
|
|
|
+ ResourceScheduler scheduler = rm.createScheduler();
|
|
|
|
+ RMContextImpl rmContext = new RMContextImpl();
|
|
|
|
+ rmContext.setResourceManager(rm);
|
|
|
|
+
|
|
|
|
+ boolean isConfigurationMutable = false;
|
|
|
|
+ String confProviderStr = conf.get(
|
|
|
|
+ YarnConfiguration.SCHEDULER_CONFIGURATION_STORE_CLASS,
|
|
|
|
+ YarnConfiguration.DEFAULT_CONFIGURATION_STORE);
|
|
|
|
+ switch (confProviderStr) {
|
|
|
|
+ case YarnConfiguration.MEMORY_CONFIGURATION_STORE:
|
|
|
|
+ case YarnConfiguration.LEVELDB_CONFIGURATION_STORE:
|
|
|
|
+ case YarnConfiguration.ZK_CONFIGURATION_STORE:
|
|
|
|
+ isConfigurationMutable = true;
|
|
|
|
+ break;
|
|
|
|
+ default:
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (scheduler instanceof MutableConfScheduler && isConfigurationMutable) {
|
|
|
|
+ YarnConfigurationStore confStore = YarnConfigurationStoreFactory
|
|
|
|
+ .getStore(conf);
|
|
|
|
+ confStore.initialize(conf, conf, rmContext);
|
|
|
|
+ confStore.format();
|
|
|
|
+ } else {
|
|
|
|
+ System.out.println("Scheduler Configuration format only " +
|
|
|
|
+ "supported by MutableConfScheduler.");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
@VisibleForTesting
|
|
@VisibleForTesting
|
|
static void removeApplication(Configuration conf, String applicationId)
|
|
static void removeApplication(Configuration conf, String applicationId)
|
|
throws Exception {
|
|
throws Exception {
|
|
@@ -1603,7 +1646,9 @@ public class ResourceManager extends CompositeService
|
|
private static void printUsage(PrintStream out) {
|
|
private static void printUsage(PrintStream out) {
|
|
out.println("Usage: yarn resourcemanager [-format-state-store]");
|
|
out.println("Usage: yarn resourcemanager [-format-state-store]");
|
|
out.println(" "
|
|
out.println(" "
|
|
- + "[-remove-application-from-state-store <appId>]" + "\n");
|
|
|
|
|
|
+ + "[-remove-application-from-state-store <appId>]");
|
|
|
|
+ out.println(" "
|
|
|
|
+ + "[-format-conf-store]" + "\n");
|
|
}
|
|
}
|
|
|
|
|
|
protected RMAppLifetimeMonitor createRMAppLifetimeMonitor() {
|
|
protected RMAppLifetimeMonitor createRMAppLifetimeMonitor() {
|