Search in sources :

Example 1 with EmbedVersion

use of com.facebook.presto.version.EmbedVersion in project presto by prestodb.

the class TestTaskExecutor method testTaskExecutorRunawaySplitInterrupt.

@Test
public void testTaskExecutorRunawaySplitInterrupt() throws Exception {
    TaskExecutor taskExecutor = new TaskExecutor(8, 16, 3, 4, TASK_FAIR, new Duration(1, SECONDS), elements -> elements.stream().anyMatch(element -> element.getFileName().equals("TestTaskExecutor.java")), new Duration(1, SECONDS), new EmbedVersion(new ServerConfig()), new MultilevelSplitQueue(2), Ticker.systemTicker());
    taskExecutor.start();
    try {
        TaskId taskId = new TaskId("foo", 0, 0, 0);
        TaskHandle taskHandle = taskExecutor.addTask(taskId, () -> 1.0, 1, new Duration(1, TimeUnit.SECONDS), OptionalInt.of(1));
        MockSplitRunner mockSplitRunner = new MockSplitRunner();
        taskExecutor.enqueueSplits(taskHandle, false, ImmutableList.of(mockSplitRunner));
        mockSplitRunner.interrupted.get(60, TimeUnit.SECONDS);
    } finally {
        taskExecutor.stop();
    }
}
Also used : TestingTicker(com.facebook.airlift.testing.TestingTicker) QUERY_FAIR(com.facebook.presto.execution.TaskManagerConfig.TaskPriorityTracking.QUERY_FAIR) Arrays(java.util.Arrays) LEVEL_THRESHOLD_SECONDS(com.facebook.presto.execution.executor.MultilevelSplitQueue.LEVEL_THRESHOLD_SECONDS) ListenableFuture(com.google.common.util.concurrent.ListenableFuture) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) LEVEL_CONTRIBUTION_CAP(com.facebook.presto.execution.executor.MultilevelSplitQueue.LEVEL_CONTRIBUTION_CAP) Assert.assertEquals(org.testng.Assert.assertEquals) Test(org.testng.annotations.Test) MINUTES(java.util.concurrent.TimeUnit.MINUTES) SplitRunner(com.facebook.presto.execution.SplitRunner) SettableFuture(com.google.common.util.concurrent.SettableFuture) OptionalInt(java.util.OptionalInt) TASK_FAIR(com.facebook.presto.execution.TaskManagerConfig.TaskPriorityTracking.TASK_FAIR) Duration(io.airlift.units.Duration) Assertions.assertLessThan(com.facebook.airlift.testing.Assertions.assertLessThan) Future(java.util.concurrent.Future) ImmutableList(com.google.common.collect.ImmutableList) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Assert.assertFalse(org.testng.Assert.assertFalse) ServerConfig(com.facebook.presto.server.ServerConfig) EmbedVersion(com.facebook.presto.version.EmbedVersion) Iterables.getOnlyElement(com.google.common.collect.Iterables.getOnlyElement) MILLISECONDS(java.util.concurrent.TimeUnit.MILLISECONDS) Ticker(com.google.common.base.Ticker) TimeUnit(java.util.concurrent.TimeUnit) Futures(com.google.common.util.concurrent.Futures) List(java.util.List) TaskId(com.facebook.presto.execution.TaskId) Phaser(java.util.concurrent.Phaser) Assertions.assertGreaterThan(com.facebook.airlift.testing.Assertions.assertGreaterThan) Assert.assertTrue(org.testng.Assert.assertTrue) SECONDS(java.util.concurrent.TimeUnit.SECONDS) ServerConfig(com.facebook.presto.server.ServerConfig) TaskId(com.facebook.presto.execution.TaskId) Duration(io.airlift.units.Duration) EmbedVersion(com.facebook.presto.version.EmbedVersion) Test(org.testng.annotations.Test)

Aggregations

Assertions.assertGreaterThan (com.facebook.airlift.testing.Assertions.assertGreaterThan)1 Assertions.assertLessThan (com.facebook.airlift.testing.Assertions.assertLessThan)1 TestingTicker (com.facebook.airlift.testing.TestingTicker)1 SplitRunner (com.facebook.presto.execution.SplitRunner)1 TaskId (com.facebook.presto.execution.TaskId)1 QUERY_FAIR (com.facebook.presto.execution.TaskManagerConfig.TaskPriorityTracking.QUERY_FAIR)1 TASK_FAIR (com.facebook.presto.execution.TaskManagerConfig.TaskPriorityTracking.TASK_FAIR)1 LEVEL_CONTRIBUTION_CAP (com.facebook.presto.execution.executor.MultilevelSplitQueue.LEVEL_CONTRIBUTION_CAP)1 LEVEL_THRESHOLD_SECONDS (com.facebook.presto.execution.executor.MultilevelSplitQueue.LEVEL_THRESHOLD_SECONDS)1 ServerConfig (com.facebook.presto.server.ServerConfig)1 EmbedVersion (com.facebook.presto.version.EmbedVersion)1 Ticker (com.google.common.base.Ticker)1 ImmutableList (com.google.common.collect.ImmutableList)1 Iterables.getOnlyElement (com.google.common.collect.Iterables.getOnlyElement)1 Futures (com.google.common.util.concurrent.Futures)1 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)1 SettableFuture (com.google.common.util.concurrent.SettableFuture)1 Duration (io.airlift.units.Duration)1 Arrays (java.util.Arrays)1 List (java.util.List)1