|
@@ -152,6 +152,7 @@ public class RMAppImpl implements RMApp, Recoverable {
|
|
|
private long storedFinishTime = 0;
|
|
|
private int firstAttemptIdInStateStore = 1;
|
|
|
private int nextAttemptId = 1;
|
|
|
+ private String aggregatorAddr;
|
|
|
// This field isn't protected by readlock now.
|
|
|
private volatile RMAppAttempt currentAttempt;
|
|
|
private String queue;
|
|
@@ -199,6 +200,8 @@ public class RMAppImpl implements RMApp, Recoverable {
|
|
|
// Transitions from NEW state
|
|
|
.addTransition(RMAppState.NEW, RMAppState.NEW,
|
|
|
RMAppEventType.NODE_UPDATE, new RMAppNodeUpdateTransition())
|
|
|
+ .addTransition(RMAppState.NEW, RMAppState.NEW,
|
|
|
+ RMAppEventType.AGGREGATOR_UPDATE, new RMAppAggregatorUpdateTransition())
|
|
|
.addTransition(RMAppState.NEW, RMAppState.NEW_SAVING,
|
|
|
RMAppEventType.START, new RMAppNewlySavingTransition())
|
|
|
.addTransition(RMAppState.NEW, EnumSet.of(RMAppState.SUBMITTED,
|
|
@@ -215,6 +218,8 @@ public class RMAppImpl implements RMApp, Recoverable {
|
|
|
// Transitions from NEW_SAVING state
|
|
|
.addTransition(RMAppState.NEW_SAVING, RMAppState.NEW_SAVING,
|
|
|
RMAppEventType.NODE_UPDATE, new RMAppNodeUpdateTransition())
|
|
|
+ .addTransition(RMAppState.NEW_SAVING, RMAppState.NEW_SAVING,
|
|
|
+ RMAppEventType.AGGREGATOR_UPDATE, new RMAppAggregatorUpdateTransition())
|
|
|
.addTransition(RMAppState.NEW_SAVING, RMAppState.SUBMITTED,
|
|
|
RMAppEventType.APP_NEW_SAVED, new AddApplicationToSchedulerTransition())
|
|
|
.addTransition(RMAppState.NEW_SAVING, RMAppState.FINAL_SAVING,
|
|
@@ -233,6 +238,8 @@ public class RMAppImpl implements RMApp, Recoverable {
|
|
|
RMAppEventType.NODE_UPDATE, new RMAppNodeUpdateTransition())
|
|
|
.addTransition(RMAppState.SUBMITTED, RMAppState.SUBMITTED,
|
|
|
RMAppEventType.MOVE, new RMAppMoveTransition())
|
|
|
+ .addTransition(RMAppState.SUBMITTED, RMAppState.SUBMITTED,
|
|
|
+ RMAppEventType.AGGREGATOR_UPDATE, new RMAppAggregatorUpdateTransition())
|
|
|
.addTransition(RMAppState.SUBMITTED, RMAppState.FINAL_SAVING,
|
|
|
RMAppEventType.APP_REJECTED,
|
|
|
new FinalSavingTransition(
|
|
@@ -249,6 +256,8 @@ public class RMAppImpl implements RMApp, Recoverable {
|
|
|
RMAppEventType.NODE_UPDATE, new RMAppNodeUpdateTransition())
|
|
|
.addTransition(RMAppState.ACCEPTED, RMAppState.ACCEPTED,
|
|
|
RMAppEventType.MOVE, new RMAppMoveTransition())
|
|
|
+ .addTransition(RMAppState.ACCEPTED, RMAppState.ACCEPTED,
|
|
|
+ RMAppEventType.AGGREGATOR_UPDATE, new RMAppAggregatorUpdateTransition())
|
|
|
.addTransition(RMAppState.ACCEPTED, RMAppState.RUNNING,
|
|
|
RMAppEventType.ATTEMPT_REGISTERED, new RMAppStateUpdateTransition(
|
|
|
YarnApplicationState.RUNNING))
|
|
@@ -276,6 +285,8 @@ public class RMAppImpl implements RMApp, Recoverable {
|
|
|
RMAppEventType.NODE_UPDATE, new RMAppNodeUpdateTransition())
|
|
|
.addTransition(RMAppState.RUNNING, RMAppState.RUNNING,
|
|
|
RMAppEventType.MOVE, new RMAppMoveTransition())
|
|
|
+ .addTransition(RMAppState.RUNNING, RMAppState.RUNNING,
|
|
|
+ RMAppEventType.AGGREGATOR_UPDATE, new RMAppAggregatorUpdateTransition())
|
|
|
.addTransition(RMAppState.RUNNING, RMAppState.FINAL_SAVING,
|
|
|
RMAppEventType.ATTEMPT_UNREGISTERED,
|
|
|
new FinalSavingTransition(
|
|
@@ -305,6 +316,8 @@ public class RMAppImpl implements RMApp, Recoverable {
|
|
|
.addTransition(RMAppState.FINAL_SAVING, RMAppState.FINAL_SAVING,
|
|
|
RMAppEventType.APP_RUNNING_ON_NODE,
|
|
|
new AppRunningOnNodeTransition())
|
|
|
+ .addTransition(RMAppState.FINAL_SAVING, RMAppState.FINAL_SAVING,
|
|
|
+ RMAppEventType.AGGREGATOR_UPDATE, new RMAppAggregatorUpdateTransition())
|
|
|
// ignorable transitions
|
|
|
.addTransition(RMAppState.FINAL_SAVING, RMAppState.FINAL_SAVING,
|
|
|
EnumSet.of(RMAppEventType.NODE_UPDATE, RMAppEventType.KILL,
|
|
@@ -316,6 +329,8 @@ public class RMAppImpl implements RMApp, Recoverable {
|
|
|
.addTransition(RMAppState.FINISHING, RMAppState.FINISHING,
|
|
|
RMAppEventType.APP_RUNNING_ON_NODE,
|
|
|
new AppRunningOnNodeTransition())
|
|
|
+ .addTransition(RMAppState.FINISHING, RMAppState.FINISHING,
|
|
|
+ RMAppEventType.AGGREGATOR_UPDATE, new RMAppAggregatorUpdateTransition())
|
|
|
// ignorable transitions
|
|
|
.addTransition(RMAppState.FINISHING, RMAppState.FINISHING,
|
|
|
EnumSet.of(RMAppEventType.NODE_UPDATE,
|
|
@@ -327,6 +342,8 @@ public class RMAppImpl implements RMApp, Recoverable {
|
|
|
.addTransition(RMAppState.KILLING, RMAppState.KILLING,
|
|
|
RMAppEventType.APP_RUNNING_ON_NODE,
|
|
|
new AppRunningOnNodeTransition())
|
|
|
+ .addTransition(RMAppState.KILLING, RMAppState.KILLING,
|
|
|
+ RMAppEventType.AGGREGATOR_UPDATE, new RMAppAggregatorUpdateTransition())
|
|
|
.addTransition(RMAppState.KILLING, RMAppState.FINAL_SAVING,
|
|
|
RMAppEventType.ATTEMPT_KILLED,
|
|
|
new FinalSavingTransition(
|
|
@@ -560,6 +577,21 @@ public class RMAppImpl implements RMApp, Recoverable {
|
|
|
public void setQueue(String queue) {
|
|
|
this.queue = queue;
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public String getAggregatorAddr() {
|
|
|
+ return this.aggregatorAddr;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void setAggregatorAddr(String aggregatorAddr) {
|
|
|
+ this.aggregatorAddr = aggregatorAddr;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void removeAggregatorAddr() {
|
|
|
+ this.aggregatorAddr = null;
|
|
|
+ }
|
|
|
|
|
|
@Override
|
|
|
public String getName() {
|
|
@@ -832,6 +864,8 @@ public class RMAppImpl implements RMApp, Recoverable {
|
|
|
|
|
|
// send the ATS create Event
|
|
|
sendATSCreateEvent(this, this.startTime);
|
|
|
+ //TODO recover aggregator address.
|
|
|
+ //this.aggregatorAddr = appState.getAggregatorAddr();
|
|
|
|
|
|
RMAppAttemptImpl preAttempt = null;
|
|
|
for (ApplicationAttemptId attemptId :
|
|
@@ -902,9 +936,24 @@ public class RMAppImpl implements RMApp, Recoverable {
|
|
|
SingleArcTransition<RMAppImpl, RMAppEvent> {
|
|
|
public void transition(RMAppImpl app, RMAppEvent event) {
|
|
|
};
|
|
|
-
|
|
|
}
|
|
|
|
|
|
+ private static final class RMAppAggregatorUpdateTransition
|
|
|
+ extends RMAppTransition {
|
|
|
+
|
|
|
+ public void transition(RMAppImpl app, RMAppEvent event) {
|
|
|
+ LOG.info("Updating aggregator info for app: " + app.getApplicationId());
|
|
|
+
|
|
|
+ RMAppAggregatorUpdateEvent appAggregatorUpdateEvent =
|
|
|
+ (RMAppAggregatorUpdateEvent) event;
|
|
|
+ // Update aggregator address
|
|
|
+ app.setAggregatorAddr(appAggregatorUpdateEvent.getAppAggregatorAddr());
|
|
|
+
|
|
|
+ // TODO persistent to RMStateStore for recover
|
|
|
+ // Save to RMStateStore
|
|
|
+ };
|
|
|
+ }
|
|
|
+
|
|
|
private static final class RMAppNodeUpdateTransition extends RMAppTransition {
|
|
|
public void transition(RMAppImpl app, RMAppEvent event) {
|
|
|
RMAppNodeUpdateEvent nodeUpdateEvent = (RMAppNodeUpdateEvent) event;
|