Search in sources :

Example 16 with RemoteTaskRunnerConfig

use of io.druid.indexing.overlord.config.RemoteTaskRunnerConfig in project druid by druid-io.

the class PendingTaskBasedResourceManagementStrategyTest method testSuccessfulMinWorkersProvisionWithOldVersionNodeRunning.

@Test
public void testSuccessfulMinWorkersProvisionWithOldVersionNodeRunning() throws Exception {
    EasyMock.expect(autoScaler.getMinNumWorkers()).andReturn(3);
    EasyMock.expect(autoScaler.getMaxNumWorkers()).andReturn(5);
    EasyMock.expect(autoScaler.ipToIdLookup(EasyMock.<List<String>>anyObject())).andReturn(Lists.<String>newArrayList());
    RemoteTaskRunner runner = EasyMock.createMock(RemoteTaskRunner.class);
    // No pending tasks
    EasyMock.expect(runner.getPendingTaskPayloads()).andReturn(Lists.<Task>newArrayList());
    // 1 node already running, only provision 2 more.
    EasyMock.expect(runner.getWorkers()).andReturn(Arrays.<ImmutableWorkerInfo>asList(new TestZkWorker(testTask).toImmutable(), // Invalid version node
    new TestZkWorker(testTask, "h1", "n1", INVALID_VERSION).toImmutable()));
    EasyMock.expect(runner.getConfig()).andReturn(new RemoteTaskRunnerConfig());
    EasyMock.expect(autoScaler.provision()).andReturn(new AutoScalingData(Lists.<String>newArrayList("aNode"))).times(2);
    EasyMock.replay(runner, autoScaler);
    boolean provisionedSomething = strategy.doProvision(runner);
    Assert.assertTrue(provisionedSomething);
    Assert.assertTrue(strategy.getStats().toList().size() == 2);
    for (ScalingStats.ScalingEvent event : strategy.getStats().toList()) {
        Assert.assertTrue(event.getEvent() == ScalingStats.EVENT.PROVISION);
    }
}
Also used : RemoteTaskRunner(io.druid.indexing.overlord.RemoteTaskRunner) RemoteTaskRunnerConfig(io.druid.indexing.overlord.config.RemoteTaskRunnerConfig) Test(org.junit.Test)

Aggregations

RemoteTaskRunnerConfig (io.druid.indexing.overlord.config.RemoteTaskRunnerConfig)16 Test (org.junit.Test)15 NoopTask (io.druid.indexing.common.task.NoopTask)9 ImmutableWorkerInfo (io.druid.indexing.overlord.ImmutableWorkerInfo)9 RemoteTaskRunner (io.druid.indexing.overlord.RemoteTaskRunner)7 Worker (io.druid.indexing.worker.Worker)7 Task (io.druid.indexing.common.task.Task)3 IndexerZkConfig (io.druid.server.initialization.IndexerZkConfig)2 ZkPathsConfig (io.druid.server.initialization.ZkPathsConfig)2 List (java.util.List)2 DateTime (org.joda.time.DateTime)2 ServiceEmitter (com.metamx.emitter.service.ServiceEmitter)1 HttpClient (com.metamx.http.client.HttpClient)1 PotentiallyGzippedCompressionProvider (io.druid.curator.PotentiallyGzippedCompressionProvider)1 IndexingServiceCondition (io.druid.indexing.common.IndexingServiceCondition)1 TaskStatus (io.druid.indexing.common.TaskStatus)1 ResourceManagementSchedulerConfig (io.druid.indexing.overlord.autoscaling.ResourceManagementSchedulerConfig)1 SimpleWorkerResourceManagementConfig (io.druid.indexing.overlord.autoscaling.SimpleWorkerResourceManagementConfig)1 SimpleWorkerResourceManagementStrategy (io.druid.indexing.overlord.autoscaling.SimpleWorkerResourceManagementStrategy)1 WorkerBehaviorConfig (io.druid.indexing.overlord.setup.WorkerBehaviorConfig)1