Search in sources :

Example 16 with NoopTask

use of io.druid.indexing.common.task.NoopTask in project druid by druid-io.

the class FillCapacityWithAffinityWorkerSelectStrategyTest method testIsolation.

@Test
public void testIsolation() throws Exception {
    FillCapacityWorkerSelectStrategy strategy = new FillCapacityWithAffinityWorkerSelectStrategy(new FillCapacityWithAffinityConfig(ImmutableMap.of("foo", Arrays.asList("localhost"))));
    Optional<ImmutableWorkerInfo> optional = strategy.findWorkerForTask(new RemoteTaskRunnerConfig(), ImmutableMap.of("localhost", new ImmutableWorkerInfo(new Worker("localhost", "localhost", 1, "v1"), 0, Sets.<String>newHashSet(), Sets.<String>newHashSet(), DateTime.now())), new NoopTask(null, 1, 0, null, null, null));
    Assert.assertFalse(optional.isPresent());
}
Also used : Worker(io.druid.indexing.worker.Worker) NoopTask(io.druid.indexing.common.task.NoopTask) RemoteTaskRunnerConfig(io.druid.indexing.overlord.config.RemoteTaskRunnerConfig) ImmutableWorkerInfo(io.druid.indexing.overlord.ImmutableWorkerInfo) Test(org.junit.Test)

Example 17 with NoopTask

use of io.druid.indexing.common.task.NoopTask in project druid by druid-io.

the class FillCapacityWithAffinityWorkerSelectStrategyTest method testFindWorkerForTask.

@Test
public void testFindWorkerForTask() throws Exception {
    FillCapacityWorkerSelectStrategy strategy = new FillCapacityWithAffinityWorkerSelectStrategy(new FillCapacityWithAffinityConfig(ImmutableMap.of("foo", Arrays.asList("localhost"))));
    Optional<ImmutableWorkerInfo> optional = strategy.findWorkerForTask(new RemoteTaskRunnerConfig(), ImmutableMap.of("lhost", new ImmutableWorkerInfo(new Worker("lhost", "lhost", 1, "v1"), 0, Sets.<String>newHashSet(), Sets.<String>newHashSet(), DateTime.now()), "localhost", new ImmutableWorkerInfo(new Worker("localhost", "localhost", 1, "v1"), 0, Sets.<String>newHashSet(), Sets.<String>newHashSet(), DateTime.now())), new NoopTask(null, 1, 0, null, null, null) {

        @Override
        public String getDataSource() {
            return "foo";
        }
    });
    ImmutableWorkerInfo worker = optional.get();
    Assert.assertEquals("localhost", worker.getWorker().getHost());
}
Also used : Worker(io.druid.indexing.worker.Worker) NoopTask(io.druid.indexing.common.task.NoopTask) RemoteTaskRunnerConfig(io.druid.indexing.overlord.config.RemoteTaskRunnerConfig) ImmutableWorkerInfo(io.druid.indexing.overlord.ImmutableWorkerInfo) Test(org.junit.Test)

Example 18 with NoopTask

use of io.druid.indexing.common.task.NoopTask in project druid by druid-io.

the class FillCapacityWithAffinityWorkerSelectStrategyTest method testFindWorkerForTaskWithNulls.

@Test
public void testFindWorkerForTaskWithNulls() throws Exception {
    FillCapacityWorkerSelectStrategy strategy = new FillCapacityWithAffinityWorkerSelectStrategy(new FillCapacityWithAffinityConfig(ImmutableMap.of("foo", Arrays.asList("localhost"))));
    Optional<ImmutableWorkerInfo> optional = strategy.findWorkerForTask(new RemoteTaskRunnerConfig(), ImmutableMap.of("lhost", new ImmutableWorkerInfo(new Worker("lhost", "lhost", 1, "v1"), 0, Sets.<String>newHashSet(), Sets.<String>newHashSet(), DateTime.now()), "localhost", new ImmutableWorkerInfo(new Worker("localhost", "localhost", 1, "v1"), 0, Sets.<String>newHashSet(), Sets.<String>newHashSet(), DateTime.now())), new NoopTask(null, 1, 0, null, null, null));
    ImmutableWorkerInfo worker = optional.get();
    Assert.assertEquals("lhost", worker.getWorker().getHost());
}
Also used : Worker(io.druid.indexing.worker.Worker) NoopTask(io.druid.indexing.common.task.NoopTask) RemoteTaskRunnerConfig(io.druid.indexing.overlord.config.RemoteTaskRunnerConfig) ImmutableWorkerInfo(io.druid.indexing.overlord.ImmutableWorkerInfo) Test(org.junit.Test)

