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

This commit is contained in:
Daniel Templeton 2017-08-11 14:02:38 -07:00
parent bbbf0e2a41
commit 218588be77
6 changed files with 16 additions and 22 deletions

View File

@ -90,7 +90,6 @@
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.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.ResourceScheduler;
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.event.SchedulerEvent;
@ -698,8 +697,7 @@ protected void serviceInit(Configuration configuration) throws Exception {
}
}
// creating monitors that handle preemption
createPolicyMonitors();
createSchedulerMonitors();
masterService = createApplicationMasterService();
addService(masterService) ;
@ -800,9 +798,8 @@ protected void serviceStop() throws Exception {
}
protected void createPolicyMonitors() {
if (scheduler instanceof PreemptableResourceScheduler
&& conf.getBoolean(YarnConfiguration.RM_SCHEDULER_ENABLE_MONITORS,
protected void createSchedulerMonitors() {
if (conf.getBoolean(YarnConfiguration.RM_SCHEDULER_ENABLE_MONITORS,
YarnConfiguration.DEFAULT_RM_SCHEDULER_ENABLE_MONITORS)) {
LOG.info("Loading policy monitors");
List<SchedulingEditPolicy> policies = conf.getInstances(

View File

@ -19,12 +19,12 @@
import org.apache.hadoop.conf.Configuration;
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 {
void init(Configuration config, RMContext context,
PreemptableResourceScheduler scheduler);
ResourceScheduler scheduler);
/**
* This method is invoked at regular intervals. Internally the policy is

View File

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

View File

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

View File

@ -20,7 +20,7 @@
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.yarn.server.resourcemanager.RMContext;
import org.apache.hadoop.yarn.server.resourcemanager.monitor.SchedulingEditPolicy;
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.PreemptableResourceScheduler;
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.ResourceScheduler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -39,16 +39,16 @@ public abstract class InvariantsChecker implements SchedulingEditPolicy {
private Configuration conf;
private RMContext context;
private PreemptableResourceScheduler scheduler;
private ResourceScheduler scheduler;
private boolean throwOnInvariantViolation;
private long monitoringInterval;
@Override
public void init(Configuration config, RMContext rmContext,
PreemptableResourceScheduler preemptableResourceScheduler) {
ResourceScheduler scheduler) {
this.conf = config;
this.context = rmContext;
this.scheduler = preemptableResourceScheduler;
this.scheduler = scheduler;
this.throwOnInvariantViolation =
conf.getBoolean(InvariantsChecker.THROW_ON_VIOLATION, false);
this.monitoringInterval =
@ -89,7 +89,7 @@ public RMContext getContext() {
return context;
}
public PreemptableResourceScheduler getScheduler() {
public ResourceScheduler getScheduler() {
return scheduler;
}

View File

@ -27,8 +27,8 @@
import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem;
import org.apache.hadoop.metrics2.source.JvmMetrics;
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.QueueMetrics;
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.ResourceScheduler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -42,7 +42,6 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* This policy checks at every invocation that a given set of invariants
@ -78,9 +77,9 @@ public class MetricsInvariantChecker extends InvariantsChecker {
@Override
public void init(Configuration config, RMContext rmContext,
PreemptableResourceScheduler preemptableResourceScheduler) {
ResourceScheduler scheduler) {
super.init(config, rmContext, preemptableResourceScheduler);
super.init(config, rmContext, scheduler);
this.metricsSystem = DefaultMetricsSystem.instance();
this.queueMetrics =