Search in sources :

Example 11 with TaskToolbox

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

the class RangePartitionTaskKillTest method failsThirdPhase.

@Test(timeout = 5000L)
public void failsThirdPhase() throws Exception {
    int targetRowsPerSegment = NUM_ROW * 2 / DIM_FILE_CARDINALITY / NUM_PARTITION;
    final ParallelIndexSupervisorTask task = newTask(TIMESTAMP_SPEC, DIMENSIONS_SPEC, INPUT_FORMAT, null, INTERVAL_TO_INDEX, inputDir, TEST_FILE_NAME_PREFIX + "*", new SingleDimensionPartitionsSpec(targetRowsPerSegment, null, DIM1, false), 2, false, 2);
    final TaskActionClient actionClient = createActionClient(task);
    final TaskToolbox toolbox = createTaskToolbox(task, actionClient);
    prepareTaskForLocking(task);
    Assert.assertTrue(task.isReady(actionClient));
    task.stopGracefully(null);
    TaskStatus taskStatus = task.runRangePartitionMultiPhaseParallel(toolbox);
    Assert.assertTrue(taskStatus.isFailure());
    Assert.assertEquals("Failed in phase[PHASE-3]. See task logs for details.", taskStatus.getErrorMsg());
}
Also used : TaskToolbox(org.apache.druid.indexing.common.TaskToolbox) TaskActionClient(org.apache.druid.indexing.common.actions.TaskActionClient) SingleDimensionPartitionsSpec(org.apache.druid.indexer.partitions.SingleDimensionPartitionsSpec) TaskStatus(org.apache.druid.indexer.TaskStatus) Test(org.junit.Test)

Example 12 with TaskToolbox

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

the class RangePartitionTaskKillTest method failsSecondPhase.

@Test(timeout = 5000L)
public void failsSecondPhase() throws Exception {
    int targetRowsPerSegment = NUM_ROW * 2 / DIM_FILE_CARDINALITY / NUM_PARTITION;
    final ParallelIndexSupervisorTask task = newTask(TIMESTAMP_SPEC, DIMENSIONS_SPEC, INPUT_FORMAT, null, INTERVAL_TO_INDEX, inputDir, TEST_FILE_NAME_PREFIX + "*", new SingleDimensionPartitionsSpec(targetRowsPerSegment, null, DIM1, false), 2, false, 1);
    final TaskActionClient actionClient = createActionClient(task);
    final TaskToolbox toolbox = createTaskToolbox(task, actionClient);
    prepareTaskForLocking(task);
    Assert.assertTrue(task.isReady(actionClient));
    task.stopGracefully(null);
    TaskStatus taskStatus = task.runRangePartitionMultiPhaseParallel(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) TaskActionClient(org.apache.druid.indexing.common.actions.TaskActionClient) SingleDimensionPartitionsSpec(org.apache.druid.indexer.partitions.SingleDimensionPartitionsSpec) TaskStatus(org.apache.druid.indexer.TaskStatus) Test(org.junit.Test)

Example 13 with TaskToolbox

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

the class HashPartitionCachingLocalSegmentAllocatorTest method setup.

@Before
public void setup() throws IOException {
    TaskToolbox toolbox = createToolbox();
    HashPartitionAnalysis partitionAnalysis = new HashPartitionAnalysis(PARTITIONS_SPEC);
    partitionAnalysis.updateBucket(INTERVAL, NUM_PARTITONS);
    target = SegmentAllocators.forNonLinearPartitioning(toolbox, DATASOURCE, TASKID, new UniformGranularitySpec(Granularities.HOUR, Granularities.NONE, ImmutableList.of()), new SupervisorTaskAccessWithNullClient(SUPERVISOR_TASKID), partitionAnalysis);
    sequenceNameFunction = ((CachingLocalSegmentAllocator) target).getSequenceNameFunction();
}
Also used : TaskToolbox(org.apache.druid.indexing.common.TaskToolbox) HashPartitionAnalysis(org.apache.druid.indexing.common.task.batch.partition.HashPartitionAnalysis) UniformGranularitySpec(org.apache.druid.segment.indexing.granularity.UniformGranularitySpec) SupervisorTaskAccessWithNullClient(org.apache.druid.indexing.common.task.SupervisorTaskAccessWithNullClient) Before(org.junit.Before)

Example 14 with TaskToolbox

use of org.apache.druid.indexing.common.TaskToolbox 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 15 with TaskToolbox

use of org.apache.druid.indexing.common.TaskToolbox 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)

Aggregations

TaskToolbox (org.apache.druid.indexing.common.TaskToolbox)51 TaskStatus (org.apache.druid.indexer.TaskStatus)34 Test (org.junit.Test)31 DataSegment (org.apache.druid.timeline.DataSegment)23 TaskActionClient (org.apache.druid.indexing.common.actions.TaskActionClient)20 ISE (org.apache.druid.java.util.common.ISE)18 File (java.io.File)16 ArrayList (java.util.ArrayList)14 Map (java.util.Map)14 InitializedNullHandlingTest (org.apache.druid.testing.InitializedNullHandlingTest)13 List (java.util.List)12 IOException (java.io.IOException)11 Preconditions (com.google.common.base.Preconditions)10 Collections (java.util.Collections)10 Pair (org.apache.druid.java.util.common.Pair)10 Interval (org.joda.time.Interval)10 ImmutableMap (com.google.common.collect.ImmutableMap)9 HashMap (java.util.HashMap)9 Set (java.util.Set)9 Nullable (javax.annotation.Nullable)9