@Override public void run() { while (!Thread.currentThread().isInterrupted()) { try { Thread.sleep(updateInterval); long start = getClock().getTime(); update(); preemptTasksIfNecessary(); long duration = getClock().getTime() - start; fsOpDurations.addUpdateThreadRunDuration(duration); } catch (InterruptedException ie) { LOG.warn("Update thread interrupted. Exiting."); return; } catch (Exception e) { LOG.error("Exception in fair scheduler UpdateThread", e); } } } }
public static FSOpDurations getInstance(boolean isExtended) { INSTANCE.setExtended(isExtended); return INSTANCE; }
@Override protected void nodeUpdate(RMNode nm) { writeLock.lock(); try { long start = getClock().getTime(); super.nodeUpdate(nm); FSSchedulerNode fsNode = getFSSchedulerNode(nm.getNodeID()); attemptScheduling(fsNode); long duration = getClock().getTime() - start; fsOpDurations.addNodeUpdateDuration(duration); } finally { writeLock.unlock(); } }
fsOpDurations.addContinuousSchedulingRunDuration(duration);
fsOpDurations = FSOpDurations.getInstance(true);
int count = 0; while (count < 100) { if (scheduler.fsOpDurations.hasUpdateThreadRunChanged()) { break; scheduler.fsOpDurations.hasUpdateThreadRunChanged()); assertEquals("Root queue metrics memory does not have expected value", memory, scheduler.getRootQueueMetrics().getAvailableMB()); scheduler.fsOpDurations.getMetrics(collector, true); MetricsRecord record = collector.getRecords().get(0); for (AbstractMetric abstractMetric : record.metrics()) {
@Test public void testPerfMetricsInited() { scheduler.init(conf); scheduler.start(); MetricsCollectorImpl collector = new MetricsCollectorImpl(); scheduler.fsOpDurations.getMetrics(collector, true); assertEquals("Incorrect number of perf metrics", 1, collector.getRecords().size()); }
/** * Recompute the internal variables used by the scheduler - per-job weights, * fair shares, deficits, minimum slot allocations, and amount of used and * required resources per job. */ protected synchronized void update() { long start = getClock().getTime(); updateStarvationStats(); // Determine if any queues merit preemption FSQueue rootQueue = queueMgr.getRootQueue(); // Recursively update demands for all queues rootQueue.updateDemand(); rootQueue.setFairShare(clusterResource); // Recursively compute fair shares for all queues // and update metrics rootQueue.recomputeShares(); updateRootQueueMetrics(); if (LOG.isDebugEnabled()) { if (--updatesToSkipForDebug < 0) { updatesToSkipForDebug = UPDATE_DEBUG_FREQUENCY; LOG.debug("Cluster Capacity: " + clusterResource + " Allocations: " + rootMetrics.getAllocatedResources() + " Availability: " + Resource.newInstance( rootMetrics.getAvailableMB(), rootMetrics.getAvailableVirtualCores()) + " Demand: " + rootQueue.getDemand()); } } long duration = getClock().getTime() - start; fsOpDurations.addUpdateCallDuration(duration); }
fsOpDurations.addPreemptCallDuration(duration);
private void verifyNoCalls() { assertFalse("Update thread should not have executed", scheduler.fsOpDurations.hasUpdateThreadRunChanged()); assertEquals("Scheduler queue memory should not have been updated", 0, scheduler.getRootQueueMetrics().getAvailableMB()); assertEquals("Scheduler queue cpu should not have been updated", 0,scheduler.getRootQueueMetrics().getAvailableVirtualCores()); } }
fsOpDurations.addNodeUpdateDuration(duration);
fsOpDurations.addContinuousSchedulingRunDuration(duration);
fsOpDurations = FSOpDurations.getInstance(true);
@Test public void testPerfMetricsInited() { scheduler.init(conf); scheduler.start(); MetricsCollectorImpl collector = new MetricsCollectorImpl(); scheduler.fsOpDurations.getMetrics(collector, true); assertEquals("Incorrect number of perf metrics", 1, collector.getRecords().size()); }
/** * Recompute the internal variables used by the scheduler - per-job weights, * fair shares, deficits, minimum slot allocations, and amount of used and * required resources per job. */ protected synchronized void update() { long start = getClock().getTime(); updateStarvationStats(); // Determine if any queues merit preemption FSQueue rootQueue = queueMgr.getRootQueue(); // Recursively update demands for all queues rootQueue.updateDemand(); rootQueue.setFairShare(clusterResource); // Recursively compute fair shares for all queues // and update metrics rootQueue.recomputeShares(); updateRootQueueMetrics(); if (LOG.isDebugEnabled()) { if (--updatesToSkipForDebug < 0) { updatesToSkipForDebug = UPDATE_DEBUG_FREQUENCY; LOG.debug("Cluster Capacity: " + clusterResource + " Allocations: " + rootMetrics.getAllocatedResources() + " Availability: " + Resource.newInstance( rootMetrics.getAvailableMB(), rootMetrics.getAvailableVirtualCores()) + " Demand: " + rootQueue.getDemand()); } } long duration = getClock().getTime() - start; fsOpDurations.addUpdateCallDuration(duration); }
fsOpDurations.addPreemptCallDuration(duration);
public static FSOpDurations getInstance(boolean isExtended) { INSTANCE.setExtended(isExtended); return INSTANCE; }
fsOpDurations.addNodeUpdateDuration(duration);
@Override public void run() { while (!Thread.currentThread().isInterrupted()) { try { Thread.sleep(updateInterval); long start = getClock().getTime(); update(); preemptTasksIfNecessary(); long duration = getClock().getTime() - start; fsOpDurations.addUpdateThreadRunDuration(duration); } catch (InterruptedException ie) { LOG.warn("Update thread interrupted. Exiting."); return; } catch (Exception e) { LOG.error("Exception in fair scheduler UpdateThread", e); } } } }
fsOpDurations.addContinuousSchedulingRunDuration(duration);