YARN-3493. RM fails to come up with error "Failed to load/recover state" when mem settings are changed. (Jian He via wangda)
(cherry picked from commit f65eeb412d
)
This commit is contained in:
parent
9827da95bc
commit
e7cbecddc3
|
@ -176,6 +176,9 @@ Release 2.8.0 - UNRELEASED
|
||||||
YARN-3021. YARN's delegation-token handling disallows certain trust setups
|
YARN-3021. YARN's delegation-token handling disallows certain trust setups
|
||||||
to operate properly over DistCp. (Yongjun Zhang via jianhe)
|
to operate properly over DistCp. (Yongjun Zhang via jianhe)
|
||||||
|
|
||||||
|
YARN-3493. RM fails to come up with error "Failed to load/recover state"
|
||||||
|
when mem settings are changed. (Jian He via wangda)
|
||||||
|
|
||||||
Release 2.7.1 - UNRELEASED
|
Release 2.7.1 - UNRELEASED
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
|
|
@ -499,7 +499,7 @@ public class ApplicationMasterService extends AbstractService implements
|
||||||
|
|
||||||
// sanity check
|
// sanity check
|
||||||
try {
|
try {
|
||||||
RMServerUtils.validateResourceRequests(ask,
|
RMServerUtils.normalizeAndValidateRequests(ask,
|
||||||
rScheduler.getMaximumResourceCapability(), app.getQueue(),
|
rScheduler.getMaximumResourceCapability(), app.getQueue(),
|
||||||
rScheduler);
|
rScheduler);
|
||||||
} catch (InvalidResourceRequestException e) {
|
} catch (InvalidResourceRequestException e) {
|
||||||
|
|
|
@ -279,7 +279,7 @@ public class RMAppManager implements EventHandler<RMAppManagerEvent>,
|
||||||
ApplicationId applicationId = submissionContext.getApplicationId();
|
ApplicationId applicationId = submissionContext.getApplicationId();
|
||||||
|
|
||||||
RMAppImpl application =
|
RMAppImpl application =
|
||||||
createAndPopulateNewRMApp(submissionContext, submitTime, user);
|
createAndPopulateNewRMApp(submissionContext, submitTime, user, false);
|
||||||
ApplicationId appId = submissionContext.getApplicationId();
|
ApplicationId appId = submissionContext.getApplicationId();
|
||||||
|
|
||||||
if (UserGroupInformation.isSecurityEnabled()) {
|
if (UserGroupInformation.isSecurityEnabled()) {
|
||||||
|
@ -316,16 +316,18 @@ public class RMAppManager implements EventHandler<RMAppManagerEvent>,
|
||||||
// create and recover app.
|
// create and recover app.
|
||||||
RMAppImpl application =
|
RMAppImpl application =
|
||||||
createAndPopulateNewRMApp(appContext, appState.getSubmitTime(),
|
createAndPopulateNewRMApp(appContext, appState.getSubmitTime(),
|
||||||
appState.getUser());
|
appState.getUser(), true);
|
||||||
|
|
||||||
application.handle(new RMAppRecoverEvent(appId, rmState));
|
application.handle(new RMAppRecoverEvent(appId, rmState));
|
||||||
}
|
}
|
||||||
|
|
||||||
private RMAppImpl createAndPopulateNewRMApp(
|
private RMAppImpl createAndPopulateNewRMApp(
|
||||||
ApplicationSubmissionContext submissionContext,
|
ApplicationSubmissionContext submissionContext, long submitTime,
|
||||||
long submitTime, String user)
|
String user, boolean isRecovery) throws YarnException {
|
||||||
throws YarnException {
|
|
||||||
ApplicationId applicationId = submissionContext.getApplicationId();
|
ApplicationId applicationId = submissionContext.getApplicationId();
|
||||||
ResourceRequest amReq = validateAndCreateResourceRequest(submissionContext);
|
ResourceRequest amReq =
|
||||||
|
validateAndCreateResourceRequest(submissionContext, isRecovery);
|
||||||
|
|
||||||
// Create RMApp
|
// Create RMApp
|
||||||
RMAppImpl application =
|
RMAppImpl application =
|
||||||
new RMAppImpl(applicationId, rmContext, this.conf,
|
new RMAppImpl(applicationId, rmContext, this.conf,
|
||||||
|
@ -343,7 +345,7 @@ public class RMAppManager implements EventHandler<RMAppManagerEvent>,
|
||||||
String message = "Application with id " + applicationId
|
String message = "Application with id " + applicationId
|
||||||
+ " is already present! Cannot add a duplicate!";
|
+ " is already present! Cannot add a duplicate!";
|
||||||
LOG.warn(message);
|
LOG.warn(message);
|
||||||
throw RPCUtil.getRemoteException(message);
|
throw new YarnException(message);
|
||||||
}
|
}
|
||||||
// Inform the ACLs Manager
|
// Inform the ACLs Manager
|
||||||
this.applicationACLsManager.addApplication(applicationId,
|
this.applicationACLsManager.addApplication(applicationId,
|
||||||
|
@ -356,7 +358,7 @@ public class RMAppManager implements EventHandler<RMAppManagerEvent>,
|
||||||
}
|
}
|
||||||
|
|
||||||
private ResourceRequest validateAndCreateResourceRequest(
|
private ResourceRequest validateAndCreateResourceRequest(
|
||||||
ApplicationSubmissionContext submissionContext)
|
ApplicationSubmissionContext submissionContext, boolean isRecovery)
|
||||||
throws InvalidResourceRequestException {
|
throws InvalidResourceRequestException {
|
||||||
// Validation of the ApplicationSubmissionContext needs to be completed
|
// Validation of the ApplicationSubmissionContext needs to be completed
|
||||||
// here. Only those fields that are dependent on RM's configuration are
|
// here. Only those fields that are dependent on RM's configuration are
|
||||||
|
@ -365,16 +367,13 @@ public class RMAppManager implements EventHandler<RMAppManagerEvent>,
|
||||||
|
|
||||||
// Check whether AM resource requirements are within required limits
|
// Check whether AM resource requirements are within required limits
|
||||||
if (!submissionContext.getUnmanagedAM()) {
|
if (!submissionContext.getUnmanagedAM()) {
|
||||||
ResourceRequest amReq;
|
ResourceRequest amReq = submissionContext.getAMContainerResourceRequest();
|
||||||
if (submissionContext.getAMContainerResourceRequest() != null) {
|
if (amReq == null) {
|
||||||
amReq = submissionContext.getAMContainerResourceRequest();
|
amReq = BuilderUtils
|
||||||
} else {
|
.newResourceRequest(RMAppAttemptImpl.AM_CONTAINER_PRIORITY,
|
||||||
amReq =
|
ResourceRequest.ANY, submissionContext.getResource(), 1);
|
||||||
BuilderUtils.newResourceRequest(
|
|
||||||
RMAppAttemptImpl.AM_CONTAINER_PRIORITY, ResourceRequest.ANY,
|
|
||||||
submissionContext.getResource(), 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// set label expression for AM container
|
// set label expression for AM container
|
||||||
if (null == amReq.getNodeLabelExpression()) {
|
if (null == amReq.getNodeLabelExpression()) {
|
||||||
amReq.setNodeLabelExpression(submissionContext
|
amReq.setNodeLabelExpression(submissionContext
|
||||||
|
@ -382,14 +381,15 @@ public class RMAppManager implements EventHandler<RMAppManagerEvent>,
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
SchedulerUtils.validateResourceRequest(amReq,
|
SchedulerUtils.normalizeAndValidateRequest(amReq,
|
||||||
scheduler.getMaximumResourceCapability(),
|
scheduler.getMaximumResourceCapability(),
|
||||||
submissionContext.getQueue(), scheduler);
|
submissionContext.getQueue(), scheduler, isRecovery);
|
||||||
} catch (InvalidResourceRequestException e) {
|
} catch (InvalidResourceRequestException e) {
|
||||||
LOG.warn("RM app submission failed in validating AM resource request"
|
LOG.warn("RM app submission failed in validating AM resource request"
|
||||||
+ " for application " + submissionContext.getApplicationId(), e);
|
+ " for application " + submissionContext.getApplicationId(), e);
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
|
||||||
SchedulerUtils.normalizeRequest(amReq, scheduler.getResourceCalculator(),
|
SchedulerUtils.normalizeRequest(amReq, scheduler.getResourceCalculator(),
|
||||||
scheduler.getClusterResource(),
|
scheduler.getClusterResource(),
|
||||||
scheduler.getMinimumResourceCapability(),
|
scheduler.getMinimumResourceCapability(),
|
||||||
|
|
|
@ -90,11 +90,11 @@ public class RMServerUtils {
|
||||||
* Utility method to validate a list resource requests, by insuring that the
|
* Utility method to validate a list resource requests, by insuring that the
|
||||||
* requested memory/vcore is non-negative and not greater than max
|
* requested memory/vcore is non-negative and not greater than max
|
||||||
*/
|
*/
|
||||||
public static void validateResourceRequests(List<ResourceRequest> ask,
|
public static void normalizeAndValidateRequests(List<ResourceRequest> ask,
|
||||||
Resource maximumResource, String queueName, YarnScheduler scheduler)
|
Resource maximumResource, String queueName, YarnScheduler scheduler)
|
||||||
throws InvalidResourceRequestException {
|
throws InvalidResourceRequestException {
|
||||||
for (ResourceRequest resReq : ask) {
|
for (ResourceRequest resReq : ask) {
|
||||||
SchedulerUtils.validateResourceRequest(resReq, maximumResource,
|
SchedulerUtils.normalizeAndvalidateRequest(resReq, maximumResource,
|
||||||
queueName, scheduler);
|
queueName, scheduler);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -940,7 +940,6 @@ public class RMAppAttemptImpl implements RMAppAttempt, Recoverable {
|
||||||
appAttempt.amReq.setResourceName(ResourceRequest.ANY);
|
appAttempt.amReq.setResourceName(ResourceRequest.ANY);
|
||||||
appAttempt.amReq.setRelaxLocality(true);
|
appAttempt.amReq.setRelaxLocality(true);
|
||||||
|
|
||||||
// SchedulerUtils.validateResourceRequests is not necessary because
|
|
||||||
// AM resource has been checked when submission
|
// AM resource has been checked when submission
|
||||||
Allocation amContainerAllocation =
|
Allocation amContainerAllocation =
|
||||||
appAttempt.scheduler.allocate(appAttempt.applicationAttemptId,
|
appAttempt.scheduler.allocate(appAttempt.applicationAttemptId,
|
||||||
|
|
|
@ -189,6 +189,50 @@ public class SchedulerUtils {
|
||||||
ask.setCapability(normalized);
|
ask.setCapability(normalized);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void normalizeNodeLabelExpressionInRequest(
|
||||||
|
ResourceRequest resReq, QueueInfo queueInfo) {
|
||||||
|
|
||||||
|
String labelExp = resReq.getNodeLabelExpression();
|
||||||
|
|
||||||
|
// if queue has default label expression, and RR doesn't have, use the
|
||||||
|
// default label expression of queue
|
||||||
|
if (labelExp == null && queueInfo != null && ResourceRequest.ANY
|
||||||
|
.equals(resReq.getResourceName())) {
|
||||||
|
labelExp = queueInfo.getDefaultNodeLabelExpression();
|
||||||
|
}
|
||||||
|
|
||||||
|
// If labelExp still equals to null, set it to be NO_LABEL
|
||||||
|
if (labelExp == null) {
|
||||||
|
labelExp = RMNodeLabelsManager.NO_LABEL;
|
||||||
|
}
|
||||||
|
resReq.setNodeLabelExpression(labelExp);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void normalizeAndValidateRequest(ResourceRequest resReq,
|
||||||
|
Resource maximumResource, String queueName, YarnScheduler scheduler,
|
||||||
|
boolean isRecovery)
|
||||||
|
throws InvalidResourceRequestException {
|
||||||
|
|
||||||
|
QueueInfo queueInfo = null;
|
||||||
|
try {
|
||||||
|
queueInfo = scheduler.getQueueInfo(queueName, false, false);
|
||||||
|
} catch (IOException e) {
|
||||||
|
// it is possible queue cannot get when queue mapping is set, just ignore
|
||||||
|
// the queueInfo here, and move forward
|
||||||
|
}
|
||||||
|
SchedulerUtils.normalizeNodeLabelExpressionInRequest(resReq, queueInfo);
|
||||||
|
if (!isRecovery) {
|
||||||
|
validateResourceRequest(resReq, maximumResource, queueInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void normalizeAndvalidateRequest(ResourceRequest resReq,
|
||||||
|
Resource maximumResource, String queueName, YarnScheduler scheduler)
|
||||||
|
throws InvalidResourceRequestException {
|
||||||
|
normalizeAndValidateRequest(resReq, maximumResource, queueName, scheduler,
|
||||||
|
false);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility method to validate a resource request, by insuring that the
|
* Utility method to validate a resource request, by insuring that the
|
||||||
* requested memory/vcore is non-negative and not greater than max
|
* requested memory/vcore is non-negative and not greater than max
|
||||||
|
@ -196,7 +240,7 @@ public class SchedulerUtils {
|
||||||
* @throws InvalidResourceRequestException when there is invalid request
|
* @throws InvalidResourceRequestException when there is invalid request
|
||||||
*/
|
*/
|
||||||
public static void validateResourceRequest(ResourceRequest resReq,
|
public static void validateResourceRequest(ResourceRequest resReq,
|
||||||
Resource maximumResource, String queueName, YarnScheduler scheduler)
|
Resource maximumResource, QueueInfo queueInfo)
|
||||||
throws InvalidResourceRequestException {
|
throws InvalidResourceRequestException {
|
||||||
if (resReq.getCapability().getMemory() < 0 ||
|
if (resReq.getCapability().getMemory() < 0 ||
|
||||||
resReq.getCapability().getMemory() > maximumResource.getMemory()) {
|
resReq.getCapability().getMemory() > maximumResource.getMemory()) {
|
||||||
|
@ -216,31 +260,7 @@ public class SchedulerUtils {
|
||||||
+ resReq.getCapability().getVirtualCores()
|
+ resReq.getCapability().getVirtualCores()
|
||||||
+ ", maxVirtualCores=" + maximumResource.getVirtualCores());
|
+ ", maxVirtualCores=" + maximumResource.getVirtualCores());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get queue from scheduler
|
|
||||||
QueueInfo queueInfo = null;
|
|
||||||
try {
|
|
||||||
queueInfo = scheduler.getQueueInfo(queueName, false, false);
|
|
||||||
} catch (IOException e) {
|
|
||||||
// it is possible queue cannot get when queue mapping is set, just ignore
|
|
||||||
// the queueInfo here, and move forward
|
|
||||||
}
|
|
||||||
|
|
||||||
// check labels in the resource request.
|
|
||||||
String labelExp = resReq.getNodeLabelExpression();
|
String labelExp = resReq.getNodeLabelExpression();
|
||||||
|
|
||||||
// if queue has default label expression, and RR doesn't have, use the
|
|
||||||
// default label expression of queue
|
|
||||||
if (labelExp == null && queueInfo != null
|
|
||||||
&& ResourceRequest.ANY.equals(resReq.getResourceName())) {
|
|
||||||
labelExp = queueInfo.getDefaultNodeLabelExpression();
|
|
||||||
}
|
|
||||||
|
|
||||||
// If labelExp still equals to null, set it to be NO_LABEL
|
|
||||||
resReq
|
|
||||||
.setNodeLabelExpression(labelExp == null ? RMNodeLabelsManager.NO_LABEL
|
|
||||||
: labelExp);
|
|
||||||
|
|
||||||
// we don't allow specify label expression other than resourceName=ANY now
|
// we don't allow specify label expression other than resourceName=ANY now
|
||||||
if (!ResourceRequest.ANY.equals(resReq.getResourceName())
|
if (!ResourceRequest.ANY.equals(resReq.getResourceName())
|
||||||
&& labelExp != null && !labelExp.trim().isEmpty()) {
|
&& labelExp != null && !labelExp.trim().isEmpty()) {
|
||||||
|
|
|
@ -1011,4 +1011,30 @@ public class TestWorkPreservingRMRestart extends ParameterizedSchedulerTestBase
|
||||||
rm2.waitForState(am1.getApplicationAttemptId(), RMAppAttemptState.FAILED);
|
rm2.waitForState(am1.getApplicationAttemptId(), RMAppAttemptState.FAILED);
|
||||||
rm2.waitForState(app1.getApplicationId(), RMAppState.FAILED);
|
rm2.waitForState(app1.getApplicationId(), RMAppState.FAILED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test validateAndCreateResourceRequest fails on recovery, app should ignore
|
||||||
|
* this Exception and continue
|
||||||
|
*/
|
||||||
|
@Test (timeout = 30000)
|
||||||
|
public void testAppFailToValidateResourceRequestOnRecovery() throws Exception{
|
||||||
|
MemoryRMStateStore memStore = new MemoryRMStateStore();
|
||||||
|
memStore.init(conf);
|
||||||
|
rm1 = new MockRM(conf, memStore);
|
||||||
|
rm1.start();
|
||||||
|
MockNM nm1 =
|
||||||
|
new MockNM("127.0.0.1:1234", 8192, rm1.getResourceTrackerService());
|
||||||
|
nm1.registerNode();
|
||||||
|
RMApp app1 = rm1.submitApp(200);
|
||||||
|
MockAM am1 = MockRM.launchAndRegisterAM(app1, rm1, nm1);
|
||||||
|
|
||||||
|
// Change the config so that validateAndCreateResourceRequest throws
|
||||||
|
// exception on recovery
|
||||||
|
conf.setInt(YarnConfiguration.RM_SCHEDULER_MINIMUM_ALLOCATION_MB, 50);
|
||||||
|
conf.setInt(YarnConfiguration.RM_SCHEDULER_MAXIMUM_ALLOCATION_MB, 100);
|
||||||
|
|
||||||
|
rm2 = new MockRM(conf, memStore);
|
||||||
|
nm1.setResourceTrackerService(rm2.getResourceTrackerService());
|
||||||
|
rm2.start();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,7 +63,6 @@ import org.apache.hadoop.yarn.exceptions.InvalidResourceBlacklistRequestExceptio
|
||||||
import org.apache.hadoop.yarn.exceptions.InvalidResourceRequestException;
|
import org.apache.hadoop.yarn.exceptions.InvalidResourceRequestException;
|
||||||
import org.apache.hadoop.yarn.ipc.YarnRPC;
|
import org.apache.hadoop.yarn.ipc.YarnRPC;
|
||||||
import org.apache.hadoop.yarn.nodelabels.CommonNodeLabelsManager;
|
import org.apache.hadoop.yarn.nodelabels.CommonNodeLabelsManager;
|
||||||
import org.apache.hadoop.yarn.nodelabels.NodeLabelsStore;
|
|
||||||
import org.apache.hadoop.yarn.server.resourcemanager.MockNM;
|
import org.apache.hadoop.yarn.server.resourcemanager.MockNM;
|
||||||
import org.apache.hadoop.yarn.server.resourcemanager.TestAMAuthorization.MockRMWithAMS;
|
import org.apache.hadoop.yarn.server.resourcemanager.TestAMAuthorization.MockRMWithAMS;
|
||||||
import org.apache.hadoop.yarn.server.resourcemanager.TestAMAuthorization.MyContainerManager;
|
import org.apache.hadoop.yarn.server.resourcemanager.TestAMAuthorization.MyContainerManager;
|
||||||
|
@ -213,19 +212,19 @@ public class TestSchedulerUtils {
|
||||||
ResourceRequest resReq = BuilderUtils.newResourceRequest(
|
ResourceRequest resReq = BuilderUtils.newResourceRequest(
|
||||||
mock(Priority.class), ResourceRequest.ANY, resource, 1);
|
mock(Priority.class), ResourceRequest.ANY, resource, 1);
|
||||||
resReq.setNodeLabelExpression("x");
|
resReq.setNodeLabelExpression("x");
|
||||||
SchedulerUtils.validateResourceRequest(resReq, maxResource, "queue",
|
SchedulerUtils.normalizeAndvalidateRequest(resReq, maxResource, "queue",
|
||||||
scheduler);
|
scheduler);
|
||||||
|
|
||||||
resReq.setNodeLabelExpression("y");
|
resReq.setNodeLabelExpression("y");
|
||||||
SchedulerUtils.validateResourceRequest(resReq, maxResource, "queue",
|
SchedulerUtils.normalizeAndvalidateRequest(resReq, maxResource, "queue",
|
||||||
scheduler);
|
scheduler);
|
||||||
|
|
||||||
resReq.setNodeLabelExpression("");
|
resReq.setNodeLabelExpression("");
|
||||||
SchedulerUtils.validateResourceRequest(resReq, maxResource, "queue",
|
SchedulerUtils.normalizeAndvalidateRequest(resReq, maxResource, "queue",
|
||||||
scheduler);
|
scheduler);
|
||||||
|
|
||||||
resReq.setNodeLabelExpression(" ");
|
resReq.setNodeLabelExpression(" ");
|
||||||
SchedulerUtils.validateResourceRequest(resReq, maxResource, "queue",
|
SchedulerUtils.normalizeAndvalidateRequest(resReq, maxResource, "queue",
|
||||||
scheduler);
|
scheduler);
|
||||||
} catch (InvalidResourceRequestException e) {
|
} catch (InvalidResourceRequestException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -244,7 +243,7 @@ public class TestSchedulerUtils {
|
||||||
ResourceRequest resReq = BuilderUtils.newResourceRequest(
|
ResourceRequest resReq = BuilderUtils.newResourceRequest(
|
||||||
mock(Priority.class), ResourceRequest.ANY, resource, 1);
|
mock(Priority.class), ResourceRequest.ANY, resource, 1);
|
||||||
resReq.setNodeLabelExpression("z");
|
resReq.setNodeLabelExpression("z");
|
||||||
SchedulerUtils.validateResourceRequest(resReq, maxResource, "queue",
|
SchedulerUtils.normalizeAndvalidateRequest(resReq, maxResource, "queue",
|
||||||
scheduler);
|
scheduler);
|
||||||
fail("Should fail");
|
fail("Should fail");
|
||||||
} catch (InvalidResourceRequestException e) {
|
} catch (InvalidResourceRequestException e) {
|
||||||
|
@ -263,7 +262,7 @@ public class TestSchedulerUtils {
|
||||||
ResourceRequest resReq = BuilderUtils.newResourceRequest(
|
ResourceRequest resReq = BuilderUtils.newResourceRequest(
|
||||||
mock(Priority.class), ResourceRequest.ANY, resource, 1);
|
mock(Priority.class), ResourceRequest.ANY, resource, 1);
|
||||||
resReq.setNodeLabelExpression("x && y");
|
resReq.setNodeLabelExpression("x && y");
|
||||||
SchedulerUtils.validateResourceRequest(resReq, maxResource, "queue",
|
SchedulerUtils.normalizeAndvalidateRequest(resReq, maxResource, "queue",
|
||||||
scheduler);
|
scheduler);
|
||||||
fail("Should fail");
|
fail("Should fail");
|
||||||
} catch (InvalidResourceRequestException e) {
|
} catch (InvalidResourceRequestException e) {
|
||||||
|
@ -280,15 +279,15 @@ public class TestSchedulerUtils {
|
||||||
YarnConfiguration.DEFAULT_RM_SCHEDULER_MINIMUM_ALLOCATION_VCORES);
|
YarnConfiguration.DEFAULT_RM_SCHEDULER_MINIMUM_ALLOCATION_VCORES);
|
||||||
ResourceRequest resReq = BuilderUtils.newResourceRequest(
|
ResourceRequest resReq = BuilderUtils.newResourceRequest(
|
||||||
mock(Priority.class), ResourceRequest.ANY, resource, 1);
|
mock(Priority.class), ResourceRequest.ANY, resource, 1);
|
||||||
SchedulerUtils.validateResourceRequest(resReq, maxResource, "queue",
|
SchedulerUtils.normalizeAndvalidateRequest(resReq, maxResource, "queue",
|
||||||
scheduler);
|
scheduler);
|
||||||
|
|
||||||
resReq.setNodeLabelExpression("");
|
resReq.setNodeLabelExpression("");
|
||||||
SchedulerUtils.validateResourceRequest(resReq, maxResource, "queue",
|
SchedulerUtils.normalizeAndvalidateRequest(resReq, maxResource, "queue",
|
||||||
scheduler);
|
scheduler);
|
||||||
|
|
||||||
resReq.setNodeLabelExpression(" ");
|
resReq.setNodeLabelExpression(" ");
|
||||||
SchedulerUtils.validateResourceRequest(resReq, maxResource, "queue",
|
SchedulerUtils.normalizeAndvalidateRequest(resReq, maxResource, "queue",
|
||||||
scheduler);
|
scheduler);
|
||||||
} catch (InvalidResourceRequestException e) {
|
} catch (InvalidResourceRequestException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -306,7 +305,7 @@ public class TestSchedulerUtils {
|
||||||
ResourceRequest resReq = BuilderUtils.newResourceRequest(
|
ResourceRequest resReq = BuilderUtils.newResourceRequest(
|
||||||
mock(Priority.class), ResourceRequest.ANY, resource, 1);
|
mock(Priority.class), ResourceRequest.ANY, resource, 1);
|
||||||
resReq.setNodeLabelExpression("x");
|
resReq.setNodeLabelExpression("x");
|
||||||
SchedulerUtils.validateResourceRequest(resReq, maxResource, "queue",
|
SchedulerUtils.normalizeAndvalidateRequest(resReq, maxResource, "queue",
|
||||||
scheduler);
|
scheduler);
|
||||||
fail("Should fail");
|
fail("Should fail");
|
||||||
} catch (InvalidResourceRequestException e) {
|
} catch (InvalidResourceRequestException e) {
|
||||||
|
@ -324,15 +323,15 @@ public class TestSchedulerUtils {
|
||||||
ResourceRequest resReq = BuilderUtils.newResourceRequest(
|
ResourceRequest resReq = BuilderUtils.newResourceRequest(
|
||||||
mock(Priority.class), ResourceRequest.ANY, resource, 1);
|
mock(Priority.class), ResourceRequest.ANY, resource, 1);
|
||||||
resReq.setNodeLabelExpression("x");
|
resReq.setNodeLabelExpression("x");
|
||||||
SchedulerUtils.validateResourceRequest(resReq, maxResource, "queue",
|
SchedulerUtils.normalizeAndvalidateRequest(resReq, maxResource, "queue",
|
||||||
scheduler);
|
scheduler);
|
||||||
|
|
||||||
resReq.setNodeLabelExpression("y");
|
resReq.setNodeLabelExpression("y");
|
||||||
SchedulerUtils.validateResourceRequest(resReq, maxResource, "queue",
|
SchedulerUtils.normalizeAndvalidateRequest(resReq, maxResource, "queue",
|
||||||
scheduler);
|
scheduler);
|
||||||
|
|
||||||
resReq.setNodeLabelExpression("z");
|
resReq.setNodeLabelExpression("z");
|
||||||
SchedulerUtils.validateResourceRequest(resReq, maxResource, "queue",
|
SchedulerUtils.normalizeAndvalidateRequest(resReq, maxResource, "queue",
|
||||||
scheduler);
|
scheduler);
|
||||||
} catch (InvalidResourceRequestException e) {
|
} catch (InvalidResourceRequestException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -351,7 +350,7 @@ public class TestSchedulerUtils {
|
||||||
ResourceRequest resReq = BuilderUtils.newResourceRequest(
|
ResourceRequest resReq = BuilderUtils.newResourceRequest(
|
||||||
mock(Priority.class), "rack", resource, 1);
|
mock(Priority.class), "rack", resource, 1);
|
||||||
resReq.setNodeLabelExpression("x");
|
resReq.setNodeLabelExpression("x");
|
||||||
SchedulerUtils.validateResourceRequest(resReq, maxResource, "queue",
|
SchedulerUtils.normalizeAndvalidateRequest(resReq, maxResource, "queue",
|
||||||
scheduler);
|
scheduler);
|
||||||
fail("Should fail");
|
fail("Should fail");
|
||||||
} catch (InvalidResourceRequestException e) {
|
} catch (InvalidResourceRequestException e) {
|
||||||
|
@ -371,7 +370,7 @@ public class TestSchedulerUtils {
|
||||||
ResourceRequest resReq = BuilderUtils.newResourceRequest(
|
ResourceRequest resReq = BuilderUtils.newResourceRequest(
|
||||||
mock(Priority.class), "rack", resource, 1);
|
mock(Priority.class), "rack", resource, 1);
|
||||||
resReq.setNodeLabelExpression("x");
|
resReq.setNodeLabelExpression("x");
|
||||||
SchedulerUtils.validateResourceRequest(resReq, maxResource, "queue",
|
SchedulerUtils.normalizeAndvalidateRequest(resReq, maxResource, "queue",
|
||||||
scheduler);
|
scheduler);
|
||||||
fail("Should fail");
|
fail("Should fail");
|
||||||
} catch (InvalidResourceRequestException e) {
|
} catch (InvalidResourceRequestException e) {
|
||||||
|
@ -395,7 +394,7 @@ public class TestSchedulerUtils {
|
||||||
ResourceRequest resReq =
|
ResourceRequest resReq =
|
||||||
BuilderUtils.newResourceRequest(mock(Priority.class),
|
BuilderUtils.newResourceRequest(mock(Priority.class),
|
||||||
ResourceRequest.ANY, resource, 1);
|
ResourceRequest.ANY, resource, 1);
|
||||||
SchedulerUtils.validateResourceRequest(resReq, maxResource, null,
|
SchedulerUtils.normalizeAndvalidateRequest(resReq, maxResource, null,
|
||||||
mockScheduler);
|
mockScheduler);
|
||||||
} catch (InvalidResourceRequestException e) {
|
} catch (InvalidResourceRequestException e) {
|
||||||
fail("Zero memory should be accepted");
|
fail("Zero memory should be accepted");
|
||||||
|
@ -409,7 +408,7 @@ public class TestSchedulerUtils {
|
||||||
ResourceRequest resReq =
|
ResourceRequest resReq =
|
||||||
BuilderUtils.newResourceRequest(mock(Priority.class),
|
BuilderUtils.newResourceRequest(mock(Priority.class),
|
||||||
ResourceRequest.ANY, resource, 1);
|
ResourceRequest.ANY, resource, 1);
|
||||||
SchedulerUtils.validateResourceRequest(resReq, maxResource, null,
|
SchedulerUtils.normalizeAndvalidateRequest(resReq, maxResource, null,
|
||||||
mockScheduler);
|
mockScheduler);
|
||||||
} catch (InvalidResourceRequestException e) {
|
} catch (InvalidResourceRequestException e) {
|
||||||
fail("Zero vcores should be accepted");
|
fail("Zero vcores should be accepted");
|
||||||
|
@ -424,7 +423,7 @@ public class TestSchedulerUtils {
|
||||||
ResourceRequest resReq =
|
ResourceRequest resReq =
|
||||||
BuilderUtils.newResourceRequest(mock(Priority.class),
|
BuilderUtils.newResourceRequest(mock(Priority.class),
|
||||||
ResourceRequest.ANY, resource, 1);
|
ResourceRequest.ANY, resource, 1);
|
||||||
SchedulerUtils.validateResourceRequest(resReq, maxResource, null,
|
SchedulerUtils.normalizeAndvalidateRequest(resReq, maxResource, null,
|
||||||
mockScheduler);
|
mockScheduler);
|
||||||
} catch (InvalidResourceRequestException e) {
|
} catch (InvalidResourceRequestException e) {
|
||||||
fail("Max memory should be accepted");
|
fail("Max memory should be accepted");
|
||||||
|
@ -439,7 +438,7 @@ public class TestSchedulerUtils {
|
||||||
ResourceRequest resReq =
|
ResourceRequest resReq =
|
||||||
BuilderUtils.newResourceRequest(mock(Priority.class),
|
BuilderUtils.newResourceRequest(mock(Priority.class),
|
||||||
ResourceRequest.ANY, resource, 1);
|
ResourceRequest.ANY, resource, 1);
|
||||||
SchedulerUtils.validateResourceRequest(resReq, maxResource, null,
|
SchedulerUtils.normalizeAndvalidateRequest(resReq, maxResource, null,
|
||||||
mockScheduler);
|
mockScheduler);
|
||||||
} catch (InvalidResourceRequestException e) {
|
} catch (InvalidResourceRequestException e) {
|
||||||
fail("Max vcores should not be accepted");
|
fail("Max vcores should not be accepted");
|
||||||
|
@ -453,7 +452,7 @@ public class TestSchedulerUtils {
|
||||||
ResourceRequest resReq =
|
ResourceRequest resReq =
|
||||||
BuilderUtils.newResourceRequest(mock(Priority.class),
|
BuilderUtils.newResourceRequest(mock(Priority.class),
|
||||||
ResourceRequest.ANY, resource, 1);
|
ResourceRequest.ANY, resource, 1);
|
||||||
SchedulerUtils.validateResourceRequest(resReq, maxResource, null,
|
SchedulerUtils.normalizeAndvalidateRequest(resReq, maxResource, null,
|
||||||
mockScheduler);
|
mockScheduler);
|
||||||
fail("Negative memory should not be accepted");
|
fail("Negative memory should not be accepted");
|
||||||
} catch (InvalidResourceRequestException e) {
|
} catch (InvalidResourceRequestException e) {
|
||||||
|
@ -468,7 +467,7 @@ public class TestSchedulerUtils {
|
||||||
ResourceRequest resReq =
|
ResourceRequest resReq =
|
||||||
BuilderUtils.newResourceRequest(mock(Priority.class),
|
BuilderUtils.newResourceRequest(mock(Priority.class),
|
||||||
ResourceRequest.ANY, resource, 1);
|
ResourceRequest.ANY, resource, 1);
|
||||||
SchedulerUtils.validateResourceRequest(resReq, maxResource, null,
|
SchedulerUtils.normalizeAndvalidateRequest(resReq, maxResource, null,
|
||||||
mockScheduler);
|
mockScheduler);
|
||||||
fail("Negative vcores should not be accepted");
|
fail("Negative vcores should not be accepted");
|
||||||
} catch (InvalidResourceRequestException e) {
|
} catch (InvalidResourceRequestException e) {
|
||||||
|
@ -484,7 +483,7 @@ public class TestSchedulerUtils {
|
||||||
ResourceRequest resReq =
|
ResourceRequest resReq =
|
||||||
BuilderUtils.newResourceRequest(mock(Priority.class),
|
BuilderUtils.newResourceRequest(mock(Priority.class),
|
||||||
ResourceRequest.ANY, resource, 1);
|
ResourceRequest.ANY, resource, 1);
|
||||||
SchedulerUtils.validateResourceRequest(resReq, maxResource, null,
|
SchedulerUtils.normalizeAndvalidateRequest(resReq, maxResource, null,
|
||||||
mockScheduler);
|
mockScheduler);
|
||||||
fail("More than max memory should not be accepted");
|
fail("More than max memory should not be accepted");
|
||||||
} catch (InvalidResourceRequestException e) {
|
} catch (InvalidResourceRequestException e) {
|
||||||
|
@ -501,7 +500,7 @@ public class TestSchedulerUtils {
|
||||||
ResourceRequest resReq =
|
ResourceRequest resReq =
|
||||||
BuilderUtils.newResourceRequest(mock(Priority.class),
|
BuilderUtils.newResourceRequest(mock(Priority.class),
|
||||||
ResourceRequest.ANY, resource, 1);
|
ResourceRequest.ANY, resource, 1);
|
||||||
SchedulerUtils.validateResourceRequest(resReq, maxResource, null,
|
SchedulerUtils.normalizeAndvalidateRequest(resReq, maxResource, null,
|
||||||
mockScheduler);
|
mockScheduler);
|
||||||
fail("More than max vcores should not be accepted");
|
fail("More than max vcores should not be accepted");
|
||||||
} catch (InvalidResourceRequestException e) {
|
} catch (InvalidResourceRequestException e) {
|
||||||
|
|
Loading…
Reference in New Issue