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);
}
}
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());
}
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());
}
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());
}
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);
}
}
Aggregations