This commit is contained in:
Nunzio Andrea Galante 2017-06-30 13:49:04 +00:00
parent 994f1abad5
commit d07cf6c2b4
4 changed files with 92 additions and 8 deletions

View File

@ -80,8 +80,7 @@ public class RestPoolManager implements PoolManager {
***REMOVED*** ***REMOVED***
***REMOVED*** System.out.println(System.getProperty("user.home")+File.separator+"/gcube/dataminer-pool-manager");
***REMOVED*** ***REMOVED*** System.out.println(System.getProperty("user.home")+File.separator+"/gcube/dataminer-pool-manager");
***REMOVED*** ***REMOVED*** ProxySelector.setDefault(new ***REMOVED*** ***REMOVED*** ProxySelector.setDefault(new
***REMOVED*** ***REMOVED*** PropertiesBasedProxySelector("/home/ngalante/.proxy-settings")); ***REMOVED*** ***REMOVED*** PropertiesBasedProxySelector("/home/ngalante/.proxy-settings"));
***REMOVED*** ***REMOVED***

View File

@ -4,9 +4,12 @@ import static org.gcube.common.authorization.client.Constants.authorizationServi
import org.gcube.common.authorization.library.AuthorizationEntry; import org.gcube.common.authorization.library.AuthorizationEntry;
***REMOVED*** ***REMOVED***
***REMOVED***
import org.gcube.dataanalysis.dataminer.poolmanager.datamodel.Algorithm; import org.gcube.dataanalysis.dataminer.poolmanager.datamodel.Algorithm;
***REMOVED*** ***REMOVED***
import org.gcube.dataanalysis.dataminer.poolmanager.util.CheckMethod;
import org.gcube.dataanalysis.dataminer.poolmanager.util.SVNUpdater; import org.gcube.dataanalysis.dataminer.poolmanager.util.SVNUpdater;
import org.gcube.dataanalysis.dataminer.poolmanager.util.ServiceConfiguration;
public class StagingJob extends DMPMJob { public class StagingJob extends DMPMJob {
@ -31,24 +34,27 @@ public class StagingJob extends DMPMJob {
@Override @Override
protected void execute() { protected void execute() {
ServiceConfiguration a = new ServiceConfiguration();
CheckMethod b = new CheckMethod();
try { try {
int ret = this.executeAnsibleWorker( int ret = this.executeAnsibleWorker(
createWorker(this.algorithm, this.stagingCluster, true, "root")); createWorker(this.algorithm, this.stagingCluster, true, "root"));
if(ret == 0){ if(ret == 0){
if (b.checkMethod(a.getStagingHost(), SecurityTokenProvider.instance.get())){
this.svnUpdater.updateRPRotoDeps(this.algorithm); this.svnUpdater.updateRPRotoDeps(this.algorithm);
this.svnUpdater.updateSVNRProtoAlgorithmList(this.algorithm, this.rProtoVREName, "DataMiner Pool Manager", "Proto"); this.svnUpdater.updateSVNRProtoAlgorithmList(this.algorithm, this.rProtoVREName, "DataMiner Pool Manager", "Proto");
***REMOVED*** int ret2 = this.executeAnsibleWorker( ***REMOVED*** int ret2 = this.executeAnsibleWorker(
***REMOVED*** createWorker(this.algorithm, this.rProtoCluster, false, "gcube")); ***REMOVED*** createWorker(this.algorithm, this.rProtoCluster, false, "gcube"));
***REMOVED***
***REMOVED*** ***REMOVED***
***REMOVED*** catch (Exception e) { ***REMOVED*** catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
***REMOVED*** ***REMOVED***

View File

@ -0,0 +1,79 @@
package org.gcube.dataanalysis.dataminer.poolmanager.util;
***REMOVED***
import java.io.FileWriter;
***REMOVED***
***REMOVED***
public class CheckMethod {
public CheckMethod() {
***REMOVED***
public boolean checkMethod(String machine, String token) throws Exception {
try {
System.out.println("Machine: " + machine);
String getCapabilitesRequest = new String();
String getCapabilitesResponse = new String();
System.out.println(" Token: " + token);
String request = "http:***REMOVED***" + machine
+ "/wps/WebProcessingService?Request=GetCapabilities&Service=WPS&gcube-token=" + token;
String response = machine + "___" + token + ".xml";
getCapabilitesRequest = request;
getCapabilitesResponse = response;
String baseDescriptionRequest = "http:***REMOVED***" + machine
+ "/wps/WebProcessingService?Request=DescribeProcess&Service=WPS&Version=1.0.0" + "&gcube-token="
+ token + "&Identifier=";
URL requestURL = new URL(request);
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(requestURL.openStream()));
FileWriter fileWriter = new FileWriter(response);
String line;
boolean flag = true;
while (flag && (line = bufferedReader.readLine()) != null) {
fileWriter.write(line);
fileWriter.write(System.lineSeparator());
if (line.contains("ows:Identifier")) {
String operatorName = line.substring(line.indexOf(">") + 1);
operatorName = operatorName.substring(0, operatorName.indexOf("<"));
System.out.println(" " + operatorName);
URL innerRequestURL = new URL(baseDescriptionRequest + operatorName);
BufferedReader innerBufferedReader = new BufferedReader(
new InputStreamReader(innerRequestURL.openStream()));
String innerLine = innerBufferedReader.readLine();
boolean innerFlag = true;
while (innerFlag && (innerLine = innerBufferedReader.readLine()) != null) {
if (innerLine.contains("ows:Abstract")) {
String operatorDescription = innerLine.substring(innerLine.indexOf(">") + 1);
operatorDescription = operatorDescription.substring(0, operatorDescription.indexOf("<"));
System.out.println(" " + operatorDescription);
innerFlag = false;
***REMOVED*** else if (innerLine.contains("ows:ExceptionText")) {
System.out.println(" " + "error retrieving operator description");
innerFlag = false;
flag = false;
***REMOVED*** else
innerLine = innerBufferedReader.readLine();
***REMOVED***
***REMOVED***
***REMOVED***
fileWriter.close();
***REMOVED*** catch (Exception a) {
a.getMessage();
return false;
***REMOVED***
return true;
***REMOVED***
public static void main(String[] args) throws Exception {
***REMOVED*** ServiceConfiguration a = new ServiceConfiguration();
***REMOVED*** System.out.println(a.getStagingHost());
CheckMethod a = new CheckMethod();
if (!a.checkMethod("dataminer1-proto.d4science.org", "254c2e2d-7f48-47aa-9fc1-5e6453a41f78-843339462")){
System.out.println("ciao");***REMOVED***
***REMOVED***
***REMOVED***

View File

@ -1,6 +1,6 @@
#YML node file #YML node file
STAGING_HOST: dataminer-proto-ghost.d4science.org #STAGING_HOST: dataminer-proto-ghost.d4science.org
#STAGING_HOST: dataminer1-devnext.d4science.org STAGING_HOST: dataminer1-devnext.d4science.org
SVN_REPO: https:***REMOVED***svn.d4science.research-infrastructures.eu/gcube/trunk/data-analysis/RConfiguration/RPackagesManagement/ SVN_REPO: https:***REMOVED***svn.d4science.research-infrastructures.eu/gcube/trunk/data-analysis/RConfiguration/RPackagesManagement/
#HAPROXY_CSV: http:***REMOVED***data.d4science.org/Yk4zSFF6V3JOSytNd3JkRDlnRFpDUUR5TnRJZEw2QjRHbWJQNStIS0N6Yz0 #HAPROXY_CSV: http:***REMOVED***data.d4science.org/Yk4zSFF6V3JOSytNd3JkRDlnRFpDUUR5TnRJZEw2QjRHbWJQNStIS0N6Yz0