Skip to content

Commit b048b10

Browse files
committed
added correct variable datatype as per getters for setters
Change-Id: If5bac319b2b2fc3cb83f438dc0e19ca09dfcc257
1 parent 4de2e19 commit b048b10

File tree

4 files changed

+19
-22
lines changed

4 files changed

+19
-22
lines changed

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

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,7 @@ public void setMaximumApplicationMasterResourcePercent(float percent) {
506506
}
507507

508508
public float getMaximumApplicationMasterResourcePercent() {
509-
return getFloat(PREFIX + MAXIMUM_AM_RESOURCE_SUFFIX,
509+
return getFloat(MAXIMUM_APPLICATION_MASTERS_RESOURCE_PERCENT,
510510
DEFAULT_MAXIMUM_APPLICATIONMASTERS_RESOURCE_PERCENT);
511511
}
512512

@@ -1226,14 +1226,14 @@ public void reinitializeConfigurationProperties() {
12261226
configurationProperties = new ConfigurationProperties(props);
12271227
}
12281228

1229-
public void setQueueMaximumAllocationMb(String queue, String value) {
1229+
public void setQueueMaximumAllocationMb(String queue, int value) {
12301230
String queuePrefix = getQueuePrefix(queue);
1231-
set(queuePrefix + MAXIMUM_ALLOCATION_MB, value);
1231+
setInt(queuePrefix + MAXIMUM_ALLOCATION_MB, value);
12321232
}
12331233

1234-
public void setQueueMaximumAllocationVcores(String queue, String value) {
1234+
public void setQueueMaximumAllocationVcores(String queue, int value) {
12351235
String queuePrefix = getQueuePrefix(queue);
1236-
set(queuePrefix + MAXIMUM_ALLOCATION_VCORES, value);
1236+
setInt(queuePrefix + MAXIMUM_ALLOCATION_VCORES, value);
12371237
}
12381238

12391239
public long getQueueMaximumAllocationMb(String queue) {
@@ -1846,17 +1846,17 @@ public static boolean shouldAppFailFast(Configuration conf) {
18461846
return conf.getBoolean(APP_FAIL_FAST, DEFAULT_APP_FAIL_FAST);
18471847
}
18481848

1849-
public void setDefaultMaxParallelAppsPerQueue(String value) {
1850-
set(PREFIX + MAX_PARALLEL_APPLICATIONS, value);
1849+
public void setDefaultMaxParallelApps(int value) {
1850+
setInt(PREFIX + MAX_PARALLEL_APPLICATIONS, value);
18511851
}
18521852

1853-
public Integer getDefaultMaxParallelAppsPerQueue() {
1853+
public Integer getDefaultMaxParallelApps() {
18541854
return getInt(PREFIX + MAX_PARALLEL_APPLICATIONS,
18551855
DEFAULT_MAX_PARALLEL_APPLICATIONS);
18561856
}
18571857

1858-
public void setDefaultMaxParallelAppsPerUser(String value) {
1859-
set(PREFIX + "user." + MAX_PARALLEL_APPLICATIONS, value);
1858+
public void setDefaultMaxParallelAppsPerUser(int value) {
1859+
setInt(PREFIX + "user." + MAX_PARALLEL_APPLICATIONS, value);
18601860
}
18611861

18621862
public Integer getDefaultMaxParallelAppsPerUser() {
@@ -1887,7 +1887,7 @@ public Integer getMaxParallelAppsForQueue(String queue) {
18871887

18881888
return (maxParallelAppsForQueue != null) ?
18891889
Integer.valueOf(maxParallelAppsForQueue)
1890-
: getDefaultMaxParallelAppsPerQueue();
1890+
: getDefaultMaxParallelApps();
18911891
}
18921892

18931893
public boolean getAllowZeroCapacitySum(String queue) {

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/converter/FSConfigToCSConfigConverter.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -374,15 +374,15 @@ private OutputStream getOutputStreamForJson() throws FileNotFoundException {
374374

375375
private void emitDefaultQueueMaxParallelApplications() {
376376
if (queueMaxAppsDefault != Integer.MAX_VALUE) {
377-
capacitySchedulerConfig.setDefaultMaxParallelAppsPerQueue(
378-
String.valueOf(queueMaxAppsDefault));
377+
capacitySchedulerConfig.setDefaultMaxParallelApps(
378+
queueMaxAppsDefault);
379379
}
380380
}
381381

382382
private void emitDefaultUserMaxParallelApplications() {
383383
if (userMaxAppsDefault != Integer.MAX_VALUE) {
384384
capacitySchedulerConfig.setDefaultMaxParallelAppsPerUser(
385-
String.valueOf(userMaxAppsDefault));
385+
userMaxAppsDefault);
386386
}
387387
}
388388

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/converter/FSQueueConverter.java

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,7 @@
1616

1717
package org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.converter;
1818

19-
import static org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacitySchedulerConfiguration.AUTO_QUEUE_CREATION_V2_ENABLED;
20-
import static org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacitySchedulerConfiguration.DEFAULT_AUTO_QUEUE_CREATION_ENABLED;
2119
import static org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacitySchedulerConfiguration.PREFIX;
22-
import static org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacitySchedulerConfiguration.DOT;
2320

2421
import java.util.List;
2522
import java.util.stream.Collectors;
@@ -179,7 +176,7 @@ private void emitMaxAllocations(String queueName, FSQueue queue) {
179176
Resource maxAllocation = queue.getMaximumContainerAllocation();
180177

181178
if (isNotUnboundedResource(maxAllocation)) {
182-
long parentMaxVcores = Integer.MIN_VALUE;
179+
int parentMaxVcores = Integer.MIN_VALUE;
183180
long parentMaxMemory = Integer.MIN_VALUE;
184181

185182
if (queue.getParent() != null) {
@@ -191,16 +188,16 @@ private void emitMaxAllocations(String queueName, FSQueue queue) {
191188
}
192189
}
193190

194-
long maxVcores = maxAllocation.getVirtualCores();
191+
int maxVcores = maxAllocation.getVirtualCores();
195192
long maxMemory = maxAllocation.getMemorySize();
196193

197194
// only emit max allocation if it differs from the parent's setting
198195
if (maxVcores != parentMaxVcores || maxMemory != parentMaxMemory) {
199196
capacitySchedulerConfig.setQueueMaximumAllocationMb(
200-
queueName, String.valueOf(maxMemory));
197+
queueName, (int) maxMemory);
201198

202199
capacitySchedulerConfig.setQueueMaximumAllocationVcores(
203-
queueName, String.valueOf(maxVcores));
200+
queueName, maxVcores);
204201
}
205202
}
206203
}

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/converter/TestFSConfigToCSConfigConverter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ public void testDefaultQueueMaxParallelApps() throws Exception {
282282
CapacitySchedulerConfiguration conf = converter.getCapacitySchedulerConfig();
283283

284284
assertEquals("Default max parallel apps", 15,
285-
conf.getDefaultMaxParallelAppsPerQueue(), 0);
285+
conf.getDefaultMaxParallelApps(), 0);
286286
}
287287

288288
@Test

0 commit comments

Comments
 (0)