use of org.apache.druid.indexing.overlord.config.RemoteTaskRunnerConfig in project druid by druid-io.
the class EqualDistributionWorkerSelectStrategyTest method testWeakAffinity.
@Test
public void testWeakAffinity() {
EqualDistributionWorkerSelectStrategy strategy = new EqualDistributionWorkerSelectStrategy(new AffinityConfig(ImmutableMap.of("foo", ImmutableSet.of("localhost1", "localhost2", "localhost3"), "bar", ImmutableSet.of("nonexistent-worker")), false));
ImmutableWorkerInfo workerFoo = strategy.findWorkerForTask(new RemoteTaskRunnerConfig(), WORKERS_FOR_AFFINITY_TESTS, createDummyTask("foo"));
Assert.assertEquals("localhost1", workerFoo.getWorker().getHost());
// With weak affinity, bar (which has no affinity workers available) can use a non-affinity worker.
ImmutableWorkerInfo workerBar = strategy.findWorkerForTask(new RemoteTaskRunnerConfig(), WORKERS_FOR_AFFINITY_TESTS, createDummyTask("bar"));
Assert.assertEquals("localhost0", workerBar.getWorker().getHost());
ImmutableWorkerInfo workerBaz = strategy.findWorkerForTask(new RemoteTaskRunnerConfig(), WORKERS_FOR_AFFINITY_TESTS, createDummyTask("baz"));
Assert.assertEquals("localhost0", workerBaz.getWorker().getHost());
}
use of org.apache.druid.indexing.overlord.config.RemoteTaskRunnerConfig in project druid by druid-io.
the class FillCapacityWithCategorySpecWorkerSelectStrategyTest method selectWorker.
private ImmutableWorkerInfo selectWorker(WorkerCategorySpec workerCategorySpec) {
final FillCapacityWithCategorySpecWorkerSelectStrategy strategy = new FillCapacityWithCategorySpecWorkerSelectStrategy(workerCategorySpec);
ImmutableWorkerInfo worker = strategy.findWorkerForTask(new RemoteTaskRunnerConfig(), WORKERS_FOR_TIER_TESTS, new NoopTask(null, null, "ds1", 1, 0, null, null, null));
return worker;
}
Aggregations