Search in sources :

Example 1 with SeekableStreamSupervisorIOConfig

use of org.apache.druid.indexing.seekablestream.supervisor.SeekableStreamSupervisorIOConfig in project druid by druid-io.

the class SeekableStreamSupervisorSpecTest method setUp.

@Before
public void setUp() {
    ingestionSchema = EasyMock.mock(SeekableStreamSupervisorIngestionSpec.class);
    taskStorage = EasyMock.mock(TaskStorage.class);
    taskMaster = EasyMock.mock(TaskMaster.class);
    indexerMetadataStorageCoordinator = EasyMock.mock(IndexerMetadataStorageCoordinator.class);
    emitter = EasyMock.mock(ServiceEmitter.class);
    rowIngestionMetersFactory = EasyMock.mock(RowIngestionMetersFactory.class);
    dataSchema = EasyMock.mock(DataSchema.class);
    seekableStreamSupervisorTuningConfig = EasyMock.mock(SeekableStreamSupervisorTuningConfig.class);
    seekableStreamSupervisorIOConfig = EasyMock.mock(SeekableStreamSupervisorIOConfig.class);
    taskClientFactory = EasyMock.mock(SeekableStreamIndexTaskClientFactory.class);
    spec = EasyMock.mock(SeekableStreamSupervisorSpec.class);
    supervisorConfig = new SupervisorStateManagerConfig();
    indexTaskClientFactory = EasyMock.mock(SeekableStreamIndexTaskClientFactory.class);
    mapper = new DefaultObjectMapper();
    monitorSchedulerConfig = EasyMock.mock(DruidMonitorSchedulerConfig.class);
    supervisorStateManagerConfig = EasyMock.mock(SupervisorStateManagerConfig.class);
    supervisor4 = EasyMock.mock(SeekableStreamSupervisor.class);
}
Also used : ServiceEmitter(org.apache.druid.java.util.emitter.service.ServiceEmitter) SeekableStreamSupervisorTuningConfig(org.apache.druid.indexing.seekablestream.supervisor.SeekableStreamSupervisorTuningConfig) SeekableStreamSupervisorIOConfig(org.apache.druid.indexing.seekablestream.supervisor.SeekableStreamSupervisorIOConfig) IndexerMetadataStorageCoordinator(org.apache.druid.indexing.overlord.IndexerMetadataStorageCoordinator) SeekableStreamSupervisorSpec(org.apache.druid.indexing.seekablestream.supervisor.SeekableStreamSupervisorSpec) SeekableStreamSupervisorIngestionSpec(org.apache.druid.indexing.seekablestream.supervisor.SeekableStreamSupervisorIngestionSpec) DataSchema(org.apache.druid.segment.indexing.DataSchema) DruidMonitorSchedulerConfig(org.apache.druid.server.metrics.DruidMonitorSchedulerConfig) TaskStorage(org.apache.druid.indexing.overlord.TaskStorage) SupervisorStateManagerConfig(org.apache.druid.indexing.overlord.supervisor.SupervisorStateManagerConfig) DefaultObjectMapper(org.apache.druid.jackson.DefaultObjectMapper) TaskMaster(org.apache.druid.indexing.overlord.TaskMaster) RowIngestionMetersFactory(org.apache.druid.segment.incremental.RowIngestionMetersFactory) SeekableStreamSupervisor(org.apache.druid.indexing.seekablestream.supervisor.SeekableStreamSupervisor) Before(org.junit.Before)

Example 2 with SeekableStreamSupervisorIOConfig

use of org.apache.druid.indexing.seekablestream.supervisor.SeekableStreamSupervisorIOConfig in project druid by druid-io.

the class SeekableStreamSupervisorSpecTest method testSeekableStreamSupervisorSpecWithScaleDisable.

