From d83d1cc390a2adf0a317cb681451a402858bd4d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Manelphe?= Date: Tue, 20 Feb 2024 17:32:07 +0100 Subject: [PATCH] feat: batchMode parameter --- .../src/main/resources/BdD/script_global.sql | 2 ++ .../pilotage/service/ServiceViewPilotageBAS.java | 16 +++++++++++++++- .../src/main/resources/messages_en.properties | 1 + .../src/main/resources/messages_fr.properties | 1 + 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/arc-core/src/main/resources/BdD/script_global.sql b/arc-core/src/main/resources/BdD/script_global.sql index b72ae0267..2da00e597 100644 --- a/arc-core/src/main/resources/BdD/script_global.sql +++ b/arc-core/src/main/resources/BdD/script_global.sql @@ -77,6 +77,8 @@ UPDATE arc.parameter set description='parameter.ihm.sandbox.maxNumberOfFilesRegi INSERT INTO arc.parameter VALUES ('ArcAction.productionEnvironments','["arc_prod"]'); UPDATE arc.parameter set description='parameter.ihm.sandbox.sandboxListWithProductionGUI' where key='ArcAction.productionEnvironments'; +INSERT INTO arc.parameter VALUES ('ArcAction.batchMode','[]'); +UPDATE arc.parameter set description='parameter.ihm.sandbox.sandboxListWithBatchMode' where key='ArcAction.batchMode'; -- parallelism parameters INSERT INTO arc.parameter VALUES ('ApiChargementService.MAX_PARALLEL_WORKERS','2'); diff --git a/arc-web/src/main/java/fr/insee/arc/web/gui/pilotage/service/ServiceViewPilotageBAS.java b/arc-web/src/main/java/fr/insee/arc/web/gui/pilotage/service/ServiceViewPilotageBAS.java index d7fb2aa6c..0fb20e44d 100644 --- a/arc-web/src/main/java/fr/insee/arc/web/gui/pilotage/service/ServiceViewPilotageBAS.java +++ b/arc-web/src/main/java/fr/insee/arc/web/gui/pilotage/service/ServiceViewPilotageBAS.java @@ -3,11 +3,14 @@ import java.nio.file.Paths; import java.util.ArrayList; import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Set; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import org.json.JSONArray; import org.springframework.stereotype.Service; import org.springframework.ui.Model; @@ -182,8 +185,19 @@ public String executerBatch(Model model, TraitementPhase phaseAExecuter) { // Maximum number of files processed in each phase iteration int maxFilesPerPhase = new BDParameters(ArcDatabase.COORDINATOR).getInt(null, "LanceurIHM.maxFilesPerPhase", 10000000); + JSONArray j=new JSONArray(new BDParameters(ArcDatabase.COORDINATOR).getString(null, "ArcAction.batchMode", "[]")); + Set found=new HashSet<>(); + + j.forEach(item -> { + if (item.toString().equals(getBacASable())) + { + found.add(item.toString()); + } + }); + String batchMode = found.isEmpty() ? null : "1"; + ApiServiceFactory.getService(phaseAExecuter, getBacASable(), - maxFilesPerPhase, null + maxFilesPerPhase, batchMode ).invokeApi(); return generateDisplay(model, RESULT_SUCCESS); } diff --git a/arc-web/src/main/resources/messages_en.properties b/arc-web/src/main/resources/messages_en.properties index 0571bd280..9317b3825 100644 --- a/arc-web/src/main/resources/messages_en.properties +++ b/arc-web/src/main/resources/messages_en.properties @@ -331,6 +331,7 @@ MAPPING\u0020KO=Map KO parameter.ihm.sandbox.maxNumberOfFilesRegisteredAtTheSameTime=Maximum number of file that can be registered by the reception module in the sandbox execution parameter.ihm.sandbox.sandboxListWithProductionGUI=List of the sandboxes with a production type GUI +parameter.ihm.sandbox.sandboxListWithBatchMode=List of the sandboxes with batch mode parameter.parallel.numberOfThread.p1.load=Number of threads allocated to the module #1 "Load" parameter.database.version.global=Current global database version identifier corresponding to the ARC version identifier on git parameter.parallel.numberOfThread.p2.xmlStructurize=Number of threads allocated to the module #2 "Structurize XML" diff --git a/arc-web/src/main/resources/messages_fr.properties b/arc-web/src/main/resources/messages_fr.properties index 709b8c47d..9de54be6e 100644 --- a/arc-web/src/main/resources/messages_fr.properties +++ b/arc-web/src/main/resources/messages_fr.properties @@ -331,6 +331,7 @@ MAPPING\u0020KO=Mapping KO parameter.ihm.sandbox.maxNumberOfFilesRegisteredAtTheSameTime=Nombre maximum de fichiers pouvant \u00eatre enregistr\u00e9s par le module de r\u00e9ception dans l''ex\u00e9cution du sandbox parameter.ihm.sandbox.sandboxListWithProductionGUI=Liste des bacs \u00e0 sable avec une interface graphique de type production +parameter.ihm.sandbox.sandboxListWithBatchMode=Liste des bacs \u00e0 sable en mode batch parameter.parallel.numberOfThread.p1.load=Nombre de threads allou\u00e9s au module #1 "Load" parameter.database.version.global=Identifiant de version de base de donn\u00e9es globale actuelle correspondant \u00e0 l''identifiant de version ARC sur git parameter.parallel.numberOfThread.p2.xmlStructurize=Nombre de threads allou\u00e9s au module #2 "Structurer XML"