Search in sources :

Example 1 with Workers

use of com.bakdata.conquery.models.worker.Workers in project conquery by bakdata.

the class ShardNode method run.

@Override
protected void run(Environment environment, Namespace namespace, ConqueryConfig config) throws Exception {
    this.environment = environment;
    connector = new NioSocketConnector();
    jobManager = new JobManager(getName(), config.isFailOnError());
    synchronized (environment) {
        environment.lifecycle().manage(this);
        validator = environment.getValidator();
        scheduler = environment.lifecycle().scheduledExecutorService("Scheduled Messages").build();
    }
    this.config = config;
    config.initialize(this);
    scheduler.scheduleAtFixedRate(this::reportJobManagerStatus, 30, 1, TimeUnit.SECONDS);
    final ObjectMapper binaryMapper = config.configureObjectMapper(Jackson.copyMapperAndInjectables(Jackson.BINARY_MAPPER));
    ((MutableInjectableValues) binaryMapper.getInjectableValues()).add(Validator.class, environment.getValidator());
    workers = new Workers(getConfig().getQueries().getExecutionPool(), binaryMapper, getConfig().getCluster().getEntityBucketSize());
    final Collection<WorkerStorage> workerStorages = config.getStorage().loadWorkerStorages();
    for (WorkerStorage workerStorage : workerStorages) {
        workers.createWorker(workerStorage, config.isFailOnError());
    }
    log.info("All Worker Storages loaded: {}", workers.getWorkers().size());
}
Also used : NioSocketConnector(org.apache.mina.transport.socket.nio.NioSocketConnector) Workers(com.bakdata.conquery.models.worker.Workers) MutableInjectableValues(com.bakdata.conquery.io.jackson.MutableInjectableValues) JobManager(com.bakdata.conquery.models.jobs.JobManager) WorkerStorage(com.bakdata.conquery.io.storage.WorkerStorage) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)

Aggregations

MutableInjectableValues (com.bakdata.conquery.io.jackson.MutableInjectableValues)1 WorkerStorage (com.bakdata.conquery.io.storage.WorkerStorage)1 JobManager (com.bakdata.conquery.models.jobs.JobManager)1 Workers (com.bakdata.conquery.models.worker.Workers)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 NioSocketConnector (org.apache.mina.transport.socket.nio.NioSocketConnector)1