From 551d803ad24ce5f1811572739be2628defebb5d9 Mon Sep 17 00:00:00 2001 From: patil Date: Fri, 21 Jun 2024 11:03:59 +0200 Subject: [PATCH 1/3] Compatibility with moteurlite 1. Support both moteur and moteurlite 2. Identifies the selected engine and sets workflowPath accordingly --- .../server/business/WorkflowBusiness.java | 80 +++++++++++++------ 1 file changed, 56 insertions(+), 24 deletions(-) diff --git a/vip-application/src/main/java/fr/insalyon/creatis/vip/application/server/business/WorkflowBusiness.java b/vip-application/src/main/java/fr/insalyon/creatis/vip/application/server/business/WorkflowBusiness.java index 9e6e7644f..bc92fab77 100644 --- a/vip-application/src/main/java/fr/insalyon/creatis/vip/application/server/business/WorkflowBusiness.java +++ b/vip-application/src/main/java/fr/insalyon/creatis/vip/application/server/business/WorkflowBusiness.java @@ -31,13 +31,48 @@ */ package fr.insalyon.creatis.vip.application.server.business; +import static fr.insalyon.creatis.vip.application.client.view.ApplicationException.ApplicationError.*; + +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Collections; +import java.util.Date; +import java.util.List; +import java.util.Map; +import java.util.Random; + +import org.apache.commons.io.FileUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Lookup; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.xml.sax.SAXException; + import fr.insalyon.creatis.grida.client.GRIDAClient; import fr.insalyon.creatis.grida.client.GRIDAClientException; import fr.insalyon.creatis.grida.client.GRIDAPoolClient; -import fr.insalyon.creatis.moteur.plugins.workflowsdb.bean.*; -import fr.insalyon.creatis.moteur.plugins.workflowsdb.dao.*; +import fr.insalyon.creatis.moteur.plugins.workflowsdb.bean.Input; +import fr.insalyon.creatis.moteur.plugins.workflowsdb.bean.Output; +import fr.insalyon.creatis.moteur.plugins.workflowsdb.bean.Processor; +import fr.insalyon.creatis.moteur.plugins.workflowsdb.bean.Workflow; +import fr.insalyon.creatis.moteur.plugins.workflowsdb.bean.WorkflowStatus; +import fr.insalyon.creatis.moteur.plugins.workflowsdb.dao.InputDAO; +import fr.insalyon.creatis.moteur.plugins.workflowsdb.dao.OutputDAO; +import fr.insalyon.creatis.moteur.plugins.workflowsdb.dao.ProcessorDAO; +import fr.insalyon.creatis.moteur.plugins.workflowsdb.dao.StatsDAO; +import fr.insalyon.creatis.moteur.plugins.workflowsdb.dao.WorkflowDAO; +import fr.insalyon.creatis.moteur.plugins.workflowsdb.dao.WorkflowsDBDAOException; import fr.insalyon.creatis.vip.application.client.ApplicationConstants; -import fr.insalyon.creatis.vip.application.client.bean.*; +import fr.insalyon.creatis.vip.application.client.bean.Activity; +import fr.insalyon.creatis.vip.application.client.bean.AppVersion; +import fr.insalyon.creatis.vip.application.client.bean.Descriptor; +import fr.insalyon.creatis.vip.application.client.bean.Engine; +import fr.insalyon.creatis.vip.application.client.bean.InOutData; +import fr.insalyon.creatis.vip.application.client.bean.Simulation; import fr.insalyon.creatis.vip.application.client.view.monitor.SimulationStatus; import fr.insalyon.creatis.vip.application.client.view.monitor.progress.ProcessorStatus; import fr.insalyon.creatis.vip.application.server.business.simulation.ParameterSweep; @@ -59,21 +94,6 @@ import fr.insalyon.creatis.vip.datamanager.server.business.DataManagerBusiness; import fr.insalyon.creatis.vip.datamanager.server.business.ExternalPlatformBusiness; import fr.insalyon.creatis.vip.datamanager.server.business.LfcPathsBusiness; -import org.apache.commons.io.FileUtils; -import org.apache.commons.io.FilenameUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Lookup; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import org.xml.sax.SAXException; - -import java.io.File; -import java.io.IOException; -import java.util.*; - -import static fr.insalyon.creatis.vip.application.client.view.ApplicationException.ApplicationError.*; /** * @@ -102,6 +122,7 @@ public class WorkflowBusiness { private GRIDAPoolClient gridaPoolClient; private GRIDAClient gridaClient; private ExternalPlatformBusiness externalPlatformBusiness; + private Engine selectedEngine; @Autowired public WorkflowBusiness( @@ -186,6 +207,7 @@ private Engine selectEngine(String applicationClass) logger.error("No available engines for class {}", applicationClass); throw new BusinessException("No available engines for class " + applicationClass); } else { + selectedEngine = engineBean; return engineBean; } } @@ -271,11 +293,15 @@ public synchronized String launch( AppVersion version = applicationDAO.getVersion( applicationName, applicationVersion); - String workflowPath = - dataManagerBusiness.getRemoteFile(user, version.getLfn()); - - //selectRandomEngine could also be used; TODO: make this choice configurable Engine engine = selectEngine(applicationClass); + String workflowPath; + workflowPath = dataManagerBusiness.getRemoteFile(user, version.getLfn()); + if (selectedEngine != null && selectedEngine.getName().equals("moteurlite")) { + workflowPath = dataManagerBusiness.getRemoteFile(user, version.getJsonLfn()); + } + else { + workflowPath = dataManagerBusiness.getRemoteFile(user, version.getLfn()); + } WorkflowExecutionBusiness executionBusiness = getWorkflowExecutionBusiness(engine.getEndpoint()); Workflow workflow = null; @@ -430,8 +456,14 @@ public Descriptor getApplicationDescriptor( try { AppVersion version = applicationDAO.getVersion(applicationName, applicationVersion); - String workflowPath = - dataManagerBusiness.getRemoteFile(user, version.getLfn()); + String workflowPath = dataManagerBusiness.getRemoteFile(user, version.getLfn()); + workflowPath = dataManagerBusiness.getRemoteFile(user, version.getLfn()); + if (selectedEngine != null && selectedEngine.getName().equals("moteurlite")) { + workflowPath = dataManagerBusiness.getRemoteFile(user, version.getJsonLfn()); + } + else { + workflowPath = dataManagerBusiness.getRemoteFile(user, version.getLfn()); + } return workflowPath.endsWith(".gwendia") ? getGwendiaParser().parse(workflowPath) : getScuflParser().parse(workflowPath); From 64896222f96a5bdc59e9e936f22606d96477c9cc Mon Sep 17 00:00:00 2001 From: patil Date: Wed, 26 Jun 2024 14:57:24 +0200 Subject: [PATCH 2/3] Use vip.conf to select moteurlite engine --- .../server/business/WorkflowBusiness.java | 29 ++++++------------- .../vip/core/client/view/CoreConstants.java | 7 +++-- .../vip/core/server/business/Server.java | 4 +-- .../server/business/SpringConfigServer.java | 27 ++++++++++------- 4 files changed, 33 insertions(+), 34 deletions(-) diff --git a/vip-application/src/main/java/fr/insalyon/creatis/vip/application/server/business/WorkflowBusiness.java b/vip-application/src/main/java/fr/insalyon/creatis/vip/application/server/business/WorkflowBusiness.java index bc92fab77..55026d9b8 100644 --- a/vip-application/src/main/java/fr/insalyon/creatis/vip/application/server/business/WorkflowBusiness.java +++ b/vip-application/src/main/java/fr/insalyon/creatis/vip/application/server/business/WorkflowBusiness.java @@ -31,8 +31,6 @@ */ package fr.insalyon.creatis.vip.application.server.business; -import static fr.insalyon.creatis.vip.application.client.view.ApplicationException.ApplicationError.*; - import java.io.File; import java.io.IOException; import java.util.ArrayList; @@ -73,6 +71,9 @@ import fr.insalyon.creatis.vip.application.client.bean.Engine; import fr.insalyon.creatis.vip.application.client.bean.InOutData; import fr.insalyon.creatis.vip.application.client.bean.Simulation; +import static fr.insalyon.creatis.vip.application.client.view.ApplicationException.ApplicationError.PLATFORM_MAX_EXECS; +import static fr.insalyon.creatis.vip.application.client.view.ApplicationException.ApplicationError.USER_MAX_EXECS; +import static fr.insalyon.creatis.vip.application.client.view.ApplicationException.ApplicationError.WRONG_APPLICATION_DESCRIPTOR; import fr.insalyon.creatis.vip.application.client.view.monitor.SimulationStatus; import fr.insalyon.creatis.vip.application.client.view.monitor.progress.ProcessorStatus; import fr.insalyon.creatis.vip.application.server.business.simulation.ParameterSweep; @@ -122,7 +123,6 @@ public class WorkflowBusiness { private GRIDAPoolClient gridaPoolClient; private GRIDAClient gridaClient; private ExternalPlatformBusiness externalPlatformBusiness; - private Engine selectedEngine; @Autowired public WorkflowBusiness( @@ -207,7 +207,6 @@ private Engine selectEngine(String applicationClass) logger.error("No available engines for class {}", applicationClass); throw new BusinessException("No available engines for class " + applicationClass); } else { - selectedEngine = engineBean; return engineBean; } } @@ -293,15 +292,11 @@ public synchronized String launch( AppVersion version = applicationDAO.getVersion( applicationName, applicationVersion); + logger.info( " moteurlite status: " + server.useMoteurlite()); + String workflowPath = dataManagerBusiness.getRemoteFile(user, server.useMoteurlite() ? version.getJsonLfn() : version.getLfn()); + + //selectRandomEngine could also be used; TODO: make this choice configurable Engine engine = selectEngine(applicationClass); - String workflowPath; - workflowPath = dataManagerBusiness.getRemoteFile(user, version.getLfn()); - if (selectedEngine != null && selectedEngine.getName().equals("moteurlite")) { - workflowPath = dataManagerBusiness.getRemoteFile(user, version.getJsonLfn()); - } - else { - workflowPath = dataManagerBusiness.getRemoteFile(user, version.getLfn()); - } WorkflowExecutionBusiness executionBusiness = getWorkflowExecutionBusiness(engine.getEndpoint()); Workflow workflow = null; @@ -456,14 +451,8 @@ public Descriptor getApplicationDescriptor( try { AppVersion version = applicationDAO.getVersion(applicationName, applicationVersion); - String workflowPath = dataManagerBusiness.getRemoteFile(user, version.getLfn()); - workflowPath = dataManagerBusiness.getRemoteFile(user, version.getLfn()); - if (selectedEngine != null && selectedEngine.getName().equals("moteurlite")) { - workflowPath = dataManagerBusiness.getRemoteFile(user, version.getJsonLfn()); - } - else { - workflowPath = dataManagerBusiness.getRemoteFile(user, version.getLfn()); - } + String workflowPath = + dataManagerBusiness.getRemoteFile(user, version.getLfn()); return workflowPath.endsWith(".gwendia") ? getGwendiaParser().parse(workflowPath) : getScuflParser().parse(workflowPath); diff --git a/vip-core/src/main/java/fr/insalyon/creatis/vip/core/client/view/CoreConstants.java b/vip-core/src/main/java/fr/insalyon/creatis/vip/core/client/view/CoreConstants.java index c0dc220fc..cd5a5050e 100644 --- a/vip-core/src/main/java/fr/insalyon/creatis/vip/core/client/view/CoreConstants.java +++ b/vip-core/src/main/java/fr/insalyon/creatis/vip/core/client/view/CoreConstants.java @@ -31,9 +31,10 @@ */ package fr.insalyon.creatis.vip.core.client.view; -import com.google.gwt.user.client.rpc.IsSerializable; import java.util.Date; +import com.google.gwt.user.client.rpc.IsSerializable; + /** * * @author Rafael Ferreira da Silva @@ -41,7 +42,7 @@ public class CoreConstants implements IsSerializable { - public static final String VERSION = "v2.7-dev"; + public static final String VERSION = "v2.6.1"; // Configuration Labels public static final String VO_NAME = "vo.name"; public static final String VO_ROOT = "vo.root"; @@ -192,6 +193,8 @@ public class CoreConstants implements IsSerializable { public static final String API_PARALLEL_DOWNLOAD_NB = "api.downloads.nb"; // ReproVIPfiles"; public static final String REPROVIP_ROOT_DIR = "reprovip.root-dir"; + //moteurlite + public static final String USE_MOTEURLITE = "moteurlite.enabled"; diff --git a/vip-core/src/main/java/fr/insalyon/creatis/vip/core/server/business/Server.java b/vip-core/src/main/java/fr/insalyon/creatis/vip/core/server/business/Server.java index bb318e993..3c216d0c7 100644 --- a/vip-core/src/main/java/fr/insalyon/creatis/vip/core/server/business/Server.java +++ b/vip-core/src/main/java/fr/insalyon/creatis/vip/core/server/business/Server.java @@ -1,7 +1,5 @@ package fr.insalyon.creatis.vip.core.server.business; -import org.apache.commons.configuration.ConfigurationException; - import java.util.HashMap; import java.util.List; @@ -113,4 +111,6 @@ public interface Server { int getApiParallelDownloadNb(); String getReproVIPRootDir(); + + boolean useMoteurlite(); } diff --git a/vip-core/src/main/java/fr/insalyon/creatis/vip/core/server/business/SpringConfigServer.java b/vip-core/src/main/java/fr/insalyon/creatis/vip/core/server/business/SpringConfigServer.java index c49d7d220..b7a34e276 100644 --- a/vip-core/src/main/java/fr/insalyon/creatis/vip/core/server/business/SpringConfigServer.java +++ b/vip-core/src/main/java/fr/insalyon/creatis/vip/core/server/business/SpringConfigServer.java @@ -1,6 +1,16 @@ package fr.insalyon.creatis.vip.core.server.business; -import fr.insalyon.creatis.vip.core.client.view.CoreConstants; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.nio.file.Paths; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.stream.Stream; + +import javax.annotation.PostConstruct; + import org.apache.commons.configuration.ConfigurationException; import org.apache.commons.configuration.PropertiesConfiguration; import org.apache.commons.configuration.reloading.FileChangedReloadingStrategy; @@ -16,15 +26,7 @@ import org.springframework.stereotype.Component; import org.springframework.util.Assert; -import javax.annotation.PostConstruct; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.nio.file.Paths; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.stream.Stream; +import fr.insalyon.creatis.vip.core.client.view.CoreConstants; /** * Reads the vip.conf property file from the configured vifConfigFolder @@ -439,4 +441,9 @@ public int getApiParallelDownloadNb() { public String getReproVIPRootDir() { return env.getProperty(CoreConstants.REPROVIP_ROOT_DIR, "/vip/ReproVip/"); } + + @Override + public boolean useMoteurlite() { + return env.getProperty(CoreConstants.USE_MOTEURLITE, Boolean.class, false); + } } From 9f2c459ebf07fda8000e20855e57a5b9544c9dd3 Mon Sep 17 00:00:00 2001 From: Sandesh Patil <99490622+sandepat@users.noreply.github.com> Date: Thu, 11 Jul 2024 10:47:55 +0200 Subject: [PATCH 3/3] Update CoreConstants.java revert back on Version to v2.7-dev --- .../fr/insalyon/creatis/vip/core/client/view/CoreConstants.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vip-core/src/main/java/fr/insalyon/creatis/vip/core/client/view/CoreConstants.java b/vip-core/src/main/java/fr/insalyon/creatis/vip/core/client/view/CoreConstants.java index cd5a5050e..584804acd 100644 --- a/vip-core/src/main/java/fr/insalyon/creatis/vip/core/client/view/CoreConstants.java +++ b/vip-core/src/main/java/fr/insalyon/creatis/vip/core/client/view/CoreConstants.java @@ -42,7 +42,7 @@ public class CoreConstants implements IsSerializable { - public static final String VERSION = "v2.6.1"; + public static final String VERSION = "v2.7-dev"; // Configuration Labels public static final String VO_NAME = "vo.name"; public static final String VO_ROOT = "vo.root";