git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-analysis/dataminer-pool-manager@152535 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
43c4be5249
commit
c69e116040
|
@ -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>$***REMOVED***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/$***REMOVED***build.finalName***REMOVED***.war</source>
|
||||
<outputDirectory>/$***REMOVED***artifactId***REMOVED***</outputDirectory>
|
||||
</file>
|
||||
</files>
|
||||
|
||||
</assembly>
|
2
pom.xml
2
pom.xml
|
@ -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>
|
||||
|
|
|
@ -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***
|
||||
|
|
|
@ -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***
|
||||
|
|
|
@ -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***
|
||||
|
||||
|
|
|
@ -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<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***
|
||||
***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("<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();
|
||||
|
|
Loading…
Reference in New Issue