|
@@ -83,6 +83,9 @@ public class FSConfigToCSConfigConverter {
|
|
private boolean preemptionEnabled = false;
|
|
private boolean preemptionEnabled = false;
|
|
private int queueMaxAppsDefault;
|
|
private int queueMaxAppsDefault;
|
|
private float queueMaxAMShareDefault;
|
|
private float queueMaxAMShareDefault;
|
|
|
|
+ private Map<String, Integer> userMaxApps;
|
|
|
|
+ private int userMaxAppsDefault;
|
|
|
|
+
|
|
private boolean autoCreateChildQueues = false;
|
|
private boolean autoCreateChildQueues = false;
|
|
private boolean sizeBasedWeight = false;
|
|
private boolean sizeBasedWeight = false;
|
|
private boolean userAsDefaultQueue = false;
|
|
private boolean userAsDefaultQueue = false;
|
|
@@ -99,6 +102,8 @@ public class FSConfigToCSConfigConverter {
|
|
private boolean consoleMode = false;
|
|
private boolean consoleMode = false;
|
|
private boolean convertPlacementRules = false;
|
|
private boolean convertPlacementRules = false;
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
public FSConfigToCSConfigConverter(FSConfigToCSConfigRuleHandler
|
|
public FSConfigToCSConfigConverter(FSConfigToCSConfigRuleHandler
|
|
ruleHandler, ConversionOptions conversionOptions) {
|
|
ruleHandler, ConversionOptions conversionOptions) {
|
|
this.ruleHandler = ruleHandler;
|
|
this.ruleHandler = ruleHandler;
|
|
@@ -242,14 +247,13 @@ public class FSConfigToCSConfigConverter {
|
|
|
|
|
|
AllocationConfiguration allocConf = fs.getAllocationConfiguration();
|
|
AllocationConfiguration allocConf = fs.getAllocationConfiguration();
|
|
queueMaxAppsDefault = allocConf.getQueueMaxAppsDefault();
|
|
queueMaxAppsDefault = allocConf.getQueueMaxAppsDefault();
|
|
|
|
+ userMaxAppsDefault = allocConf.getUserMaxAppsDefault();
|
|
|
|
+ userMaxApps = allocConf.getUserMaxApps();
|
|
queueMaxAMShareDefault = allocConf.getQueueMaxAMShareDefault();
|
|
queueMaxAMShareDefault = allocConf.getQueueMaxAMShareDefault();
|
|
|
|
|
|
convertedYarnSiteConfig = new Configuration(false);
|
|
convertedYarnSiteConfig = new Configuration(false);
|
|
capacitySchedulerConfig = new Configuration(false);
|
|
capacitySchedulerConfig = new Configuration(false);
|
|
|
|
|
|
- checkUserMaxApps(allocConf);
|
|
|
|
- checkUserMaxAppsDefault(allocConf);
|
|
|
|
-
|
|
|
|
convertYarnSiteXml(inputYarnSiteConfig, havePlacementPolicies);
|
|
convertYarnSiteXml(inputYarnSiteConfig, havePlacementPolicies);
|
|
convertCapacitySchedulerXml(fs);
|
|
convertCapacitySchedulerXml(fs);
|
|
|
|
|
|
@@ -287,7 +291,9 @@ public class FSConfigToCSConfigConverter {
|
|
|
|
|
|
private void convertCapacitySchedulerXml(FairScheduler fs) {
|
|
private void convertCapacitySchedulerXml(FairScheduler fs) {
|
|
FSParentQueue rootQueue = fs.getQueueManager().getRootQueue();
|
|
FSParentQueue rootQueue = fs.getQueueManager().getRootQueue();
|
|
- emitDefaultMaxApplications();
|
|
|
|
|
|
+ emitDefaultQueueMaxParallelApplications();
|
|
|
|
+ emitDefaultUserMaxParallelApplications();
|
|
|
|
+ emitUserMaxParallelApplications();
|
|
emitDefaultMaxAMShare();
|
|
emitDefaultMaxAMShare();
|
|
|
|
|
|
FSQueueConverter queueConverter = FSQueueConverterBuilder.create()
|
|
FSQueueConverter queueConverter = FSQueueConverterBuilder.create()
|
|
@@ -322,14 +328,30 @@ public class FSConfigToCSConfigConverter {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- private void emitDefaultMaxApplications() {
|
|
|
|
|
|
+ private void emitDefaultQueueMaxParallelApplications() {
|
|
if (queueMaxAppsDefault != Integer.MAX_VALUE) {
|
|
if (queueMaxAppsDefault != Integer.MAX_VALUE) {
|
|
capacitySchedulerConfig.set(
|
|
capacitySchedulerConfig.set(
|
|
- CapacitySchedulerConfiguration.MAXIMUM_SYSTEM_APPLICATIONS,
|
|
|
|
|
|
+ PREFIX + "max-parallel-apps",
|
|
String.valueOf(queueMaxAppsDefault));
|
|
String.valueOf(queueMaxAppsDefault));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private void emitDefaultUserMaxParallelApplications() {
|
|
|
|
+ if (userMaxAppsDefault != Integer.MAX_VALUE) {
|
|
|
|
+ capacitySchedulerConfig.set(
|
|
|
|
+ PREFIX + "user.max-parallel-apps",
|
|
|
|
+ String.valueOf(userMaxAppsDefault));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void emitUserMaxParallelApplications() {
|
|
|
|
+ userMaxApps
|
|
|
|
+ .forEach((user, apps) -> {
|
|
|
|
+ capacitySchedulerConfig.setInt(
|
|
|
|
+ PREFIX + "user." + user + ".max-parallel-apps", apps);
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
private void emitDefaultMaxAMShare() {
|
|
private void emitDefaultMaxAMShare() {
|
|
if (queueMaxAMShareDefault == QUEUE_MAX_AM_SHARE_DISABLED) {
|
|
if (queueMaxAMShareDefault == QUEUE_MAX_AM_SHARE_DISABLED) {
|
|
capacitySchedulerConfig.setFloat(
|
|
capacitySchedulerConfig.setFloat(
|
|
@@ -374,19 +396,6 @@ public class FSConfigToCSConfigConverter {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- private void checkUserMaxApps(AllocationConfiguration allocConf) {
|
|
|
|
- if (allocConf.getUserMaxApps() != null
|
|
|
|
- && allocConf.getUserMaxApps().size() > 0) {
|
|
|
|
- ruleHandler.handleUserMaxApps();
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- private void checkUserMaxAppsDefault(AllocationConfiguration allocConf) {
|
|
|
|
- if (allocConf.getUserMaxAppsDefault() > 0) {
|
|
|
|
- ruleHandler.handleUserMaxAppsDefault();
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
private boolean isDrfUsed(FairScheduler fs) {
|
|
private boolean isDrfUsed(FairScheduler fs) {
|
|
FSQueue rootQueue = fs.getQueueManager().getRootQueue();
|
|
FSQueue rootQueue = fs.getQueueManager().getRootQueue();
|
|
AllocationConfiguration allocConf = fs.getAllocationConfiguration();
|
|
AllocationConfiguration allocConf = fs.getAllocationConfiguration();
|