MAPREDUCE-7351 - CleanupJob during handle of SIGTERM signal (#3176)

Co-authored-by: Shubham Gupta <gshubham@microsoft.com>
This commit is contained in:
Shubham Gupta 2021-07-07 09:08:15 +05:30 committed by GitHub
parent c42441a1ec
commit 3f4221ec34
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 0 deletions

View File

@ -1714,6 +1714,19 @@ public class MRAppMaster extends CompositeService {
}
appMaster.notifyIsLastAMRetry(appMaster.isLastAMRetry);
appMaster.stop();
try {
JobContext jobContext = appMaster
.getJobContextFromConf(appMaster.getConfig());
appMaster.committer.abortJob(jobContext, State.KILLED);
} catch (FileNotFoundException e) {
System.out.println("Previous job temporary " +
"files do not exist, no clean up was necessary.");
} catch (Exception e) {
// the clean up of a previous attempt is not critical to the success
// of this job - only logging the error
System.err.println("Error while trying to " +
"clean up previous job's temporary files" + e);
}
}
}