Search in sources :

Example 11 with EvictingPriorityBlockingQueue

use of org.apache.hadoop.hive.llap.daemon.impl.EvictingPriorityBlockingQueue in project hive by apache.

the class TestShortestJobFirstComparator method testWaitQueueComparatorCanFinish.

@Test(timeout = 60000)
public void testWaitQueueComparatorCanFinish() throws InterruptedException {
    // Test that only the fixed property (...ForQueue) is used in order determination, not the dynamic call.
    TaskWrapper r1 = createTaskWrapper(createSubmitWorkRequestProto(1, 1, 0, 10, 100, 2), true, false, 100000);
    TaskWrapper r2 = createTaskWrapper(createSubmitWorkRequestProto(2, 1, 0, 10, 100, 1), false, true, 100000);
    TaskWrapper r3 = createTaskWrapper(createSubmitWorkRequestProto(3, 1, 0, 10, 100, 5), true, true, 100000);
    EvictingPriorityBlockingQueue<TaskWrapper> queue = new EvictingPriorityBlockingQueue<>(new ShortestJobFirstComparator(), 4);
    assertNull(queue.offer(r1, 0));
    assertNull(queue.offer(r2, 0));
    assertNull(queue.offer(r3, 0));
    assertEquals(r2, queue.take());
    assertEquals(r3, queue.take());
    assertEquals(r1, queue.take());
}
Also used : TaskExecutorTestHelpers.createTaskWrapper(org.apache.hadoop.hive.llap.daemon.impl.TaskExecutorTestHelpers.createTaskWrapper) TaskWrapper(org.apache.hadoop.hive.llap.daemon.impl.TaskExecutorService.TaskWrapper) EvictingPriorityBlockingQueue(org.apache.hadoop.hive.llap.daemon.impl.EvictingPriorityBlockingQueue) Test(org.junit.Test)

Aggregations

EvictingPriorityBlockingQueue (org.apache.hadoop.hive.llap.daemon.impl.EvictingPriorityBlockingQueue)11 TaskWrapper (org.apache.hadoop.hive.llap.daemon.impl.TaskExecutorService.TaskWrapper)11 TaskExecutorTestHelpers.createTaskWrapper (org.apache.hadoop.hive.llap.daemon.impl.TaskExecutorTestHelpers.createTaskWrapper)11 Test (org.junit.Test)11