Description
1. The amResource should be normalized instead of fetching from ApplicationSubmissionContext directly.
ApplicationSubmissionContext appSubmissionContext = rmContext.getRMApps().get(applicationAttemptId.getApplicationId()) .getApplicationSubmissionContext(); if (appSubmissionContext != null) { amResource = appSubmissionContext.getResource(); unmanagedAM = appSubmissionContext.getUnmanagedAM(); }
2. When one application is removed, the FSLeafQueue's amResourceUsage should be updated only if the app has started its AM.
if (runnableAppScheds.remove(app.getAppSchedulable())) { // Update AM resource usage if (app.getAMResource() != null) { Resources.subtractFrom(amResourceUsage, app.getAMResource()); } return true; }