diff --git a/distro/descriptor.xml b/distro/descriptor.xml
index 7e10090..fdbce89 100644
--- a/distro/descriptor.xml
+++ b/distro/descriptor.xml
@@ -2,15 +2,11 @@
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
-
servicearchive
-
tar.gz
-
/
-
${distroDirectory}
@@ -19,18 +15,16 @@
README
LICENSE
- profile.xml
+ changelog.xml
755
true
-
/${artifactId}
-
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index a312b0d..665c9da 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/rest/RestPoolManager.java b/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/rest/RestPoolManager.java
index 82c4b6a..5fe519b 100644
--- a/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/rest/RestPoolManager.java
+++ b/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/rest/RestPoolManager.java
@@ -51,11 +51,12 @@ public class RestPoolManager implements PoolManager {
@Produces("text/plain")
public String stageAlgorithm(
@QueryParam("algorithmPackageURL") String algorithmPackageURL,
- @QueryParam("targetVRE") String targetVRE
- /*@QueryParam("category") String category*/) throws IOException, InterruptedException {
+ @QueryParam("targetVRE") String targetVRE,
+ @QueryParam("category") String category,
+ @QueryParam("algorithm_type") String algorithm_type) throws IOException, InterruptedException {
Algorithm algo = AlgorithmBuilder.create(algorithmPackageURL);
String env = context.application().getInitParameter("Environment");
- return this.service.stageAlgorithm(algo,env,targetVRE);
+ return this.service.stageAlgorithm(algo,targetVRE,category,algorithm_type,env);
}
@@ -64,12 +65,13 @@ public class RestPoolManager implements PoolManager {
@Produces("text/plain")
public String publishAlgorithm(
@QueryParam("algorithmPackageURL") String algorithmPackageURL,
- @QueryParam("targetVREToken") String targetVREToken,
- @QueryParam("targetVRE") String targetVRE
- /*@QueryParam("category") String category*/) throws IOException, InterruptedException {
+ //@QueryParam("targetVREToken") String targetVREToken,
+ @QueryParam("targetVRE") String targetVRE,
+ @QueryParam("category") String category,
+ @QueryParam("algorithm_type") String algorithm_type) throws IOException, InterruptedException {
Algorithm algo = AlgorithmBuilder.create(algorithmPackageURL);
String env = context.application().getInitParameter("Environment");
- return this.service.publishAlgorithm(algo, targetVREToken, targetVRE,env);
+ return this.service.publishAlgorithm(algo, /*targetVREToken,*/ targetVRE,category,algorithm_type,env);
}
/*
@@ -225,6 +227,17 @@ public class RestPoolManager implements PoolManager {
}
+ @Override
+ public String publishAlgorithm(String algorithmPackageURL, String targetVREToken, String targetVRE)
+ throws IOException, InterruptedException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+
+
+
+
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 587d740..8925d79 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 {
}
- public String stageAlgorithm(Algorithm algo, String env, String targetVRE) throws IOException, InterruptedException {
+ public String stageAlgorithm(Algorithm algo,String targetVRE, String category, String algorithm_type,String env) throws IOException, InterruptedException {
Cluster stagingCluster = ClusterBuilder.getStagingDataminerCluster(env);
//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;
}
- public String publishAlgorithm(Algorithm algo, String targetVREToken, String targetVRE, String env) throws IOException, InterruptedException {
+ public String publishAlgorithm(Algorithm algo, String targetVRE, String category, String algorithm_type, String env) throws IOException, InterruptedException {
//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;
}
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 6674865..b2c24a2 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 {
private Algorithm algorithm;
//private Cluster prodCluster;
private String targetVREName;
- private String targetVREToken;
+ private String category;
+ private String algorithm_type;
+ //private String targetVREToken;
private String env;
- public ProductionPublishingJob(SVNUpdater svnUpdater, Algorithm algorithm, /*Cluster prodCluster,*/ String targetVREName, String targetVREToken, String env) throws FileNotFoundException, UnsupportedEncodingException {
+ public ProductionPublishingJob(SVNUpdater svnUpdater, Algorithm algorithm,
+ /*Cluster prodCluster,*/ String targetVREName, String category,String algorithm_type, String env) throws FileNotFoundException, UnsupportedEncodingException {
super(svnUpdater);
this.algorithm = algorithm;
//this.prodCluster = prodCluster;
this.targetVREName = targetVREName;
- this.targetVREToken = targetVREToken;
+ this.category = category;
+ this.algorithm_type = algorithm_type;
+ //this.targetVREToken = targetVREToken;
this.env= env;
@@ -42,21 +47,30 @@ public class ProductionPublishingJob extends DMPMJob {
NotificationHelper nh = new NotificationHelper();
try {
- if (CheckPermission.apply(targetVREToken,targetVREName)){
+ //if (CheckPermission.apply(targetVREToken,targetVREName)){
//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;
- }
- 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;
+ //}
+ //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;
// int ret = this.executeAnsibleWorker(
// createWorker(this.algorithm, this.prodCluster, false, "gcube"));
} catch (Exception e) {
+ try {
+ this.getStatus(0);
+ } catch (FileNotFoundException e1) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ } catch (UnsupportedEncodingException e1) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ }
e.printStackTrace();
}
}
@@ -70,12 +84,12 @@ public class ProductionPublishingJob extends DMPMJob {
String response = "";
if (exitstatus == 9) {
- response = "SVN REPOSITORY CORRECTLY UPDATED; THE CRON JOB WILL INSTALL THE ALGORITHM "+ this.algorithm.getName() + " IN THE VRE " + targetVREName;
+ response = "COMPLETED";
writer.println(response);
}
if (exitstatus == 0) {
- 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);
//writer.close();
}
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 68e094f..7fd285c 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 {
// 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 {
+ String rProtoVREName, String category, String algorithm_type, String env) throws FileNotFoundException, UnsupportedEncodingException {
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 {
// this.rProtoCluster = rProtoCluster;
this.rProtoVREName = rProtoVREName;
this.env = env;
+ this.category = category;
+ this.algorithm_type = algorithm_type;
//File m = new File(this.jobLogs + File.separator + this.id + "_exitStatus");
@@ -101,7 +105,7 @@ public class StagingJob extends DMPMJob {
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 {
"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";
}
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 81241cc..66ab5a2 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 {
// this.updateSVN(this.configuration.getSVNRProdGitHubDepsList(), algorithm.getGitHubDependencies());
// }
- public void updateSVNAlgorithmList(Algorithm algorithm, String targetVRE, String user, String env) {
+ public void updateSVNAlgorithmList(Algorithm algorithm, String targetVRE, String category, String algorithm_type, String user, String env) {
if (env.equals("Dev")){
- this.updateSVNAlgorithmList(this.configuration.getSVNDevAlgorithmsList(), algorithm, targetVRE, user, env);
+ this.updateSVNAlgorithmList(this.configuration.getSVNDevAlgorithmsList(), algorithm, targetVRE, category,algorithm_type, user, env);
}
if (env.equals("Prod")){
- this.updateSVNAlgorithmList(this.configuration.getSVNProdAlgorithmsList(), algorithm, targetVRE, user, env);
+ this.updateSVNAlgorithmList(this.configuration.getSVNProdAlgorithmsList(), algorithm, targetVRE, category, algorithm_type, user, env);
}
if (env.equals("Proto")){
- this.updateSVNAlgorithmList(this.configuration.getSVNRProtoAlgorithmsList(), algorithm, targetVRE, user, env);
+ this.updateSVNAlgorithmList(this.configuration.getSVNRProtoAlgorithmsList(), algorithm, targetVRE, category, algorithm_type, user, env);
}
}
- public void updateSVNProdAlgorithmList(Algorithm algorithm, String targetVRE, String user, String env) {
- 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) {
+ this.updateSVNAlgorithmList(this.configuration.getSVNProdAlgorithmsList(), algorithm, targetVRE, category, algorithm_type, user, env);
}
@@ -371,7 +371,7 @@ public class SVNUpdater {
}
- public void updateSVNAlgorithmList(String file, Algorithm algorithm, String targetVRE, String user, String env) {
+ public void updateSVNAlgorithmList(String file, Algorithm algorithm, String targetVRE, String category, String algorithm_type, String user, String env) {
try {
System.out.println("Updating algorithm list: " + file);
final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
@@ -389,7 +389,7 @@ public class SVNUpdater {
// 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));
// Collections.sort(newContent);
final SVNDeltaGenerator deltaGenerator = new SVNDeltaGenerator();
@@ -424,14 +424,14 @@ public class SVNUpdater {
}
}
- public String generateAlgorithmEntry(Algorithm algorithm, String targetVRE, String env) {
+ public String generateAlgorithmEntry(Algorithm algorithm, String targetVRE, String category, String algorithm_type,String env) {
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();