Search in sources :

Example 21 with TaskConfig

use of org.apache.druid.indexing.common.config.TaskConfig in project druid by druid-io.

the class ShuffleDataSegmentPusherTest method setup.

@Before
public void setup() throws IOException {
    final WorkerConfig workerConfig = new WorkerConfig();
    final TaskConfig taskConfig = new TaskConfig(null, null, null, null, null, false, null, null, ImmutableList.of(new StorageLocationConfig(temporaryFolder.newFolder(), null, null)), false, false, TaskConfig.BATCH_PROCESSING_MODE_DEFAULT.name());
    final IndexingServiceClient indexingServiceClient = new NoopIndexingServiceClient();
    if (LOCAL.equals(intermediateDataStore)) {
        intermediaryDataManager = new LocalIntermediaryDataManager(workerConfig, taskConfig, indexingServiceClient);
    } else if (DEEPSTORE.equals(intermediateDataStore)) {
        localDeepStore = temporaryFolder.newFolder("localStorage");
        intermediaryDataManager = new DeepStorageIntermediaryDataManager(new LocalDataSegmentPusher(new LocalDataSegmentPusherConfig() {

            @Override
            public File getStorageDirectory() {
                return localDeepStore;
            }
        }));
    }
    intermediaryDataManager.start();
    segmentPusher = new ShuffleDataSegmentPusher("supervisorTaskId", "subTaskId", intermediaryDataManager);
    final Injector injector = GuiceInjectors.makeStartupInjectorWithModules(ImmutableList.of(binder -> binder.bind(LocalDataSegmentPuller.class)));
    mapper = new DefaultObjectMapper();
    mapper.registerModule(new SimpleModule("loadSpecTest").registerSubtypes(LocalLoadSpec.class));
    mapper.setInjectableValues(new GuiceInjectableValues(injector));
    final GuiceAnnotationIntrospector guiceIntrospector = new GuiceAnnotationIntrospector();
    mapper.setAnnotationIntrospectors(new AnnotationIntrospectorPair(guiceIntrospector, mapper.getSerializationConfig().getAnnotationIntrospector()), new AnnotationIntrospectorPair(guiceIntrospector, mapper.getDeserializationConfig().getAnnotationIntrospector()));
}
Also used : Arrays(java.util.Arrays) TaskConfig(org.apache.druid.indexing.common.config.TaskConfig) Intervals(org.apache.druid.java.util.common.Intervals) RunWith(org.junit.runner.RunWith) CompressionUtils(org.apache.druid.utils.CompressionUtils) IndexingServiceClient(org.apache.druid.client.indexing.IndexingServiceClient) SegmentLoadingException(org.apache.druid.segment.loading.SegmentLoadingException) AnnotationIntrospectorPair(com.fasterxml.jackson.databind.introspect.AnnotationIntrospectorPair) SimpleModule(com.fasterxml.jackson.databind.module.SimpleModule) Interval(org.joda.time.Interval) ImmutableList(com.google.common.collect.ImmutableList) Files(com.google.common.io.Files) LocalDataSegmentPuller(org.apache.druid.segment.loading.LocalDataSegmentPuller) LocalDataSegmentPusherConfig(org.apache.druid.segment.loading.LocalDataSegmentPusherConfig) After(org.junit.After) ByteSource(com.google.common.io.ByteSource) LoadSpec(org.apache.druid.segment.loading.LoadSpec) BucketNumberedShardSpec(org.apache.druid.timeline.partition.BucketNumberedShardSpec) Parameterized(org.junit.runners.Parameterized) NoopIndexingServiceClient(org.apache.druid.client.indexing.NoopIndexingServiceClient) Before(org.junit.Before) WorkerConfig(org.apache.druid.indexing.worker.config.WorkerConfig) LocalLoadSpec(org.apache.druid.segment.loading.LocalLoadSpec) Collection(java.util.Collection) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) FileUtils(org.apache.commons.io.FileUtils) Test(org.junit.Test) IOException(java.io.IOException) StorageLocationConfig(org.apache.druid.segment.loading.StorageLocationConfig) Ints(com.google.common.primitives.Ints) GuiceInjectors(org.apache.druid.guice.GuiceInjectors) File(java.io.File) StandardCharsets(java.nio.charset.StandardCharsets) DefaultObjectMapper(org.apache.druid.jackson.DefaultObjectMapper) Injector(com.google.inject.Injector) Mockito(org.mockito.Mockito) List(java.util.List) Rule(org.junit.Rule) GuiceAnnotationIntrospector(org.apache.druid.guice.GuiceAnnotationIntrospector) LocalDataSegmentPusher(org.apache.druid.segment.loading.LocalDataSegmentPusher) DataSegment(org.apache.druid.timeline.DataSegment) Optional(java.util.Optional) Assert(org.junit.Assert) Comparator(java.util.Comparator) GuiceInjectableValues(org.apache.druid.guice.GuiceInjectableValues) TemporaryFolder(org.junit.rules.TemporaryFolder) LocalLoadSpec(org.apache.druid.segment.loading.LocalLoadSpec) AnnotationIntrospectorPair(com.fasterxml.jackson.databind.introspect.AnnotationIntrospectorPair) IndexingServiceClient(org.apache.druid.client.indexing.IndexingServiceClient) NoopIndexingServiceClient(org.apache.druid.client.indexing.NoopIndexingServiceClient) StorageLocationConfig(org.apache.druid.segment.loading.StorageLocationConfig) LocalDataSegmentPusherConfig(org.apache.druid.segment.loading.LocalDataSegmentPusherConfig) TaskConfig(org.apache.druid.indexing.common.config.TaskConfig) LocalDataSegmentPusher(org.apache.druid.segment.loading.LocalDataSegmentPusher) NoopIndexingServiceClient(org.apache.druid.client.indexing.NoopIndexingServiceClient) Injector(com.google.inject.Injector) WorkerConfig(org.apache.druid.indexing.worker.config.WorkerConfig) DefaultObjectMapper(org.apache.druid.jackson.DefaultObjectMapper) GuiceAnnotationIntrospector(org.apache.druid.guice.GuiceAnnotationIntrospector) SimpleModule(com.fasterxml.jackson.databind.module.SimpleModule) GuiceInjectableValues(org.apache.druid.guice.GuiceInjectableValues) Before(org.junit.Before)

