Skip to content

Commit 262330e

Browse files
committed
Fix checkstyle errors
1 parent 12ab649 commit 262330e

File tree

6 files changed

+27
-13
lines changed

6 files changed

+27
-13
lines changed

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/scheduler/ContainerScheduler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ private static int getMaxOppQueueLengthFromConf(final Context context) {
126126
}
127127

128128
private static OpportunisticContainersQueuePolicy
129-
getOppContainersQueuePolicyFromConf(final Context context) {
129+
getOppContainersQueuePolicyFromConf(final Context context) {
130130
final OpportunisticContainersQueuePolicy queuePolicy;
131131
if (context == null || context.getConf() == null) {
132132
queuePolicy = OpportunisticContainersQueuePolicy.DEFAULT;

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/scheduler/OpportunisticContainersQueuePolicy.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,16 @@
1818

1919
package org.apache.hadoop.yarn.server.nodemanager.containermanager.scheduler;
2020

21+
import org.apache.hadoop.yarn.conf.YarnConfiguration;
22+
2123
/**
2224
* Determines how to schedule opportunistic containers at the NodeManager,
2325
* i.e., whether or not to accept, queue, or reject a container run request.
2426
*/
2527
public enum OpportunisticContainersQueuePolicy {
2628
/**
2729
* Determines whether or not to run a container by the queue capacity:
28-
* {@link org.apache.hadoop.yarn.conf.YarnConfiguration#NM_OPPORTUNISTIC_CONTAINERS_MAX_QUEUE_LENGTH}.
30+
* {@link YarnConfiguration#NM_OPPORTUNISTIC_CONTAINERS_MAX_QUEUE_LENGTH}.
2931
* If there's enough capacity in the queue,
3032
* queues the container, otherwise rejects it.
3133
*/

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/BaseContainerManagerTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ public NMLogAggregationStatusTracker getNMLogAggregationStatusTracker() {
160160
private NodeResourceMonitorImpl nodeResourceMonitor = mock(
161161
NodeResourceMonitorImpl.class);
162162
private NodeHealthCheckerService nodeHealthCheckerService;
163-
protected NodeStatusUpdater nodeStatusUpdater;
163+
private NodeStatusUpdater nodeStatusUpdater;
164164
protected ContainerManagerImpl containerManager = null;
165165

166166
public NodeStatusUpdater getNodeStatusUpdater() {

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/BaseContainerSchedulerTest.java

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,19 @@ public BaseContainerSchedulerTest() throws UnsupportedFileSystemException {
6666

6767
public static class Listener implements ContainerStateTransitionListener {
6868

69-
public final Map<ContainerId, List<ContainerState>> states =
69+
private final Map<ContainerId, List<ContainerState>> states =
7070
new HashMap<>();
71-
public final Map<ContainerId, List<ContainerEventType>> events =
71+
private final Map<ContainerId, List<ContainerEventType>> events =
7272
new HashMap<>();
7373

74+
public Map<ContainerId, List<ContainerEventType>> getEvents() {
75+
return events;
76+
}
77+
78+
public Map<ContainerId, List<ContainerState>> getStates() {
79+
return states;
80+
}
81+
7482
@Override
7583
public void init(Context context) {}
7684

@@ -93,13 +101,17 @@ public void postTransition(ContainerImpl op, ContainerState beforeState,
93101
}
94102
}
95103

96-
protected boolean delayContainers = true;
104+
private boolean delayContainers = true;
105+
106+
protected void setDelayContainers(final boolean delayContainersParam) {
107+
this.delayContainers = delayContainersParam;
108+
}
97109

98110
@Override
99111
protected ContainerManagerImpl createContainerManager(
100112
DeletionService delSrvc) {
101113
return new ContainerManagerImpl(context, exec, delSrvc,
102-
nodeStatusUpdater, metrics, dirsHandler) {
114+
getNodeStatusUpdater(), metrics, dirsHandler) {
103115

104116
@Override
105117
protected UserGroupInformation getRemoteUgi() throws YarnException {

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/scheduler/TestContainerSchedulerOppContainersByResources.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ public void testKillOpportunisticWhenNoResourcesAvailable() throws Exception {
232232

233233
// Wait for the OContainer to get killed
234234
BaseContainerManagerTest.waitForNMContainerState(containerManager,
235-
createContainerId(1), ContainerState.DONE,40);
235+
createContainerId(1), ContainerState.DONE, 40);
236236

237237
// Get container statuses.
238238
// Container 0 should be running and container 1 should be killed

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/scheduler/TestContainerSchedulerQueuing.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ public void testPauseOpportunisticForGuaranteedContainer() throws Exception {
508508

509509
List<org.apache.hadoop.yarn.server.nodemanager.containermanager.container.
510510
ContainerState> containerStates =
511-
listener.states.get(createContainerId(0));
511+
listener.getStates().get(createContainerId(0));
512512
Assert.assertEquals(Arrays.asList(
513513
org.apache.hadoop.yarn.server.nodemanager.containermanager.container.
514514
ContainerState.NEW,
@@ -529,7 +529,7 @@ public void testPauseOpportunisticForGuaranteedContainer() throws Exception {
529529
org.apache.hadoop.yarn.server.nodemanager.containermanager.container.
530530
ContainerState.DONE), containerStates);
531531
List<ContainerEventType> containerEventTypes =
532-
listener.events.get(createContainerId(0));
532+
listener.getEvents().get(createContainerId(0));
533533
Assert.assertEquals(Arrays.asList(ContainerEventType.INIT_CONTAINER,
534534
ContainerEventType.CONTAINER_LAUNCHED,
535535
ContainerEventType.PAUSE_CONTAINER,
@@ -1083,7 +1083,7 @@ public void testPromotionOfOpportunisticContainers() throws Exception {
10831083

10841084
List<org.apache.hadoop.yarn.server.nodemanager.containermanager.container.
10851085
ContainerState> containerStates =
1086-
listener.states.get(createContainerId(1));
1086+
listener.getStates().get(createContainerId(1));
10871087
Assert.assertEquals(Arrays.asList(
10881088
org.apache.hadoop.yarn.server.nodemanager.containermanager.container.
10891089
ContainerState.NEW,
@@ -1094,7 +1094,7 @@ public void testPromotionOfOpportunisticContainers() throws Exception {
10941094
org.apache.hadoop.yarn.server.nodemanager.containermanager.container.
10951095
ContainerState.RUNNING), containerStates);
10961096
List<ContainerEventType> containerEventTypes =
1097-
listener.events.get(createContainerId(1));
1097+
listener.getEvents().get(createContainerId(1));
10981098
Assert.assertEquals(Arrays.asList(
10991099
ContainerEventType.INIT_CONTAINER,
11001100
ContainerEventType.UPDATE_CONTAINER_TOKEN,
@@ -1107,7 +1107,7 @@ public void testPromotionOfOpportunisticContainers() throws Exception {
11071107
@Test
11081108
public void testContainerUpdateExecTypeGuaranteedToOpportunistic()
11091109
throws Exception {
1110-
delayContainers = true;
1110+
setDelayContainers(true);
11111111
containerManager.start();
11121112
// Construct the Container-id
11131113
ContainerId cId = createContainerId(0);

0 commit comments

Comments
 (0)