YARN-1407. RM Web UI and REST APIs should uniformly use YarnApplicationState (Sandy Ryza)
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1543678 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
dd889fc773
commit
da6d4dbc13
|
@ -138,6 +138,9 @@ Release 2.3.0 - UNRELEASED
|
||||||
YARN-1419. TestFifoScheduler.testAppAttemptMetrics fails intermittently
|
YARN-1419. TestFifoScheduler.testAppAttemptMetrics fails intermittently
|
||||||
under jdk7 (Jonathan Eagles via jlowe)
|
under jdk7 (Jonathan Eagles via jlowe)
|
||||||
|
|
||||||
|
YARN-1407. RM Web UI and REST APIs should uniformly use
|
||||||
|
YarnApplicationState (Sandy Ryza)
|
||||||
|
|
||||||
Release 2.2.1 - UNRELEASED
|
Release 2.2.1 - UNRELEASED
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
|
|
@ -29,9 +29,9 @@ import java.util.concurrent.ConcurrentMap;
|
||||||
|
|
||||||
import org.apache.commons.lang.StringEscapeUtils;
|
import org.apache.commons.lang.StringEscapeUtils;
|
||||||
import org.apache.hadoop.yarn.api.records.ApplicationId;
|
import org.apache.hadoop.yarn.api.records.ApplicationId;
|
||||||
|
import org.apache.hadoop.yarn.api.records.YarnApplicationState;
|
||||||
import org.apache.hadoop.yarn.server.resourcemanager.RMContext;
|
import org.apache.hadoop.yarn.server.resourcemanager.RMContext;
|
||||||
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMApp;
|
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;
|
import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.AppInfo;
|
||||||
import org.apache.hadoop.yarn.webapp.hamlet.Hamlet;
|
import org.apache.hadoop.yarn.webapp.hamlet.Hamlet;
|
||||||
import org.apache.hadoop.yarn.webapp.hamlet.Hamlet.TABLE;
|
import org.apache.hadoop.yarn.webapp.hamlet.Hamlet.TABLE;
|
||||||
|
@ -65,18 +65,18 @@ class AppsBlock extends HtmlBlock {
|
||||||
th(".progress", "Progress").
|
th(".progress", "Progress").
|
||||||
th(".ui", "Tracking UI")._()._().
|
th(".ui", "Tracking UI")._()._().
|
||||||
tbody();
|
tbody();
|
||||||
Collection<RMAppState> reqAppStates = null;
|
Collection<YarnApplicationState> reqAppStates = null;
|
||||||
String reqStateString = $(APP_STATE);
|
String reqStateString = $(APP_STATE);
|
||||||
if (reqStateString != null && !reqStateString.isEmpty()) {
|
if (reqStateString != null && !reqStateString.isEmpty()) {
|
||||||
String[] appStateStrings = reqStateString.split(",");
|
String[] appStateStrings = reqStateString.split(",");
|
||||||
reqAppStates = new HashSet<RMAppState>(appStateStrings.length);
|
reqAppStates = new HashSet<YarnApplicationState>(appStateStrings.length);
|
||||||
for(String stateString : appStateStrings) {
|
for(String stateString : appStateStrings) {
|
||||||
reqAppStates.add(RMAppState.valueOf(stateString));
|
reqAppStates.add(YarnApplicationState.valueOf(stateString));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
StringBuilder appsTableData = new StringBuilder("[\n");
|
StringBuilder appsTableData = new StringBuilder("[\n");
|
||||||
for (RMApp app : apps.values()) {
|
for (RMApp app : apps.values()) {
|
||||||
if (reqAppStates != null && !reqAppStates.contains(app.getState())) {
|
if (reqAppStates != null && !reqAppStates.contains(app.createApplicationState())) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
AppInfo appInfo = new AppInfo(app, true);
|
AppInfo appInfo = new AppInfo(app, true);
|
||||||
|
|
|
@ -30,10 +30,10 @@ import java.util.concurrent.ConcurrentMap;
|
||||||
import org.apache.commons.lang.StringEscapeUtils;
|
import org.apache.commons.lang.StringEscapeUtils;
|
||||||
import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
|
import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
|
||||||
import org.apache.hadoop.yarn.api.records.ApplicationId;
|
import org.apache.hadoop.yarn.api.records.ApplicationId;
|
||||||
|
import org.apache.hadoop.yarn.api.records.YarnApplicationState;
|
||||||
import org.apache.hadoop.yarn.server.resourcemanager.RMContext;
|
import org.apache.hadoop.yarn.server.resourcemanager.RMContext;
|
||||||
import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager;
|
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.RMApp;
|
||||||
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppState;
|
|
||||||
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FairScheduler;
|
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FairScheduler;
|
||||||
import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.AppInfo;
|
import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.AppInfo;
|
||||||
import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.FairSchedulerInfo;
|
import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.FairSchedulerInfo;
|
||||||
|
@ -77,13 +77,13 @@ public class FairSchedulerAppsBlock extends HtmlBlock {
|
||||||
th(".progress", "Progress").
|
th(".progress", "Progress").
|
||||||
th(".ui", "Tracking UI")._()._().
|
th(".ui", "Tracking UI")._()._().
|
||||||
tbody();
|
tbody();
|
||||||
Collection<RMAppState> reqAppStates = null;
|
Collection<YarnApplicationState> reqAppStates = null;
|
||||||
String reqStateString = $(APP_STATE);
|
String reqStateString = $(APP_STATE);
|
||||||
if (reqStateString != null && !reqStateString.isEmpty()) {
|
if (reqStateString != null && !reqStateString.isEmpty()) {
|
||||||
String[] appStateStrings = reqStateString.split(",");
|
String[] appStateStrings = reqStateString.split(",");
|
||||||
reqAppStates = new HashSet<RMAppState>(appStateStrings.length);
|
reqAppStates = new HashSet<YarnApplicationState>(appStateStrings.length);
|
||||||
for(String stateString : appStateStrings) {
|
for(String stateString : appStateStrings) {
|
||||||
reqAppStates.add(RMAppState.valueOf(stateString));
|
reqAppStates.add(YarnApplicationState.valueOf(stateString));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
StringBuilder appsTableData = new StringBuilder("[\n");
|
StringBuilder appsTableData = new StringBuilder("[\n");
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
package org.apache.hadoop.yarn.server.resourcemanager.webapp;
|
package org.apache.hadoop.yarn.server.resourcemanager.webapp;
|
||||||
|
|
||||||
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppState;
|
import org.apache.hadoop.yarn.api.records.YarnApplicationState;
|
||||||
import org.apache.hadoop.yarn.webapp.hamlet.Hamlet;
|
import org.apache.hadoop.yarn.webapp.hamlet.Hamlet;
|
||||||
import org.apache.hadoop.yarn.webapp.hamlet.Hamlet.DIV;
|
import org.apache.hadoop.yarn.webapp.hamlet.Hamlet.DIV;
|
||||||
import org.apache.hadoop.yarn.webapp.hamlet.Hamlet.LI;
|
import org.apache.hadoop.yarn.webapp.hamlet.Hamlet.LI;
|
||||||
|
@ -38,7 +38,7 @@ public class NavBlock extends HtmlBlock {
|
||||||
li().a(url("apps"), "Applications").
|
li().a(url("apps"), "Applications").
|
||||||
ul();
|
ul();
|
||||||
subAppsList.li()._();
|
subAppsList.li()._();
|
||||||
for (RMAppState state : RMAppState.values()) {
|
for (YarnApplicationState state : YarnApplicationState.values()) {
|
||||||
subAppsList.
|
subAppsList.
|
||||||
li().a(url("apps", state.toString()), state.toString())._();
|
li().a(url("apps", state.toString()), state.toString())._();
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,8 +21,8 @@ package org.apache.hadoop.yarn.server.resourcemanager.webapp;
|
||||||
import static org.apache.hadoop.yarn.util.StringHelper.join;
|
import static org.apache.hadoop.yarn.util.StringHelper.join;
|
||||||
import static org.apache.hadoop.yarn.webapp.YarnWebParams.QUEUE_NAME;
|
import static org.apache.hadoop.yarn.webapp.YarnWebParams.QUEUE_NAME;
|
||||||
|
|
||||||
|
import org.apache.hadoop.yarn.api.records.YarnApplicationState;
|
||||||
import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager;
|
import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager;
|
||||||
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.ResourceScheduler;
|
||||||
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacityScheduler;
|
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacityScheduler;
|
||||||
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FairScheduler;
|
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FairScheduler;
|
||||||
|
@ -62,12 +62,11 @@ public class RmController extends Controller {
|
||||||
public void scheduler() {
|
public void scheduler() {
|
||||||
// limit applications to those in states relevant to scheduling
|
// limit applications to those in states relevant to scheduling
|
||||||
set(YarnWebParams.APP_STATE, StringHelper.cjoin(
|
set(YarnWebParams.APP_STATE, StringHelper.cjoin(
|
||||||
RMAppState.NEW.toString(),
|
YarnApplicationState.NEW.toString(),
|
||||||
RMAppState.NEW_SAVING.toString(),
|
YarnApplicationState.NEW_SAVING.toString(),
|
||||||
RMAppState.SUBMITTED.toString(),
|
YarnApplicationState.SUBMITTED.toString(),
|
||||||
RMAppState.ACCEPTED.toString(),
|
YarnApplicationState.ACCEPTED.toString(),
|
||||||
RMAppState.RUNNING.toString(),
|
YarnApplicationState.RUNNING.toString()));
|
||||||
RMAppState.FINISHING.toString()));
|
|
||||||
|
|
||||||
ResourceManager rm = getInstance(ResourceManager.class);
|
ResourceManager rm = getInstance(ResourceManager.class);
|
||||||
ResourceScheduler rs = rm.getResourceScheduler();
|
ResourceScheduler rs = rm.getResourceScheduler();
|
||||||
|
|
|
@ -30,6 +30,7 @@ import org.apache.hadoop.yarn.api.records.ApplicationResourceUsageReport;
|
||||||
import org.apache.hadoop.yarn.api.records.Container;
|
import org.apache.hadoop.yarn.api.records.Container;
|
||||||
import org.apache.hadoop.yarn.api.records.FinalApplicationStatus;
|
import org.apache.hadoop.yarn.api.records.FinalApplicationStatus;
|
||||||
import org.apache.hadoop.yarn.api.records.Resource;
|
import org.apache.hadoop.yarn.api.records.Resource;
|
||||||
|
import org.apache.hadoop.yarn.api.records.YarnApplicationState;
|
||||||
import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager;
|
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.RMApp;
|
||||||
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppState;
|
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppState;
|
||||||
|
@ -58,7 +59,7 @@ public class AppInfo {
|
||||||
protected String user;
|
protected String user;
|
||||||
protected String name;
|
protected String name;
|
||||||
protected String queue;
|
protected String queue;
|
||||||
protected RMAppState state;
|
protected YarnApplicationState state;
|
||||||
protected FinalApplicationStatus finalStatus;
|
protected FinalApplicationStatus finalStatus;
|
||||||
protected float progress;
|
protected float progress;
|
||||||
protected String trackingUI;
|
protected String trackingUI;
|
||||||
|
@ -88,12 +89,12 @@ public class AppInfo {
|
||||||
|
|
||||||
if (app != null) {
|
if (app != null) {
|
||||||
String trackingUrl = app.getTrackingUrl();
|
String trackingUrl = app.getTrackingUrl();
|
||||||
this.state = app.getState();
|
this.state = app.createApplicationState();
|
||||||
this.trackingUrlIsNotReady = trackingUrl == null || trackingUrl.isEmpty()
|
this.trackingUrlIsNotReady = trackingUrl == null || trackingUrl.isEmpty()
|
||||||
|| RMAppState.NEW == this.state
|
|| YarnApplicationState.NEW == this.state
|
||||||
|| RMAppState.NEW_SAVING == this.state
|
|| YarnApplicationState.NEW_SAVING == this.state
|
||||||
|| RMAppState.SUBMITTED == this.state
|
|| YarnApplicationState.SUBMITTED == this.state
|
||||||
|| RMAppState.ACCEPTED == this.state;
|
|| YarnApplicationState.ACCEPTED == this.state;
|
||||||
this.trackingUI = this.trackingUrlIsNotReady ? "UNASSIGNED" : (app
|
this.trackingUI = this.trackingUrlIsNotReady ? "UNASSIGNED" : (app
|
||||||
.getFinishTime() == 0 ? "ApplicationMaster" : "History");
|
.getFinishTime() == 0 ? "ApplicationMaster" : "History");
|
||||||
if (!trackingUrlIsNotReady) {
|
if (!trackingUrlIsNotReady) {
|
||||||
|
|
|
@ -168,8 +168,8 @@ public abstract class MockAsm extends MockApps {
|
||||||
final long start = 123456 + i * 1000;
|
final long start = 123456 + i * 1000;
|
||||||
final long finish = 234567 + i * 1000;
|
final long finish = 234567 + i * 1000;
|
||||||
final String type = YarnConfiguration.DEFAULT_APPLICATION_TYPE;
|
final String type = YarnConfiguration.DEFAULT_APPLICATION_TYPE;
|
||||||
RMAppState[] allStates = RMAppState.values();
|
YarnApplicationState[] allStates = YarnApplicationState.values();
|
||||||
final RMAppState state = allStates[i % allStates.length];
|
final YarnApplicationState state = allStates[i % allStates.length];
|
||||||
final int maxAppAttempts = i % 1000;
|
final int maxAppAttempts = i % 1000;
|
||||||
return new ApplicationBase() {
|
return new ApplicationBase() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -210,7 +210,7 @@ public abstract class MockAsm extends MockApps {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public RMAppState getState() {
|
public YarnApplicationState createApplicationState() {
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -32,6 +32,7 @@ import org.apache.hadoop.conf.Configuration;
|
||||||
import org.apache.hadoop.yarn.api.records.ApplicationId;
|
import org.apache.hadoop.yarn.api.records.ApplicationId;
|
||||||
import org.apache.hadoop.yarn.api.records.NodeId;
|
import org.apache.hadoop.yarn.api.records.NodeId;
|
||||||
import org.apache.hadoop.yarn.api.records.NodeState;
|
import org.apache.hadoop.yarn.api.records.NodeState;
|
||||||
|
import org.apache.hadoop.yarn.api.records.YarnApplicationState;
|
||||||
import org.apache.hadoop.yarn.conf.YarnConfiguration;
|
import org.apache.hadoop.yarn.conf.YarnConfiguration;
|
||||||
import org.apache.hadoop.yarn.server.resourcemanager.MockNodes;
|
import org.apache.hadoop.yarn.server.resourcemanager.MockNodes;
|
||||||
import org.apache.hadoop.yarn.server.resourcemanager.RMContext;
|
import org.apache.hadoop.yarn.server.resourcemanager.RMContext;
|
||||||
|
@ -39,7 +40,6 @@ import org.apache.hadoop.yarn.server.resourcemanager.RMContextImpl;
|
||||||
import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager;
|
import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager;
|
||||||
import org.apache.hadoop.yarn.server.resourcemanager.applicationsmanager.MockAsm;
|
import org.apache.hadoop.yarn.server.resourcemanager.applicationsmanager.MockAsm;
|
||||||
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMApp;
|
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.rmnode.RMNode;
|
import org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNode;
|
||||||
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.ResourceScheduler;
|
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.scheduler.capacity.CapacityScheduler;
|
||||||
|
@ -93,12 +93,14 @@ public class TestRMWebApp {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
RmView rmViewInstance = injector.getInstance(RmView.class);
|
RmView rmViewInstance = injector.getInstance(RmView.class);
|
||||||
rmViewInstance.set(YarnWebParams.APP_STATE, RMAppState.RUNNING.toString());
|
rmViewInstance.set(YarnWebParams.APP_STATE,
|
||||||
|
YarnApplicationState.RUNNING.toString());
|
||||||
rmViewInstance.render();
|
rmViewInstance.render();
|
||||||
WebAppTests.flushOutput(injector);
|
WebAppTests.flushOutput(injector);
|
||||||
|
|
||||||
rmViewInstance.set(YarnWebParams.APP_STATE, StringHelper.cjoin(
|
rmViewInstance.set(YarnWebParams.APP_STATE, StringHelper.cjoin(
|
||||||
RMAppState.ACCEPTED.toString(), RMAppState.RUNNING.toString()));
|
YarnApplicationState.ACCEPTED.toString(),
|
||||||
|
YarnApplicationState.RUNNING.toString()));
|
||||||
rmViewInstance.render();
|
rmViewInstance.render();
|
||||||
WebAppTests.flushOutput(injector);
|
WebAppTests.flushOutput(injector);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1445,7 +1445,7 @@ _01_000001</amContainerLogs>
|
||||||
*---------------+--------------+--------------------------------+
|
*---------------+--------------+--------------------------------+
|
||||||
| queue | string | The queue the application was submitted to|
|
| queue | string | The queue the application was submitted to|
|
||||||
*---------------+--------------+--------------------------------+
|
*---------------+--------------+--------------------------------+
|
||||||
| state | string | The application state according to the ResourceManager - valid values are: NEW, SUBMITTED, ACCEPTED, RUNNING, FINISHED, FAILED, KILLED|
|
| state | string | The application state according to the ResourceManager - valid values are members of the YarnApplicationState enum: NEW, NEW_SAVING, SUBMITTED, ACCEPTED, RUNNING, FINISHED, FAILED, KILLED|
|
||||||
*---------------+--------------+--------------------------------+
|
*---------------+--------------+--------------------------------+
|
||||||
| finalStatus | string | The final status of the application if finished - reported by the application itself - valid values are: UNDEFINED, SUCCEEDED, FAILED, KILLED|
|
| finalStatus | string | The final status of the application if finished - reported by the application itself - valid values are: UNDEFINED, SUCCEEDED, FAILED, KILLED|
|
||||||
*---------------+--------------+--------------------------------+
|
*---------------+--------------+--------------------------------+
|
||||||
|
|
Loading…
Reference in New Issue