MAPREDUCE-4151. RM scheduler web page should filter apps to those that are relevant to scheduling (Jason Lowe via tgraves)
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1327263 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
b89b6bd75f
commit
ca9f62121e
@ -262,6 +262,9 @@ Release 0.23.3 - UNRELEASED
|
||||
ApplicationTokenSecretManager and roll it every so often. (Vinod Kumar
|
||||
Vavilapalli via sseth)
|
||||
|
||||
MAPREDUCE-4151. RM scheduler web page should filter apps to those that
|
||||
are relevant to scheduling (Jason Lowe via tgraves)
|
||||
|
||||
OPTIMIZATIONS
|
||||
|
||||
BUG FIXES
|
||||
|
@ -23,6 +23,9 @@
|
||||
import static org.apache.hadoop.yarn.webapp.view.JQueryUI._PROGRESSBAR;
|
||||
import static org.apache.hadoop.yarn.webapp.view.JQueryUI._PROGRESSBAR_VALUE;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
|
||||
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMApp;
|
||||
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppState;
|
||||
import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.AppInfo;
|
||||
@ -60,10 +63,17 @@ class AppsBlock extends HtmlBlock {
|
||||
th(".ui", "Tracking UI")._()._().
|
||||
tbody();
|
||||
int i = 0;
|
||||
String reqState = $(APP_STATE);
|
||||
reqState = (reqState == null ? "" : reqState);
|
||||
Collection<RMAppState> reqAppStates = null;
|
||||
String reqStateString = $(APP_STATE);
|
||||
if (reqStateString != null && !reqStateString.isEmpty()) {
|
||||
String[] appStateStrings = reqStateString.split(",");
|
||||
reqAppStates = new HashSet<RMAppState>(appStateStrings.length);
|
||||
for(String stateString : appStateStrings) {
|
||||
reqAppStates.add(RMAppState.valueOf(stateString));
|
||||
}
|
||||
}
|
||||
for (RMApp app : list.apps.values()) {
|
||||
if (!reqState.isEmpty() && app.getState() != RMAppState.valueOf(reqState)) {
|
||||
if (reqAppStates != null && !reqAppStates.contains(app.getState())) {
|
||||
continue;
|
||||
}
|
||||
AppInfo appInfo = new AppInfo(app, true);
|
||||
@ -100,7 +110,7 @@ class AppsBlock extends HtmlBlock {
|
||||
if (list.rendering == Render.JS_ARRAY) {
|
||||
echo("<script type='text/javascript'>\n",
|
||||
"var appsData=");
|
||||
list.toDataTableArrays(reqState, writer());
|
||||
list.toDataTableArrays(reqAppStates, writer());
|
||||
echo("\n</script>\n");
|
||||
}
|
||||
}
|
||||
|
@ -26,6 +26,7 @@
|
||||
import static org.apache.hadoop.yarn.webapp.view.Jsons.appendSortable;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.util.Collection;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
|
||||
import org.apache.hadoop.yarn.api.records.ApplicationId;
|
||||
@ -53,12 +54,12 @@ class AppsList implements ToJSON {
|
||||
apps = rmContext.getRMApps();
|
||||
}
|
||||
|
||||
void toDataTableArrays(String requiredAppState, PrintWriter out) {
|
||||
void toDataTableArrays(Collection<RMAppState> requiredAppStates, PrintWriter out) {
|
||||
out.append('[');
|
||||
boolean first = true;
|
||||
for (RMApp app : apps.values()) {
|
||||
if (requiredAppState != null && !requiredAppState.isEmpty()
|
||||
&& app.getState() != RMAppState.valueOf(requiredAppState)) {
|
||||
if (requiredAppStates != null &&
|
||||
!requiredAppStates.contains(app.getState())) {
|
||||
continue;
|
||||
}
|
||||
AppInfo appInfo = new AppInfo(app, true);
|
||||
|
@ -31,14 +31,17 @@
|
||||
import org.apache.hadoop.yarn.server.resourcemanager.RMContext;
|
||||
import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager;
|
||||
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMApp;
|
||||
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppState;
|
||||
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.ResourceScheduler;
|
||||
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacityScheduler;
|
||||
import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.AppInfo;
|
||||
import org.apache.hadoop.yarn.server.security.ApplicationACLsManager;
|
||||
import org.apache.hadoop.yarn.util.Apps;
|
||||
import org.apache.hadoop.yarn.util.StringHelper;
|
||||
import org.apache.hadoop.yarn.util.Times;
|
||||
import org.apache.hadoop.yarn.webapp.Controller;
|
||||
import org.apache.hadoop.yarn.webapp.ResponseInfo;
|
||||
import org.apache.hadoop.yarn.webapp.YarnWebParams;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
|
||||
@ -123,6 +126,13 @@ public void nodes() {
|
||||
}
|
||||
|
||||
public void scheduler() {
|
||||
// limit applications to those in states relevant to scheduling
|
||||
set(YarnWebParams.APP_STATE, StringHelper.cjoin(
|
||||
RMAppState.NEW.toString(),
|
||||
RMAppState.SUBMITTED.toString(),
|
||||
RMAppState.ACCEPTED.toString(),
|
||||
RMAppState.RUNNING.toString()));
|
||||
|
||||
ResourceManager rm = getInstance(ResourceManager.class);
|
||||
ResourceScheduler rs = rm.getResourceScheduler();
|
||||
if (rs == null || rs instanceof CapacityScheduler) {
|
||||
|
@ -47,6 +47,7 @@
|
||||
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacitySchedulerConfiguration;
|
||||
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.fifo.FifoScheduler;
|
||||
import org.apache.hadoop.yarn.server.security.ApplicationACLsManager;
|
||||
import org.apache.hadoop.yarn.util.StringHelper;
|
||||
import org.apache.hadoop.yarn.webapp.WebApps;
|
||||
import org.apache.hadoop.yarn.webapp.YarnWebParams;
|
||||
import org.apache.hadoop.yarn.webapp.test.WebAppTests;
|
||||
@ -93,6 +94,11 @@ public void configure(Binder binder) {
|
||||
rmViewInstance.set(YarnWebParams.APP_STATE, RMAppState.RUNNING.toString());
|
||||
rmViewInstance.render();
|
||||
WebAppTests.flushOutput(injector);
|
||||
|
||||
rmViewInstance.set(YarnWebParams.APP_STATE, StringHelper.cjoin(
|
||||
RMAppState.ACCEPTED.toString(), RMAppState.RUNNING.toString()));
|
||||
rmViewInstance.render();
|
||||
WebAppTests.flushOutput(injector);
|
||||
}
|
||||
|
||||
@Test public void testNodesPage() {
|
||||
|
Loading…
Reference in New Issue
Block a user