Example 19 with NoopTask

use of io.druid.indexing.common.task.NoopTask in project druid by druid-io.

the class SegmentAllocateActionTest method testCannotAddToExistingSingleDimensionShardSpecs.

@Test
public void testCannotAddToExistingSingleDimensionShardSpecs() throws Exception {
    final Task task = new NoopTask(null, 0, 0, null, null, null);
    taskActionTestKit.getMetadataStorageCoordinator().announceHistoricalSegments(ImmutableSet.of(DataSegment.builder().dataSource(DATA_SOURCE).interval(Granularities.HOUR.bucket(PARTY_TIME)).version(PARTY_TIME.toString()).shardSpec(new SingleDimensionShardSpec("foo", null, "bar", 0)).build(), DataSegment.builder().dataSource(DATA_SOURCE).interval(Granularities.HOUR.bucket(PARTY_TIME)).version(PARTY_TIME.toString()).shardSpec(new SingleDimensionShardSpec("foo", "bar", null, 1)).build()));
    taskActionTestKit.getTaskLockbox().add(task);
    final SegmentIdentifier id1 = allocate(task, PARTY_TIME, Granularities.NONE, Granularities.HOUR, "s1", null);
    Assert.assertNull(id1);
}
Also used : Task(io.druid.indexing.common.task.Task) NoopTask(io.druid.indexing.common.task.NoopTask) SegmentIdentifier(io.druid.segment.realtime.appenderator.SegmentIdentifier) NoopTask(io.druid.indexing.common.task.NoopTask) SingleDimensionShardSpec(io.druid.timeline.partition.SingleDimensionShardSpec) Test(org.junit.Test)

Example 20 with NoopTask

use of io.druid.indexing.common.task.NoopTask in project druid by druid-io.

the class SegmentAllocateActionTest method testCannotDoAnythingWithSillyQueryGranularity.

@Test
public void testCannotDoAnythingWithSillyQueryGranularity() throws Exception {
    final Task task = new NoopTask(null, 0, 0, null, null, null);
    taskActionTestKit.getTaskLockbox().add(task);
    final SegmentIdentifier id1 = allocate(task, PARTY_TIME, Granularities.DAY, Granularities.HOUR, "s1", null);
    Assert.assertNull(id1);
}
Also used : Task(io.druid.indexing.common.task.Task) NoopTask(io.druid.indexing.common.task.NoopTask) SegmentIdentifier(io.druid.segment.realtime.appenderator.SegmentIdentifier) NoopTask(io.druid.indexing.common.task.NoopTask) Test(org.junit.Test)

Aggregations

NoopTask (io.druid.indexing.common.task.NoopTask)25 Test (org.junit.Test)24 Task (io.druid.indexing.common.task.Task)17 SegmentIdentifier (io.druid.segment.realtime.appenderator.SegmentIdentifier)10 NumberedShardSpec (io.druid.timeline.partition.NumberedShardSpec)7 ImmutableWorkerInfo (io.druid.indexing.overlord.ImmutableWorkerInfo)6 RemoteTaskRunnerConfig (io.druid.indexing.overlord.config.RemoteTaskRunnerConfig)6 Worker (io.druid.indexing.worker.Worker)6 Interval (org.joda.time.Interval)5 Predicate (com.google.common.base.Predicate)3 TaskLock (io.druid.indexing.common.TaskLock)3 SegmentPublishResult (io.druid.indexing.overlord.SegmentPublishResult)3 DataSegment (io.druid.timeline.DataSegment)3 Request (com.metamx.http.client.Request)2 StatusResponseHandler (com.metamx.http.client.response.StatusResponseHandler)2 StatusResponseHolder (com.metamx.http.client.response.StatusResponseHolder)2 RetryPolicyFactory (io.druid.indexing.common.RetryPolicyFactory)2 ObjectMetadata (io.druid.indexing.overlord.ObjectMetadata)2 IOException (java.io.IOException)2 HashMap (java.util.HashMap)2