This commit is contained in:
Nunzio Andrea Galante 2017-08-29 15:43:31 +00:00
parent 2c4ee18a2b
commit bf15cee6bc
7 changed files with 69 additions and 44 deletions

View File

@ -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">
<id>servicearchive</id>
<formats>
<format>tar.gz</format>
</formats>
<baseDirectory>/</baseDirectory>
<fileSets>
<fileSet>
<directory>${distroDirectory***REMOVED***</directory>
@ -19,18 +15,16 @@
<includes>
<include>README</include>
<include>LICENSE</include>
<include>profile.xml</include>
<include>changelog.xml</include>
</includes>
<fileMode>755</fileMode>
<filtered>true</filtered>
</fileSet>
</fileSets>
<files>
<file>
<source>target/${build.finalName***REMOVED***.war</source>
<outputDirectory>/${artifactId***REMOVED***</outputDirectory>
</file>
</files>
</assembly>

View File

@ -11,8 +11,8 @@
<groupId>org.gcube.dataAnalysis</groupId>
<artifactId>dataminer-pool-manager</artifactId>
<version>2.0.0-SNAPSHOT</version>
<packaging>war</packaging>
<version>2.0.0-SNAPSHOT</version>
<name>dataminer-pool-manager</name>
<description>

View File

@ -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);
***REMOVED***
@ -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 {
***REMOVED***@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);
***REMOVED***
/*
@ -225,6 +227,17 @@ public class RestPoolManager implements PoolManager {
***REMOVED***
@Override
public String publishAlgorithm(String algorithmPackageURL, String targetVREToken, String targetVRE)
throws IOException, InterruptedException {
***REMOVED*** TODO Auto-generated method stub
return null;
***REMOVED***

View File

@ -28,23 +28,23 @@ public class DataminerPoolManager {
***REMOVED***
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);
***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***
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 {
***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***

View File

@ -19,16 +19,21 @@ public class ProductionPublishingJob extends DMPMJob {
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 {
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;
***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 {
NotificationHelper nh = new NotificationHelper();
try {
if (CheckPermission.apply(targetVREToken,targetVREName)){
***REMOVED***if (CheckPermission.apply(targetVREToken,targetVREName)){
***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) {
try {
this.getStatus(0);
***REMOVED*** catch (FileNotFoundException e1) {
***REMOVED*** TODO Auto-generated catch block
e1.printStackTrace();
***REMOVED*** catch (UnsupportedEncodingException e1) {
***REMOVED*** TODO Auto-generated catch block
e1.printStackTrace();
***REMOVED***
e.printStackTrace();
***REMOVED***
***REMOVED***
@ -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);
***REMOVED***
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);
***REMOVED***writer.close();
***REMOVED***

View File

@ -28,11 +28,13 @@ public class StagingJob extends DMPMJob {
***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 {
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 {
***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 {
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";
***REMOVED***

View File

@ -249,23 +249,23 @@ public class SVNUpdater {
***REMOVED*** this.updateSVN(this.configuration.getSVNRProdGitHubDepsList(), algorithm.getGitHubDependencies());
***REMOVED******REMOVED***
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);
***REMOVED***
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);
***REMOVED***
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);
***REMOVED***
***REMOVED***
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);
***REMOVED***
@ -371,7 +371,7 @@ public class SVNUpdater {
***REMOVED***
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 {
***REMOVED*** the algorithm is not in the list. Add it
List<String> 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***
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("<notextile>./addAlgorithm.sh " + algorithm.getName() + " " + algorithm.getCategory() + " "
+ algorithm.getClazz() + " " + targetVRE + " " + algorithm.getAlgorithmType() + " N "
+ algorithm.getClazz() + " " + targetVRE + " " + algorithm_type + " N "
+ algorithm.getPackageURL() + " \"" + algorithm.getDescription() + "\" </notextile> | ");
sb.append("none |");
return sb.toString();