YARN-10397. SchedulerRequest should be forwarded to scheduler if custom scheduler supports placement constraints. Contributed by Bilwa S T.
(cherry picked from commit 43572fc7f8
)
This commit is contained in:
parent
262c575fab
commit
ea37a05d4b
@ -884,6 +884,15 @@ public Set<String> getPlanQueues() throws YarnException {
|
||||
+ " does not support reservations");
|
||||
}
|
||||
|
||||
/**
|
||||
* By default placement constraint is disabled. Schedulers which support
|
||||
* placement constraint can override this value.
|
||||
* @return enabled or not
|
||||
*/
|
||||
public boolean placementConstraintEnabled() {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void refreshMaximumAllocation(Resource newMaxAlloc) {
|
||||
nodeTracker.setConfiguredMaxAllocation(newMaxAlloc);
|
||||
}
|
||||
|
@ -3285,4 +3285,12 @@ public int getNumAsyncSchedulerThreads() {
|
||||
public void setMaxRunningAppsEnforcer(CSMaxRunningAppsEnforcer enforcer) {
|
||||
this.maxRunningEnforcer = enforcer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returning true as capacity scheduler supports placement constraints.
|
||||
*/
|
||||
@Override
|
||||
public boolean placementConstraintEnabled() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -22,7 +22,6 @@
|
||||
import org.apache.hadoop.yarn.api.protocolrecords.AllocateResponse;
|
||||
import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
|
||||
import org.apache.hadoop.yarn.exceptions.YarnException;
|
||||
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacityScheduler;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@ -39,7 +38,7 @@ public void allocate(ApplicationAttemptId appAttemptId,
|
||||
AllocateRequest request, AllocateResponse response) throws YarnException {
|
||||
if (request.getSchedulingRequests() != null
|
||||
&& !request.getSchedulingRequests().isEmpty()) {
|
||||
if (!(scheduler instanceof CapacityScheduler)) {
|
||||
if (!scheduler.placementConstraintEnabled()) {
|
||||
String message = "Found non empty SchedulingRequest of "
|
||||
+ "AllocateRequest for application=" + appAttemptId.toString()
|
||||
+ ", however the configured scheduler="
|
||||
|
Loading…
Reference in New Issue
Block a user