Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switched out for runtime exceptions #1785

Merged
merged 1 commit into from
Jan 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ private void runLoad(BulkLoadFileHistory history, List<BiogridOrcFmsDTO> biogrid
}
ph.progressProcess();
if (Thread.currentThread().isInterrupted()) {
Log.info("Thread Interrupted:");
break;
history.setErrorMessage("Thread isInterrupted");
throw new RuntimeException("Thread isInterrupted");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ public void execLoad(BulkLoadFileHistory bulkLoadFileHistory) throws IOException
}

private void runLoad(BulkLoadFileHistory history, BackendBulkDataProvider dataProvider, List<String> identifiers) {
if (Thread.currentThread().isInterrupted()) {
history.setErrorMessage("Thread isInterrupted");
throw new RuntimeException("Thread isInterrupted");
}

ProcessDisplayHelper ph = new ProcessDisplayHelper();
ph.addDisplayHandler(loadProcessDisplayService);
if (CollectionUtils.isNotEmpty(identifiers)) {
Expand Down Expand Up @@ -89,8 +94,8 @@ private void runLoad(BulkLoadFileHistory history, BackendBulkDataProvider dataPr
}
ph.progressProcess();
if (Thread.currentThread().isInterrupted()) {
Log.info("Thread Interrupted:");
break;
history.setErrorMessage("Thread isInterrupted");
throw new RuntimeException("Thread isInterrupted");
}
}
updateHistory(history);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import org.alliancegenome.curation_api.util.ProcessDisplayHelper;
import org.apache.commons.lang3.StringUtils;

import io.quarkus.logging.Log;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;

Expand Down Expand Up @@ -112,8 +111,8 @@ private void loadExperiments(BulkLoadFileHistory history, BackendBulkDataProvide
}
ph.progressProcess();
if (Thread.currentThread().isInterrupted()) {
Log.info("Thread Interrupted:");
break;
history.setErrorMessage("Thread isInterrupted");
throw new RuntimeException("Thread isInterrupted");
}
}
updateHistory(history);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import org.alliancegenome.curation_api.util.ProcessDisplayHelper;
import org.apache.commons.lang3.StringUtils;

import io.quarkus.logging.Log;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
import lombok.extern.jbosslog.JBossLog;
Expand Down Expand Up @@ -110,8 +109,8 @@ public void execLoad(BulkLoadFileHistory bulkLoadFileHistory) throws IOException
}
ph.progressProcess();
if (Thread.currentThread().isInterrupted()) {
Log.info("Thread Interrupted:");
break;
bulkLoadFileHistory.setErrorMessage("Thread isInterrupted");
throw new RuntimeException("Thread isInterrupted");
}
}
bulkLoadFileHistory.setTotalCount(dtos.size());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ public void execLoad(BulkLoadFileHistory bulkLoadFileHistory) throws IOException
}

