Search in sources :

Example 11 with DruidMonitorSchedulerConfig

use of org.apache.druid.server.metrics.DruidMonitorSchedulerConfig in project druid by apache.

the class SeekableStreamSupervisorStateTest method expectEmitterSupervisor.

private void expectEmitterSupervisor(boolean suspended) throws EntryExistsException {
    spec = createMock(SeekableStreamSupervisorSpec.class);
    EasyMock.expect(spec.getSupervisorStateManagerConfig()).andReturn(supervisorConfig).anyTimes();
    EasyMock.expect(spec.getDataSchema()).andReturn(getDataSchema()).anyTimes();
    EasyMock.expect(spec.getIoConfig()).andReturn(new SeekableStreamSupervisorIOConfig("stream", new JsonInputFormat(new JSONPathSpec(true, ImmutableList.of()), ImmutableMap.of(), false), 1, 1, new Period("PT1H"), new Period("PT1S"), new Period("PT30S"), false, new Period("PT30M"), null, null, null, null) {
    }).anyTimes();
    EasyMock.expect(spec.getTuningConfig()).andReturn(getTuningConfig()).anyTimes();
    EasyMock.expect(spec.getEmitter()).andReturn(emitter).anyTimes();
    EasyMock.expect(spec.getMonitorSchedulerConfig()).andReturn(new DruidMonitorSchedulerConfig() {

        @Override
        public Duration getEmitterPeriod() {
            return new Period("PT1S").toStandardDuration();
        }
    }).anyTimes();
    EasyMock.expect(spec.isSuspended()).andReturn(suspended).anyTimes();
    EasyMock.expect(spec.getType()).andReturn("test").anyTimes();
    EasyMock.expect(recordSupplier.getPartitionIds(STREAM)).andReturn(ImmutableSet.of(SHARD_ID)).anyTimes();
    EasyMock.expect(taskStorage.getActiveTasksByDatasource(DATASOURCE)).andReturn(ImmutableList.of()).anyTimes();
    EasyMock.expect(taskQueue.add(EasyMock.anyObject())).andReturn(true).anyTimes();
    replayAll();
}
Also used : DruidMonitorSchedulerConfig(org.apache.druid.server.metrics.DruidMonitorSchedulerConfig) JsonInputFormat(org.apache.druid.data.input.impl.JsonInputFormat) JSONPathSpec(org.apache.druid.java.util.common.parsers.JSONPathSpec) Period(org.joda.time.Period)

Example 12 with DruidMonitorSchedulerConfig

use of org.apache.druid.server.metrics.DruidMonitorSchedulerConfig in project druid by druid-io.

the class KinesisSupervisorTest method getSupervisor.

/**
 * Use for tests where you don't want generateSequenceName to be overridden out
 */
private KinesisSupervisor getSupervisor(int replicas, int taskCount, boolean useEarliestOffset, String duration, Period lateMessageRejectionPeriod, Period earlyMessageRejectionPeriod, boolean suspended, Integer recordsPerFetch, Integer fetchDelayMillis, DataSchema dataSchema, KinesisSupervisorTuningConfig tuningConfig) {
    KinesisSupervisorIOConfig kinesisSupervisorIOConfig = new KinesisSupervisorIOConfig(STREAM, INPUT_FORMAT, "awsEndpoint", null, replicas, taskCount, new Period(duration), new Period("P1D"), new Period("PT30S"), useEarliestOffset, new Period("PT30M"), lateMessageRejectionPeriod, earlyMessageRejectionPeriod, null, recordsPerFetch, fetchDelayMillis, null, null, null, false);
    KinesisIndexTaskClientFactory taskClientFactory = new KinesisIndexTaskClientFactory(null, null) {

        @Override
        public KinesisIndexTaskClient build(TaskInfoProvider taskInfoProvider, String dataSource, int numThreads, Duration httpTimeout, long numRetries) {
            Assert.assertEquals(TEST_CHAT_THREADS, numThreads);
            Assert.assertEquals(TEST_HTTP_TIMEOUT.toStandardDuration(), httpTimeout);
            Assert.assertEquals(TEST_CHAT_RETRIES, numRetries);
            return taskClient;
        }
    };
    return new KinesisSupervisor(taskStorage, taskMaster, indexerMetadataStorageCoordinator, taskClientFactory, OBJECT_MAPPER, new KinesisSupervisorSpec(null, dataSchema, tuningConfig, kinesisSupervisorIOConfig, null, suspended, taskStorage, taskMaster, indexerMetadataStorageCoordinator, taskClientFactory, OBJECT_MAPPER, new NoopServiceEmitter(), new DruidMonitorSchedulerConfig(), rowIngestionMetersFactory, null, supervisorConfig), rowIngestionMetersFactory, null);
}
Also used : KinesisIndexTaskClientFactory(org.apache.druid.indexing.kinesis.KinesisIndexTaskClientFactory) DruidMonitorSchedulerConfig(org.apache.druid.server.metrics.DruidMonitorSchedulerConfig) Period(org.joda.time.Period) Duration(org.joda.time.Duration) NoopServiceEmitter(org.apache.druid.server.metrics.NoopServiceEmitter) TaskInfoProvider(org.apache.druid.indexing.common.TaskInfoProvider)

