Search in sources :

Example 6 with TaskActionClient

use of org.apache.druid.indexing.common.actions.TaskActionClient in project druid by druid-io.

the class HashPartitionCachingLocalSegmentAllocatorTest method createTaskActionClient.

private static TaskActionClient createTaskActionClient() {
    List<TaskLock> taskLocks = Collections.singletonList(createTaskLock());
    try {
        TaskActionClient taskActionClient = EasyMock.mock(TaskActionClient.class);
        EasyMock.expect(taskActionClient.submit(EasyMock.anyObject(LockListAction.class))).andStubReturn(taskLocks);
        EasyMock.replay(taskActionClient);
        return taskActionClient;
    } catch (IOException e) {
        throw new UncheckedIOException(e);
    }
}
Also used : LockListAction(org.apache.druid.indexing.common.actions.LockListAction) TaskLock(org.apache.druid.indexing.common.TaskLock) TaskActionClient(org.apache.druid.indexing.common.actions.TaskActionClient) UncheckedIOException(java.io.UncheckedIOException) IOException(java.io.IOException) UncheckedIOException(java.io.UncheckedIOException)

Example 7 with TaskActionClient

use of org.apache.druid.indexing.common.actions.TaskActionClient in project druid by druid-io.

the class HashPartitionTaskKillTest method failsInSecondPhase.

@Test(timeout = 5000L)
public void failsInSecondPhase() throws Exception {
    final ParallelIndexSupervisorTask task = createTestTask(TIMESTAMP_SPEC, DIMENSIONS_SPEC, INPUT_FORMAT, null, INTERVAL_TO_INDEX, inputDir, "test_*", new HashedPartitionsSpec(null, 3, ImmutableList.of("dim1", "dim2")), 2, false, true, 0);
    final TaskActionClient actionClient = createActionClient(task);
    final TaskToolbox toolbox = createTaskToolbox(task, actionClient);
    prepareTaskForLocking(task);
    Assert.assertTrue(task.isReady(actionClient));
    task.stopGracefully(null);
    TaskStatus taskStatus = task.runHashPartitionMultiPhaseParallel(toolbox);
    Assert.assertTrue(taskStatus.isFailure());
    Assert.assertEquals("Failed in phase[PHASE-2]. See task logs for details.", taskStatus.getErrorMsg());
}
Also used : TaskToolbox(org.apache.druid.indexing.common.TaskToolbox) HashedPartitionsSpec(org.apache.druid.indexer.partitions.HashedPartitionsSpec) TaskActionClient(org.apache.druid.indexing.common.actions.TaskActionClient) TaskStatus(org.apache.druid.indexer.TaskStatus) Test(org.junit.Test)

Example 8 with TaskActionClient

use of org.apache.druid.indexing.common.actions.TaskActionClient in project druid by druid-io.

the class ParallelIndexPhaseRunnerTest method testSmallEstimatedNumSplits.

@Test
public void testSmallEstimatedNumSplits() throws Exception {
    final NoopTask task = NoopTask.create();
    final TaskActionClient actionClient = createActionClient(task);
    final TaskToolbox toolbox = createTaskToolbox(task, actionClient);
    final TestPhaseRunner runner = new TestPhaseRunner(toolbox, "supervisorTaskId", "groupId", AbstractParallelIndexSupervisorTaskTest.DEFAULT_TUNING_CONFIG_FOR_PARALLEL_INDEXING, 10, 8);
    Assert.assertEquals(TaskState.SUCCESS, runner.run());
}
Also used : TaskToolbox(org.apache.druid.indexing.common.TaskToolbox) TaskActionClient(org.apache.druid.indexing.common.actions.TaskActionClient) NoopTask(org.apache.druid.indexing.common.task.NoopTask) Test(org.junit.Test)

Example 9 with TaskActionClient

use of org.apache.druid.indexing.common.actions.TaskActionClient in project druid by druid-io.

the class ParallelIndexSupervisorTaskKillTest method testSubTaskFail.

