YARN-9723. ApplicationPlacementContext is not required for terminated jobs during recovery. Contributed by Prabhu Joseph

This commit is contained in:
Szilard Nemeth 2019-08-12 15:15:43 +02:00
parent b91099efd6
commit e4b538bbda
1 changed files with 11 additions and 6 deletions

View File

@ -64,6 +64,7 @@ import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppMetrics;
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppRecoverEvent;
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttempt;
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttemptImpl;
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppState;
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerUtils;
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.YarnScheduler;
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CSQueue;
@ -371,7 +372,7 @@ public class RMAppManager implements EventHandler<RMAppManagerEvent>,
// Passing start time as -1. It will be eventually set in RMAppImpl
// constructor.
RMAppImpl application = createAndPopulateNewRMApp(
submissionContext, submitTime, user, false, -1);
submissionContext, submitTime, user, false, -1, null);
try {
if (UserGroupInformation.isSecurityEnabled()) {
this.rmContext.getDelegationTokenRenewer()
@ -408,18 +409,22 @@ public class RMAppManager implements EventHandler<RMAppManagerEvent>,
// create and recover app.
RMAppImpl application =
createAndPopulateNewRMApp(appContext, appState.getSubmitTime(),
appState.getUser(), true, appState.getStartTime());
appState.getUser(), true, appState.getStartTime(),
appState.getState());
application.handle(new RMAppRecoverEvent(appId, rmState));
}
private RMAppImpl createAndPopulateNewRMApp(
ApplicationSubmissionContext submissionContext, long submitTime,
String user, boolean isRecovery, long startTime) throws YarnException {
String user, boolean isRecovery, long startTime,
RMAppState recoveredFinalState) throws YarnException {
ApplicationPlacementContext placementContext =
placeApplication(rmContext.getQueuePlacementManager(),
submissionContext, user, isRecovery);
ApplicationPlacementContext placementContext = null;
if (recoveredFinalState == null) {
placementContext = placeApplication(rmContext.getQueuePlacementManager(),
submissionContext, user, isRecovery);
}
// We only replace the queue when it's a new application
if (!isRecovery) {