/** * Test if the metric scheduling policy is set correctly. */ @Test public void testSchedulingPolicy() { String queueName = "single"; FSQueueMetrics metrics = FSQueueMetrics.forQueue(ms, queueName, null, false, CONF); metrics.setSchedulingPolicy("drf"); checkSchedulingPolicy(queueName, "drf"); // test resetting the scheduling policy metrics.setSchedulingPolicy("fair"); checkSchedulingPolicy(queueName, "fair"); }
/** * Initialize a {@link FSQueue} with queue-specific properties and its * metrics. * @param queue the FSQueue needed to be initialized */ public void initFSQueue(FSQueue queue){ // Set queue-specific properties. String name = queue.getName(); queue.setWeights(getQueueWeight(name)); queue.setMinShare(getMinResources(name)); queue.setMaxShare(getMaxResources(name)); queue.setMaxRunningApps(getQueueMaxApps(name)); queue.setMaxAMShare(getQueueMaxAMShare(name)); queue.setMaxChildQueueResource(getMaxChildResources(name)); queue.setMaxContainerAllocation(getQueueMaxContainerAllocation(name)); // Set queue metrics. queue.getMetrics().setMinShare(queue.getMinShare()); queue.getMetrics().setMaxShare(queue.getMaxShare()); queue.getMetrics().setMaxApps(queue.getMaxRunningApps()); queue.getMetrics().setSchedulingPolicy(getSchedulingPolicy(name).getName()); } }