Example 13 with DruidMonitorSchedulerConfig

use of org.apache.druid.server.metrics.DruidMonitorSchedulerConfig in project druid by druid-io.

the class KinesisSupervisorTest method getTestableSupervisor.

private TestableKinesisSupervisor getTestableSupervisor(int replicas, int taskCount, boolean useEarliestOffset, boolean resetOffsetAutomatically, String duration, Period lateMessageRejectionPeriod, Period earlyMessageRejectionPeriod, boolean suspended) {
    KinesisSupervisorIOConfig kinesisSupervisorIOConfig = new KinesisSupervisorIOConfig(STREAM, INPUT_FORMAT, "awsEndpoint", null, replicas, taskCount, new Period(duration), new Period("P1D"), new Period("PT30S"), useEarliestOffset, new Period("PT30M"), lateMessageRejectionPeriod, earlyMessageRejectionPeriod, null, null, null, null, null, null, false);
    KinesisIndexTaskClientFactory taskClientFactory = new KinesisIndexTaskClientFactory(null, null) {

        @Override
        public KinesisIndexTaskClient build(TaskInfoProvider taskInfoProvider, String dataSource, int numThreads, Duration httpTimeout, long numRetries) {
            Assert.assertEquals(TEST_CHAT_THREADS, numThreads);
            Assert.assertEquals(TEST_HTTP_TIMEOUT.toStandardDuration(), httpTimeout);
            Assert.assertEquals(TEST_CHAT_RETRIES, numRetries);
            return taskClient;
        }
    };
    final KinesisSupervisorTuningConfig tuningConfig = new KinesisSupervisorTuningConfig(null, 1000, null, null, 50000, null, new Period("P1Y"), new File("/test"), null, null, null, false, null, resetOffsetAutomatically, null, null, numThreads, TEST_CHAT_THREADS, TEST_CHAT_RETRIES, TEST_HTTP_TIMEOUT, TEST_SHUTDOWN_TIMEOUT, null, null, null, 5000, null, null, null, null, null, null, null, null, null);
    return new TestableKinesisSupervisor(taskStorage, taskMaster, indexerMetadataStorageCoordinator, taskClientFactory, OBJECT_MAPPER, new KinesisSupervisorSpec(null, dataSchema, tuningConfig, kinesisSupervisorIOConfig, null, suspended, taskStorage, taskMaster, indexerMetadataStorageCoordinator, taskClientFactory, OBJECT_MAPPER, new NoopServiceEmitter(), new DruidMonitorSchedulerConfig(), rowIngestionMetersFactory, null, new SupervisorStateManagerConfig()), rowIngestionMetersFactory);
}
Also used : Period(org.joda.time.Period) Duration(org.joda.time.Duration) NoopServiceEmitter(org.apache.druid.server.metrics.NoopServiceEmitter) KinesisIndexTaskClientFactory(org.apache.druid.indexing.kinesis.KinesisIndexTaskClientFactory) DruidMonitorSchedulerConfig(org.apache.druid.server.metrics.DruidMonitorSchedulerConfig) SupervisorStateManagerConfig(org.apache.druid.indexing.overlord.supervisor.SupervisorStateManagerConfig) TaskInfoProvider(org.apache.druid.indexing.common.TaskInfoProvider) File(java.io.File)

Example 14 with DruidMonitorSchedulerConfig

use of org.apache.druid.server.metrics.DruidMonitorSchedulerConfig in project druid by druid-io.

the class KinesisSupervisorTest method testRecordSupplier.

@Test
public void testRecordSupplier() {
    KinesisSupervisorIOConfig kinesisSupervisorIOConfig = new KinesisSupervisorIOConfig(STREAM, INPUT_FORMAT, "awsEndpoint", null, 1, 1, new Period("PT30M"), new Period("P1D"), new Period("PT30S"), false, new Period("PT30M"), null, null, null, 100, 1000, null, null, null, false);
    KinesisIndexTaskClientFactory clientFactory = new KinesisIndexTaskClientFactory(null, OBJECT_MAPPER);
    KinesisSupervisor supervisor = new KinesisSupervisor(taskStorage, taskMaster, indexerMetadataStorageCoordinator, clientFactory, OBJECT_MAPPER, new KinesisSupervisorSpec(null, dataSchema, tuningConfig, kinesisSupervisorIOConfig, null, false, taskStorage, taskMaster, indexerMetadataStorageCoordinator, clientFactory, OBJECT_MAPPER, new NoopServiceEmitter(), new DruidMonitorSchedulerConfig(), rowIngestionMetersFactory, null, new SupervisorStateManagerConfig()), rowIngestionMetersFactory, null);
    KinesisRecordSupplier supplier = (KinesisRecordSupplier) supervisor.setupRecordSupplier();
    Assert.assertNotNull(supplier);
    Assert.assertEquals(0, supplier.bufferSize());
    Assert.assertEquals(Collections.emptySet(), supplier.getAssignment());
    // background fetch should not be enabled for supervisor supplier
    supplier.start();
    Assert.assertFalse(supplier.isBackgroundFetchRunning());
}
Also used : KinesisIndexTaskClientFactory(org.apache.druid.indexing.kinesis.KinesisIndexTaskClientFactory) DruidMonitorSchedulerConfig(org.apache.druid.server.metrics.DruidMonitorSchedulerConfig) KinesisRecordSupplier(org.apache.druid.indexing.kinesis.KinesisRecordSupplier) SupervisorStateManagerConfig(org.apache.druid.indexing.overlord.supervisor.SupervisorStateManagerConfig) Period(org.joda.time.Period) NoopServiceEmitter(org.apache.druid.server.metrics.NoopServiceEmitter) Test(org.junit.Test)

