Skip to content

Commit

Permalink
YARN-9870. Remove unused function from OpportunisticContainerAllocato…
Browse files Browse the repository at this point in the history
…rAMService. Contributed by Abhishek Modi.
  • Loading branch information
abmodi committed Oct 2, 2019
1 parent f1ba9bf commit 61a8436
Showing 1 changed file with 6 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
import org.apache.hadoop.yarn.api.records.NodeId;
import org.apache.hadoop.yarn.api.records.ResourceRequest;
import org.apache.hadoop.yarn.event.EventHandler;
import org.apache.hadoop.yarn.security.AMRMTokenIdentifier;
import org.apache.hadoop.yarn.server.api.DistributedSchedulingAMProtocol;
import org.apache.hadoop.yarn.api.impl.pb.service.ApplicationMasterProtocolPBServiceImpl;

Expand Down Expand Up @@ -77,7 +76,6 @@

import org.apache.hadoop.yarn.server.scheduler.OpportunisticContainerAllocator;
import org.apache.hadoop.yarn.server.scheduler.OpportunisticContainerContext;
import org.apache.hadoop.yarn.server.utils.YarnServerSecurityUtils;

import java.io.IOException;
import java.net.InetSocketAddress;
Expand All @@ -103,7 +101,7 @@ public class OpportunisticContainerAllocatorAMService
private final NodeQueueLoadMonitor nodeMonitor;
private final OpportunisticContainerAllocator oppContainerAllocator;

private final int k;
private final int numNodes;

private final long cacheRefreshInterval;
private volatile List<RemoteNode> cachedNodes;
Expand Down Expand Up @@ -176,7 +174,7 @@ public void allocate(ApplicationAttemptId appAttemptId,

if (!appAttempt.getApplicationAttemptId().equals(appAttemptId)){
LOG.error("Calling allocate on previous or removed or non "
+ "existent application attempt " + appAttemptId);
+ "existent application attempt {}", appAttemptId);
return;
}

Expand Down Expand Up @@ -238,7 +236,7 @@ public OpportunisticContainerAllocatorAMService(RMContext rmContext,
new DistributedOpportunisticContainerAllocator(
rmContext.getContainerTokenSecretManager(),
maxAllocationsPerAMHeartbeat);
this.k = rmContext.getYarnConfiguration().getInt(
this.numNodes = rmContext.getYarnConfiguration().getInt(
YarnConfiguration.OPP_CONTAINER_ALLOCATION_NODES_NUMBER_USED,
YarnConfiguration.DEFAULT_OPP_CONTAINER_ALLOCATION_NODES_NUMBER_USED);
long nodeSortInterval = rmContext.getYarnConfiguration().getLong(
Expand Down Expand Up @@ -440,12 +438,12 @@ public void handle(SchedulerEvent event) {
// <-- IGNORED EVENTS : END -->
default:
LOG.error("Unknown event arrived at" +
"OpportunisticContainerAllocatorAMService: " + event.toString());
"OpportunisticContainerAllocatorAMService: {}", event);
}

}

public QueueLimitCalculator getNodeManagerQueueLimitCalculator() {
QueueLimitCalculator getNodeManagerQueueLimitCalculator() {
return nodeMonitor.getThresholdCalculator();
}

Expand All @@ -455,7 +453,7 @@ synchronized List<RemoteNode> getLeastLoadedNodes() {
if ((currTime - lastCacheUpdateTime > cacheRefreshInterval)
|| (cachedNodes == null)) {
cachedNodes = convertToRemoteNodes(
this.nodeMonitor.selectLeastLoadedNodes(this.k));
this.nodeMonitor.selectLeastLoadedNodes(this.numNodes));
if (cachedNodes.size() > 0) {
lastCacheUpdateTime = currTime;
}
Expand Down Expand Up @@ -485,12 +483,4 @@ private RemoteNode convertToRemoteNode(NodeId nodeId) {
}
return null;
}

private static ApplicationAttemptId getAppAttemptId() throws YarnException {
AMRMTokenIdentifier amrmTokenIdentifier =
YarnServerSecurityUtils.authorizeRequest();
ApplicationAttemptId applicationAttemptId =
amrmTokenIdentifier.getApplicationAttemptId();
return applicationAttemptId;
}
}

0 comments on commit 61a8436

Please sign in to comment.