goiri commented on a change in pull request #3766:
URL: https://github.com/apache/hadoop/pull/3766#discussion_r767988895
##########
File path:
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/DefaultAMSProcessor.java
##########
@@ -334,6 +335,15 @@ public void allocate(ApplicationAttemptId appAttemptId,
.pullJustFinishedContainers());
response.setAvailableResources(allocation.getResourceLimit());
+ int totalVirtualCores = this.rmContext.getScheduler().getRootQueueMetrics()
Review comment:
Extract this.rmContext.getScheduler().getRootQueueMetrics()
##########
File path:
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/TestPBImplRecords.java
##########
@@ -430,6 +431,7 @@ public static void setup() throws Exception {
generateByNewInstance(UpdatedContainer.class);
generateByNewInstance(ContainerUpdateRequest.class);
generateByNewInstance(ContainerUpdateResponse.class);
+ generateByNewInstance(EnhancedHeadroom.class);
Review comment:
No other tests?
##########
File path:
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/policies/amrmproxy/LocalityMulticastAMRMProxyPolicy.java
##########
@@ -195,9 +198,14 @@ public void notifyOfResponse(SubClusterId subClusterId,
AllocateResponse response) throws YarnException {
if (response.getAvailableResources() != null) {
headroom.put(subClusterId, response.getAvailableResources());
- LOG.info("Subcluster {} updated with {} memory headroom", subClusterId,
- response.getAvailableResources().getMemorySize());
}
+ if (response.getEnhancedHeadroom() != null) {
+ this.enhancedHeadroom.put(subClusterId, response.getEnhancedHeadroom());
Review comment:
Shouldn't we do something with this?
##########
File path:
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/EnhancedHeadroom.java
##########
@@ -0,0 +1,59 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.yarn.api.records;
+
+import org.apache.hadoop.yarn.util.Records;
+
+/**
+ * Enhanced head room in AllocateResponse.
+ *
+ * This provides a channel for RMs to return load information for AMRMProxy
+ * decision making when rerouting resource requests.
+ *
+ * Contains total pending container count and active cores for a cluster.
+ */
+
+public abstract class EnhancedHeadroom {
+
+ public static EnhancedHeadroom newInstance(int totalPendingCount,
+ int totalActiveCores) {
+ EnhancedHeadroom enhancedHeadroom =
+ Records.newRecord(EnhancedHeadroom.class);
+ enhancedHeadroom.setTotalPendingCount(totalPendingCount);
+ enhancedHeadroom.setTotalActiveCores(totalActiveCores);
+ return enhancedHeadroom;
+ }
+
+ public abstract void setTotalPendingCount(int totalPendingCount);
Review comment:
It would be good to add the javadoc for each method.
##########
File path:
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/EnhancedHeadroom.java
##########
@@ -0,0 +1,59 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.yarn.api.records;
+
+import org.apache.hadoop.yarn.util.Records;
+
+/**
+ * Enhanced head room in AllocateResponse.
+ *
+ * This provides a channel for RMs to return load information for AMRMProxy
+ * decision making when rerouting resource requests.
+ *
+ * Contains total pending container count and active cores for a cluster.
+ */
+
Review comment:
Remove empty breakline.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]