YARN-9824. Fall back to configured queue ordering policy class name

This commit is contained in:
Jonathan Hung 2019-09-10 15:19:07 -07:00
parent 10144a580e
commit f8f8598ea5

View File

@ -1552,20 +1552,23 @@ public QueueOrderingPolicy getQueueOrderingPolicy(String queue,
}
String policyType = get(getQueuePrefix(queue) + ORDERING_POLICY,
defaultPolicy);
defaultPolicy).trim();
QueueOrderingPolicy qop;
if (policyType.trim().equals(QUEUE_UTILIZATION_ORDERING_POLICY)) {
if (policyType.equals(QUEUE_UTILIZATION_ORDERING_POLICY)) {
// Doesn't respect priority
qop = new PriorityUtilizationQueueOrderingPolicy(false);
} else if (policyType.trim().equals(
} else if (policyType.equals(
QUEUE_PRIORITY_UTILIZATION_ORDERING_POLICY)) {
qop = new PriorityUtilizationQueueOrderingPolicy(true);
} else {
String message =
"Unable to construct queue ordering policy=" + policyType + " queue="
+ queue;
throw new YarnRuntimeException(message);
try {
qop = (QueueOrderingPolicy) Class.forName(policyType).newInstance();
} catch (Exception e) {
String message = "Unable to construct queue ordering policy="
+ policyType + " queue=" + queue;
throw new YarnRuntimeException(message, e);
}
}
return qop;