Search in sources :

Example 11 with TaskResponseObject

use of org.apache.druid.testing.clients.TaskResponseObject in project druid by druid-io.

the class AbstractIndexerTest method unloadAndKillData.

protected void unloadAndKillData(final String dataSource) {
    // Get all failed task logs
    List<TaskResponseObject> allTasks = indexer.getCompleteTasksForDataSource(dataSource);
    for (TaskResponseObject task : allTasks) {
        if (task.getStatus().isFailure()) {
            LOG.info("------- START Found failed task logging for taskId=" + task.getId() + " -------");
            LOG.info("Start failed task log:");
            LOG.info(indexer.getTaskLog(task.getId()));
            LOG.info("End failed task log.");
            LOG.info("Start failed task errorMsg:");
            LOG.info(indexer.getTaskErrorMessage(task.getId()));
            LOG.info("End failed task errorMsg.");
            LOG.info("------- END Found failed task logging for taskId=" + task.getId() + " -------");
        }
    }
    List<String> intervals = coordinator.getSegmentIntervals(dataSource);
    // each element in intervals has this form:
    // 2015-12-01T23:15:00.000Z/2015-12-01T23:16:00.000Z
    // we'll sort the list (ISO dates have lexicographic order)
    // then delete segments from the 1st date in the first string
    // to the 2nd date in the last string
    Collections.sort(intervals);
    String first = intervals.get(0).split("/")[0];
    String last = intervals.get(intervals.size() - 1).split("/")[1];
    unloadAndKillData(dataSource, first, last);
}
Also used : TaskResponseObject(org.apache.druid.testing.clients.TaskResponseObject)

Aggregations

TaskResponseObject (org.apache.druid.testing.clients.TaskResponseObject)11 Closeable (java.io.Closeable)9 AbstractITBatchIndexTest (org.apache.druid.tests.indexer.AbstractITBatchIndexTest)8 AbstractIndexerTest (org.apache.druid.tests.indexer.AbstractIndexerTest)8 Test (org.testng.annotations.Test)8 UserCompactionTaskGranularityConfig (org.apache.druid.server.coordinator.UserCompactionTaskGranularityConfig)4 UniformGranularitySpec (org.apache.druid.segment.indexing.granularity.UniformGranularitySpec)3 Interval (org.joda.time.Interval)3 ISOChronology (org.joda.time.chrono.ISOChronology)3 IOException (java.io.IOException)2 Granularity (org.apache.druid.java.util.common.granularity.Granularity)2 DoubleSumAggregatorFactory (org.apache.druid.query.aggregation.DoubleSumAggregatorFactory)1 LongSumAggregatorFactory (org.apache.druid.query.aggregation.LongSumAggregatorFactory)1 SelectorDimFilter (org.apache.druid.query.filter.SelectorDimFilter)1 RowIngestionMetersTotals (org.apache.druid.segment.incremental.RowIngestionMetersTotals)1 UserCompactionTaskDimensionsConfig (org.apache.druid.server.coordinator.UserCompactionTaskDimensionsConfig)1 UserCompactionTaskTransformConfig (org.apache.druid.server.coordinator.UserCompactionTaskTransformConfig)1 JsonEventSerializer (org.apache.druid.testing.utils.JsonEventSerializer)1 StreamEventWriter (org.apache.druid.testing.utils.StreamEventWriter)1 StreamGenerator (org.apache.druid.testing.utils.StreamGenerator)1