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

View File

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