private void runLoad(BulkLoadFileHistory history, BackendBulkDataProvider dataProvider, List<String> entrezIds) {
if (Thread.currentThread().isInterrupted()) {
history.setErrorMessage("Thread isInterrupted");
throw new RuntimeException("Thread isInterrupted");
}
ProcessDisplayHelper ph = new ProcessDisplayHelper();
ph.addDisplayHandler(loadProcessDisplayService);
if (CollectionUtils.isNotEmpty(entrezIds)) {
Expand Down Expand Up @@ -92,8 +96,8 @@ private void runLoad(BulkLoadFileHistory history, BackendBulkDataProvider dataPr
}
ph.progressProcess();
if (Thread.currentThread().isInterrupted()) {
Log.info("Thread Interrupted:");
break;
history.setErrorMessage("Thread isInterrupted");
throw new RuntimeException("Thread isInterrupted");
}
}
updateHistory(history);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ private boolean runLoad(BulkLoadFileHistory history, BackendBulkDataProvider dat
}
ph.progressProcess();
if (Thread.currentThread().isInterrupted()) {
Log.info("Thread Interrupted:");
break;
history.setErrorMessage("Thread isInterrupted");
throw new RuntimeException("Thread isInterrupted");
}
}
updateHistory(history);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ protected <E extends AuditedObject, T extends BaseDTO> boolean runLoad(BaseUpser

protected <E extends AuditedObject, T extends BaseDTO> boolean runLoad(BaseUpsertServiceInterface<E, T> service, BulkLoadFileHistory history, BackendBulkDataProvider dataProvider, List<T> objectList, List<Long> idsAdded, Boolean terminateFailing, String countType, String dataType) {
if (Thread.currentThread().isInterrupted()) {
history.setErrorMessage("Thread isInterrupted");
throw new RuntimeException("Thread isInterrupted");
}
ProcessDisplayHelper ph = new ProcessDisplayHelper();
Expand Down Expand Up @@ -259,6 +260,7 @@ protected <E extends AuditedObject, T extends BaseDTO> boolean runLoad(BaseUpser
}
ph.progressProcess();
if (Thread.currentThread().isInterrupted()) {
history.setErrorMessage("Thread isInterrupted");
throw new RuntimeException("Thread isInterrupted");
}
}
Expand All @@ -276,6 +278,7 @@ protected <E extends AuditedObject, T extends BaseDTO> boolean runLoad(BaseUpser
// The following methods are for bulk validation
protected <S extends BaseEntityCrudService<?, ?>> void runCleanup(S service, BulkLoadFileHistory history, String dataProviderName, List<Long> annotationIdsBefore, List<Long> annotationIdsAfter, String loadTypeString, Boolean deprecate) {
if (Thread.currentThread().isInterrupted()) {
history.setErrorMessage("Thread isInterrupted");
throw new RuntimeException("Thread isInterrupted");
}
Log.debug("runLoad: After: " + dataProviderName + " " + annotationIdsAfter.size());
Expand Down Expand Up @@ -312,6 +315,7 @@ protected <E extends AuditedObject, T extends BaseDTO> boolean runLoad(BaseUpser
}
ph.progressProcess();
if (Thread.currentThread().isInterrupted()) {
history.setErrorMessage("Thread isInterrupted");
throw new RuntimeException("Thread isInterrupted");
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@
import org.alliancegenome.curation_api.services.processing.LoadProcessDisplayService;
import org.alliancegenome.curation_api.util.ProcessDisplayHelper;

import io.quarkus.logging.Log;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
import lombok.extern.jbosslog.JBossLog;
Expand Down Expand Up @@ -275,8 +274,8 @@ private void processTerms(BulkLoadFileHistory bulkLoadFileHistory, OntologyBulkL
bulkLoadFileHistory.incrementCompleted(countType);
ph.progressProcess();
if (Thread.currentThread().isInterrupted()) {
Log.info("Thread Interrupted:");
break;
bulkLoadFileHistory.setErrorMessage("Thread isInterrupted");
throw new RuntimeException("Thread isInterrupted");
}
}
ph.finishProcess();
Expand All @@ -290,8 +289,8 @@ private void processTerms(BulkLoadFileHistory bulkLoadFileHistory, OntologyBulkL
bulkLoadFileHistory.incrementCompleted(countType);
ph1.progressProcess();
if (Thread.currentThread().isInterrupted()) {
Log.info("Thread Interrupted:");
break;
bulkLoadFileHistory.setErrorMessage("Thread isInterrupted");
throw new RuntimeException("Thread isInterrupted");
}
}
ph1.finishProcess();
Expand All @@ -305,8 +304,8 @@ private void processTerms(BulkLoadFileHistory bulkLoadFileHistory, OntologyBulkL
bulkLoadFileHistory.incrementCompleted(countType);
ph2.progressProcess();
if (Thread.currentThread().isInterrupted()) {
Log.info("Thread Interrupted:");
break;
bulkLoadFileHistory.setErrorMessage("Thread isInterrupted");
throw new RuntimeException("Thread isInterrupted");
}
}
ph2.finishProcess();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;

import io.quarkus.logging.Log;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;

Expand Down Expand Up @@ -115,8 +114,8 @@ private void loadSecondaryAnnotations(BulkLoadFileHistory history, List<Phenotyp

ph.progressProcess();
if (Thread.currentThread().isInterrupted()) {
Log.info("Thread Interrupted:");
break;
history.setErrorMessage("Thread isInterrupted");
throw new RuntimeException("Thread isInterrupted");
}
}
updateHistory(history);
Expand Down Expand Up @@ -147,8 +146,8 @@ private void loadPrimaryAnnotations(BulkLoadFileHistory history, List<PhenotypeF

ph.progressProcess();
if (Thread.currentThread().isInterrupted()) {
Log.info("Thread Interrupted:");
break;
history.setErrorMessage("Thread isInterrupted");
throw new RuntimeException("Thread isInterrupted");
}
}
updateHistory(history);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import org.alliancegenome.curation_api.util.ProcessDisplayHelper;
import org.apache.commons.lang3.StringUtils;

import io.quarkus.logging.Log;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;

Expand Down Expand Up @@ -131,8 +130,8 @@ private void loadSequenceTargetingReagents(BulkLoadFileHistory history, List<Seq
updateHistory(history);
ph.progressProcess();
if (Thread.currentThread().isInterrupted()) {
Log.info("Thread Interrupted:");
break;
history.setErrorMessage("Thread isInterrupted");
throw new RuntimeException("Thread isInterrupted");
}
}
}
Expand All @@ -158,8 +157,8 @@ private void loadSequenceTargetingReagentGeneAssociations(BulkLoadFileHistory hi
updateHistory(history);
ph.progressProcess();
if (Thread.currentThread().isInterrupted()) {
Log.info("Thread Interrupted:");
break;
history.setErrorMessage("Thread isInterrupted");
throw new RuntimeException("Thread isInterrupted");
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import org.alliancegenome.curation_api.util.ProcessDisplayHelper;
import org.apache.commons.lang3.StringUtils;

import io.quarkus.logging.Log;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;

Expand Down Expand Up @@ -126,8 +125,8 @@ private boolean runLoad(
}
ph.progressProcess();
if (Thread.currentThread().isInterrupted()) {
Log.info("Thread Interrupted:");
break;
history.setErrorMessage("Thread isInterrupted");
throw new RuntimeException("Thread isInterrupted");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ public void execLoad(BulkLoadFileHistory bulkLoadFileHistory) {
}

protected boolean runLoad(BulkLoadFileHistory history, BackendBulkDataProvider dataProvider, List<VepTxtDTO> objectList, List<Long> idsUpdated) {
if (Thread.currentThread().isInterrupted()) {
history.setErrorMessage("Thread isInterrupted");
throw new RuntimeException("Thread isInterrupted");
}

ProcessDisplayHelper ph = new ProcessDisplayHelper();
ph.addDisplayHandler(loadProcessDisplayService);
if (CollectionUtils.isNotEmpty(objectList)) {
Expand Down Expand Up @@ -107,8 +112,8 @@ protected boolean runLoad(BulkLoadFileHistory history, BackendBulkDataProvider d
}
ph.progressProcess();
if (Thread.currentThread().isInterrupted()) {
Log.info("Thread Interrupted:");
break;
history.setErrorMessage("Thread isInterrupted");
throw new RuntimeException("Thread isInterrupted");
}
}
updateHistory(history);
Expand Down Expand Up @@ -152,8 +157,8 @@ protected void runCleanup(BulkLoadFileHistory history, String dataProviderName,
}
ph.progressProcess();
if (Thread.currentThread().isInterrupted()) {
Log.info("Thread Interrupted:");
break;
history.setErrorMessage("Thread isInterrupted");
throw new RuntimeException("Thread isInterrupted");
}
}
updateHistory(history);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import com.fasterxml.jackson.dataformat.csv.CsvParser;
import com.fasterxml.jackson.dataformat.csv.CsvSchema;

import io.quarkus.logging.Log;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;

Expand Down Expand Up @@ -153,8 +152,8 @@ private boolean runLoad(
}
ph.progressProcess();
if (Thread.currentThread().isInterrupted()) {
Log.info("Thread Interrupted:");
break;
history.setErrorMessage("Thread isInterrupted");
throw new RuntimeException("Thread isInterrupted");
}
}
updateHistory(history);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import com.fasterxml.jackson.dataformat.csv.CsvParser;
import com.fasterxml.jackson.dataformat.csv.CsvSchema;

import io.quarkus.logging.Log;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;

Expand Down Expand Up @@ -157,8 +156,8 @@ private boolean runLoad(

ph.progressProcess();
if (Thread.currentThread().isInterrupted()) {
Log.info("Thread Interrupted:");
break;
history.setErrorMessage("Thread isInterrupted");
throw new RuntimeException("Thread isInterrupted");
}
}
updateHistory(history);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import com.fasterxml.jackson.dataformat.csv.CsvParser;
import com.fasterxml.jackson.dataformat.csv.CsvSchema;

import io.quarkus.logging.Log;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;

Expand Down Expand Up @@ -154,8 +153,8 @@ private boolean runLoad(
}
ph.progressProcess();
if (Thread.currentThread().isInterrupted()) {
Log.info("Thread Interrupted:");
break;
history.setErrorMessage("Thread isInterrupted");
throw new RuntimeException("Thread isInterrupted");
}
}
updateHistory(history);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ public void bulkLoadFile(@ObservesAsync StartedLoadJobEvent event) { // An @Obse
} catch (Exception e) {
endLoad(bulkLoadFileHistory, "Failed loading: " + bulkLoadFileHistory.getBulkLoad().getName() + " please check the logs for more info. " + bulkLoadFileHistory.getErrorMessage(), JobStatus.FAILED);
Log.error("Load File: " + bulkLoadFileHistory.getBulkLoad().getName() + " is failed");
e.printStackTrace();
if (!bulkLoadFileHistory.getErrorMessage().equals("Thread isInterrupted")) {
e.printStackTrace();
}
}

}
Expand Down
Loading