@Test
public void testSeekableStreamSupervisorSpecWithScaleDisable() throws InterruptedException {
    SeekableStreamSupervisorIOConfig seekableStreamSupervisorIOConfig = new SeekableStreamSupervisorIOConfig("stream", new JsonInputFormat(new JSONPathSpec(true, ImmutableList.of()), ImmutableMap.of(), false), 1, 1, new Period("PT1H"), new Period("P1D"), new Period("PT30S"), false, new Period("PT30M"), null, null, null, null) {
    };
    EasyMock.expect(spec.getSupervisorStateManagerConfig()).andReturn(supervisorConfig).anyTimes();
    EasyMock.expect(spec.getDataSchema()).andReturn(getDataSchema()).anyTimes();
    EasyMock.expect(spec.getIoConfig()).andReturn(seekableStreamSupervisorIOConfig).anyTimes();
    EasyMock.expect(spec.getTuningConfig()).andReturn(getTuningConfig()).anyTimes();
    EasyMock.expect(spec.getEmitter()).andReturn(emitter).anyTimes();
    EasyMock.expect(spec.isSuspended()).andReturn(false).anyTimes();
    EasyMock.replay(spec);
    EasyMock.expect(ingestionSchema.getIOConfig()).andReturn(this.seekableStreamSupervisorIOConfig).anyTimes();
    EasyMock.expect(ingestionSchema.getDataSchema()).andReturn(dataSchema).anyTimes();
    EasyMock.expect(ingestionSchema.getTuningConfig()).andReturn(seekableStreamSupervisorTuningConfig).anyTimes();
    EasyMock.replay(ingestionSchema);
    EasyMock.expect(taskMaster.getTaskRunner()).andReturn(Optional.absent()).anyTimes();
    EasyMock.expect(taskMaster.getSupervisorManager()).andReturn(Optional.absent()).anyTimes();
    EasyMock.replay(taskMaster);
    TestSeekableStreamSupervisor supervisor = new TestSeekableStreamSupervisor(3);
    NoopTaskAutoScaler autoScaler = new NoopTaskAutoScaler();
    supervisor.start();
    autoScaler.start();
    supervisor.runInternal();
    int taskCountBeforeScaleOut = supervisor.getIoConfig().getTaskCount();
    Assert.assertEquals(1, taskCountBeforeScaleOut);
    Thread.sleep(1 * 1000);
    int taskCountAfterScaleOut = supervisor.getIoConfig().getTaskCount();
    Assert.assertEquals(1, taskCountAfterScaleOut);
    autoScaler.reset();
    autoScaler.stop();
}
Also used : SeekableStreamSupervisorIOConfig(org.apache.druid.indexing.seekablestream.supervisor.SeekableStreamSupervisorIOConfig) JsonInputFormat(org.apache.druid.data.input.impl.JsonInputFormat) JSONPathSpec(org.apache.druid.java.util.common.parsers.JSONPathSpec) Period(org.joda.time.Period) NoopTaskAutoScaler(org.apache.druid.indexing.seekablestream.supervisor.autoscaler.NoopTaskAutoScaler) Test(org.junit.Test)

Aggregations

SeekableStreamSupervisorIOConfig (org.apache.druid.indexing.seekablestream.supervisor.SeekableStreamSupervisorIOConfig)2 JsonInputFormat (org.apache.druid.data.input.impl.JsonInputFormat)1 IndexerMetadataStorageCoordinator (org.apache.druid.indexing.overlord.IndexerMetadataStorageCoordinator)1 TaskMaster (org.apache.druid.indexing.overlord.TaskMaster)1 TaskStorage (org.apache.druid.indexing.overlord.TaskStorage)1 SupervisorStateManagerConfig (org.apache.druid.indexing.overlord.supervisor.SupervisorStateManagerConfig)1 SeekableStreamSupervisor (org.apache.druid.indexing.seekablestream.supervisor.SeekableStreamSupervisor)1 SeekableStreamSupervisorIngestionSpec (org.apache.druid.indexing.seekablestream.supervisor.SeekableStreamSupervisorIngestionSpec)1 SeekableStreamSupervisorSpec (org.apache.druid.indexing.seekablestream.supervisor.SeekableStreamSupervisorSpec)1 SeekableStreamSupervisorTuningConfig (org.apache.druid.indexing.seekablestream.supervisor.SeekableStreamSupervisorTuningConfig)1 NoopTaskAutoScaler (org.apache.druid.indexing.seekablestream.supervisor.autoscaler.NoopTaskAutoScaler)1 DefaultObjectMapper (org.apache.druid.jackson.DefaultObjectMapper)1 JSONPathSpec (org.apache.druid.java.util.common.parsers.JSONPathSpec)1 ServiceEmitter (org.apache.druid.java.util.emitter.service.ServiceEmitter)1 RowIngestionMetersFactory (org.apache.druid.segment.incremental.RowIngestionMetersFactory)1 DataSchema (org.apache.druid.segment.indexing.DataSchema)1 DruidMonitorSchedulerConfig (org.apache.druid.server.metrics.DruidMonitorSchedulerConfig)1 Period (org.joda.time.Period)1 Before (org.junit.Before)1 Test (org.junit.Test)1