MAPREDUCE-7151. RMContainerAllocator#handleJobPriorityChange expects application_priority always. Contributed by Bilwa S T.
(cherry picked from commit 74a5e683fe
)
This commit is contained in:
parent
b6937e8e70
commit
aed71316e5
|
@ -1020,13 +1020,15 @@ public class RMContainerAllocator extends RMContainerRequestor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleJobPriorityChange(AllocateResponse response) {
|
void handleJobPriorityChange(AllocateResponse response) {
|
||||||
Priority priorityFromResponse = Priority.newInstance(response
|
Priority applicationPriority = response.getApplicationPriority();
|
||||||
.getApplicationPriority().getPriority());
|
if (null != applicationPriority) {
|
||||||
|
Priority priorityFromResponse = Priority
|
||||||
|
.newInstance(applicationPriority.getPriority());
|
||||||
// Update the job priority to Job directly.
|
// Update the job priority to Job directly.
|
||||||
getJob().setJobPriority(priorityFromResponse);
|
getJob().setJobPriority(priorityFromResponse);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Private
|
@Private
|
||||||
public Resource getResourceLimit() {
|
public Resource getResourceLimit() {
|
||||||
|
|
|
@ -2160,6 +2160,20 @@ public class TestRMContainerAllocator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testIfApplicationPriorityIsNotSet() {
|
||||||
|
Job mockJob = mock(Job.class);
|
||||||
|
RMCommunicator communicator = mock(RMCommunicator.class);
|
||||||
|
ClientService service = mock(ClientService.class);
|
||||||
|
AppContext context = mock(AppContext.class);
|
||||||
|
AMPreemptionPolicy policy = mock(AMPreemptionPolicy.class);
|
||||||
|
when(communicator.getJob()).thenReturn(mockJob);
|
||||||
|
RMContainerAllocator allocator = new RMContainerAllocator(service, context,
|
||||||
|
policy);
|
||||||
|
AllocateResponse response = Records.newRecord(AllocateResponse.class);
|
||||||
|
allocator.handleJobPriorityChange(response);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testReduceScheduling() throws Exception {
|
public void testReduceScheduling() throws Exception {
|
||||||
int totalMaps = 10;
|
int totalMaps = 10;
|
||||||
|
|
Loading…
Reference in New Issue