|
@@ -151,6 +151,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;
|
|
@@ -198,6 +199,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,
|
|
@@ -214,6 +217,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,
|
|
@@ -232,6 +237,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(
|
|
@@ -248,6 +255,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)
|
|
|
.addTransition(RMAppState.ACCEPTED,
|
|
@@ -274,6 +283,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(
|
|
@@ -303,6 +314,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,
|
|
@@ -314,6 +327,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,
|
|
@@ -325,6 +340,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(
|
|
@@ -576,6 +593,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() {
|
|
@@ -848,6 +880,8 @@ public class RMAppImpl implements RMApp, Recoverable {
|
|
|
|
|
|
// send the ATS create Event
|
|
|
sendATSCreateEvent(this, this.startTime);
|
|
|
+ //TODO recover aggregator address.
|
|
|
+ //this.aggregatorAddr = appState.getAggregatorAddr();
|
|
|
|
|
|
for(int i=0; i<appState.getAttemptCount(); ++i) {
|
|
|
// create attempt
|
|
@@ -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;
|