Search in sources :

Example 11 with TaskLockConfig

use of org.apache.druid.indexing.overlord.config.TaskLockConfig in project druid by druid-io.

the class TaskQueueTest method testSetUseLineageBasedSegmentAllocationByDefault.

@Test
public void testSetUseLineageBasedSegmentAllocationByDefault() throws EntryExistsException {
    final TaskActionClientFactory actionClientFactory = createActionClientFactory();
    final TaskQueue taskQueue = new TaskQueue(new TaskLockConfig(), new TaskQueueConfig(null, null, null, null), new DefaultTaskConfig(), getTaskStorage(), new SimpleTaskRunner(actionClientFactory), actionClientFactory, getLockbox(), new NoopServiceEmitter());
    taskQueue.setActive(true);
    final Task task = new TestTask("t1", Intervals.of("2021-01-01/P1D"));
    taskQueue.add(task);
    final List<Task> tasks = taskQueue.getTasks();
    Assert.assertEquals(1, tasks.size());
    final Task queuedTask = tasks.get(0);
    Assert.assertTrue(queuedTask.getContextValue(SinglePhaseParallelIndexTaskRunner.CTX_USE_LINEAGE_BASED_SEGMENT_ALLOCATION_KEY));
}
Also used : Task(org.apache.druid.indexing.common.task.Task) AbstractBatchIndexTask(org.apache.druid.indexing.common.task.AbstractBatchIndexTask) TaskActionClientFactory(org.apache.druid.indexing.common.actions.TaskActionClientFactory) TaskQueueConfig(org.apache.druid.indexing.overlord.config.TaskQueueConfig) NoopServiceEmitter(org.apache.druid.server.metrics.NoopServiceEmitter) DefaultTaskConfig(org.apache.druid.indexing.overlord.config.DefaultTaskConfig) TaskLockConfig(org.apache.druid.indexing.overlord.config.TaskLockConfig) Test(org.junit.Test)

Aggregations

DefaultTaskConfig (org.apache.druid.indexing.overlord.config.DefaultTaskConfig)11 TaskLockConfig (org.apache.druid.indexing.overlord.config.TaskLockConfig)11 TaskQueueConfig (org.apache.druid.indexing.overlord.config.TaskQueueConfig)11 TaskActionClientFactory (org.apache.druid.indexing.common.actions.TaskActionClientFactory)10 NoopServiceEmitter (org.apache.druid.server.metrics.NoopServiceEmitter)10 Test (org.junit.Test)8 AbstractBatchIndexTask (org.apache.druid.indexing.common.task.AbstractBatchIndexTask)6 Task (org.apache.druid.indexing.common.task.Task)6 ImmutableMap (com.google.common.collect.ImmutableMap)2 Map (java.util.Map)2 TaskStatus (org.apache.druid.indexer.TaskStatus)2 ServiceEmitter (org.apache.druid.java.util.emitter.service.ServiceEmitter)2 CountDownLatch (java.util.concurrent.CountDownLatch)1 HttpServletRequest (javax.servlet.http.HttpServletRequest)1 NoopServiceAnnouncer (org.apache.druid.curator.discovery.NoopServiceAnnouncer)1 TaskLock (org.apache.druid.indexing.common.TaskLock)1 LocalTaskActionClientFactory (org.apache.druid.indexing.common.actions.LocalTaskActionClientFactory)1 TaskActionClient (org.apache.druid.indexing.common.actions.TaskActionClient)1 TaskStorageConfig (org.apache.druid.indexing.common.config.TaskStorageConfig)1 HeapMemoryTaskStorage (org.apache.druid.indexing.overlord.HeapMemoryTaskStorage)1