YARN-6952. Enable scheduling monitor in FS. (Yufei Gu via Daniel Templeton)

This commit is contained in:
Daniel Templeton 2017-08-11 14:02:38 -07:00 committed by Yufei Gu
parent d8d2a221f8
commit 78f9dca2cb
4 changed files with 8 additions and 13 deletions

View File

@ -84,7 +84,6 @@ import org.apache.hadoop.yarn.server.resourcemanager.rmcontainer.ContainerAlloca
import org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNode; import org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNode;
import org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNodeEvent; import org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNodeEvent;
import org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNodeEventType; import org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNodeEventType;
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.PreemptableResourceScheduler;
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.QueueMetrics; import org.apache.hadoop.yarn.server.resourcemanager.scheduler.QueueMetrics;
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.ResourceScheduler; import org.apache.hadoop.yarn.server.resourcemanager.scheduler.ResourceScheduler;
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.event.SchedulerEvent; import org.apache.hadoop.yarn.server.resourcemanager.scheduler.event.SchedulerEvent;
@ -643,8 +642,7 @@ public class ResourceManager extends CompositeService implements Recoverable {
} }
} }
// creating monitors that handle preemption createSchedulerMonitors();
createPolicyMonitors();
masterService = createApplicationMasterService(); masterService = createApplicationMasterService();
addService(masterService) ; addService(masterService) ;
@ -724,9 +722,8 @@ public class ResourceManager extends CompositeService implements Recoverable {
} }
protected void createPolicyMonitors() { protected void createSchedulerMonitors() {
if (scheduler instanceof PreemptableResourceScheduler if (conf.getBoolean(YarnConfiguration.RM_SCHEDULER_ENABLE_MONITORS,
&& conf.getBoolean(YarnConfiguration.RM_SCHEDULER_ENABLE_MONITORS,
YarnConfiguration.DEFAULT_RM_SCHEDULER_ENABLE_MONITORS)) { YarnConfiguration.DEFAULT_RM_SCHEDULER_ENABLE_MONITORS)) {
LOG.info("Loading policy monitors"); LOG.info("Loading policy monitors");
List<SchedulingEditPolicy> policies = conf.getInstances( List<SchedulingEditPolicy> policies = conf.getInstances(

View File

@ -19,12 +19,12 @@ package org.apache.hadoop.yarn.server.resourcemanager.monitor;
import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.yarn.server.resourcemanager.RMContext; import org.apache.hadoop.yarn.server.resourcemanager.RMContext;
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.PreemptableResourceScheduler; import org.apache.hadoop.yarn.server.resourcemanager.scheduler.ResourceScheduler;
public interface SchedulingEditPolicy { public interface SchedulingEditPolicy {
void init(Configuration config, RMContext context, void init(Configuration config, RMContext context,
PreemptableResourceScheduler scheduler); ResourceScheduler scheduler);
/** /**
* This method is invoked at regular intervals. Internally the policy is * This method is invoked at regular intervals. Internally the policy is

View File

@ -29,7 +29,6 @@ import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.service.AbstractService; import org.apache.hadoop.service.AbstractService;
import org.apache.hadoop.yarn.exceptions.YarnRuntimeException; import org.apache.hadoop.yarn.exceptions.YarnRuntimeException;
import org.apache.hadoop.yarn.server.resourcemanager.RMContext; import org.apache.hadoop.yarn.server.resourcemanager.RMContext;
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.PreemptableResourceScheduler;
import com.google.common.annotations.VisibleForTesting; import com.google.common.annotations.VisibleForTesting;
@ -59,8 +58,7 @@ public class SchedulingMonitor extends AbstractService {
} }
public void serviceInit(Configuration conf) throws Exception { public void serviceInit(Configuration conf) throws Exception {
scheduleEditPolicy.init(conf, rmContext, scheduleEditPolicy.init(conf, rmContext, rmContext.getScheduler());
(PreemptableResourceScheduler) rmContext.getScheduler());
this.monitorInterval = scheduleEditPolicy.getMonitoringInterval(); this.monitorInterval = scheduleEditPolicy.getMonitoringInterval();
super.serviceInit(conf); super.serviceInit(conf);
} }

View File

@ -32,7 +32,7 @@ import org.apache.hadoop.yarn.server.resourcemanager.RMContext;
import org.apache.hadoop.yarn.server.resourcemanager.monitor.SchedulingEditPolicy; import org.apache.hadoop.yarn.server.resourcemanager.monitor.SchedulingEditPolicy;
import org.apache.hadoop.yarn.server.resourcemanager.nodelabels.RMNodeLabelsManager; import org.apache.hadoop.yarn.server.resourcemanager.nodelabels.RMNodeLabelsManager;
import org.apache.hadoop.yarn.server.resourcemanager.rmcontainer.RMContainer; import org.apache.hadoop.yarn.server.resourcemanager.rmcontainer.RMContainer;
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.PreemptableResourceScheduler; 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.CSQueue;
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacityScheduler; 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.CapacitySchedulerConfiguration;
@ -151,7 +151,7 @@ public class ProportionalCapacityPreemptionPolicy
} }
public void init(Configuration config, RMContext context, public void init(Configuration config, RMContext context,
PreemptableResourceScheduler sched) { ResourceScheduler sched) {
LOG.info("Preemption monitor:" + this.getClass().getCanonicalName()); LOG.info("Preemption monitor:" + this.getClass().getCanonicalName());
assert null == scheduler : "Unexpected duplicate call to init"; assert null == scheduler : "Unexpected duplicate call to init";
if (!(sched instanceof CapacityScheduler)) { if (!(sched instanceof CapacityScheduler)) {