38
38
import org .apache .hadoop .yarn .api .records .NodeId ;
39
39
import org .apache .hadoop .yarn .api .records .ResourceRequest ;
40
40
import org .apache .hadoop .yarn .event .EventHandler ;
41
- import org .apache .hadoop .yarn .security .AMRMTokenIdentifier ;
42
41
import org .apache .hadoop .yarn .server .api .DistributedSchedulingAMProtocol ;
43
42
import org .apache .hadoop .yarn .api .impl .pb .service .ApplicationMasterProtocolPBServiceImpl ;
44
43
77
76
78
77
import org .apache .hadoop .yarn .server .scheduler .OpportunisticContainerAllocator ;
79
78
import org .apache .hadoop .yarn .server .scheduler .OpportunisticContainerContext ;
80
- import org .apache .hadoop .yarn .server .utils .YarnServerSecurityUtils ;
81
79
82
80
import java .io .IOException ;
83
81
import java .net .InetSocketAddress ;
@@ -103,7 +101,7 @@ public class OpportunisticContainerAllocatorAMService
103
101
private final NodeQueueLoadMonitor nodeMonitor ;
104
102
private final OpportunisticContainerAllocator oppContainerAllocator ;
105
103
106
- private final int k ;
104
+ private final int numNodes ;
107
105
108
106
private final long cacheRefreshInterval ;
109
107
private volatile List <RemoteNode > cachedNodes ;
@@ -176,7 +174,7 @@ public void allocate(ApplicationAttemptId appAttemptId,
176
174
177
175
if (!appAttempt .getApplicationAttemptId ().equals (appAttemptId )){
178
176
LOG .error ("Calling allocate on previous or removed or non "
179
- + "existent application attempt " + appAttemptId );
177
+ + "existent application attempt {}" , appAttemptId );
180
178
return ;
181
179
}
182
180
@@ -238,7 +236,7 @@ public OpportunisticContainerAllocatorAMService(RMContext rmContext,
238
236
new DistributedOpportunisticContainerAllocator (
239
237
rmContext .getContainerTokenSecretManager (),
240
238
maxAllocationsPerAMHeartbeat );
241
- this .k = rmContext .getYarnConfiguration ().getInt (
239
+ this .numNodes = rmContext .getYarnConfiguration ().getInt (
242
240
YarnConfiguration .OPP_CONTAINER_ALLOCATION_NODES_NUMBER_USED ,
243
241
YarnConfiguration .DEFAULT_OPP_CONTAINER_ALLOCATION_NODES_NUMBER_USED );
244
242
long nodeSortInterval = rmContext .getYarnConfiguration ().getLong (
@@ -440,12 +438,12 @@ public void handle(SchedulerEvent event) {
440
438
// <-- IGNORED EVENTS : END -->
441
439
default :
442
440
LOG .error ("Unknown event arrived at" +
443
- "OpportunisticContainerAllocatorAMService: " + event . toString () );
441
+ "OpportunisticContainerAllocatorAMService: {}" , event );
444
442
}
445
443
446
444
}
447
445
448
- public QueueLimitCalculator getNodeManagerQueueLimitCalculator () {
446
+ QueueLimitCalculator getNodeManagerQueueLimitCalculator () {
449
447
return nodeMonitor .getThresholdCalculator ();
450
448
}
451
449
@@ -455,7 +453,7 @@ synchronized List<RemoteNode> getLeastLoadedNodes() {
455
453
if ((currTime - lastCacheUpdateTime > cacheRefreshInterval )
456
454
|| (cachedNodes == null )) {
457
455
cachedNodes = convertToRemoteNodes (
458
- this .nodeMonitor .selectLeastLoadedNodes (this .k ));
456
+ this .nodeMonitor .selectLeastLoadedNodes (this .numNodes ));
459
457
if (cachedNodes .size () > 0 ) {
460
458
lastCacheUpdateTime = currTime ;
461
459
}
@@ -485,12 +483,4 @@ private RemoteNode convertToRemoteNode(NodeId nodeId) {
485
483
}
486
484
return null ;
487
485
}
488
-
489
- private static ApplicationAttemptId getAppAttemptId () throws YarnException {
490
- AMRMTokenIdentifier amrmTokenIdentifier =
491
- YarnServerSecurityUtils .authorizeRequest ();
492
- ApplicationAttemptId applicationAttemptId =
493
- amrmTokenIdentifier .getApplicationAttemptId ();
494
- return applicationAttemptId ;
495
- }
496
486
}
0 commit comments