Search in sources :

Example 1 with CancelQuery

use of com.bakdata.conquery.models.messages.namespaces.specific.CancelQuery in project conquery by bakdata.

the class QueryProcessor method cancel.

/**
 * Cancel a running query: Sending cancellation to shards, which will cause them to stop executing them, results are not sent back, and incoming results will be discarded.
 */
public void cancel(Subject subject, Dataset dataset, ManagedExecution<?> query) {
    // Does not make sense to cancel a query that isn't running.
    if (!query.getState().equals(ExecutionState.RUNNING)) {
        return;
    }
    log.info("User[{}] cancelled Query[{}]", subject.getId(), query.getId());
    final Namespace namespace = getDatasetRegistry().get(dataset.getId());
    query.reset();
    namespace.sendToAll(new CancelQuery(query.getId()));
}
Also used : CancelQuery(com.bakdata.conquery.models.messages.namespaces.specific.CancelQuery) Namespace(com.bakdata.conquery.models.worker.Namespace)

Aggregations

CancelQuery (com.bakdata.conquery.models.messages.namespaces.specific.CancelQuery)1 Namespace (com.bakdata.conquery.models.worker.Namespace)1