Search in sources :

Example 1 with CalculateCBlocksJob

use of com.bakdata.conquery.models.jobs.CalculateCBlocksJob in project conquery by bakdata.

the class BucketManager method addConcept.

public void addConcept(Concept<?> concept) {
    storage.updateConcept(concept);
    if (!(concept instanceof TreeConcept)) {
        return;
    }
    CalculateCBlocksJob job = new CalculateCBlocksJob(storage, this, worker.getJobsExecutorService());
    for (ConceptTreeConnector connector : ((TreeConcept) concept).getConnectors()) {
        for (Bucket bucket : storage.getAllBuckets()) {
            if (!bucket.getTable().equals(connector.getTable())) {
                continue;
            }
            final CBlockId cBlockId = new CBlockId(bucket.getId(), connector.getId());
            if (hasCBlock(cBlockId)) {
                continue;
            }
            job.addCBlock(bucket, connector);
        }
    }
    jobManager.addSlowJob(job);
}
Also used : CBlockId(com.bakdata.conquery.models.identifiable.ids.specific.CBlockId) TreeConcept(com.bakdata.conquery.models.datasets.concepts.tree.TreeConcept) ConceptTreeConnector(com.bakdata.conquery.models.datasets.concepts.tree.ConceptTreeConnector) CalculateCBlocksJob(com.bakdata.conquery.models.jobs.CalculateCBlocksJob)

Example 2 with CalculateCBlocksJob

use of com.bakdata.conquery.models.jobs.CalculateCBlocksJob in project conquery by bakdata.

the class BucketManager method addBucket.

public void addBucket(Bucket bucket) {
    storage.addBucket(bucket);
    registerBucket(bucket, entities, tableToBuckets);
    CalculateCBlocksJob job = new CalculateCBlocksJob(storage, this, worker.getJobsExecutorService());
    for (Concept<?> concept : storage.getAllConcepts()) {
        if (!(concept instanceof TreeConcept)) {
            continue;
        }
        for (ConceptTreeConnector connector : ((TreeConcept) concept).getConnectors()) {
            if (!connector.getTable().equals(bucket.getTable())) {
                continue;
            }
            CBlockId cBlockId = new CBlockId(bucket.getId(), connector.getId());
            if (hasCBlock(cBlockId)) {
                continue;
            }
            job.addCBlock(bucket, connector);
        }
    }
    jobManager.addSlowJob(job);
}
Also used : CBlockId(com.bakdata.conquery.models.identifiable.ids.specific.CBlockId) TreeConcept(com.bakdata.conquery.models.datasets.concepts.tree.TreeConcept) ConceptTreeConnector(com.bakdata.conquery.models.datasets.concepts.tree.ConceptTreeConnector) CalculateCBlocksJob(com.bakdata.conquery.models.jobs.CalculateCBlocksJob)

Example 3 with CalculateCBlocksJob

use of com.bakdata.conquery.models.jobs.CalculateCBlocksJob in project conquery by bakdata.

the class BucketManager method fullUpdate.

@SneakyThrows
public void fullUpdate() {
    CalculateCBlocksJob job = new CalculateCBlocksJob(storage, this, worker.getJobsExecutorService());
    for (Concept<?> c : storage.getAllConcepts()) {
        if (!(c instanceof TreeConcept)) {
            continue;
        }
        for (ConceptTreeConnector con : ((TreeConcept) c).getConnectors()) {
            for (Bucket bucket : storage.getAllBuckets()) {
                CBlockId cBlockId = new CBlockId(bucket.getId(), con.getId());
                if (!con.getTable().equals(bucket.getTable())) {
                    continue;
                }
                if (hasCBlock(cBlockId)) {
                    log.trace("Skip calculation of CBlock[{}], because it was loaded from the storage.", cBlockId);
                    continue;
                }
                log.warn("CBlock[{}] missing in Storage. Queuing recalculation", cBlockId);
                job.addCBlock(bucket, con);
            }
        }
    }
    if (!job.isEmpty()) {
        jobManager.addSlowJob(job);
    }
}
Also used : CBlockId(com.bakdata.conquery.models.identifiable.ids.specific.CBlockId) TreeConcept(com.bakdata.conquery.models.datasets.concepts.tree.TreeConcept) ConceptTreeConnector(com.bakdata.conquery.models.datasets.concepts.tree.ConceptTreeConnector) CalculateCBlocksJob(com.bakdata.conquery.models.jobs.CalculateCBlocksJob) SneakyThrows(lombok.SneakyThrows)

Aggregations

ConceptTreeConnector (com.bakdata.conquery.models.datasets.concepts.tree.ConceptTreeConnector)3 TreeConcept (com.bakdata.conquery.models.datasets.concepts.tree.TreeConcept)3 CBlockId (com.bakdata.conquery.models.identifiable.ids.specific.CBlockId)3 CalculateCBlocksJob (com.bakdata.conquery.models.jobs.CalculateCBlocksJob)3 SneakyThrows (lombok.SneakyThrows)1