use of org.apache.druid.indexing.overlord.TestRemoteTaskRunnerConfig in project druid by druid-io.
the class JavaScriptWorkerSelectStrategyTest method testNoValidWorker.
@Test
public void testNoValidWorker() {
ImmutableMap<String, ImmutableWorkerInfo> workerMap = ImmutableMap.of("10.0.0.1", createMockWorker(1, true, false), "10.0.0.4", createMockWorker(1, true, false));
ImmutableWorkerInfo workerForBatchTask = STRATEGY.findWorkerForTask(new TestRemoteTaskRunnerConfig(new Period("PT1S")), workerMap, createMockTask("index_hadoop"));
Assert.assertNull(workerForBatchTask);
ImmutableWorkerInfo workerForOtherTask = STRATEGY.findWorkerForTask(new TestRemoteTaskRunnerConfig(new Period("PT1S")), workerMap, createMockTask("otherTask"));
// all other tasks should be sent to worker2
Assert.assertNull(workerForOtherTask);
}
use of org.apache.druid.indexing.overlord.TestRemoteTaskRunnerConfig in project druid by druid-io.
the class JavaScriptWorkerSelectStrategyTest method testIsolationOfBatchWorker.
@Test
public void testIsolationOfBatchWorker() {
ImmutableMap<String, ImmutableWorkerInfo> workerMap = ImmutableMap.of("10.0.0.1", createMockWorker(1, true, true), "10.0.0.2", createMockWorker(1, true, true));
ImmutableWorkerInfo workerForOtherTask = STRATEGY.findWorkerForTask(new TestRemoteTaskRunnerConfig(new Period("PT1S")), workerMap, createMockTask("other_type"));
Assert.assertNull(workerForOtherTask);
}
use of org.apache.druid.indexing.overlord.TestRemoteTaskRunnerConfig in project druid by druid-io.
the class JavaScriptWorkerSelectStrategyTest method testFindWorkerForTask.
@Test
public void testFindWorkerForTask() {
ImmutableWorkerInfo worker1 = createMockWorker(1, true, true);
ImmutableWorkerInfo worker2 = createMockWorker(1, true, true);
ImmutableMap<String, ImmutableWorkerInfo> workerMap = ImmutableMap.of("10.0.0.1", worker1, "10.0.0.3", worker2);
ImmutableWorkerInfo workerForBatchTask = STRATEGY.findWorkerForTask(new TestRemoteTaskRunnerConfig(new Period("PT1S")), workerMap, createMockTask("index_hadoop"));
// batch tasks should be sent to worker1
Assert.assertEquals(worker1, workerForBatchTask);
ImmutableWorkerInfo workerForOtherTask = STRATEGY.findWorkerForTask(new TestRemoteTaskRunnerConfig(new Period("PT1S")), workerMap, createMockTask("other_type"));
// all other tasks should be sent to worker2
Assert.assertEquals(worker2, workerForOtherTask);
}
use of org.apache.druid.indexing.overlord.TestRemoteTaskRunnerConfig in project druid by druid-io.
the class JavaScriptWorkerSelectStrategyTest method testNoWorkerCanRunTask.
@Test
public void testNoWorkerCanRunTask() {
ImmutableMap<String, ImmutableWorkerInfo> workerMap = ImmutableMap.of("10.0.0.1", createMockWorker(1, false, true), "10.0.0.4", createMockWorker(1, false, true));
ImmutableWorkerInfo workerForBatchTask = STRATEGY.findWorkerForTask(new TestRemoteTaskRunnerConfig(new Period("PT1S")), workerMap, createMockTask("index_hadoop"));
Assert.assertNull(workerForBatchTask);
ImmutableWorkerInfo workerForOtherTask = STRATEGY.findWorkerForTask(new TestRemoteTaskRunnerConfig(new Period("PT1S")), workerMap, createMockTask("otherTask"));
// all other tasks should be sent to worker2
Assert.assertNull(workerForOtherTask);
}
use of org.apache.druid.indexing.overlord.TestRemoteTaskRunnerConfig in project druid by druid-io.
the class JavaScriptWorkerSelectStrategyTest method testFillWorkerCapacity.
@Test
public void testFillWorkerCapacity() {
// tasks shoudl be assigned to the worker with maximum currCapacity used until its full
ImmutableMap<String, ImmutableWorkerInfo> workerMap = ImmutableMap.of("10.0.0.1", createMockWorker(1, true, true), "10.0.0.2", createMockWorker(5, true, true));
ImmutableWorkerInfo workerForBatchTask = STRATEGY.findWorkerForTask(new TestRemoteTaskRunnerConfig(new Period("PT1S")), workerMap, createMockTask("index_hadoop"));
Assert.assertEquals(workerMap.get("10.0.0.2"), workerForBatchTask);
}
Aggregations