Example 15 with DruidMonitorSchedulerConfig

use of org.apache.druid.server.metrics.DruidMonitorSchedulerConfig in project druid by druid-io.

the class SeekableStreamSupervisorStateTest method expectEmitterSupervisor.

private void expectEmitterSupervisor(boolean suspended) throws EntryExistsException {
    spec = createMock(SeekableStreamSupervisorSpec.class);
    EasyMock.expect(spec.getSupervisorStateManagerConfig()).andReturn(supervisorConfig).anyTimes();
    EasyMock.expect(spec.getDataSchema()).andReturn(getDataSchema()).anyTimes();
    EasyMock.expect(spec.getIoConfig()).andReturn(new SeekableStreamSupervisorIOConfig("stream", new JsonInputFormat(new JSONPathSpec(true, ImmutableList.of()), ImmutableMap.of(), false), 1, 1, new Period("PT1H"), new Period("PT1S"), new Period("PT30S"), false, new Period("PT30M"), null, null, null, null) {
    }).anyTimes();
    EasyMock.expect(spec.getTuningConfig()).andReturn(getTuningConfig()).anyTimes();
    EasyMock.expect(spec.getEmitter()).andReturn(emitter).anyTimes();
    EasyMock.expect(spec.getMonitorSchedulerConfig()).andReturn(new DruidMonitorSchedulerConfig() {

        @Override
        public Duration getEmitterPeriod() {
            return new Period("PT1S").toStandardDuration();
        }
    }).anyTimes();
    EasyMock.expect(spec.isSuspended()).andReturn(suspended).anyTimes();
    EasyMock.expect(spec.getType()).andReturn("test").anyTimes();
    EasyMock.expect(recordSupplier.getPartitionIds(STREAM)).andReturn(ImmutableSet.of(SHARD_ID)).anyTimes();
    EasyMock.expect(taskStorage.getActiveTasksByDatasource(DATASOURCE)).andReturn(ImmutableList.of()).anyTimes();
    EasyMock.expect(taskQueue.add(EasyMock.anyObject())).andReturn(true).anyTimes();
    replayAll();
}
Also used : DruidMonitorSchedulerConfig(org.apache.druid.server.metrics.DruidMonitorSchedulerConfig) JsonInputFormat(org.apache.druid.data.input.impl.JsonInputFormat) JSONPathSpec(org.apache.druid.java.util.common.parsers.JSONPathSpec) Period(org.joda.time.Period)

Aggregations

DruidMonitorSchedulerConfig (org.apache.druid.server.metrics.DruidMonitorSchedulerConfig)20 Period (org.joda.time.Period)20 NoopServiceEmitter (org.apache.druid.server.metrics.NoopServiceEmitter)18 TaskInfoProvider (org.apache.druid.indexing.common.TaskInfoProvider)16 Duration (org.joda.time.Duration)16 KinesisIndexTaskClientFactory (org.apache.druid.indexing.kinesis.KinesisIndexTaskClientFactory)10 File (java.io.File)8 KafkaIndexTaskClientFactory (org.apache.druid.indexing.kafka.KafkaIndexTaskClientFactory)8 SupervisorStateManagerConfig (org.apache.druid.indexing.overlord.supervisor.SupervisorStateManagerConfig)8 HashMap (java.util.HashMap)6 Test (org.junit.Test)4 Executor (java.util.concurrent.Executor)2 JsonInputFormat (org.apache.druid.data.input.impl.JsonInputFormat)2 KafkaDataSourceMetadata (org.apache.druid.indexing.kafka.KafkaDataSourceMetadata)2 KafkaIndexTask (org.apache.druid.indexing.kafka.KafkaIndexTask)2 KafkaIndexTaskIOConfig (org.apache.druid.indexing.kafka.KafkaIndexTaskIOConfig)2 KinesisRecordSupplier (org.apache.druid.indexing.kinesis.KinesisRecordSupplier)2 TaskRunnerListener (org.apache.druid.indexing.overlord.TaskRunnerListener)2 SupervisorTaskAutoScaler (org.apache.druid.indexing.overlord.supervisor.autoscaler.SupervisorTaskAutoScaler)2 SeekableStreamSupervisorSpec (org.apache.druid.indexing.seekablestream.supervisor.SeekableStreamSupervisorSpec)2