Example 22 with TaskConfig

use of org.apache.druid.indexing.common.config.TaskConfig in project druid by druid-io.

the class ShuffleResourceTest method setup.

@Before
public void setup() throws IOException {
    final WorkerConfig workerConfig = new WorkerConfig() {

        @Override
        public long getIntermediaryPartitionDiscoveryPeriodSec() {
            return 1;
        }

        @Override
        public long getIntermediaryPartitionCleanupPeriodSec() {
            return 2;
        }

        @Override
        public Period getIntermediaryPartitionTimeout() {
            return new Period("PT2S");
        }
    };
    final TaskConfig taskConfig = new TaskConfig(null, null, null, null, null, false, null, null, ImmutableList.of(new StorageLocationConfig(tempDir.newFolder(), null, null)), false, false, TaskConfig.BATCH_PROCESSING_MODE_DEFAULT.name());
    final IndexingServiceClient indexingServiceClient = new NoopIndexingServiceClient() {

        @Override
        public Map<String, TaskStatus> getTaskStatuses(Set<String> taskIds) {
            final Map<String, TaskStatus> result = new HashMap<>();
            for (String taskId : taskIds) {
                result.put(taskId, new TaskStatus(taskId, TaskState.SUCCESS, 10));
            }
            return result;
        }
    };
    intermediaryDataManager = new LocalIntermediaryDataManager(workerConfig, taskConfig, indexingServiceClient);
    shuffleMetrics = new ShuffleMetrics();
    shuffleResource = new ShuffleResource(intermediaryDataManager, Optional.of(shuffleMetrics));
}
Also used : IndexingServiceClient(org.apache.druid.client.indexing.IndexingServiceClient) NoopIndexingServiceClient(org.apache.druid.client.indexing.NoopIndexingServiceClient) StorageLocationConfig(org.apache.druid.segment.loading.StorageLocationConfig) Set(java.util.Set) HashMap(java.util.HashMap) Period(org.joda.time.Period) TaskConfig(org.apache.druid.indexing.common.config.TaskConfig) TaskStatus(org.apache.druid.client.indexing.TaskStatus) NoopIndexingServiceClient(org.apache.druid.client.indexing.NoopIndexingServiceClient) PerDatasourceShuffleMetrics(org.apache.druid.indexing.worker.shuffle.ShuffleMetrics.PerDatasourceShuffleMetrics) WorkerConfig(org.apache.druid.indexing.worker.config.WorkerConfig) Before(org.junit.Before)

