|
@@ -163,16 +163,18 @@ public class FairSchedulerTestBase {
|
|
protected ApplicationAttemptId createSchedulingRequest(
|
|
protected ApplicationAttemptId createSchedulingRequest(
|
|
int memory, int vcores, String queueId, String userId, int numContainers,
|
|
int memory, int vcores, String queueId, String userId, int numContainers,
|
|
int priority) {
|
|
int priority) {
|
|
- ApplicationAttemptId id = createAppAttemptId(this.APP_ID++, this.ATTEMPT_ID++);
|
|
|
|
|
|
+ ApplicationAttemptId id = createAppAttemptId(this.APP_ID++,
|
|
|
|
+ this.ATTEMPT_ID++);
|
|
scheduler.addApplication(id.getApplicationId(), queueId, userId, false);
|
|
scheduler.addApplication(id.getApplicationId(), queueId, userId, false);
|
|
// This conditional is for testAclSubmitApplication where app is rejected
|
|
// This conditional is for testAclSubmitApplication where app is rejected
|
|
// and no app is added.
|
|
// and no app is added.
|
|
- if (scheduler.getSchedulerApplications().containsKey(id.getApplicationId())) {
|
|
|
|
|
|
+ if (scheduler.getSchedulerApplications().
|
|
|
|
+ containsKey(id.getApplicationId())) {
|
|
scheduler.addApplicationAttempt(id, false, false);
|
|
scheduler.addApplicationAttempt(id, false, false);
|
|
}
|
|
}
|
|
List<ResourceRequest> ask = new ArrayList<ResourceRequest>();
|
|
List<ResourceRequest> ask = new ArrayList<ResourceRequest>();
|
|
- ResourceRequest request = createResourceRequest(memory, vcores, ResourceRequest.ANY,
|
|
|
|
- priority, numContainers, true);
|
|
|
|
|
|
+ ResourceRequest request = createResourceRequest(memory, vcores,
|
|
|
|
+ ResourceRequest.ANY, priority, numContainers, true);
|
|
ask.add(request);
|
|
ask.add(request);
|
|
|
|
|
|
RMApp rmApp = mock(RMApp.class);
|
|
RMApp rmApp = mock(RMApp.class);
|
|
@@ -180,9 +182,11 @@ public class FairSchedulerTestBase {
|
|
when(rmApp.getCurrentAppAttempt()).thenReturn(rmAppAttempt);
|
|
when(rmApp.getCurrentAppAttempt()).thenReturn(rmAppAttempt);
|
|
when(rmAppAttempt.getRMAppAttemptMetrics()).thenReturn(
|
|
when(rmAppAttempt.getRMAppAttemptMetrics()).thenReturn(
|
|
new RMAppAttemptMetrics(id, resourceManager.getRMContext()));
|
|
new RMAppAttemptMetrics(id, resourceManager.getRMContext()));
|
|
- ApplicationSubmissionContext submissionContext = mock(ApplicationSubmissionContext.class);
|
|
|
|
|
|
+ ApplicationSubmissionContext submissionContext =
|
|
|
|
+ mock(ApplicationSubmissionContext.class);
|
|
when(submissionContext.getUnmanagedAM()).thenReturn(false);
|
|
when(submissionContext.getUnmanagedAM()).thenReturn(false);
|
|
when(rmAppAttempt.getSubmissionContext()).thenReturn(submissionContext);
|
|
when(rmAppAttempt.getSubmissionContext()).thenReturn(submissionContext);
|
|
|
|
+ when(rmApp.getApplicationSubmissionContext()).thenReturn(submissionContext);
|
|
Container container = mock(Container.class);
|
|
Container container = mock(Container.class);
|
|
when(rmAppAttempt.getMasterContainer()).thenReturn(container);
|
|
when(rmAppAttempt.getMasterContainer()).thenReturn(container);
|
|
resourceManager.getRMContext().getRMApps()
|
|
resourceManager.getRMContext().getRMApps()
|
|
@@ -210,9 +214,11 @@ public class FairSchedulerTestBase {
|
|
when(rmApp.getCurrentAppAttempt()).thenReturn(rmAppAttempt);
|
|
when(rmApp.getCurrentAppAttempt()).thenReturn(rmAppAttempt);
|
|
when(rmAppAttempt.getRMAppAttemptMetrics()).thenReturn(
|
|
when(rmAppAttempt.getRMAppAttemptMetrics()).thenReturn(
|
|
new RMAppAttemptMetrics(id,resourceManager.getRMContext()));
|
|
new RMAppAttemptMetrics(id,resourceManager.getRMContext()));
|
|
- ApplicationSubmissionContext submissionContext = mock(ApplicationSubmissionContext.class);
|
|
|
|
|
|
+ ApplicationSubmissionContext submissionContext =
|
|
|
|
+ mock(ApplicationSubmissionContext.class);
|
|
when(submissionContext.getUnmanagedAM()).thenReturn(false);
|
|
when(submissionContext.getUnmanagedAM()).thenReturn(false);
|
|
when(rmAppAttempt.getSubmissionContext()).thenReturn(submissionContext);
|
|
when(rmAppAttempt.getSubmissionContext()).thenReturn(submissionContext);
|
|
|
|
+ when(rmApp.getApplicationSubmissionContext()).thenReturn(submissionContext);
|
|
resourceManager.getRMContext().getRMApps()
|
|
resourceManager.getRMContext().getRMApps()
|
|
.put(id.getApplicationId(), rmApp);
|
|
.put(id.getApplicationId(), rmApp);
|
|
|
|
|
|
@@ -275,9 +281,11 @@ public class FairSchedulerTestBase {
|
|
RMAppAttemptMetrics attemptMetric = mock(RMAppAttemptMetrics.class);
|
|
RMAppAttemptMetrics attemptMetric = mock(RMAppAttemptMetrics.class);
|
|
when(attempt.getRMAppAttemptMetrics()).thenReturn(attemptMetric);
|
|
when(attempt.getRMAppAttemptMetrics()).thenReturn(attemptMetric);
|
|
when(app.getCurrentAppAttempt()).thenReturn(attempt);
|
|
when(app.getCurrentAppAttempt()).thenReturn(attempt);
|
|
- ApplicationSubmissionContext submissionContext = mock(ApplicationSubmissionContext.class);
|
|
|
|
|
|
+ ApplicationSubmissionContext submissionContext =
|
|
|
|
+ mock(ApplicationSubmissionContext.class);
|
|
when(submissionContext.getUnmanagedAM()).thenReturn(false);
|
|
when(submissionContext.getUnmanagedAM()).thenReturn(false);
|
|
when(attempt.getSubmissionContext()).thenReturn(submissionContext);
|
|
when(attempt.getSubmissionContext()).thenReturn(submissionContext);
|
|
|
|
+ when(app.getApplicationSubmissionContext()).thenReturn(submissionContext);
|
|
resourceManager.getRMContext().getRMApps()
|
|
resourceManager.getRMContext().getRMApps()
|
|
.put(attemptId.getApplicationId(), app);
|
|
.put(attemptId.getApplicationId(), app);
|
|
return app;
|
|
return app;
|