Search in sources :

Example 1 with StatsSettings

use of com.datastax.oss.dsbulk.workflow.commons.settings.StatsSettings in project dsbulk by datastax.

the class CountWorkflow method init.

@Override
public void init() throws Exception {
    settingsManager.init("COUNT", false, SchemaGenerationStrategy.READ_AND_COUNT);
    executionId = settingsManager.getExecutionId();
    LogSettings logSettings = settingsManager.getLogSettings();
    DriverSettings driverSettings = settingsManager.getDriverSettings();
    SchemaSettings schemaSettings = settingsManager.getSchemaSettings();
    ExecutorSettings executorSettings = settingsManager.getExecutorSettings();
    CodecSettings codecSettings = settingsManager.getCodecSettings();
    MonitoringSettings monitoringSettings = settingsManager.getMonitoringSettings();
    EngineSettings engineSettings = settingsManager.getEngineSettings();
    StatsSettings statsSettings = settingsManager.getStatsSettings();
    engineSettings.init();
    // First verify that dry-run is off; that's unsupported for count.
    if (engineSettings.isDryRun()) {
        throw new IllegalArgumentException("Dry-run is not supported for count");
    }
    logSettings.init();
    driverSettings.init(false);
    logSettings.logEffectiveSettings(settingsManager.getEffectiveBulkLoaderConfig(), driverSettings.getDriverConfig());
    codecSettings.init();
    monitoringSettings.init();
    executorSettings.init();
    statsSettings.init();
    ConvertingCodecFactory codecFactory = codecSettings.createCodecFactory(schemaSettings.isAllowExtraFields(), schemaSettings.isAllowMissingFields());
    session = driverSettings.newSession(executionId, codecFactory.getCodecRegistry(), monitoringSettings.getRegistry());
    ClusterInformationUtils.printDebugInfoAboutCluster(session);
    schemaSettings.init(session, codecFactory, false, false);
    logManager = logSettings.newLogManager(session, false);
    logManager.init();
    metricsManager = monitoringSettings.newMetricsManager(false, false, logManager.getOperationDirectory(), logSettings.getVerbosity(), session.getContext().getProtocolVersion(), session.getContext().getCodecRegistry(), schemaSettings.getRowType());
    metricsManager.init();
    executor = executorSettings.newReadExecutor(session, metricsManager.getExecutionListener(), false);
    EnumSet<StatsSettings.StatisticsMode> modes = statsSettings.getStatisticsModes();
    int numPartitions = statsSettings.getNumPartitions();
    readResultCounter = schemaSettings.createReadResultCounter(session, codecFactory, modes, numPartitions);
    readStatements = schemaSettings.createReadStatements(session);
    closed.set(false);
    success = false;
    totalItemsMonitor = metricsManager.newTotalItemsMonitor();
    failedItemsMonitor = metricsManager.newFailedItemsMonitor();
    totalItemsCounter = logManager.newTotalItemsCounter();
    failedReadsHandler = logManager.newFailedReadsHandler();
    queryWarningsHandler = logManager.newQueryWarningsHandler();
    terminationHandler = logManager.newTerminationHandler();
    int numCores = Runtime.getRuntime().availableProcessors();
    readConcurrency = Math.min(readStatements.size(), engineSettings.getMaxConcurrentQueries().orElse(numCores));
    LOGGER.debug("Using read concurrency: {} (user-supplied: {})", readConcurrency, engineSettings.getMaxConcurrentQueries().isPresent());
    int numThreads = Math.min(readConcurrency, numCores);
    scheduler = Schedulers.newParallel(numThreads, new DefaultThreadFactory("workflow"));
}
Also used : ExecutorSettings(com.datastax.oss.dsbulk.workflow.commons.settings.ExecutorSettings) ConvertingCodecFactory(com.datastax.oss.dsbulk.codecs.api.ConvertingCodecFactory) EngineSettings(com.datastax.oss.dsbulk.workflow.commons.settings.EngineSettings) LogSettings(com.datastax.oss.dsbulk.workflow.commons.settings.LogSettings) StatsSettings(com.datastax.oss.dsbulk.workflow.commons.settings.StatsSettings) MonitoringSettings(com.datastax.oss.dsbulk.workflow.commons.settings.MonitoringSettings) SchemaSettings(com.datastax.oss.dsbulk.workflow.commons.settings.SchemaSettings) CodecSettings(com.datastax.oss.dsbulk.workflow.commons.settings.CodecSettings) DefaultThreadFactory(io.netty.util.concurrent.DefaultThreadFactory) DriverSettings(com.datastax.oss.dsbulk.workflow.commons.settings.DriverSettings)

Aggregations

ConvertingCodecFactory (com.datastax.oss.dsbulk.codecs.api.ConvertingCodecFactory)1 CodecSettings (com.datastax.oss.dsbulk.workflow.commons.settings.CodecSettings)1 DriverSettings (com.datastax.oss.dsbulk.workflow.commons.settings.DriverSettings)1 EngineSettings (com.datastax.oss.dsbulk.workflow.commons.settings.EngineSettings)1 ExecutorSettings (com.datastax.oss.dsbulk.workflow.commons.settings.ExecutorSettings)1 LogSettings (com.datastax.oss.dsbulk.workflow.commons.settings.LogSettings)1 MonitoringSettings (com.datastax.oss.dsbulk.workflow.commons.settings.MonitoringSettings)1 SchemaSettings (com.datastax.oss.dsbulk.workflow.commons.settings.SchemaSettings)1 StatsSettings (com.datastax.oss.dsbulk.workflow.commons.settings.StatsSettings)1 DefaultThreadFactory (io.netty.util.concurrent.DefaultThreadFactory)1