Example 23 with TaskConfig

use of org.apache.druid.indexing.common.config.TaskConfig in project druid by druid-io.

the class LocalIntermediaryDataManagerManualAddAndDeleteTest method setup.

@Before
public void setup() throws IOException {
    final WorkerConfig workerConfig = new WorkerConfig();
    intermediarySegmentsLocation = tempDir.newFolder();
    siblingLocation = tempDir.newFolder();
    final TaskConfig taskConfig = new TaskConfig(null, null, null, null, null, false, null, null, ImmutableList.of(new StorageLocationConfig(intermediarySegmentsLocation, 1200L, null)), false, false, TaskConfig.BATCH_PROCESSING_MODE_DEFAULT.name());
    final IndexingServiceClient indexingServiceClient = new NoopIndexingServiceClient();
    intermediaryDataManager = new LocalIntermediaryDataManager(workerConfig, taskConfig, indexingServiceClient);
    intermediaryDataManager.start();
}
Also used : IndexingServiceClient(org.apache.druid.client.indexing.IndexingServiceClient) NoopIndexingServiceClient(org.apache.druid.client.indexing.NoopIndexingServiceClient) StorageLocationConfig(org.apache.druid.segment.loading.StorageLocationConfig) NoopIndexingServiceClient(org.apache.druid.client.indexing.NoopIndexingServiceClient) WorkerConfig(org.apache.druid.indexing.worker.config.WorkerConfig) TaskConfig(org.apache.druid.indexing.common.config.TaskConfig) Before(org.junit.Before)

Example 24 with TaskConfig

use of org.apache.druid.indexing.common.config.TaskConfig in project druid by druid-io.

the class ResetCluster method deleteIndexerHadoopWorkingDir.

private void deleteIndexerHadoopWorkingDir(Injector injector) {
    try {
        log.info("===========================================================================");
        log.info("Deleting hadoopWorkingPath.");
        log.info("===========================================================================");
        TaskConfig taskConfig = injector.getInstance(TaskConfig.class);
        HadoopTask.invokeForeignLoader("org.apache.druid.indexer.HadoopWorkingDirCleaner", new String[] { taskConfig.getHadoopWorkingPath() }, HadoopTask.buildClassLoader(null, taskConfig.getDefaultHadoopCoordinates()));
    } catch (Exception ex) {
        log.error(ex, "Failed to cleanup indexer hadoop working directory.");
    }
}
Also used : TaskConfig(org.apache.druid.indexing.common.config.TaskConfig)

Aggregations

TaskConfig (org.apache.druid.indexing.common.config.TaskConfig)24 Test (org.junit.Test)13 NoopIndexingServiceClient (org.apache.druid.client.indexing.NoopIndexingServiceClient)12 TaskStatus (org.apache.druid.indexer.TaskStatus)11 DruidNode (org.apache.druid.server.DruidNode)10 File (java.io.File)9 SegmentCacheManagerFactory (org.apache.druid.indexing.common.SegmentCacheManagerFactory)9 Task (org.apache.druid.indexing.common.task.Task)9 WorkerConfig (org.apache.druid.indexing.worker.config.WorkerConfig)9 NoopChatHandlerProvider (org.apache.druid.segment.realtime.firehose.NoopChatHandlerProvider)9 Period (org.joda.time.Period)9 Before (org.junit.Before)9 ImmutableList (com.google.common.collect.ImmutableList)8 List (java.util.List)8 TaskToolboxFactory (org.apache.druid.indexing.common.TaskToolboxFactory)8 DataSegment (org.apache.druid.timeline.DataSegment)8 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)7 TaskToolbox (org.apache.druid.indexing.common.TaskToolbox)7 TaskActionClientFactory (org.apache.druid.indexing.common.actions.TaskActionClientFactory)7 TestAppenderatorsManager (org.apache.druid.indexing.common.task.TestAppenderatorsManager)6