TaoYang526 commented on code in PR #7121:
URL: https://github.com/apache/hadoop/pull/7121#discussion_r1806055092
##########
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/placement/MultiNodeSorter.java:
##########
@@ -74,23 +75,30 @@ public synchronized MultiNodeLookupPolicy<N>
getMultiNodeLookupPolicy() {
}
public void serviceInit(Configuration conf) throws Exception {
- LOG.info("Initializing MultiNodeSorter=" + policySpec.getPolicyClassName()
+ LOG.info("Initializing MultiNodeSorter policyName=" +
policySpec.getPolicyName()
+ + ", policyClassName=" + policySpec.getPolicyClassName()
+ ", with sorting interval=" + policySpec.getSortingInterval());
- initPolicy(policySpec.getPolicyClassName());
+ initPolicy(policySpec);
super.serviceInit(conf);
}
@SuppressWarnings("unchecked")
- void initPolicy(String policyName) throws YarnException {
+ void initPolicy(MultiNodePolicySpec policySpec) throws YarnException {
+ String policyName = policySpec.getPolicyName();
+ String policyClassName = policySpec.getPolicyClassName();
Class<?> policyClass;
try {
- policyClass = Class.forName(policyName);
+ policyClass = Class.forName(policyClassName);
} catch (ClassNotFoundException e) {
throw new YarnException(
- "Invalid policy name:" + policyName + e.getMessage());
+ "Invalid policy class name:" + policyClassName + e.getMessage());
}
+ Configuration policyConf = new Configuration(this.getConfig());
Review Comment:
In MultiNodeSortingManager#createAllPolicies, we can see all the
MultiNodeSorter instances owns a shared config, policyName will be set in
policyConf, which is a instance-level configuration, so that policyInstance can
get the configurations belong to itself.
--
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]