You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by ab...@apache.org on 2019/10/02 12:25:19 UTC

[hadoop] branch trunk updated: YARN-9870. Remove unused function from OpportunisticContainerAllocatorAMService. Contributed by Abhishek Modi.

This is an automated email from the ASF dual-hosted git repository.

abmodi pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/hadoop.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 61a8436  YARN-9870. Remove unused function from OpportunisticContainerAllocatorAMService. Contributed by Abhishek Modi.
61a8436 is described below

commit 61a8436004294db0224dd20aa3997fa2e3136114
Author: Abhishek Modi <ab...@apache.org>
AuthorDate: Wed Oct 2 17:55:07 2019 +0530

    YARN-9870. Remove unused function from OpportunisticContainerAllocatorAMService. Contributed by Abhishek Modi.
---
 .../OpportunisticContainerAllocatorAMService.java  | 22 ++++++----------------
 1 file changed, 6 insertions(+), 16 deletions(-)

diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/OpportunisticContainerAllocatorAMService.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/OpportunisticContainerAllocatorAMService.java
index 4475caf..d51afa2 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/OpportunisticContainerAllocatorAMService.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/OpportunisticContainerAllocatorAMService.java
@@ -38,7 +38,6 @@ import org.apache.hadoop.yarn.api.records.Container;
 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;
 
@@ -77,7 +76,6 @@ import org.apache.hadoop.yarn.server.resourcemanager.security.AMRMTokenSecretMan
 
 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;
@@ -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;
@@ -176,7 +174,7 @@ public class OpportunisticContainerAllocatorAMService
 
       if (!appAttempt.getApplicationAttemptId().equals(appAttemptId)){
         LOG.error("Calling allocate on previous or removed or non "
-            + "existent application attempt " + appAttemptId);
+            + "existent application attempt {}", appAttemptId);
         return;
       }
 
@@ -238,7 +236,7 @@ public class OpportunisticContainerAllocatorAMService
         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(
@@ -440,12 +438,12 @@ public class OpportunisticContainerAllocatorAMService
     // <-- IGNORED EVENTS : END -->
     default:
       LOG.error("Unknown event arrived at" +
-          "OpportunisticContainerAllocatorAMService: " + event.toString());
+          "OpportunisticContainerAllocatorAMService: {}", event);
     }
 
   }
 
-  public QueueLimitCalculator getNodeManagerQueueLimitCalculator() {
+  QueueLimitCalculator getNodeManagerQueueLimitCalculator() {
     return nodeMonitor.getThresholdCalculator();
   }
 
@@ -455,7 +453,7 @@ public class OpportunisticContainerAllocatorAMService
     if ((currTime - lastCacheUpdateTime > cacheRefreshInterval)
         || (cachedNodes == null)) {
       cachedNodes = convertToRemoteNodes(
-          this.nodeMonitor.selectLeastLoadedNodes(this.k));
+          this.nodeMonitor.selectLeastLoadedNodes(this.numNodes));
       if (cachedNodes.size() > 0) {
         lastCacheUpdateTime = currTime;
       }
@@ -485,12 +483,4 @@ public class OpportunisticContainerAllocatorAMService
     }
     return null;
   }
-
-  private static ApplicationAttemptId getAppAttemptId() throws YarnException {
-    AMRMTokenIdentifier amrmTokenIdentifier =
-        YarnServerSecurityUtils.authorizeRequest();
-    ApplicationAttemptId applicationAttemptId =
-        amrmTokenIdentifier.getApplicationAttemptId();
-    return applicationAttemptId;
-  }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org