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/trunk@1543675 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
00d9b8eedb
commit
2f6b393543
|
@ -156,6 +156,9 @@ Release 2.3.0 - UNRELEASED
|
|||
YARN-1419. TestFifoScheduler.testAppAttemptMetrics fails intermittently
|
||||
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
|
||||
|
||||
INCOMPATIBLE CHANGES
|
||||
|
|
|
@ -29,9 +29,9 @@ import java.util.concurrent.ConcurrentMap;
|
|||
|
||||
import org.apache.commons.lang.StringEscapeUtils;
|
||||
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.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.webapp.hamlet.Hamlet;
|
||||
import org.apache.hadoop.yarn.webapp.hamlet.Hamlet.TABLE;
|
||||
|
@ -65,18 +65,18 @@ class AppsBlock extends HtmlBlock {
|
|||
th(".progress", "Progress").
|
||||
th(".ui", "Tracking UI")._()._().
|
||||
tbody();
|
||||
Collection<RMAppState> reqAppStates = null;
|
||||
Collection<YarnApplicationState> reqAppStates = null;
|
||||
String reqStateString = $(APP_STATE);
|
||||
if (reqStateString != null && !reqStateString.isEmpty()) {
|
||||
String[] appStateStrings = reqStateString.split(",");
|
||||
reqAppStates = new HashSet<RMAppState>(appStateStrings.length);
|
||||
reqAppStates = new HashSet<YarnApplicationState>(appStateStrings.length);
|
||||
for(String stateString : appStateStrings) {
|
||||
reqAppStates.add(RMAppState.valueOf(stateString));
|
||||
reqAppStates.add(YarnApplicationState.valueOf(stateString));
|
||||
}
|
||||
}
|
||||
StringBuilder appsTableData = new StringBuilder("[\n");
|
||||
for (RMApp app : apps.values()) {
|
||||
if (reqAppStates != null && !reqAppStates.contains(app.getState())) {
|
||||
if (reqAppStates != null && !reqAppStates.contains(app.createApplicationState())) {
|
||||
continue;
|
||||
}
|
||||
AppInfo appInfo = new AppInfo(app, true);
|
||||
|
|
|
@ -30,10 +30,10 @@ import java.util.concurrent.ConcurrentMap;
|
|||
import org.apache.commons.lang.StringEscapeUtils;
|
||||
import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
|
||||
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.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.fair.FairScheduler;
|
||||
import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.AppInfo;
|
||||
import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.FairSchedulerInfo;
|
||||
|
@ -77,13 +77,13 @@ public class FairSchedulerAppsBlock extends HtmlBlock {
|
|||
th(".progress", "Progress").
|
||||
th(".ui", "Tracking UI")._()._().
|
||||
tbody();
|
||||
Collection<RMAppState> reqAppStates = null;
|
||||
Collection<YarnApplicationState> reqAppStates = null;
|
||||
String reqStateString = $(APP_STATE);
|
||||
if (reqStateString != null && !reqStateString.isEmpty()) {
|
||||
String[] appStateStrings = reqStateString.split(",");
|
||||
reqAppStates = new HashSet<RMAppState>(appStateStrings.length);
|
||||
reqAppStates = new HashSet<YarnApplicationState>(appStateStrings.length);
|
||||
for(String stateString : appStateStrings) {
|
||||
reqAppStates.add(RMAppState.valueOf(stateString));
|
||||
reqAppStates.add(YarnApplicationState.valueOf(stateString));
|
||||
}
|
||||
}
|
||||
StringBuilder appsTableData = new StringBuilder("[\n");
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
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.DIV;
|
||||
import org.apache.hadoop.yarn.webapp.hamlet.Hamlet.LI;
|
||||
|
@ -38,7 +38,7 @@ public class NavBlock extends HtmlBlock {
|
|||
li().a(url("apps"), "Applications").
|
||||
ul();
|
||||
subAppsList.li()._();
|
||||
for (RMAppState state : RMAppState.values()) {
|
||||
for (YarnApplicationState state : YarnApplicationState.values()) {
|
||||
subAppsList.
|
||||
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.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.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.scheduler.fair.FairScheduler;
|
||||
|
@ -62,12 +62,11 @@ public class RmController extends Controller {
|
|||
public void scheduler() {
|
||||
// limit applications to those in states relevant to scheduling
|
||||
set(YarnWebParams.APP_STATE, StringHelper.cjoin(
|
||||
RMAppState.NEW.toString(),
|
||||
RMAppState.NEW_SAVING.toString(),
|
||||
RMAppState.SUBMITTED.toString(),
|
||||
RMAppState.ACCEPTED.toString(),
|
||||
RMAppState.RUNNING.toString(),
|
||||
RMAppState.FINISHING.toString()));
|
||||
YarnApplicationState.NEW.toString(),
|
||||
YarnApplicationState.NEW_SAVING.toString(),
|
||||
YarnApplicationState.SUBMITTED.toString(),
|
||||
YarnApplicationState.ACCEPTED.toString(),
|
||||
YarnApplicationState.RUNNING.toString()));
|
||||
|
||||
ResourceManager rm = getInstance(ResourceManager.class);
|
||||
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.FinalApplicationStatus;
|
||||
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.rmapp.RMApp;
|
||||
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppState;
|
||||
|
@ -58,7 +59,7 @@ public class AppInfo {
|
|||
protected String user;
|
||||
protected String name;
|
||||
protected String queue;
|
||||
protected RMAppState state;
|
||||
protected YarnApplicationState state;
|
||||
protected FinalApplicationStatus finalStatus;
|
||||
protected float progress;
|
||||
protected String trackingUI;
|
||||
|
@ -88,12 +89,12 @@ public class AppInfo {
|
|||
|
||||
if (app != null) {
|
||||
String trackingUrl = app.getTrackingUrl();
|
||||
this.state = app.getState();
|
||||
this.state = app.createApplicationState();
|
||||
this.trackingUrlIsNotReady = trackingUrl == null || trackingUrl.isEmpty()
|
||||
|| RMAppState.NEW == this.state
|
||||
|| RMAppState.NEW_SAVING == this.state
|
||||
|| RMAppState.SUBMITTED == this.state
|
||||
|| RMAppState.ACCEPTED == this.state;
|
||||
|| YarnApplicationState.NEW == this.state
|
||||
|| YarnApplicationState.NEW_SAVING == this.state
|
||||
|| YarnApplicationState.SUBMITTED == this.state
|
||||
|| YarnApplicationState.ACCEPTED == this.state;
|
||||
this.trackingUI = this.trackingUrlIsNotReady ? "UNASSIGNED" : (app
|
||||
.getFinishTime() == 0 ? "ApplicationMaster" : "History");
|
||||
if (!trackingUrlIsNotReady) {
|
||||
|
|
|
@ -168,8 +168,8 @@ public abstract class MockAsm extends MockApps {
|
|||
final long start = 123456 + i * 1000;
|
||||
final long finish = 234567 + i * 1000;
|
||||
final String type = YarnConfiguration.DEFAULT_APPLICATION_TYPE;
|
||||
RMAppState[] allStates = RMAppState.values();
|
||||
final RMAppState state = allStates[i % allStates.length];
|
||||
YarnApplicationState[] allStates = YarnApplicationState.values();
|
||||
final YarnApplicationState state = allStates[i % allStates.length];
|
||||
final int maxAppAttempts = i % 1000;
|
||||
return new ApplicationBase() {
|
||||
@Override
|
||||
|
@ -210,7 +210,7 @@ public abstract class MockAsm extends MockApps {
|
|||
return null;
|
||||
}
|
||||
@Override
|
||||
public RMAppState getState() {
|
||||
public YarnApplicationState createApplicationState() {
|
||||
return state;
|
||||
}
|
||||
@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.NodeId;
|
||||
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.server.resourcemanager.MockNodes;
|
||||
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.applicationsmanager.MockAsm;
|
||||
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.scheduler.ResourceScheduler;
|
||||
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacityScheduler;
|
||||
|
@ -93,12 +93,14 @@ public class TestRMWebApp {
|
|||
}
|
||||
});
|
||||
RmView rmViewInstance = injector.getInstance(RmView.class);
|
||||
rmViewInstance.set(YarnWebParams.APP_STATE, RMAppState.RUNNING.toString());
|
||||
rmViewInstance.set(YarnWebParams.APP_STATE,
|
||||
YarnApplicationState.RUNNING.toString());
|
||||
rmViewInstance.render();
|
||||
WebAppTests.flushOutput(injector);
|
||||
|
||||
rmViewInstance.set(YarnWebParams.APP_STATE, StringHelper.cjoin(
|
||||
RMAppState.ACCEPTED.toString(), RMAppState.RUNNING.toString()));
|
||||
YarnApplicationState.ACCEPTED.toString(),
|
||||
YarnApplicationState.RUNNING.toString()));
|
||||
rmViewInstance.render();
|
||||
WebAppTests.flushOutput(injector);
|
||||
}
|
||||
|
|
|
@ -1445,7 +1445,7 @@ _01_000001</amContainerLogs>
|
|||
*---------------+--------------+--------------------------------+
|
||||
| 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|
|
||||
*---------------+--------------+--------------------------------+
|
||||
|
|
Loading…
Reference in New Issue