diff --git a/distro/descriptor.xml b/distro/descriptor.xml index 5c6de76..6f95660 100644 --- a/distro/descriptor.xml +++ b/distro/descriptor.xml @@ -2,15 +2,11 @@ xmlns="http:***REMOVED***maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0" xmlns:xsi="http:***REMOVED***www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http:***REMOVED***maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http:***REMOVED***maven.apache.org/xsd/assembly-1.1.0.xsd"> - servicearchive - tar.gz - / - $***REMOVED***distroDirectory***REMOVED*** @@ -19,18 +15,16 @@ README LICENSE - profile.xml + changelog.xml 755 true - target/$***REMOVED***build.finalName***REMOVED***.war /$***REMOVED***artifactId***REMOVED*** - \ No newline at end of file diff --git a/pom.xml b/pom.xml index a0bd4e2..a85752c 100644 --- a/pom.xml +++ b/pom.xml @@ -11,8 +11,8 @@ org.gcube.dataAnalysis dataminer-pool-manager - 2.0.0-SNAPSHOT war + 2.0.0-SNAPSHOT dataminer-pool-manager diff --git a/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/service/DataminerPoolManager.java b/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/service/DataminerPoolManager.java index ad90c0d..cfd5a4c 100644 --- a/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/service/DataminerPoolManager.java +++ b/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/service/DataminerPoolManager.java @@ -28,23 +28,23 @@ public class DataminerPoolManager ***REMOVED*** ***REMOVED*** -***REMOVED***Algorithm algo, String env, String targetVRE) throws IOException, InterruptedException ***REMOVED*** +***REMOVED***Algorithm algo,String targetVRE, String category, String algorithm_type,String env) throws IOException, InterruptedException ***REMOVED*** Cluster stagingCluster = ClusterBuilder.getStagingDataminerCluster(env); ***REMOVED***Cluster rProtoCluster = ClusterBuilder.getRProtoCluster(); - DMPMJob job = new StagingJob(this.svnUpdater, algo, stagingCluster, /*rProtoCluster,*/ targetVRE, env); + DMPMJob job = new StagingJob(this.svnUpdater, algo, stagingCluster, /*rProtoCluster,*/ targetVRE, category, algorithm_type,env); String id = job.start(); return id; ***REMOVED*** -***REMOVED***Algorithm algo, String targetVREToken, String targetVRE, String env) throws IOException, InterruptedException ***REMOVED*** +***REMOVED***Algorithm algo, String targetVRE, String category, String algorithm_type, String env) throws IOException, InterruptedException ***REMOVED*** ***REMOVED***Cluster prodCluster = ClusterBuilder.getVRECluster(targetVREToken, targetVRE); - DMPMJob job = new ProductionPublishingJob(this.svnUpdater, algo, /*prodCluster,*/ targetVRE, targetVREToken,env); + DMPMJob job = new ProductionPublishingJob(this.svnUpdater, algo, /*prodCluster,*/ targetVRE, category, algorithm_type,env); String id = job.start(); return id; ***REMOVED*** diff --git a/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/service/ProductionPublishingJob.java b/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/service/ProductionPublishingJob.java index 5b292a0..4c07ebe 100644 --- a/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/service/ProductionPublishingJob.java +++ b/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/service/ProductionPublishingJob.java @@ -19,16 +19,21 @@ public class ProductionPublishingJob extends DMPMJob ***REMOVED*** private Algorithm algorithm; ***REMOVED***private Cluster prodCluster; private String targetVREName; - private String targetVREToken; + private String category; + private String algorithm_type; + ***REMOVED***private String targetVREToken; private String env; - public ProductionPublishingJob(SVNUpdater svnUpdater, Algorithm algorithm, /*Cluster prodCluster,*/ String targetVREName, String targetVREToken, String env) throws FileNotFoundException, UnsupportedEncodingException ***REMOVED*** + public ProductionPublishingJob(SVNUpdater svnUpdater, Algorithm algorithm, + ***REMOVED***Cluster prodCluster,*/ String targetVREName, String category,String algorithm_type, String env) throws FileNotFoundException, UnsupportedEncodingException ***REMOVED*** super(svnUpdater); this.algorithm = algorithm; ***REMOVED***this.prodCluster = prodCluster; this.targetVREName = targetVREName; - this.targetVREToken = targetVREToken; + this.category = category; + this.algorithm_type = algorithm_type; + ***REMOVED***this.targetVREToken = targetVREToken; this.env= env; @@ -42,21 +47,30 @@ public class ProductionPublishingJob extends DMPMJob ***REMOVED*** NotificationHelper nh = new NotificationHelper(); try ***REMOVED*** - if (CheckPermission.apply(targetVREToken,targetVREName))***REMOVED*** + ***REMOVED***if (CheckPermission.apply(targetVREToken,targetVREName))***REMOVED*** ***REMOVED***this.svnUpdater.updateProdDeps(this.algorithm); - this.svnUpdater.updateSVNAlgorithmList(this.algorithm, this.targetVREName, this.algorithm.getFullname(), env); + this.svnUpdater.updateSVNAlgorithmList(this.algorithm, this.targetVREName, this.category,this.algorithm_type, this.algorithm.getFullname(), env); this.getStatus(9); sm.sendNotification(nh.getSuccessSubjectRelease() + " for "+this.algorithm.getName()+ " algorithm", nh.getSuccessBodyRelease("\n\n"+this.buildInfo())); return; - ***REMOVED*** - else this.getStatus(0); - sm.sendNotification(nh.getFailedSubjectRelease() + " for "+this.algorithm.getName()+ " algorithm", nh.getFailedBodyRelease(" The user "+this.algorithm.getFullname()+ " is not authorized to access to the "+ targetVREName+ " VRE"+"\n\n"+this.buildInfo())); - return; + ***REMOVED******REMOVED*** + ***REMOVED***else this.getStatus(0); + ***REMOVED***sm.sendNotification(nh.getFailedSubjectRelease() + " for "+this.algorithm.getName()+ " algorithm", nh.getFailedBodyRelease(" The user "+this.algorithm.getFullname()+ " is not authorized to access to the "+ targetVREName+ " VRE"+"\n\n"+this.buildInfo())); + ***REMOVED***return; ***REMOVED*** int ret = this.executeAnsibleWorker( ***REMOVED*** createWorker(this.algorithm, this.prodCluster, false, "gcube")); ***REMOVED*** catch (Exception e) ***REMOVED*** + try ***REMOVED*** + this.getStatus(0); + ***REMOVED*** catch (FileNotFoundException e1) ***REMOVED*** + ***REMOVED*** TODO Auto-generated catch block + e1.printStackTrace(); + ***REMOVED*** catch (UnsupportedEncodingException e1) ***REMOVED*** + ***REMOVED*** TODO Auto-generated catch block + e1.printStackTrace(); + ***REMOVED*** e.printStackTrace(); ***REMOVED*** ***REMOVED*** @@ -70,12 +84,12 @@ public class ProductionPublishingJob extends DMPMJob ***REMOVED*** String response = ""; if (exitstatus == 9) ***REMOVED*** - response = "SVN REPOSITORY CORRECTLY UPDATED; THE CRON JOB WILL INSTALL THE ALGORITHM "+ this.algorithm.getName() + " IN THE VRE " + targetVREName; + response = "COMPLETED"; writer.println(response); ***REMOVED*** if (exitstatus == 0) ***REMOVED*** - response = "SVN REPOSITORY UPDATE FAI; THE CRON JOB WILL NOT BE ABLE TO INSTALL THE ALGORITHM "+this.algorithm.getName()+" IN THE VRE " + targetVREName;; + response = "FAILED"; writer.println(response); ***REMOVED***writer.close(); ***REMOVED*** diff --git a/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/service/StagingJob.java b/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/service/StagingJob.java index 3a9b0e9..ec8f247 100644 --- a/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/service/StagingJob.java +++ b/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/service/StagingJob.java @@ -28,11 +28,13 @@ public class StagingJob extends DMPMJob ***REMOVED*** ***REMOVED*** private Cluster rProtoCluster; private String rProtoVREName; private String env; + private String category; + private String algorithm_type; public StagingJob(SVNUpdater svnUpdater, Algorithm algorithm, Cluster stagingCluster, /* Cluster rProtoCluster, */ - String rProtoVREName, String env) throws FileNotFoundException, UnsupportedEncodingException ***REMOVED*** + String rProtoVREName, String category, String algorithm_type, String env) throws FileNotFoundException, UnsupportedEncodingException ***REMOVED*** super(svnUpdater); this.jobLogs = new File( System.getProperty("user.home") + File.separator + "dataminer-pool-manager" + File.separator + "jobs"); @@ -43,6 +45,8 @@ public class StagingJob extends DMPMJob ***REMOVED*** ***REMOVED*** this.rProtoCluster = rProtoCluster; this.rProtoVREName = rProtoVREName; this.env = env; + this.category = category; + this.algorithm_type = algorithm_type; ***REMOVED***File m = new File(this.jobLogs + File.separator + this.id + "_exitStatus"); @@ -101,7 +105,7 @@ public class StagingJob extends DMPMJob ***REMOVED*** System.out.println("Interface check ok!"); System.out.println("Both the files exist at the correct path!"); - this.svnUpdater.updateSVNAlgorithmList(this.algorithm, this.rProtoVREName, + this.svnUpdater.updateSVNAlgorithmList(this.algorithm, this.rProtoVREName,this.category, this.algorithm_type, this.algorithm.getFullname(), env); this.getStatus(9); @@ -160,7 +164,7 @@ public class StagingJob extends DMPMJob ***REMOVED*** "User: "+this.algorithm.getFullname()+"\n"+ "Algorithm name: "+this.algorithm.getName()+"\n"+ "Staging DataMiner Host: "+ a.getHost(this.env)+"\n"+ - "Caller VRE: "+rProtoVREName+"\n"+ + "Caller VRE: "+ScopeProvider.instance.get()+"\n"+ "Target VRE: "+rProtoVREName+"\n"; ***REMOVED*** diff --git a/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/util/SVNUpdater.java b/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/util/SVNUpdater.java index a8ce293..23ce156 100644 --- a/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/util/SVNUpdater.java +++ b/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/util/SVNUpdater.java @@ -249,23 +249,23 @@ public class SVNUpdater ***REMOVED*** ***REMOVED*** this.updateSVN(this.configuration.getSVNRProdGitHubDepsList(), algorithm.getGitHubDependencies()); ***REMOVED******REMOVED*** - public void updateSVNAlgorithmList(Algorithm algorithm, String targetVRE, String user, String env) ***REMOVED*** + public void updateSVNAlgorithmList(Algorithm algorithm, String targetVRE, String category, String algorithm_type, String user, String env) ***REMOVED*** if (env.equals("Dev"))***REMOVED*** - this.updateSVNAlgorithmList(this.configuration.getSVNDevAlgorithmsList(), algorithm, targetVRE, user, env); + this.updateSVNAlgorithmList(this.configuration.getSVNDevAlgorithmsList(), algorithm, targetVRE, category,algorithm_type, user, env); ***REMOVED*** if (env.equals("Prod"))***REMOVED*** - this.updateSVNAlgorithmList(this.configuration.getSVNProdAlgorithmsList(), algorithm, targetVRE, user, env); + this.updateSVNAlgorithmList(this.configuration.getSVNProdAlgorithmsList(), algorithm, targetVRE, category, algorithm_type, user, env); ***REMOVED*** if (env.equals("Proto"))***REMOVED*** - this.updateSVNAlgorithmList(this.configuration.getSVNRProtoAlgorithmsList(), algorithm, targetVRE, user, env); + this.updateSVNAlgorithmList(this.configuration.getSVNRProtoAlgorithmsList(), algorithm, targetVRE, category, algorithm_type, user, env); ***REMOVED*** ***REMOVED*** - public void updateSVNProdAlgorithmList(Algorithm algorithm, String targetVRE, String user, String env) ***REMOVED*** - this.updateSVNAlgorithmList(this.configuration.getSVNProdAlgorithmsList(), algorithm, targetVRE, user, env); + public void updateSVNProdAlgorithmList(Algorithm algorithm, String targetVRE, String category, String algorithm_type, String user, String env) ***REMOVED*** + this.updateSVNAlgorithmList(this.configuration.getSVNProdAlgorithmsList(), algorithm, targetVRE, category, algorithm_type, user, env); ***REMOVED*** @@ -371,7 +371,7 @@ public class SVNUpdater ***REMOVED*** ***REMOVED*** - public void updateSVNAlgorithmList(String file, Algorithm algorithm, String targetVRE, String user, String env) ***REMOVED*** + public void updateSVNAlgorithmList(String file, Algorithm algorithm, String targetVRE, String category, String algorithm_type, String user, String env) ***REMOVED*** try ***REMOVED*** System.out.println("Updating algorithm list: " + file); final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); @@ -389,7 +389,7 @@ public class SVNUpdater ***REMOVED*** ***REMOVED*** the algorithm is not in the list. Add it List newContent = new LinkedList<>(Arrays.asList(lines)); - newContent.add(this.generateAlgorithmEntry(algorithm, targetVRE, env)); + newContent.add(this.generateAlgorithmEntry(algorithm, targetVRE, category,algorithm_type, env)); ***REMOVED*** Collections.sort(newContent); final SVNDeltaGenerator deltaGenerator = new SVNDeltaGenerator(); @@ -424,14 +424,14 @@ public class SVNUpdater ***REMOVED*** ***REMOVED*** ***REMOVED*** - public String generateAlgorithmEntry(Algorithm algorithm, String targetVRE, String env) ***REMOVED*** + public String generateAlgorithmEntry(Algorithm algorithm, String targetVRE, String category, String algorithm_type,String env) ***REMOVED*** StringBuffer sb = new StringBuffer("| "); sb.append(algorithm.getName() + " | "); sb.append(algorithm.getFullname() + " | "); - sb.append(algorithm.getCategory() + " | "); + sb.append(category + " | "); sb.append(env + " | "); sb.append("./addAlgorithm.sh " + algorithm.getName() + " " + algorithm.getCategory() + " " - + algorithm.getClazz() + " " + targetVRE + " " + algorithm.getAlgorithmType() + " N " + + algorithm.getClazz() + " " + targetVRE + " " + algorithm_type + " N " + algorithm.getPackageURL() + " \"" + algorithm.getDescription() + "\" | "); sb.append("none |"); return sb.toString();