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/AbstractYarnScheduler.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/AbstractYarnScheduler.java index b40ce40761..d506f4d2cc 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/AbstractYarnScheduler.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/AbstractYarnScheduler.java @@ -519,20 +519,10 @@ private RMContainer recoverAndCreateContainer(NMContainerStatus status, container.setVersion(status.getVersion()); ApplicationAttemptId attemptId = container.getId().getApplicationAttemptId(); - String labelExpression = status.getNodeLabelExpression(); - // If NodeLabel is disabled but recovered container has label expression - // its better to suppress that and considered as default label. - if (!status.getNodeLabelExpression().isEmpty() && !YarnConfiguration - .areNodeLabelsEnabled(rmContext.getYarnConfiguration())) { - labelExpression = RMNodeLabelsManager.NO_LABEL; - } - - RMContainer rmContainer = - new RMContainerImpl(container, - SchedulerRequestKey.extractFrom(container), attemptId, - node.getNodeID(), applications.get( - attemptId.getApplicationId()).getUser(), rmContext, - status.getCreationTime(), labelExpression); + RMContainer rmContainer = new RMContainerImpl(container, + SchedulerRequestKey.extractFrom(container), attemptId, node.getNodeID(), + applications.get(attemptId.getApplicationId()).getUser(), rmContext, + status.getCreationTime(), status.getNodeLabelExpression()); return rmContainer; } 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/AppSchedulingInfo.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/AppSchedulingInfo.java index 851c9f5587..8acf7d55db 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/AppSchedulingInfo.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/AppSchedulingInfo.java @@ -524,7 +524,7 @@ public void transferStateFromPreviousAppSchedulingInfo( this.placesBlacklistedByApp = appInfo.getBlackList(); } - public void recoverContainer(RMContainer rmContainer) { + public void recoverContainer(RMContainer rmContainer, String partition) { try { this.writeLock.lock(); QueueMetrics metrics = queue.getMetrics(); @@ -540,8 +540,8 @@ public void recoverContainer(RMContainer rmContainer) { return; } - metrics.allocateResources(rmContainer.getNodeLabelExpression(), - user, 1, rmContainer.getAllocatedResource(), false); + metrics.allocateResources(partition, user, 1, + rmContainer.getAllocatedResource(), false); } finally { this.writeLock.unlock(); } 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/SchedulerApplicationAttempt.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/SchedulerApplicationAttempt.java index 4b0bf91e25..8b2f9db927 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/SchedulerApplicationAttempt.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/SchedulerApplicationAttempt.java @@ -1103,7 +1103,7 @@ public void recoverContainer(SchedulerNode node, try { writeLock.lock(); // recover app scheduling info - appSchedulingInfo.recoverContainer(rmContainer); + appSchedulingInfo.recoverContainer(rmContainer, node.getPartition()); if (rmContainer.getState().equals(RMContainerState.COMPLETED)) { return;