use of com.bakdata.conquery.models.error.ConqueryError in project conquery by bakdata.
the class ExecuteForm method react.
@Override
public void react(Worker worker) throws Exception {
log.info("Started Form {}", formId);
// Execution might have been cancelled before so we uncancel it here.
final QueryExecutor queryExecutor = worker.getQueryExecutor();
queryExecutor.unsetQueryCancelled(formId);
// Execute all plans.
for (Entry<ManagedExecutionId, Query> entry : queries.entrySet()) {
final Query query = entry.getValue();
ShardResult result = createResult(worker, entry.getKey());
// Before we start the query, we create it once to test if it will succeed before creating it multiple times for evaluation per core.
try {
query.createQueryPlan(new QueryPlanContext(worker));
} catch (Exception e) {
ConqueryError err = asConqueryError(e);
log.warn("Failed to create query plans for {}.", formId, err);
queryExecutor.sendFailureToManagerNode(result, err);
return;
}
final QueryExecutionContext subQueryContext = new QueryExecutionContext(formId, queryExecutor, worker.getStorage(), worker.getBucketManager());
if (!queryExecutor.execute(query, subQueryContext, result)) {
return;
}
}
}
use of com.bakdata.conquery.models.error.ConqueryError in project conquery by bakdata.
the class ExecuteQuery method react.
@Override
public void react(Worker worker) throws Exception {
final ManagedExecutionId executionId = id;
log.info("Started {} {}", query.getClass().getSimpleName(), executionId);
// Execution might have been cancelled before so we uncancel it here.
final QueryExecutor queryExecutor = worker.getQueryExecutor();
queryExecutor.unsetQueryCancelled(executionId);
final ShardResult result = createShardResult(worker);
// Before we start the query, we create it once to test if it will succeed before creating it multiple times for evaluation per core.
try {
query.createQueryPlan(new QueryPlanContext(worker));
} catch (Exception e) {
ConqueryError err = asConqueryError(e);
log.warn("Failed to create query plans for {}.", executionId, err);
queryExecutor.sendFailureToManagerNode(result, err);
return;
}
final QueryExecutionContext executionContext = new QueryExecutionContext(executionId, queryExecutor, worker.getStorage(), worker.getBucketManager());
queryExecutor.execute(query, executionContext, result);
}
use of com.bakdata.conquery.models.error.ConqueryError in project conquery by bakdata.
the class SerializationTests method executionQueryJobError.
@Test
public void executionQueryJobError() throws JSONException, IOException {
log.info("Beware, this test will print an ERROR message.");
ConqueryError error = new ConqueryError.ExecutionJobErrorWrapper(new Entity(5), new ConqueryError.UnknownError(null));
SerializationTestUtil.forType(ConqueryError.class).test(error);
}
use of com.bakdata.conquery.models.error.ConqueryError in project conquery by bakdata.
the class QueryJob method get.
@Override
public Optional<EntityResult> get() {
if (ctx.isQueryCancelled()) {
return Optional.empty();
}
try {
QueryPlan queryPlan = plan.get();
queryPlan.init(ctx, entity);
return queryPlan.execute(ctx, entity);
} catch (ConqueryError e) {
// Catch errors, propagate them with their id.
throw new ConqueryError.ExecutionJobErrorWrapper(entity, e);
} catch (Exception e) {
throw new ConqueryError.ExecutionJobErrorWrapper(entity, new ConqueryError.UnknownError(e));
}
}
use of com.bakdata.conquery.models.error.ConqueryError in project conquery by bakdata.
the class AdminResource method getQueries.
@GET
@Path("/queries")
public FullExecutionStatus[] getQueries(@Auth Subject currentUser, @QueryParam("limit") OptionalLong limit, @QueryParam("since") Optional<String> since) {
final MetaStorage storage = processor.getStorage();
final DatasetRegistry datasetRegistry = processor.getDatasetRegistry();
return storage.getAllExecutions().stream().map(t -> {
try {
return t.buildStatusFull(storage, currentUser, datasetRegistry, processor.getConfig());
} catch (ConqueryError e) {
// Initialization of execution probably failed, so we construct a status based on the overview status
final FullExecutionStatus fullExecutionStatus = new FullExecutionStatus();
t.setStatusBase(currentUser, fullExecutionStatus);
fullExecutionStatus.setStatus(ExecutionState.FAILED);
fullExecutionStatus.setError(e);
return fullExecutionStatus;
}
}).filter(t -> t.getCreatedAt().toLocalDate().isEqual(since.map(LocalDate::parse).orElse(LocalDate.now()))).limit(limit.orElse(100)).toArray(FullExecutionStatus[]::new);
}
Aggregations