From 4e209a31da6c242a3cb940fa97758e1e040ef8a4 Mon Sep 17 00:00:00 2001 From: Jack Date: Wed, 8 Sep 2021 22:19:29 +0800 Subject: [PATCH] YARN-10919. Remove LeafQueue#scheduler field (#3382) Co-authored-by: Jie Wang --- .../scheduler/capacity/LeafQueue.java | 13 +++++-------- 1 file changed, 5 insertions(+), 8 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/scheduler/capacity/LeafQueue.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/LeafQueue.java index 44727fb1db..73b21060ac 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/LeafQueue.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/LeafQueue.java @@ -109,8 +109,6 @@ public class LeafQueue extends AbstractCSQueue { private final RecordFactory recordFactory = RecordFactoryProvider.getRecordFactory(null); - private CapacitySchedulerContext scheduler; - private final UsersManager usersManager; // cache last cluster resource to compute actual capacity @@ -162,9 +160,8 @@ public LeafQueue(CapacitySchedulerContext cs, IOException { super(cs, configuration, queueName, parent, old); setDynamicQueue(isDynamic); - this.scheduler = cs; - this.usersManager = new UsersManager(metrics, this, labelManager, scheduler, + this.usersManager = new UsersManager(metrics, this, labelManager, csContext, resourceCalculator); // One time initialization is enough since it is static ordering policy @@ -217,7 +214,7 @@ protected void setupQueueConfigs(Resource clusterResource, } priorityAcls = conf.getPriorityAcls(getQueuePath(), - scheduler.getMaxClusterLevelAppPriority()); + csContext.getMaxClusterLevelAppPriority()); if (!SchedulerUtils.checkQueueLabelExpression(this.accessibleLabels, this.defaultLabelExpression, null)) { @@ -2031,7 +2028,7 @@ public void recoverContainer(Resource clusterResource, // Careful! Locking order is important! writeLock.lock(); try { - FiCaSchedulerNode node = scheduler.getNode( + FiCaSchedulerNode node = csContext.getNode( rmContainer.getContainer().getNodeId()); allocateResource(clusterResource, attempt, rmContainer.getContainer().getResource(), node.getPartition(), @@ -2158,7 +2155,7 @@ public void attachContainer(Resource clusterResource, if (application != null && rmContainer != null && rmContainer.getExecutionType() == ExecutionType.GUARANTEED) { FiCaSchedulerNode node = - scheduler.getNode(rmContainer.getContainer().getNodeId()); + csContext.getNode(rmContainer.getContainer().getNodeId()); allocateResource(clusterResource, application, rmContainer.getContainer() .getResource(), node.getPartition(), rmContainer); LOG.info("movedContainer" + " container=" + rmContainer.getContainer() @@ -2178,7 +2175,7 @@ public void detachContainer(Resource clusterResource, if (application != null && rmContainer != null && rmContainer.getExecutionType() == ExecutionType.GUARANTEED) { FiCaSchedulerNode node = - scheduler.getNode(rmContainer.getContainer().getNodeId()); + csContext.getNode(rmContainer.getContainer().getNodeId()); releaseResource(clusterResource, application, rmContainer.getContainer() .getResource(), node.getPartition(), rmContainer); LOG.info("movedContainer" + " container=" + rmContainer.getContainer()