YARN-11278. Fixed Ambiguous error message in mutation API. Contributed by Ashutosh Gupta.
This commit is contained in:
parent
56387cce57
commit
5b85af87f0
@ -2748,26 +2748,26 @@ public synchronized Response updateSchedulerConfiguration(SchedConfUpdateInfo
|
|||||||
initForWritableEndpoints(callerUGI, true);
|
initForWritableEndpoints(callerUGI, true);
|
||||||
|
|
||||||
ResourceScheduler scheduler = rm.getResourceScheduler();
|
ResourceScheduler scheduler = rm.getResourceScheduler();
|
||||||
if (isConfigurationMutable(scheduler)) {
|
if (!(scheduler instanceof MutableConfScheduler)) {
|
||||||
|
return Response.status(Status.BAD_REQUEST)
|
||||||
|
.entity("Configuration change only supported by MutableConfScheduler.").build();
|
||||||
|
} else if (!((MutableConfScheduler) scheduler).isConfigurationMutable()) {
|
||||||
|
return Response.status(Status.BAD_REQUEST)
|
||||||
|
.entity("Configuration change only supported by mutable configuration store.").build();
|
||||||
|
} else {
|
||||||
try {
|
try {
|
||||||
callerUGI.doAs((PrivilegedExceptionAction<Void>) () -> {
|
callerUGI.doAs((PrivilegedExceptionAction<Void>) () -> {
|
||||||
MutableConfigurationProvider provider = ((MutableConfScheduler)
|
MutableConfigurationProvider provider =
|
||||||
scheduler).getMutableConfProvider();
|
((MutableConfScheduler) scheduler).getMutableConfProvider();
|
||||||
LogMutation logMutation = applyMutation(provider, callerUGI, mutationInfo);
|
LogMutation logMutation = applyMutation(provider, callerUGI, mutationInfo);
|
||||||
return refreshQueues(provider, logMutation);
|
return refreshQueues(provider, logMutation);
|
||||||
});
|
});
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
LOG.error("Exception thrown when modifying configuration.", e);
|
LOG.error("Exception thrown when modifying configuration.", e);
|
||||||
return Response.status(Status.BAD_REQUEST).entity(e.getMessage())
|
return Response.status(Status.BAD_REQUEST).entity(e.getMessage()).build();
|
||||||
.build();
|
|
||||||
}
|
}
|
||||||
return Response.status(Status.OK).entity("Configuration change successfully applied.")
|
return Response.status(Status.OK).entity("Configuration change successfully applied.")
|
||||||
.build();
|
.build();
|
||||||
} else {
|
|
||||||
return Response.status(Status.BAD_REQUEST)
|
|
||||||
.entity(String.format("Configuration change only supported by " +
|
|
||||||
"%s.", MutableConfScheduler.class.getSimpleName()))
|
|
||||||
.build();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user