From 87db5ae6ab7d39c26335cce0b8d8f42340b0af42 Mon Sep 17 00:00:00 2001 From: Douglas Gillespie <50671166+douggillespie@users.noreply.github.com> Date: Fri, 7 Apr 2023 18:36:51 +0100 Subject: [PATCH 1/2] Merge batch support (#103) * Update FileListWorker.java * Support batch processing Multicast controller and a couple of additional commands to work with the batch processing plugin. * Database float unpack Better unpacking checks of floats coming back from the database * Batch changes Changes in support of batch processing --- src/Acquisition/FolderInputSystem.java | 20 ++++++++++++++++--- src/PamController/command/ExitCommand.java | 5 ++++- .../fileprocessing/ReprocessManager.java | 8 +++++++- 3 files changed, 28 insertions(+), 5 deletions(-) diff --git a/src/Acquisition/FolderInputSystem.java b/src/Acquisition/FolderInputSystem.java index 5c51f56c..731c3439 100644 --- a/src/Acquisition/FolderInputSystem.java +++ b/src/Acquisition/FolderInputSystem.java @@ -876,16 +876,30 @@ public class FolderInputSystem extends FileInputSystem implements PamSettings, D * processing will continue from there. */ if (allFiles == null || allFiles.size() == 0) { + System.out.println("Daq setanal start time: no files to check against"); return false; } + System.out.printf("setAnalysisStarttTime: checking %d files for start time of %s\n", allFiles.size(), PamCalendar.formatDBDateTime(startTime)); + /* + * If the starttime is maxint then there is nothing to do, but we do need to set the file index + * correctly to not over confuse the batch processing system. + */ + long lastFileTime = getFileStartTime(allFiles.get(allFiles.size()-1).getAbsoluteFile()); + if (startTime > lastFileTime) { + currentFile = allFiles.size(); + System.out.println("Folder Acquisition processing is complete and no files require processing"); + return true; + } for (int i = 0; i < allFiles.size(); i++) { long fileStart = getFileStartTime(allFiles.get(i).getAbsoluteFile()); if (fileStart >= startTime) { currentFile = i; PamCalendar.setSoundFile(true); - PamCalendar.setSessionStartTime(startTime); - System.out.printf("Sound Acquisition start processing at file %s time %s\n", allFiles.get(i).getName(), - PamCalendar.formatDBDateTime(fileStart)); + if (startTime > 0) { + PamCalendar.setSessionStartTime(startTime); + System.out.printf("Sound Acquisition start processing at file %s time %s\n", allFiles.get(i).getName(), + PamCalendar.formatDBDateTime(fileStart)); + } return true; } } diff --git a/src/PamController/command/ExitCommand.java b/src/PamController/command/ExitCommand.java index 0871c7f2..f12a6dd6 100644 --- a/src/PamController/command/ExitCommand.java +++ b/src/PamController/command/ExitCommand.java @@ -20,7 +20,10 @@ public class ExitCommand extends ExtCommand { public String execute(String command) { PamController.getInstance().pamStop(); PamSettingManager.getInstance().saveFinalSettings(); - System.exit(0); + PamController pamController = PamController.getInstance(); + pamController.pamClose(); + // shut down the JavaFX thread and the JVM + pamController.shutDownPamguard(); return getName(); } diff --git a/src/PamController/fileprocessing/ReprocessManager.java b/src/PamController/fileprocessing/ReprocessManager.java index 69ebf54f..2272d3cf 100644 --- a/src/PamController/fileprocessing/ReprocessManager.java +++ b/src/PamController/fileprocessing/ReprocessManager.java @@ -54,13 +54,19 @@ public class ReprocessManager { // need to decide what to do based on the list of possible choices. ReprocessStoreChoice choice = chosePartStoreAction(choiceSummary); + + /** + * Need to call this even though we aren't reprocessing so that + * the Folderinput stream reports correctly on how many files have + * been processed. + */ + boolean setupOK = setupInputStream(choiceSummary, choice); if (choice == ReprocessStoreChoice.DONTSSTART) { return false; } boolean deleteOK = deleteOldData(choiceSummary, choice); - boolean setupOK = setupInputStream(choiceSummary, choice); return true; From 57bae3c39c1f92c4748bf367a6d9fc498542277a Mon Sep 17 00:00:00 2001 From: Douglas Gillespie <50671166+douggillespie@users.noreply.github.com> Date: Thu, 13 Apr 2023 17:05:40 +0100 Subject: [PATCH 2/2] Fix reprocess manager Stop it responding with stupid questions when there are no part complete stores. --- src/PamController/fileprocessing/ReprocessManager.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/PamController/fileprocessing/ReprocessManager.java b/src/PamController/fileprocessing/ReprocessManager.java index 2272d3cf..4f05913a 100644 --- a/src/PamController/fileprocessing/ReprocessManager.java +++ b/src/PamController/fileprocessing/ReprocessManager.java @@ -175,9 +175,11 @@ public class ReprocessManager { ArrayList outputStores = PamController.getInstance().findControlledUnits(DataOutputStore.class, true); boolean partStores = false; + int nOutputStores = 0; for (PamControlledUnit aPCU : outputStores) { DataOutputStore offlineStore = (DataOutputStore) aPCU; StoreStatus status = offlineStore.getStoreStatus(false); + nOutputStores++; if (status == null) { continue; } @@ -191,8 +193,8 @@ public class ReprocessManager { } if (partStores == false) { - choiceSummary.addChoice(ReprocessStoreChoice.STARTNORMAL); - return choiceSummary; +// choiceSummary.addChoice(ReprocessStoreChoice.STARTNORMAL); + return null; // no part full stores, so can start without questions } if (choiceSummary.getInputStartTime() >= choiceSummary.getOutputEndTime()) { /*