|
@@ -566,7 +566,7 @@ public class FairScheduler extends
|
|
|
* configured limits, but the app will not be marked as runnable.
|
|
|
*/
|
|
|
protected synchronized void addApplication(ApplicationId applicationId,
|
|
|
- String queueName, String user) {
|
|
|
+ String queueName, String user, boolean isAppRecovering) {
|
|
|
if (queueName == null || queueName.isEmpty()) {
|
|
|
String message = "Reject application " + applicationId +
|
|
|
" submitted by user " + user + " with an empty queue name.";
|
|
@@ -603,8 +603,14 @@ public class FairScheduler extends
|
|
|
LOG.info("Accepted application " + applicationId + " from user: " + user
|
|
|
+ ", in queue: " + queueName + ", currently num of applications: "
|
|
|
+ applications.size());
|
|
|
- rmContext.getDispatcher().getEventHandler()
|
|
|
+ if (isAppRecovering) {
|
|
|
+ if (LOG.isDebugEnabled()) {
|
|
|
+ LOG.debug(applicationId + " is recovering. Skip notifying APP_ACCEPTED");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ rmContext.getDispatcher().getEventHandler()
|
|
|
.handle(new RMAppEvent(applicationId, RMAppEventType.APP_ACCEPTED));
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -613,7 +619,7 @@ public class FairScheduler extends
|
|
|
protected synchronized void addApplicationAttempt(
|
|
|
ApplicationAttemptId applicationAttemptId,
|
|
|
boolean transferStateFromPreviousAttempt,
|
|
|
- boolean shouldNotifyAttemptAdded) {
|
|
|
+ boolean isAttemptRecovering) {
|
|
|
SchedulerApplication<FSSchedulerApp> application =
|
|
|
applications.get(applicationAttemptId.getApplicationId());
|
|
|
String user = application.getUser();
|
|
@@ -642,14 +648,15 @@ public class FairScheduler extends
|
|
|
LOG.info("Added Application Attempt " + applicationAttemptId
|
|
|
+ " to scheduler from user: " + user);
|
|
|
|
|
|
- if (shouldNotifyAttemptAdded) {
|
|
|
- rmContext.getDispatcher().getEventHandler().handle(
|
|
|
- new RMAppAttemptEvent(applicationAttemptId,
|
|
|
- RMAppAttemptEventType.ATTEMPT_ADDED));
|
|
|
- } else {
|
|
|
+ if (isAttemptRecovering) {
|
|
|
if (LOG.isDebugEnabled()) {
|
|
|
- LOG.debug("Skipping notifying ATTEMPT_ADDED");
|
|
|
+ LOG.debug(applicationAttemptId
|
|
|
+ + " is recovering. Skipping notifying ATTEMPT_ADDED");
|
|
|
}
|
|
|
+ } else {
|
|
|
+ rmContext.getDispatcher().getEventHandler().handle(
|
|
|
+ new RMAppAttemptEvent(applicationAttemptId,
|
|
|
+ RMAppAttemptEventType.ATTEMPT_ADDED));
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1136,7 +1143,8 @@ public class FairScheduler extends
|
|
|
}
|
|
|
AppAddedSchedulerEvent appAddedEvent = (AppAddedSchedulerEvent) event;
|
|
|
addApplication(appAddedEvent.getApplicationId(),
|
|
|
- appAddedEvent.getQueue(), appAddedEvent.getUser());
|
|
|
+ appAddedEvent.getQueue(), appAddedEvent.getUser(),
|
|
|
+ appAddedEvent.getIsAppRecovering());
|
|
|
break;
|
|
|
case APP_REMOVED:
|
|
|
if (!(event instanceof AppRemovedSchedulerEvent)) {
|
|
@@ -1154,7 +1162,7 @@ public class FairScheduler extends
|
|
|
(AppAttemptAddedSchedulerEvent) event;
|
|
|
addApplicationAttempt(appAttemptAddedEvent.getApplicationAttemptId(),
|
|
|
appAttemptAddedEvent.getTransferStateFromPreviousAttempt(),
|
|
|
- appAttemptAddedEvent.getShouldNotifyAttemptAdded());
|
|
|
+ appAttemptAddedEvent.getIsAttemptRecovering());
|
|
|
break;
|
|
|
case APP_ATTEMPT_REMOVED:
|
|
|
if (!(event instanceof AppAttemptRemovedSchedulerEvent)) {
|