@Test(timeout = 5000L)
public void testSubTaskFail() throws Exception {
    final ParallelIndexSupervisorTask task = newTask(Intervals.of("2017/2018"), new ParallelIndexIOConfig(null, new TestInputSource(Pair.of(new TestInput(10L, TaskState.FAILED), 1), Pair.of(new TestInput(Integer.MAX_VALUE, TaskState.FAILED), 3)), new NoopInputFormat(), false, null));
    final TaskActionClient actionClient = createActionClient(task);
    final TaskToolbox toolbox = createTaskToolbox(task, actionClient);
    prepareTaskForLocking(task);
    Assert.assertTrue(task.isReady(actionClient));
    final TaskStatus taskStatus = task.run(toolbox);
    Assert.assertEquals("Failed in phase[segment generation]. See task logs for details.", taskStatus.getErrorMsg());
    Assert.assertEquals(TaskState.FAILED, taskStatus.getStatusCode());
    final SinglePhaseParallelIndexTaskRunner runner = (SinglePhaseParallelIndexTaskRunner) task.getCurrentRunner();
    Assert.assertTrue(runner.getRunningTaskIds().isEmpty());
    final List<SubTaskSpec<SinglePhaseSubTask>> completeSubTaskSpecs = runner.getCompleteSubTaskSpecs();
    Assert.assertEquals(1, completeSubTaskSpecs.size());
    final TaskHistory<SinglePhaseSubTask> history = runner.getCompleteSubTaskSpecAttemptHistory(completeSubTaskSpecs.get(0).getId());
    Assert.assertNotNull(history);
    Assert.assertEquals(3, history.getAttemptHistory().size());
    for (TaskStatusPlus status : history.getAttemptHistory()) {
        Assert.assertEquals(TaskState.FAILED, status.getStatusCode());
    }
    Assert.assertEquals(3, runner.getTaskMonitor().getNumCanceledTasks());
}
Also used : TaskStatus(org.apache.druid.indexer.TaskStatus) TaskToolbox(org.apache.druid.indexing.common.TaskToolbox) TaskActionClient(org.apache.druid.indexing.common.actions.TaskActionClient) TaskStatusPlus(org.apache.druid.indexer.TaskStatusPlus) NoopInputFormat(org.apache.druid.data.input.impl.NoopInputFormat) Test(org.junit.Test)

Example 10 with TaskActionClient

use of org.apache.druid.indexing.common.actions.TaskActionClient in project druid by druid-io.

the class RangePartitionCachingLocalSegmentAllocatorTest method createTaskActionClient.

private static TaskActionClient createTaskActionClient(List<TaskLock> taskLocks) {
    try {
        TaskActionClient taskActionClient = EasyMock.mock(TaskActionClient.class);
        EasyMock.expect(taskActionClient.submit(EasyMock.anyObject(LockListAction.class))).andStubReturn(taskLocks);
        EasyMock.replay(taskActionClient);
        return taskActionClient;
    } catch (IOException e) {
        throw new UncheckedIOException(e);
    }
}
Also used : LockListAction(org.apache.druid.indexing.common.actions.LockListAction) TaskActionClient(org.apache.druid.indexing.common.actions.TaskActionClient) UncheckedIOException(java.io.UncheckedIOException) IOException(java.io.IOException) UncheckedIOException(java.io.UncheckedIOException)

Aggregations

TaskActionClient (org.apache.druid.indexing.common.actions.TaskActionClient)20 Test (org.junit.Test)14 TaskToolbox (org.apache.druid.indexing.common.TaskToolbox)13 TaskStatus (org.apache.druid.indexer.TaskStatus)10 TaskConfig (org.apache.druid.indexing.common.config.TaskConfig)5 IOException (java.io.IOException)4 DataSegment (org.apache.druid.timeline.DataSegment)4 List (java.util.List)3 SingleDimensionPartitionsSpec (org.apache.druid.indexer.partitions.SingleDimensionPartitionsSpec)3 Preconditions (com.google.common.base.Preconditions)2 ImmutableList (com.google.common.collect.ImmutableList)2 UncheckedIOException (java.io.UncheckedIOException)2 ArrayList (java.util.ArrayList)2 Collections (java.util.Collections)2 HashSet (java.util.HashSet)2 Map (java.util.Map)2 Set (java.util.Set)2 Collectors (java.util.stream.Collectors)2 Nullable (javax.annotation.Nullable)2 NoopIndexingServiceClient (org.apache.druid.client.indexing.NoopIndexingServiceClient)2