diff --git a/backend/src/main/java/com/bakdata/conquery/apiv1/QueryProcessor.java b/backend/src/main/java/com/bakdata/conquery/apiv1/QueryProcessor.java index f201d1f6c5..5e43bc644a 100644 --- a/backend/src/main/java/com/bakdata/conquery/apiv1/QueryProcessor.java +++ b/backend/src/main/java/com/bakdata/conquery/apiv1/QueryProcessor.java @@ -3,7 +3,11 @@ import static com.bakdata.conquery.models.auth.AuthorizationHelper.buildDatasetAbilityMap; import java.net.URL; -import java.util.*; +import java.util.Collection; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; import java.util.function.Consumer; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -360,7 +364,7 @@ public FullExecutionStatus getQueryFullStatus(ManagedExecution query, User us query.initExecutable(datasetRegistry, config); Map> datasetAbilities = buildDatasetAbilityMap(user, datasetRegistry); - final FullExecutionStatus status = query.buildStatusFull(storage, user, datasetRegistry); + final FullExecutionStatus status = query.buildStatusFull(storage, user, datasetRegistry, config); if (query.isReadyToDownload(datasetAbilities)) { setDownloadUrls(status, config.getResultProviders(), query, url, allProviders); diff --git a/backend/src/main/java/com/bakdata/conquery/models/execution/ManagedExecution.java b/backend/src/main/java/com/bakdata/conquery/models/execution/ManagedExecution.java index a9f6e48b0c..90327a0577 100644 --- a/backend/src/main/java/com/bakdata/conquery/models/execution/ManagedExecution.java +++ b/backend/src/main/java/com/bakdata/conquery/models/execution/ManagedExecution.java @@ -55,13 +55,15 @@ import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.google.common.base.Preconditions; import com.google.common.util.concurrent.Uninterruptibles; -import lombok.*; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.NonNull; +import lombok.Setter; +import lombok.ToString; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.ArrayUtils; import org.apache.shiro.authz.Permission; -import static org.apache.shiro.util.StringUtils.hasText; - @Getter @Setter @ToString @@ -268,8 +270,9 @@ public OverviewExecutionStatus buildStatusOverview(UriBuilder url, User user) { * Renders an extensive status of this query (see {@link FullExecutionStatus}. The rendering can be computation intensive and can produce a large * object. The use of the full status is only intended if a client requested specific information about this execution. */ - public FullExecutionStatus buildStatusFull(@NonNull MetaStorage storage, User user, DatasetRegistry datasetRegistry) { - Preconditions.checkArgument(isInitialized(), "The execution must have been initialized first"); + public FullExecutionStatus buildStatusFull(@NonNull MetaStorage storage, User user, DatasetRegistry datasetRegistry, ConqueryConfig config) { + + initExecutable(datasetRegistry, config); FullExecutionStatus status = new FullExecutionStatus(); setStatusBase(user, status); diff --git a/backend/src/main/java/com/bakdata/conquery/resources/admin/rest/AdminResource.java b/backend/src/main/java/com/bakdata/conquery/resources/admin/rest/AdminResource.java index 20ac72e5cd..e0af8d4679 100644 --- a/backend/src/main/java/com/bakdata/conquery/resources/admin/rest/AdminResource.java +++ b/backend/src/main/java/com/bakdata/conquery/resources/admin/rest/AdminResource.java @@ -1,18 +1,30 @@ package com.bakdata.conquery.resources.admin.rest; +import static com.bakdata.conquery.resources.ResourceConstants.JOB_ID; + +import java.time.LocalDate; +import java.util.Objects; +import java.util.Optional; +import java.util.OptionalLong; +import java.util.UUID; + +import javax.inject.Inject; +import javax.ws.rs.Consumes; +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.UriBuilder; + import com.bakdata.conquery.apiv1.FullExecutionStatus; -import com.bakdata.conquery.io.jackson.Jackson; import com.bakdata.conquery.io.jersey.ExtraMimeTypes; import com.bakdata.conquery.io.storage.MetaStorage; import com.bakdata.conquery.models.auth.entities.User; -import com.bakdata.conquery.models.error.ConqueryError; -import com.bakdata.conquery.models.execution.ExecutionState; -import com.bakdata.conquery.models.execution.ManagedExecution; -import com.bakdata.conquery.models.i18n.I18n; -import com.bakdata.conquery.models.common.Range; import com.bakdata.conquery.models.config.auth.AuthenticationConfig; -import com.bakdata.conquery.models.identifiable.ids.specific.DatasetId; -import com.bakdata.conquery.models.identifiable.ids.specific.ManagedExecutionId; import com.bakdata.conquery.models.jobs.JobManagerStatus; import com.bakdata.conquery.models.messages.network.specific.CancelJobMessage; import com.bakdata.conquery.models.worker.DatasetRegistry; @@ -21,20 +33,6 @@ import com.google.common.collect.ImmutableMap; import io.dropwizard.auth.Auth; -import javax.inject.Inject; -import javax.ws.rs.*; -import javax.ws.rs.core.Cookie; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.UriBuilder; -import java.time.LocalDate; -import java.time.LocalDateTime; -import java.time.ZonedDateTime; -import java.util.*; - -import static com.bakdata.conquery.resources.ResourceConstants.JOB_ID; -import static org.apache.shiro.util.StringUtils.hasText; - @Consumes({ExtraMimeTypes.JSON_STRING, ExtraMimeTypes.SMILE_STRING}) @Produces(ExtraMimeTypes.JSON_STRING) @Path("/") @@ -101,7 +99,7 @@ public FullExecutionStatus[] getQueries(@Auth User currentUser, @QueryParam("lim final MetaStorage storage = processor.getStorage(); final DatasetRegistry datasetRegistry = processor.getDatasetRegistry(); return storage.getAllExecutions().stream() - .map(t -> t.buildStatusFull(storage, currentUser, datasetRegistry)) + .map(t -> t.buildStatusFull(storage, currentUser, datasetRegistry, processor.getConfig())) .filter(t -> t.getCreatedAt().toLocalDate().isEqual(since.map(LocalDate::parse).orElse(LocalDate.now()))) .limit(limit.orElse(100)) .toArray(FullExecutionStatus[]::new);