YARN-3489. RMServerUtils.validateResourceRequests should only obtain queue info once. (Varun Saxena via wangda)

This commit is contained in:
Wangda Tan 2015-05-28 17:04:20 -07:00
parent 7489b128db
commit bb8350388b
3 changed files with 38 additions and 11 deletions

View File

@ -17,6 +17,9 @@ Release 2.7.1 - UNRELEASED
YARN-3723. Need to clearly document primaryFilter and otherInfo value type. YARN-3723. Need to clearly document primaryFilter and otherInfo value type.
(Zhijie Shen via xgong) (Zhijie Shen via xgong)
YARN-3489. RMServerUtils.validateResourceRequests should only obtain queue
info once. (Varun Saxena via wangda)
OPTIMIZATIONS OPTIMIZATIONS
YARN-3006. Improve the error message when attempting manual failover with YARN-3006. Improve the error message when attempting manual failover with
@ -86,7 +89,6 @@ Release 2.7.1 - UNRELEASED
YARN-3493. RM fails to come up with error "Failed to load/recover state" YARN-3493. RM fails to come up with error "Failed to load/recover state"
when mem settings are changed. (Jian He via wangda) when mem settings are changed. (Jian He via wangda)
<<<<<<< HEAD
YARN-3626. On Windows localized resources are not moved to the front YARN-3626. On Windows localized resources are not moved to the front
of the classpath when they should be. (Craig Welch via xgong) of the classpath when they should be. (Craig Welch via xgong)
@ -1131,7 +1133,6 @@ Release 2.6.0 - 2014-11-18
YARN-2406. Move RM recovery related proto to YARN-2406. Move RM recovery related proto to
yarn_server_resourcemanager_recovery.proto. (Tsuyoshi Ozawa via jianhe) yarn_server_resourcemanager_recovery.proto. (Tsuyoshi Ozawa via jianhe)
<<<<<<< HEAD
YARN-1506. Changed RMNode/SchedulerNode to update resource with event YARN-1506. Changed RMNode/SchedulerNode to update resource with event
notification. (Junping Du via jianhe) notification. (Junping Du via jianhe)

View File

@ -35,6 +35,7 @@ import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
import org.apache.hadoop.yarn.api.records.ApplicationResourceUsageReport; import org.apache.hadoop.yarn.api.records.ApplicationResourceUsageReport;
import org.apache.hadoop.yarn.api.records.ContainerId; import org.apache.hadoop.yarn.api.records.ContainerId;
import org.apache.hadoop.yarn.api.records.NodeState; import org.apache.hadoop.yarn.api.records.NodeState;
import org.apache.hadoop.yarn.api.records.QueueInfo;
import org.apache.hadoop.yarn.api.records.Resource; import org.apache.hadoop.yarn.api.records.Resource;
import org.apache.hadoop.yarn.api.records.ResourceBlacklistRequest; import org.apache.hadoop.yarn.api.records.ResourceBlacklistRequest;
import org.apache.hadoop.yarn.api.records.ResourceRequest; import org.apache.hadoop.yarn.api.records.ResourceRequest;
@ -94,9 +95,16 @@ public class RMServerUtils {
Resource maximumResource, String queueName, YarnScheduler scheduler, Resource maximumResource, String queueName, YarnScheduler scheduler,
RMContext rmContext) RMContext rmContext)
throws InvalidResourceRequestException { throws InvalidResourceRequestException {
QueueInfo queueInfo = null;
try {
queueInfo = scheduler.getQueueInfo(queueName, false, false);
} catch (IOException e) {
}
for (ResourceRequest resReq : ask) { for (ResourceRequest resReq : ask) {
SchedulerUtils.normalizeAndvalidateRequest(resReq, maximumResource, SchedulerUtils.normalizeAndvalidateRequest(resReq, maximumResource,
queueName, scheduler, rmContext); queueName, scheduler, rmContext, queueInfo);
} }
} }

View File

@ -212,28 +212,46 @@ public class SchedulerUtils {
public static void normalizeAndValidateRequest(ResourceRequest resReq, public static void normalizeAndValidateRequest(ResourceRequest resReq,
Resource maximumResource, String queueName, YarnScheduler scheduler, Resource maximumResource, String queueName, YarnScheduler scheduler,
boolean isRecovery, RMContext rmContext) boolean isRecovery, RMContext rmContext, QueueInfo queueInfo)
throws InvalidResourceRequestException { throws InvalidResourceRequestException {
QueueInfo queueInfo = null; if (queueInfo == null) {
try { try {
queueInfo = scheduler.getQueueInfo(queueName, false, false); queueInfo = scheduler.getQueueInfo(queueName, false, false);
} catch (IOException e) { } catch (IOException e) {
// it is possible queue cannot get when queue mapping is set, just ignore // it is possible queue cannot get when queue mapping is set, just ignore
// the queueInfo here, and move forward // the queueInfo here, and move forward
} }
}
SchedulerUtils.normalizeNodeLabelExpressionInRequest(resReq, queueInfo); SchedulerUtils.normalizeNodeLabelExpressionInRequest(resReq, queueInfo);
if (!isRecovery) { if (!isRecovery) {
validateResourceRequest(resReq, maximumResource, queueInfo, rmContext); validateResourceRequest(resReq, maximumResource, queueInfo, rmContext);
} }
} }
public static void normalizeAndValidateRequest(ResourceRequest resReq,
Resource maximumResource, String queueName, YarnScheduler scheduler,
boolean isRecovery, RMContext rmContext)
throws InvalidResourceRequestException {
normalizeAndValidateRequest(resReq, maximumResource, queueName, scheduler,
isRecovery, rmContext, null);
}
public static void normalizeAndvalidateRequest(ResourceRequest resReq,
Resource maximumResource, String queueName, YarnScheduler scheduler,
RMContext rmContext, QueueInfo queueInfo)
throws InvalidResourceRequestException {
normalizeAndValidateRequest(resReq, maximumResource, queueName, scheduler,
false, rmContext, queueInfo);
}
public static void normalizeAndvalidateRequest(ResourceRequest resReq, public static void normalizeAndvalidateRequest(ResourceRequest resReq,
Resource maximumResource, String queueName, YarnScheduler scheduler, Resource maximumResource, String queueName, YarnScheduler scheduler,
RMContext rmContext) RMContext rmContext)
throws InvalidResourceRequestException { throws InvalidResourceRequestException {
normalizeAndValidateRequest(resReq, maximumResource, queueName, scheduler, normalizeAndValidateRequest(resReq, maximumResource, queueName, scheduler,
false, rmContext); false, rmContext, null);
} }
/** /**