YARN-8948. PlacementRule interface should be for all YarnSchedulers. Contributed by Bibin A Chundatt.
This commit is contained in:
parent
c1d24f8483
commit
a68d766e87
|
@ -20,11 +20,12 @@ package org.apache.hadoop.yarn.server.resourcemanager.placement;
|
|||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.hadoop.yarn.api.records.ApplicationId;
|
||||
import org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext;
|
||||
import org.apache.hadoop.yarn.conf.YarnConfiguration;
|
||||
import org.apache.hadoop.yarn.exceptions.YarnException;
|
||||
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.ResourceScheduler;
|
||||
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CSQueue;
|
||||
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacityScheduler;
|
||||
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacitySchedulerConfiguration;
|
||||
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacitySchedulerContext;
|
||||
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacitySchedulerQueueManager;
|
||||
|
@ -61,8 +62,15 @@ public class AppNameMappingPlacementRule extends PlacementRule {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean initialize(CapacitySchedulerContext schedulerContext)
|
||||
public boolean initialize(ResourceScheduler scheduler)
|
||||
throws IOException {
|
||||
if (!(scheduler instanceof CapacityScheduler)) {
|
||||
throw new IOException(
|
||||
"AppNameMappingPlacementRule can be configured only for "
|
||||
+ "CapacityScheduler");
|
||||
}
|
||||
CapacitySchedulerContext schedulerContext =
|
||||
(CapacitySchedulerContext) scheduler;
|
||||
CapacitySchedulerConfiguration conf = schedulerContext.getConfiguration();
|
||||
boolean overrideWithQueueMappings = conf.getOverrideWithQueueMappings();
|
||||
LOG.info(
|
||||
|
|
|
@ -22,7 +22,7 @@ import java.io.IOException;
|
|||
|
||||
import org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext;
|
||||
import org.apache.hadoop.yarn.exceptions.YarnException;
|
||||
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacitySchedulerContext;
|
||||
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.ResourceScheduler;
|
||||
|
||||
public abstract class PlacementRule {
|
||||
|
||||
|
@ -31,7 +31,7 @@ public abstract class PlacementRule {
|
|||
}
|
||||
|
||||
public abstract boolean initialize(
|
||||
CapacitySchedulerContext schedulerContext) throws IOException;
|
||||
ResourceScheduler scheduler) throws IOException;
|
||||
|
||||
/**
|
||||
* Get queue for a given application
|
||||
|
|
|
@ -34,8 +34,10 @@ import org.apache.hadoop.yarn.exceptions.YarnException;
|
|||
import org.apache.hadoop.yarn.server.resourcemanager.placement.UserGroupMappingPlacementRule.QueueMapping.MappingType;
|
||||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.ResourceScheduler;
|
||||
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.AutoCreatedLeafQueue;
|
||||
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CSQueue;
|
||||
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacityScheduler;
|
||||
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacitySchedulerConfiguration;
|
||||
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacitySchedulerContext;
|
||||
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacitySchedulerQueueManager;
|
||||
|
@ -230,8 +232,15 @@ public class UserGroupMappingPlacementRule extends PlacementRule {
|
|||
|
||||
@VisibleForTesting
|
||||
@Override
|
||||
public boolean initialize(CapacitySchedulerContext schedulerContext)
|
||||
public boolean initialize(ResourceScheduler scheduler)
|
||||
throws IOException {
|
||||
if (!(scheduler instanceof CapacityScheduler)) {
|
||||
throw new IOException(
|
||||
"UserGroupMappingPlacementRule can be configured only for "
|
||||
+ "CapacityScheduler");
|
||||
}
|
||||
CapacitySchedulerContext schedulerContext =
|
||||
(CapacitySchedulerContext) scheduler;
|
||||
CapacitySchedulerConfiguration conf = schedulerContext.getConfiguration();
|
||||
boolean overrideWithQueueMappings = conf.getOverrideWithQueueMappings();
|
||||
LOG.info(
|
||||
|
|
Loading…
Reference in New Issue