From 1ba2de33d957d5e1ec632d35babf2a7fdb06c9c6 Mon Sep 17 00:00:00 2001 From: Axel Bonnet Date: Wed, 2 Oct 2024 12:56:04 +0200 Subject: [PATCH 1/3] add timestamped results directory for moteurLite --- .../server/rpc/WorkflowServiceImpl.java | 24 ++++- .../main/resources/vm/gwendia-dot-inputs.vm | 97 ------------------- 2 files changed, 23 insertions(+), 98 deletions(-) delete mode 100644 vip-portal/src/main/resources/vm/gwendia-dot-inputs.vm diff --git a/vip-application/src/main/java/fr/insalyon/creatis/vip/application/server/rpc/WorkflowServiceImpl.java b/vip-application/src/main/java/fr/insalyon/creatis/vip/application/server/rpc/WorkflowServiceImpl.java index 85e280610..16f40adeb 100644 --- a/vip-application/src/main/java/fr/insalyon/creatis/vip/application/server/rpc/WorkflowServiceImpl.java +++ b/vip-application/src/main/java/fr/insalyon/creatis/vip/application/server/rpc/WorkflowServiceImpl.java @@ -43,6 +43,7 @@ import fr.insalyon.creatis.vip.application.server.dao.ApplicationInputDAO; import fr.insalyon.creatis.vip.core.client.bean.Group; import fr.insalyon.creatis.vip.core.client.bean.User; +import fr.insalyon.creatis.vip.core.client.view.CoreConstants; import fr.insalyon.creatis.vip.core.client.view.CoreException; import fr.insalyon.creatis.vip.core.server.business.BusinessException; import fr.insalyon.creatis.vip.core.server.business.ConfigurationBusiness; @@ -60,6 +61,8 @@ import java.io.File; import java.io.FileReader; import java.io.IOException; +import java.text.DateFormat; +import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -192,8 +195,9 @@ public void launchSimulation(Map parametersMap, } for (Map.Entry p : parametersMap.entrySet()) { - logger.info("received param {} : {}", p.getKey(), p.getValue()); + logger.info("received param {} : {}", p.getKey(), p.getValue()); } + addTimestampedSubDirectoryIfNecessary(parametersMap); String simulationID = workflowBusiness.launch( user, groups, @@ -207,6 +211,24 @@ public void launchSimulation(Map parametersMap, } } + private void addTimestampedSubDirectoryIfNecessary(Map parametersMap) { + if (server.useMoteurlite()) { + if (parametersMap.containsKey(CoreConstants.RESULTS_DIRECTORY_PARAM_NAME)) { + String resultDir = parametersMap.get(CoreConstants.RESULTS_DIRECTORY_PARAM_NAME); + if (resultDir.startsWith("/") || resultDir.startsWith("lfn:")) { + DateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy_HH:mm:ss"); + resultDir = resultDir + "/" + (dateFormat.format(System.currentTimeMillis())); + parametersMap.put(CoreConstants.RESULTS_DIRECTORY_PARAM_NAME, resultDir); + logger.info("For MoteurLite : changing results-directory to : {}", resultDir); + } else { + logger.info("Using MoteurLite but results-directory not a LFN ({})", resultDir); + } + } else { + logger.info("Using MoteurLite but no results-directory given -> no subdirectory added"); + } + } + } + /** * * @param name diff --git a/vip-portal/src/main/resources/vm/gwendia-dot-inputs.vm b/vip-portal/src/main/resources/vm/gwendia-dot-inputs.vm deleted file mode 100644 index 59bd99437..000000000 --- a/vip-portal/src/main/resources/vm/gwendia-dot-inputs.vm +++ /dev/null @@ -1,97 +0,0 @@ - - - $esc.xml($tool.getDescription()) - - - Directory where the results will be stored. - -#foreach( $input in $tool.getInputs() ) - #set($type="string") - #if($input.getType().getCamelName()=="File") - #set($type="URI") - #end - #if($input.getType().getCamelName()=="Flag") - #if($input.getDefaultValue() && $input.getDefaultValue()!="") - - #else - - #end - #else - #if($input.getDefaultValue() && $input.getDefaultValue()!="") - #if($input.getType().getCamelName()=="Number" && $input.isInteger()) - - #else - - #end - #else - #if($input.isOptional()==true) - - #else - - #end - #end - #end - #if($input.getDescription()) - $esc.xml($input.getDescription()) - #else - - #end - -#end -#foreach($output in $tool.getOutputFiles()) - -#end - - - - - - /*----------Beginning of Beanshell------------*/ -import java.text.DateFormat; -import java.text.SimpleDateFormat; -import java.util.Date; - -String result = dir.toString(); -if ( result.startsWith("/") || result.startsWith("lfn:") ) { - DateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy_HH:mm:ss"); - result = result + "/" + (dateFormat.format(System.currentTimeMillis())); -} -/*------------End of Beanshell------------*/ - - - - -#foreach($input in $tool.getInputs()) - #if($input.getType().getCamelName()=="File" ) - - #else - - #end -#end -#foreach( $output in $tool.getOutputFiles() ) - -#end - - - -#foreach($input in $tool.getInputs()) - -#end - - - - - - - - - - -#foreach( $input in $tool.getInputs() ) - -#end -#foreach($output in $tool.getOutputFiles()) - -#end - - From 7ad9e97f3b61e76a85a92ca500499ad29bfd5260 Mon Sep 17 00:00:00 2001 From: Axel Bonnet Date: Wed, 2 Oct 2024 12:56:36 +0200 Subject: [PATCH 2/3] removing outdated python2 encoding thing from wrapper script --- vip-portal/src/main/resources/vm/wrapper.vm | 3 --- 1 file changed, 3 deletions(-) diff --git a/vip-portal/src/main/resources/vm/wrapper.vm b/vip-portal/src/main/resources/vm/wrapper.vm index e424af8d6..5427229c6 100644 --- a/vip-portal/src/main/resources/vm/wrapper.vm +++ b/vip-portal/src/main/resources/vm/wrapper.vm @@ -187,9 +187,6 @@ then fi #end -# Change PYTHONPATH to make all strings unicode by default in python2 (as in python3) -# Otherwise `bosh exec` fails on any non-ascii characters in outputs -echo "import sys; sys.setdefaultencoding(\"UTF8\")" > sitecustomize.py #creating a temporary directory for bindmount /tmp of containers #TMP_FOLDER is created differently for execution on GRID and execution on LOCAL #TMP of the container is bind mounted on TMP_FOLDER to avoid creating temporary files on container. From a97aecdebaf7dcd55f209815a92d826c048e9d4a Mon Sep 17 00:00:00 2001 From: Axel Bonnet Date: Wed, 2 Oct 2024 12:56:57 +0200 Subject: [PATCH 3/3] keeping only 1 gwendia template --- .../rpc/ApplicationImporterService.java | 2 +- .../rpc/ApplicationImporterServiceAsync.java | 2 +- .../client/view/Constants.java | 7 ------ .../view/applicationdisplay/DisplayTab.java | 5 ++-- .../view/applicationdisplay/VIPLayout.java | 25 +------------------ .../business/ApplicationImporterBusiness.java | 9 +------ .../rpc/ApplicationImporterServiceImpl.java | 4 +-- .../GwendiaTemplateTest.java | 9 +++---- 8 files changed, 12 insertions(+), 51 deletions(-) diff --git a/vip-application-importer/src/main/java/fr/insalyon/creatis/vip/applicationimporter/client/rpc/ApplicationImporterService.java b/vip-application-importer/src/main/java/fr/insalyon/creatis/vip/applicationimporter/client/rpc/ApplicationImporterService.java index c719419e7..cc69c2502 100644 --- a/vip-application-importer/src/main/java/fr/insalyon/creatis/vip/applicationimporter/client/rpc/ApplicationImporterService.java +++ b/vip-application-importer/src/main/java/fr/insalyon/creatis/vip/applicationimporter/client/rpc/ApplicationImporterService.java @@ -55,7 +55,7 @@ public static ApplicationImporterServiceAsync getInstance() { String readAndValidateBoutiquesFile(String fileLFN) throws ApplicationImporterException; - void createApplication(BoutiquesApplication bt, String type, String tag, boolean isRunOnGrid, boolean overwriteVersion, String fileAccessProtocol) throws ApplicationImporterException; + void createApplication(BoutiquesApplication bt, String tag, boolean isRunOnGrid, boolean overwriteVersion, String fileAccessProtocol) throws ApplicationImporterException; String getApplicationImporterRootFolder() throws ApplicationImporterException; diff --git a/vip-application-importer/src/main/java/fr/insalyon/creatis/vip/applicationimporter/client/rpc/ApplicationImporterServiceAsync.java b/vip-application-importer/src/main/java/fr/insalyon/creatis/vip/applicationimporter/client/rpc/ApplicationImporterServiceAsync.java index bf3ff4939..3cdb7b47e 100644 --- a/vip-application-importer/src/main/java/fr/insalyon/creatis/vip/applicationimporter/client/rpc/ApplicationImporterServiceAsync.java +++ b/vip-application-importer/src/main/java/fr/insalyon/creatis/vip/applicationimporter/client/rpc/ApplicationImporterServiceAsync.java @@ -40,7 +40,7 @@ public interface ApplicationImporterServiceAsync { public void readAndValidateBoutiquesFile(String fileLFN, AsyncCallback callback); - public void createApplication(BoutiquesApplication bt, String type, String tag, boolean isRunOnGrid, boolean overwriteVersion, String fileAccessProtocol, AsyncCallback callback); + public void createApplication(BoutiquesApplication bt, String tag, boolean isRunOnGrid, boolean overwriteVersion, String fileAccessProtocol, AsyncCallback callback); public void getApplicationImporterRootFolder(AsyncCallback asyncCallback); diff --git a/vip-application-importer/src/main/java/fr/insalyon/creatis/vip/applicationimporter/client/view/Constants.java b/vip-application-importer/src/main/java/fr/insalyon/creatis/vip/applicationimporter/client/view/Constants.java index b6978e352..d2db239e6 100755 --- a/vip-application-importer/src/main/java/fr/insalyon/creatis/vip/applicationimporter/client/view/Constants.java +++ b/vip-application-importer/src/main/java/fr/insalyon/creatis/vip/applicationimporter/client/view/Constants.java @@ -70,13 +70,6 @@ public class Constants { public static final String APP_IMG_IMPORTER = IMG_FOLDER + "importer.png"; //Group public static final String APPLICATION_IMPORTER_GROUP = "Application Importer"; - //vm files - public static final String VM_GASW = "gasw.vm"; - //LFN access to SegPerfAnalyzer - public static final String LNF_PATH = ""; - // Application Importer types - public static final String APP_IMPORTER_STANDALONE_TYPE = "app-importer-standalone-type"; - public static final String APP_IMPORTER_DOT_INPUTS_TYPE = "app-importer-dot-inputs-type"; //Execution type public static final String APP_IMPORTER_FILE_PROTOCOL = "file"; public static final String APP_IMPORTER_LFN_PROTOCOL = "lfn"; diff --git a/vip-application-importer/src/main/java/fr/insalyon/creatis/vip/applicationimporter/client/view/applicationdisplay/DisplayTab.java b/vip-application-importer/src/main/java/fr/insalyon/creatis/vip/applicationimporter/client/view/applicationdisplay/DisplayTab.java index b8490a287..fc2b61e1e 100644 --- a/vip-application-importer/src/main/java/fr/insalyon/creatis/vip/applicationimporter/client/view/applicationdisplay/DisplayTab.java +++ b/vip-application-importer/src/main/java/fr/insalyon/creatis/vip/applicationimporter/client/view/applicationdisplay/DisplayTab.java @@ -110,8 +110,8 @@ private void configure() { createApplicationButton = WidgetUtil.getIButton("Create application", Constants.ICON_LAUNCH, new ClickHandler() { @Override public void onClick(ClickEvent event) { - if (vipLayout.getApplicationType() == null){ - Layout.getInstance().setWarningMessage("Select type of Application is empty, please choose one."); + if (vipLayout.getFileAccessProtocol() == null){ + Layout.getInstance().setWarningMessage("Select file access protocol."); } else { boutiquesTool.setApplicationLFN(vipLayout.getApplicationLocation() + "/" + boutiquesTool.getName()); createApplication(); @@ -215,7 +215,6 @@ public void onSuccess(Void result) { modal.show("Creating application...", true); ApplicationImporterService.Util.getInstance().createApplication( boutiquesTool, - vipLayout.getApplicationType(), vipLayout.getTag(), vipLayout.getIsRunOnGrid(), vipLayout.getOverwrite(), diff --git a/vip-application-importer/src/main/java/fr/insalyon/creatis/vip/applicationimporter/client/view/applicationdisplay/VIPLayout.java b/vip-application-importer/src/main/java/fr/insalyon/creatis/vip/applicationimporter/client/view/applicationdisplay/VIPLayout.java index 2f661b9b1..1f477522c 100644 --- a/vip-application-importer/src/main/java/fr/insalyon/creatis/vip/applicationimporter/client/view/applicationdisplay/VIPLayout.java +++ b/vip-application-importer/src/main/java/fr/insalyon/creatis/vip/applicationimporter/client/view/applicationdisplay/VIPLayout.java @@ -52,7 +52,6 @@ public class VIPLayout extends AbstractFormLayout { private final LocalTextField applicationLocation; private final CheckboxItem isRunOnGrid; // And not locally. private final CheckboxItem overwriteIfexists; - private final SelectItem appCbItem; private final SelectItem tagsCbItem; private final SelectItem fileAccessProtocolItem; @@ -72,15 +71,6 @@ public VIPLayout(String width, String height) { isRunOnGrid = new CheckboxItem("ckbox_isRunOnGrid", "Application must run on grid, and not locally"); isRunOnGrid.setAlign(Alignment.LEFT); - //ComboBox to select type of application - appCbItem = new SelectItem(); - appCbItem.setTitle("Select type of application"); - appCbItem.setType("comboBox"); - LinkedHashMap valueMap = new LinkedHashMap<>(); - valueMap.put(Constants.APP_IMPORTER_STANDALONE_TYPE, "standalone"); - valueMap.put(Constants.APP_IMPORTER_DOT_INPUTS_TYPE, "Dot inputs (Challenge)"); - appCbItem.setValueMap(valueMap); - tagsCbItem = createTagsSelect(); //select list to choose the execution type @@ -92,7 +82,6 @@ public VIPLayout(String width, String height) { fileAccessProtocolValueMap.put(Constants.APP_IMPORTER_LFN_PROTOCOL, "Grid (lfn)"); fileAccessProtocolItem.setValueMap(fileAccessProtocolValueMap); - this.addMember(FieldUtil.getForm(appCbItem)); this.addMember(FieldUtil.getForm(isRunOnGrid)); this.addMember(FieldUtil.getForm(overwriteIfexists)); this.addMember(FieldUtil.getForm(tagsCbItem)); @@ -141,19 +130,6 @@ public boolean getIsRunOnGrid() { return this.isRunOnGrid.getValueAsBoolean(); } - /** - * Get the type of application (standalone or challenge) - * - * @return the type - */ - public String getApplicationType() { - if (appCbItem._getValue() == null){ - return null; - } else { - return appCbItem._getValue().toString(); - } - } - private SelectItem createTagsSelect() { // ComboBox to select tags. SelectItem tagsCb = new SelectItem(); @@ -192,6 +168,7 @@ public void onSuccess(List result) { public String getTag() { return tagsCbItem._getValue().toString(); } + public String getFileAccessProtocol(){ return fileAccessProtocolItem._getValue().toString(); } diff --git a/vip-application-importer/src/main/java/fr/insalyon/creatis/vip/applicationimporter/server/business/ApplicationImporterBusiness.java b/vip-application-importer/src/main/java/fr/insalyon/creatis/vip/applicationimporter/server/business/ApplicationImporterBusiness.java index d72bfb244..67f852f37 100644 --- a/vip-application-importer/src/main/java/fr/insalyon/creatis/vip/applicationimporter/server/business/ApplicationImporterBusiness.java +++ b/vip-application-importer/src/main/java/fr/insalyon/creatis/vip/applicationimporter/server/business/ApplicationImporterBusiness.java @@ -104,20 +104,13 @@ public String readAndValidationBoutiquesFile(String fileLFN, User user) } public void createApplication( - BoutiquesApplication bt, String type, String tag, boolean isRunOnGrid, boolean overwriteApplicationVersion, String fileAccessProtocol, User user) + BoutiquesApplication bt, String tag, boolean isRunOnGrid, boolean overwriteApplicationVersion, String fileAccessProtocol, User user) throws BusinessException { try { String wrapperTemplate = "vm/wrapper.vm"; String gaswTemplate = "vm/gasw.vm"; - String gwendiaTemplate = "vm/gwendia-standalone.vm"; - if (Constants.APP_IMPORTER_DOT_INPUTS_TYPE.equals(type)) { - gwendiaTemplate = "vm/gwendia-dot-inputs.vm"; - } else if ( ! Constants.APP_IMPORTER_STANDALONE_TYPE.equals(type)) { - logger.error("Cannot import pipeline : unknown importer type : {}", type); - throw new BusinessException("Cannot import pipeline : unknown importer type"); - } // Check rights checkEditionRights(bt.getName(), bt.getToolVersion(), overwriteApplicationVersion, user); diff --git a/vip-application-importer/src/main/java/fr/insalyon/creatis/vip/applicationimporter/server/rpc/ApplicationImporterServiceImpl.java b/vip-application-importer/src/main/java/fr/insalyon/creatis/vip/applicationimporter/server/rpc/ApplicationImporterServiceImpl.java index b9196069e..421548a28 100644 --- a/vip-application-importer/src/main/java/fr/insalyon/creatis/vip/applicationimporter/server/rpc/ApplicationImporterServiceImpl.java +++ b/vip-application-importer/src/main/java/fr/insalyon/creatis/vip/applicationimporter/server/rpc/ApplicationImporterServiceImpl.java @@ -69,12 +69,12 @@ public String readAndValidateBoutiquesFile(String fileLFN) throws ApplicationImp @Override public void createApplication( - BoutiquesApplication bt, String type, String tag, boolean isRunOnGrid, boolean overwriteVersion, String fileAccessProtocol) + BoutiquesApplication bt, String tag, boolean isRunOnGrid, boolean overwriteVersion, String fileAccessProtocol) throws ApplicationImporterException { try { trace(logger, "Creating application"); applicationImporterBusiness.createApplication( - bt, type, tag, isRunOnGrid, overwriteVersion, fileAccessProtocol, getSessionUser()); + bt, tag, isRunOnGrid, overwriteVersion, fileAccessProtocol, getSessionUser()); } catch (CoreException | BusinessException ex) { throw new ApplicationImporterException(ex); } diff --git a/vip-portal/src/test/java/fr/insalyon/creatis/applicationimporter/GwendiaTemplateTest.java b/vip-portal/src/test/java/fr/insalyon/creatis/applicationimporter/GwendiaTemplateTest.java index 2b36d85f8..e107b2b52 100644 --- a/vip-portal/src/test/java/fr/insalyon/creatis/applicationimporter/GwendiaTemplateTest.java +++ b/vip-portal/src/test/java/fr/insalyon/creatis/applicationimporter/GwendiaTemplateTest.java @@ -22,11 +22,10 @@ */ public class GwendiaTemplateTest { - final protected String DOT_TEMPLATE = "vm/gwendia-dot-inputs.vm"; final protected String STANDALONE_TEMPLATE = "vm/gwendia-standalone.vm"; @ParameterizedTest - @ValueSource(strings = {DOT_TEMPLATE, STANDALONE_TEMPLATE}) + @ValueSource(strings = {STANDALONE_TEMPLATE}) public void testTemplateWithNonNullDescription(String template) throws IOException, InvalidBoutiquesDescriptorException, SAXException { String inputDescription = "test input description"; Descriptor gwendiaDesc = testGwendiaTemplate( @@ -37,7 +36,7 @@ public void testTemplateWithNonNullDescription(String template) throws IOExcepti } @ParameterizedTest - @ValueSource(strings = {DOT_TEMPLATE, STANDALONE_TEMPLATE}) + @ValueSource(strings = {STANDALONE_TEMPLATE}) public void testTemplateWithNullDescription(String template) throws IOException, InvalidBoutiquesDescriptorException, SAXException { // when the description is not in boutiques, it must be an empty string in gwendia Descriptor gwendiaDesc = testGwendiaTemplate( @@ -48,7 +47,7 @@ public void testTemplateWithNullDescription(String template) throws IOException, } @ParameterizedTest - @ValueSource(strings = {DOT_TEMPLATE, STANDALONE_TEMPLATE}) + @ValueSource(strings = {STANDALONE_TEMPLATE}) public void testTemplateWithAIntegerInput(String template) throws IOException, InvalidBoutiquesDescriptorException, SAXException { Descriptor gwendiaDesc = testGwendiaTemplate( template, @@ -57,7 +56,7 @@ public void testTemplateWithAIntegerInput(String template) throws IOException, I } @ParameterizedTest - @ValueSource(strings = {DOT_TEMPLATE, STANDALONE_TEMPLATE}) + @ValueSource(strings = {STANDALONE_TEMPLATE}) public void testTemplateWithANumberInput(String template) throws IOException, InvalidBoutiquesDescriptorException, SAXException { Descriptor gwendiaDesc = testGwendiaTemplate( template,