Search in sources :

Example 21 with ImmutableWorkerInfo

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

the class FillCapacityWithCategorySpecWorkerSelectStrategyTest method testFindWorkerForTaskWithNullPreferredTier.

@Test
public void testFindWorkerForTaskWithNullPreferredTier() {
    final WorkerCategorySpec workerCategorySpec = new WorkerCategorySpec(ImmutableMap.of("noop", new WorkerCategorySpec.CategoryConfig(null, null)), false);
    ImmutableWorkerInfo worker = selectWorker(workerCategorySpec);
    Assert.assertEquals("localhost3", worker.getWorker().getHost());
}
Also used : ImmutableWorkerInfo(org.apache.druid.indexing.overlord.ImmutableWorkerInfo) Test(org.junit.Test)

Example 22 with ImmutableWorkerInfo

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

the class PendingTaskBasedProvisioningStrategyTest method testGetExpectedWorkerCapacityWithSingleWorker.

@Test
public void testGetExpectedWorkerCapacityWithSingleWorker() {
    int workerCapacity = 3;
    Collection<ImmutableWorkerInfo> workerInfoCollection = ImmutableList.of(new ImmutableWorkerInfo(new Worker("http", "localhost0", "localhost0", workerCapacity, "v1", WorkerConfig.DEFAULT_CATEGORY), 0, new HashSet<>(), new HashSet<>(), DateTimes.nowUtc()));
    int expectedWorkerCapacity = strategy.getExpectedWorkerCapacity(workerInfoCollection);
    Assert.assertEquals(workerCapacity, expectedWorkerCapacity);
}
Also used : Worker(org.apache.druid.indexing.worker.Worker) ZkWorker(org.apache.druid.indexing.overlord.ZkWorker) ImmutableWorkerInfo(org.apache.druid.indexing.overlord.ImmutableWorkerInfo) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 23 with ImmutableWorkerInfo

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

the class EqualDistributionWithCategorySpecWorkerSelectStrategyTest method testFindWorkerForTaskWithNullWorkerTierSpec.

@Test
public void testFindWorkerForTaskWithNullWorkerTierSpec() {
    ImmutableWorkerInfo worker = selectWorker(null);
    Assert.assertEquals("localhost3", worker.getWorker().getHost());
}
Also used : ImmutableWorkerInfo(org.apache.druid.indexing.overlord.ImmutableWorkerInfo) Test(org.junit.Test)

Example 24 with ImmutableWorkerInfo

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

the class EqualDistributionWithCategorySpecWorkerSelectStrategyTest method testFindWorkerForTaskWithPreferredTier.

@Test
public void testFindWorkerForTaskWithPreferredTier() {
    // test defaultTier != null and tierAffinity is not empty
    final WorkerCategorySpec workerCategorySpec1 = new WorkerCategorySpec(ImmutableMap.of("noop", new WorkerCategorySpec.CategoryConfig("c2", ImmutableMap.of("ds1", "c2"))), false);
    ImmutableWorkerInfo worker1 = selectWorker(workerCategorySpec1);
    Assert.assertEquals("localhost3", worker1.getWorker().getHost());
    // test defaultTier == null and tierAffinity is not empty
    final WorkerCategorySpec workerCategorySpec2 = new WorkerCategorySpec(ImmutableMap.of("noop", new WorkerCategorySpec.CategoryConfig(null, ImmutableMap.of("ds1", "c2"))), false);
    ImmutableWorkerInfo worker2 = selectWorker(workerCategorySpec2);
    Assert.assertEquals("localhost3", worker2.getWorker().getHost());
    // test defaultTier != null and tierAffinity is empty
    final WorkerCategorySpec workerCategorySpec3 = new WorkerCategorySpec(ImmutableMap.of("noop", new WorkerCategorySpec.CategoryConfig("c2", null)), false);
    ImmutableWorkerInfo worker3 = selectWorker(workerCategorySpec3);
    Assert.assertEquals("localhost3", worker3.getWorker().getHost());
}
Also used : ImmutableWorkerInfo(org.apache.druid.indexing.overlord.ImmutableWorkerInfo) Test(org.junit.Test)

Example 25 with ImmutableWorkerInfo

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

the class EqualDistributionWithCategorySpecWorkerSelectStrategyTest method testFindWorkerForTaskWithNullPreferredTier.

@Test
public void testFindWorkerForTaskWithNullPreferredTier() {
    final WorkerCategorySpec workerCategorySpec = new WorkerCategorySpec(ImmutableMap.of("noop", new WorkerCategorySpec.CategoryConfig(null, null)), false);
    ImmutableWorkerInfo worker = selectWorker(workerCategorySpec);
    Assert.assertEquals("localhost3", worker.getWorker().getHost());
}
Also used : ImmutableWorkerInfo(org.apache.druid.indexing.overlord.ImmutableWorkerInfo) Test(org.junit.Test)

Aggregations

ImmutableWorkerInfo (org.apache.druid.indexing.overlord.ImmutableWorkerInfo)42 Test (org.junit.Test)31 RemoteTaskRunnerConfig (org.apache.druid.indexing.overlord.config.RemoteTaskRunnerConfig)14 Worker (org.apache.druid.indexing.worker.Worker)14 NoopTask (org.apache.druid.indexing.common.task.NoopTask)12 TestRemoteTaskRunnerConfig (org.apache.druid.indexing.overlord.TestRemoteTaskRunnerConfig)5 Period (org.joda.time.Period)5 HashMap (java.util.HashMap)4 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)4 WorkerTaskRunner (org.apache.druid.indexing.overlord.WorkerTaskRunner)3 DefaultWorkerBehaviorConfig (org.apache.druid.indexing.overlord.setup.DefaultWorkerBehaviorConfig)3 WorkerBehaviorConfig (org.apache.druid.indexing.overlord.setup.WorkerBehaviorConfig)3 HashSet (java.util.HashSet)2 AtomicReference (java.util.concurrent.atomic.AtomicReference)2 Nullable (javax.annotation.Nullable)2 Response (javax.ws.rs.core.Response)2 ZkWorker (org.apache.druid.indexing.overlord.ZkWorker)2 AutoScaler (org.apache.druid.indexing.overlord.autoscaling.AutoScaler)2 ResourceFilters (com.sun.jersey.spi.container.ResourceFilters)1 GET (javax.ws.rs.GET)1