use of org.apache.hadoop.hive.llap.daemon.impl.TaskExecutorTestHelpers.MockRequest in project hive by apache.
the class TestTaskExecutorService method testDontKillMultiple.
@Test(timeout = 10000)
public void testDontKillMultiple() throws InterruptedException {
MockRequest victim1 = createMockRequest(1, 1, 100, 100, false, 20000l, false);
MockRequest victim2 = createMockRequest(2, 1, 100, 100, false, 20000l, false);
runPreemptionGraceTest(victim1, victim2, 200);
// One and only one.
assertNotEquals(victim1.wasPreempted(), victim2.wasPreempted());
}
use of org.apache.hadoop.hive.llap.daemon.impl.TaskExecutorTestHelpers.MockRequest in project hive by apache.
the class TestTaskExecutorService method testDoKillMultiple.
@Test(timeout = 10000)
public void testDoKillMultiple() throws InterruptedException {
MockRequest victim1 = createMockRequest(1, 1, 100, 100, false, 20000l, false);
MockRequest victim2 = createMockRequest(2, 1, 100, 100, false, 20000l, false);
runPreemptionGraceTest(victim1, victim2, 1000);
assertTrue(victim1.wasPreempted());
assertTrue(victim2.wasPreempted());
}
use of org.apache.hadoop.hive.llap.daemon.impl.TaskExecutorTestHelpers.MockRequest in project hive by apache.
the class TestTaskExecutorService method testDuckPreemptsNonDuck.
// (timeout = 10000)
@Test
public void testDuckPreemptsNonDuck() throws InterruptedException {
MockRequest r1 = createMockRequest(1, 1, 100, 200, true, 5000l, false);
MockRequest r2 = createMockRequest(2, 1, 100, 200, false, 1000l, true);
testPreemptionHelper(r1, r2, true);
r1 = createMockRequest(1, 1, 100, 200, false, 5000l, false);
r2 = createMockRequest(2, 1, 100, 200, false, 1000l, true);
testPreemptionHelper(r1, r2, true);
}
use of org.apache.hadoop.hive.llap.daemon.impl.TaskExecutorTestHelpers.MockRequest in project hive by apache.
the class TestTaskExecutorService method testPreemptionStateOnTaskMoveToNonFinishableState.
@Test(timeout = 10000)
public void testPreemptionStateOnTaskMoveToNonFinishableState() throws InterruptedException {
MockRequest r1 = createMockRequest(1, 1, 100, 200, true, 20000l);
TaskExecutorServiceForTest taskExecutorService = new TaskExecutorServiceForTest(1, 2, ShortestJobFirstComparator.class.getName(), true);
taskExecutorService.init(new Configuration());
taskExecutorService.start();
try {
Scheduler.SubmissionState submissionState = taskExecutorService.schedule(r1);
assertEquals(Scheduler.SubmissionState.ACCEPTED, submissionState);
awaitStartAndSchedulerRun(r1, taskExecutorService);
TaskWrapper taskWrapper = taskExecutorService.preemptionQueue.peek();
assertNull(taskWrapper);
assertEquals(1, taskExecutorService.knownTasks.size());
taskWrapper = taskExecutorService.knownTasks.entrySet().iterator().next().getValue();
assertFalse(taskWrapper.isInPreemptionQueue());
// Now notify the executorService that the task has moved to finishable state.
taskWrapper.finishableStateUpdated(false);
TaskWrapper taskWrapper2 = taskExecutorService.preemptionQueue.peek();
assertNotNull(taskWrapper2);
assertTrue(taskWrapper2.isInPreemptionQueue());
assertEquals(taskWrapper, taskWrapper2);
r1.complete();
r1.awaitEnd();
} finally {
taskExecutorService.shutDown(false);
}
}
use of org.apache.hadoop.hive.llap.daemon.impl.TaskExecutorTestHelpers.MockRequest in project hive by apache.
the class TestTaskExecutorService method testFinishablePreeptsNonFinishable.
@Test(timeout = 10000)
public void testFinishablePreeptsNonFinishable() throws InterruptedException {
MockRequest r1 = createMockRequest(1, 1, 100, 200, false, 5000l);
MockRequest r2 = createMockRequest(2, 1, 100, 200, true, 1000l);
TaskExecutorServiceForTest taskExecutorService = new TaskExecutorServiceForTest(1, 2, ShortestJobFirstComparator.class.getName(), true);
taskExecutorService.init(new Configuration());
taskExecutorService.start();
try {
taskExecutorService.schedule(r1);
awaitStartAndSchedulerRun(r1, taskExecutorService);
taskExecutorService.schedule(r2);
awaitStartAndSchedulerRun(r2, taskExecutorService);
// Verify r1 was preempted. Also verify that it finished (single executor), otherwise
// r2 could have run anyway.
r1.awaitEnd();
assertTrue(r1.wasPreempted());
assertTrue(r1.hasFinished());
r2.complete();
r2.awaitEnd();
TaskExecutorServiceForTest.InternalCompletionListenerForTest icl1 = taskExecutorService.getInternalCompletionListenerForTest(r1.getRequestId());
TaskExecutorServiceForTest.InternalCompletionListenerForTest icl2 = taskExecutorService.getInternalCompletionListenerForTest(r2.getRequestId());
// Ensure Data structures are updated in the main TaskScheduler
icl1.awaitCompletion();
icl2.awaitCompletion();
assertEquals(0, taskExecutorService.knownTasks.size());
} finally {
taskExecutorService.shutDown(false);
}
}
Aggregations