YARN-2274. FairScheduler: Add debug information about cluster capacity, availability and reservations. (kasha)

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1609942 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Karthik Kambatla 2014-07-12 15:10:19 +00:00
parent 43342670db
commit 4d211d5fde
2 changed files with 20 additions and 3 deletions

View File

@ -40,6 +40,9 @@ Release 2.6.0 - UNRELEASED
YARN-2242. Improve exception information on AM launch crashes. (Li Lu YARN-2242. Improve exception information on AM launch crashes. (Li Lu
via junping_du) via junping_du)
YARN-2274. FairScheduler: Add debug information about cluster capacity,
availability and reservations. (kasha)
OPTIMIZATIONS OPTIMIZATIONS
BUG FIXES BUG FIXES

View File

@ -136,6 +136,8 @@ public class FairScheduler extends
// How often fair shares are re-calculated (ms) // How often fair shares are re-calculated (ms)
protected long UPDATE_INTERVAL = 500; protected long UPDATE_INTERVAL = 500;
private final int UPDATE_DEBUG_FREQUENCY = 5;
private int updatesToSkipForDebug = UPDATE_DEBUG_FREQUENCY;
private Thread updateThread; private Thread updateThread;
private Thread schedulingThread; private Thread schedulingThread;
@ -275,6 +277,18 @@ public class FairScheduler extends
// Recursively compute fair shares for all queues // Recursively compute fair shares for all queues
// and update metrics // and update metrics
rootQueue.recomputeShares(); rootQueue.recomputeShares();
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());
}
}
} }
/** /**
@ -879,14 +893,14 @@ public class FairScheduler extends
// Update application requests // Update application requests
application.updateResourceRequests(ask); application.updateResourceRequests(ask);
LOG.debug("allocate: post-update");
application.showRequests(); application.showRequests();
} }
if (LOG.isDebugEnabled()) { if (LOG.isDebugEnabled()) {
LOG.debug("allocate:" + LOG.debug("allocate: post-update" +
" applicationAttemptId=" + appAttemptId + " applicationAttemptId=" + appAttemptId +
" #ask=" + ask.size()); " #ask=" + ask.size() +
" reservation= " + application.getCurrentReservation());
LOG.debug("Preempting " + application.getPreemptionContainers().size() LOG.debug("Preempting " + application.getPreemptionContainers().size()
+ " container(s)"); + " container(s)");