From 8e14d4dbe08bbd420616593626c9150e7bd70689 Mon Sep 17 00:00:00 2001 From: LSmyrnaios Date: Tue, 30 Apr 2024 23:43:52 +0300 Subject: [PATCH] - Fix not counting the files from the bulkImport-segment, which failed due to an exception. - Write segment-exception-messages to the bulkImport-report. --- .../urls_controller/services/BulkImportServiceImpl.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/eu/openaire/urls_controller/services/BulkImportServiceImpl.java b/src/main/java/eu/openaire/urls_controller/services/BulkImportServiceImpl.java index 9407e86..0725d5f 100644 --- a/src/main/java/eu/openaire/urls_controller/services/BulkImportServiceImpl.java +++ b/src/main/java/eu/openaire/urls_controller/services/BulkImportServiceImpl.java @@ -156,13 +156,19 @@ public class BulkImportServiceImpl implements BulkImportService { // The failed-to-be-imported files, will not be deleted, even if the user specifies that he wants to delete the directory. } catch (ExecutionException ee) { // These can be serious errors like an "out of memory exception" (Java HEAP). numFailedSegments ++; + numAllFailedFiles += subLists.get(i).size(); // We assume all files of this segment failed, as all are passed through the same parts of code, so any serious exception should arise from the 1st files being processed and the rest of the files wil be skipped.. logger.error(GenericUtils.getSelectedStackTraceForCausedException(ee, "Task_" + i + " failed with: ", additionalLoggingMsg, 15)); + bulkImportReport.addEvent("Segment_" + i + " failed with: " + ee.getCause().getMessage()); } catch (CancellationException ce) { numFailedSegments ++; + numAllFailedFiles += subLists.get(i).size(); // We assume all files have failed. logger.error("Task_" + i + " was cancelled: " + ce.getMessage() + additionalLoggingMsg); + bulkImportReport.addEvent("Segment_" + i + " failed with: " + ce.getMessage()); } catch (InterruptedException ie) { numFailedSegments ++; + numAllFailedFiles += (subLists.get(i).size() / 3); // In this case, only some of the files will have failed (do not know how many). logger.error("Task_" + i + " was interrupted: " + ie.getMessage()); + bulkImportReport.addEvent("Segment_" + i + " failed with: " + ie.getMessage()); } catch (IndexOutOfBoundsException ioobe) { logger.error("IOOBE for task_" + i + " in the futures-list! " + ioobe.getMessage() + additionalLoggingMsg); }