|
|
@ -1,6 +1,5 @@
|
|
|
|
package org.gcube.dataanalysis.dataminer.poolmanager.rest;
|
|
|
|
package org.gcube.dataanalysis.dataminer.poolmanager.rest;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.io.IOException;
|
|
|
|
import java.io.IOException;
|
|
|
|
import java.net.MalformedURLException;
|
|
|
|
import java.net.MalformedURLException;
|
|
|
|
import java.net.URL;
|
|
|
|
import java.net.URL;
|
|
|
@ -24,52 +23,44 @@ import org.slf4j.LoggerFactory;
|
|
|
|
import org.tmatesoft.svn.core.SVNException;
|
|
|
|
import org.tmatesoft.svn.core.SVNException;
|
|
|
|
|
|
|
|
|
|
|
|
@Path("/")
|
|
|
|
@Path("/")
|
|
|
|
public class RestPoolManager implements PoolManager
|
|
|
|
public class RestPoolManager implements PoolManager {
|
|
|
|
{
|
|
|
|
// @Context ServletContext context;
|
|
|
|
//@Context ServletContext context;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final Logger logger;
|
|
|
|
private final Logger logger;
|
|
|
|
private DataminerPoolManager service;
|
|
|
|
private DataminerPoolManager service;
|
|
|
|
|
|
|
|
|
|
|
|
//@Context
|
|
|
|
// @Context
|
|
|
|
//private ApplicationContext context = ContextProvider.get();
|
|
|
|
// private ApplicationContext context = ContextProvider.get();
|
|
|
|
|
|
|
|
|
|
|
|
public RestPoolManager()
|
|
|
|
public RestPoolManager() {
|
|
|
|
{
|
|
|
|
|
|
|
|
this.logger = LoggerFactory.getLogger(RestPoolManager.class);
|
|
|
|
this.logger = LoggerFactory.getLogger(RestPoolManager.class);
|
|
|
|
this.service = new DataminerPoolManager();
|
|
|
|
this.service = new DataminerPoolManager();
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@GET
|
|
|
|
@GET
|
|
|
|
@Path("/algorithm/stage")
|
|
|
|
@Path("/algorithm/stage")
|
|
|
|
@Produces("text/plain")
|
|
|
|
@Produces("text/plain")
|
|
|
|
public String stageAlgorithm(
|
|
|
|
public String stageAlgorithm(@QueryParam("algorithmPackageURL") String algorithmPackageURL,
|
|
|
|
@QueryParam("algorithmPackageURL") String algorithmPackageURL,
|
|
|
|
@QueryParam("targetVRE") String targetVRE, @QueryParam("category") String category,
|
|
|
|
@QueryParam("targetVRE") String targetVRE,
|
|
|
|
|
|
|
|
@QueryParam("category") String category,
|
|
|
|
|
|
|
|
@QueryParam("algorithm_type") String algorithm_type) throws IOException, InterruptedException {
|
|
|
|
@QueryParam("algorithm_type") String algorithm_type) throws IOException, InterruptedException {
|
|
|
|
this.logger.debug("Stage algorithm method called");
|
|
|
|
this.logger.debug("Stage algorithm method called");
|
|
|
|
Algorithm algo = AlgorithmBuilder.create(algorithmPackageURL);
|
|
|
|
Algorithm algo = AlgorithmBuilder.create(algorithmPackageURL);
|
|
|
|
//String env = context.application().getInitParameter("Environment");
|
|
|
|
// String env = context.application().getInitParameter("Environment");
|
|
|
|
return this.service.stageAlgorithm(algo,targetVRE,category,algorithm_type/*,env*/);
|
|
|
|
return this.service.stageAlgorithm(algo, targetVRE, category, algorithm_type/* ,env */);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@GET
|
|
|
|
@GET
|
|
|
|
@Path("/algorithm/add")
|
|
|
|
@Path("/algorithm/add")
|
|
|
|
@Produces("text/plain")
|
|
|
|
@Produces("text/plain")
|
|
|
|
public String publishAlgorithm(
|
|
|
|
public String publishAlgorithm(@QueryParam("algorithmPackageURL") String algorithmPackageURL,
|
|
|
|
@QueryParam("algorithmPackageURL") String algorithmPackageURL,
|
|
|
|
// @QueryParam("targetVREToken") String targetVREToken,
|
|
|
|
//@QueryParam("targetVREToken") String targetVREToken,
|
|
|
|
@QueryParam("targetVRE") String targetVRE, @QueryParam("category") String category,
|
|
|
|
@QueryParam("targetVRE") String targetVRE,
|
|
|
|
|
|
|
|
@QueryParam("category") String category,
|
|
|
|
|
|
|
|
@QueryParam("algorithm_type") String algorithm_type) throws IOException, InterruptedException {
|
|
|
|
@QueryParam("algorithm_type") String algorithm_type) throws IOException, InterruptedException {
|
|
|
|
this.logger.debug("Publish algorithm method called");
|
|
|
|
this.logger.debug("Publish algorithm method called");
|
|
|
|
Algorithm algo = AlgorithmBuilder.create(algorithmPackageURL);
|
|
|
|
Algorithm algo = AlgorithmBuilder.create(algorithmPackageURL);
|
|
|
|
//String env = context.application().getInitParameter("Environment");
|
|
|
|
// String env = context.application().getInitParameter("Environment");
|
|
|
|
return this.service.publishAlgorithm(algo, /*targetVREToken,*/ targetVRE,category,algorithm_type/*,env*/);
|
|
|
|
return this.service.publishAlgorithm(algo, /* targetVREToken, */ targetVRE, category, algorithm_type/* ,env */);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
@ -87,7 +78,6 @@ public class RestPoolManager implements PoolManager
|
|
|
|
return service.getLogById(logUrl);
|
|
|
|
return service.getLogById(logUrl);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@GET
|
|
|
|
@GET
|
|
|
|
@Path("/monitor")
|
|
|
|
@Path("/monitor")
|
|
|
|
@Produces("text/plain")
|
|
|
|
@Produces("text/plain")
|
|
|
@ -98,12 +88,7 @@ public class RestPoolManager implements PoolManager
|
|
|
|
return service.getMonitorById(logUrl);
|
|
|
|
return service.getMonitorById(logUrl);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public Algorithm extractAlgorithm(String url) throws IOException {
|
|
|
|
public Algorithm extractAlgorithm(String url) throws IOException {
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
return null;
|
|
|
|
return null;
|
|
|
@ -111,7 +96,6 @@ public class RestPoolManager implements PoolManager
|
|
|
|
|
|
|
|
|
|
|
|
public static void main(String[] args) throws ObjectNotFound, Exception {
|
|
|
|
public static void main(String[] args) throws ObjectNotFound, Exception {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// System.out.println(System.getProperty("user.home")+File.separator+"/gcube/dataminer-pool-manager");
|
|
|
|
// System.out.println(System.getProperty("user.home")+File.separator+"/gcube/dataminer-pool-manager");
|
|
|
|
// // ProxySelector.setDefault(new
|
|
|
|
// // ProxySelector.setDefault(new
|
|
|
|
// // PropertiesBasedProxySelector("/home/ngalante/.proxy-settings"));
|
|
|
|
// // PropertiesBasedProxySelector("/home/ngalante/.proxy-settings"));
|
|
|
@ -120,12 +104,9 @@ public class RestPoolManager implements PoolManager
|
|
|
|
ScopeProvider.instance.set("/gcube/devNext");
|
|
|
|
ScopeProvider.instance.set("/gcube/devNext");
|
|
|
|
SecurityTokenProvider.instance.set("");
|
|
|
|
SecurityTokenProvider.instance.set("");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// AuthorizationEntry entry = authorizationService().get("xxxx-xxx-xxxxx-xxxx");
|
|
|
|
// AuthorizationEntry entry = authorizationService().get("xxxx-xxx-xxxxx-xxxx");
|
|
|
|
// System.out.println(entry.getContext());
|
|
|
|
// System.out.println(entry.getContext());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
RestPoolManager a = new RestPoolManager();
|
|
|
|
RestPoolManager a = new RestPoolManager();
|
|
|
|
|
|
|
|
|
|
|
|
a.stageAlgorithm("http://data-d.d4science.org/TSt3cUpDTG1teUJMemxpcXplVXYzV1lBelVHTTdsYjlHbWJQNStIS0N6Yz0");
|
|
|
|
a.stageAlgorithm("http://data-d.d4science.org/TSt3cUpDTG1teUJMemxpcXplVXYzV1lBelVHTTdsYjlHbWJQNStIS0N6Yz0");
|
|
|
@ -135,32 +116,48 @@ public class RestPoolManager implements PoolManager
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Production Testing
|
|
|
|
|
|
|
|
|
|
|
|
//Production Testing
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
stageAlgorithm(Rproto caller token,pacchetto, category)
|
|
|
|
* stageAlgorithm(Rproto caller token,pacchetto, category)
|
|
|
|
http://node2-d-d4s.d4science.org:8080/dataminer-pool-manager-1.0.0-SNAPSHOT/rest/algorithm/stage?gcube-token=xxx-xxx-xxx-xxx&algorithmPackageURL=http://data.d4science.org/dENQTTMxdjNZcGRpK0NHd2pvU0owMFFzN0VWemw3Zy9HbWJQNStIS0N6Yz0&category=ICHTHYOP_MODEL
|
|
|
|
* http://node2-d-d4s.d4science.org:8080/dataminer-pool-manager-1.0.0-SNAPSHOT/
|
|
|
|
|
|
|
|
* rest/algorithm/stage?gcube-token=xxx-xxx-xxx-xxx&algorithmPackageURL=http://
|
|
|
|
|
|
|
|
* data.d4science.org/
|
|
|
|
|
|
|
|
* dENQTTMxdjNZcGRpK0NHd2pvU0owMFFzN0VWemw3Zy9HbWJQNStIS0N6Yz0&category=
|
|
|
|
|
|
|
|
* ICHTHYOP_MODEL
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* publishAlgorithm(Rproto caller token, pacchetto, category, target token,
|
|
|
|
|
|
|
|
* target prod vre)
|
|
|
|
|
|
|
|
* node2-d-d4s.d4science.org:8080/dataminer-pool-manager-1.0.0-SNAPSHOT/rest/
|
|
|
|
|
|
|
|
* algorithm/add?gcube-token=xxxx-xxxx-xxx-xxx&algorithmPackageURL=http://data.
|
|
|
|
|
|
|
|
* d4science.org/dENQTTMxdjNZcGRpK0NHd2pvU0owMFFzN0VWemw3Zy9HbWJQNStIS0N6Yz0&
|
|
|
|
|
|
|
|
* category=ICHTHYOP_MODEL&targetVREToken=xxxx-xxxx-xxxx&targetVRE=/d4science.
|
|
|
|
|
|
|
|
* research-infrastructures.eu/gCubeApps/RPrototypingLab
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* getLogById(Rproto caller token, logid)
|
|
|
|
|
|
|
|
* http://node2-d-d4s.d4science.org:8080/dataminer-pool-manager-1.0.0-SNAPSHOT/
|
|
|
|
|
|
|
|
* rest/log?gcube-token=xxxx-xxx-xxx-xxx&logUrl=
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
publishAlgorithm(Rproto caller token, pacchetto, category, target token, target prod vre)
|
|
|
|
// dev Testing
|
|
|
|
node2-d-d4s.d4science.org:8080/dataminer-pool-manager-1.0.0-SNAPSHOT/rest/algorithm/add?gcube-token=xxxx-xxxx-xxx-xxx&algorithmPackageURL=http://data.d4science.org/dENQTTMxdjNZcGRpK0NHd2pvU0owMFFzN0VWemw3Zy9HbWJQNStIS0N6Yz0&category=ICHTHYOP_MODEL&targetVREToken=xxxx-xxxx-xxxx&targetVRE=/d4science.research-infrastructures.eu/gCubeApps/RPrototypingLab
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getLogById(Rproto caller token, logid)
|
|
|
|
|
|
|
|
http://node2-d-d4s.d4science.org:8080/dataminer-pool-manager-1.0.0-SNAPSHOT/rest/log?gcube-token=xxxx-xxx-xxx-xxx&logUrl=
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//dev Testing
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
stageAlgorithm(dev_caller_vre_token,pacchetto, category)
|
|
|
|
* stageAlgorithm(dev_caller_vre_token,pacchetto, category)
|
|
|
|
http://node2-d-d4s.d4science.org:8080/dataminer-pool-manager-1.0.0-SNAPSHOT/rest/algorithm/stage?gcube-token=xxxx-xxxx-xxxx&algorithmPackageURL=http://data.d4science.org/dENQTTMxdjNZcGRpK0NHd2pvU0owMFFzN0VWemw3Zy9HbWJQNStIS0N6Yz0&category=ICHTHYOP_MODEL
|
|
|
|
* http://node2-d-d4s.d4science.org:8080/dataminer-pool-manager-1.0.0-SNAPSHOT/
|
|
|
|
|
|
|
|
* rest/algorithm/stage?gcube-token=xxxx-xxxx-xxxx&algorithmPackageURL=http://
|
|
|
|
publishAlgorithm(dev_caller_vre_token, pacchetto, category, target token, target prod vre)
|
|
|
|
* data.d4science.org/
|
|
|
|
http://node2-d-d4s.d4science.org:8080/dataminer-pool-manager-1.0.0-SNAPSHOT/rest/log?gcube-token=xxxx-xxxx-xxx-xxxx&logUrl=450bb7f9-9e38-4bde-8f4d-f3296f95deba
|
|
|
|
* dENQTTMxdjNZcGRpK0NHd2pvU0owMFFzN0VWemw3Zy9HbWJQNStIS0N6Yz0&category=
|
|
|
|
|
|
|
|
* ICHTHYOP_MODEL
|
|
|
|
getLogById(dev_caller_vre_token, logid)
|
|
|
|
*
|
|
|
|
http://node2-d-d4s.d4science.org:8080/dataminer-pool-manager-1.0.0-SNAPSHOT/rest/log?gcube-token=xxx-xxx-xxx-xxx&logUrl=426c8e35-a624-4710-b612-c90929c32c27 */
|
|
|
|
* publishAlgorithm(dev_caller_vre_token, pacchetto, category, target token,
|
|
|
|
|
|
|
|
* target prod vre)
|
|
|
|
|
|
|
|
* http://node2-d-d4s.d4science.org:8080/dataminer-pool-manager-1.0.0-SNAPSHOT/
|
|
|
|
|
|
|
|
* rest/log?gcube-token=xxxx-xxxx-xxx-xxxx&logUrl=450bb7f9-9e38-4bde-8f4d-
|
|
|
|
|
|
|
|
* f3296f95deba
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* getLogById(dev_caller_vre_token, logid)
|
|
|
|
|
|
|
|
* http://node2-d-d4s.d4science.org:8080/dataminer-pool-manager-1.0.0-SNAPSHOT/
|
|
|
|
|
|
|
|
* rest/log?gcube-token=xxx-xxx-xxx-xxx&logUrl=426c8e35-a624-4710-b612-
|
|
|
|
|
|
|
|
* c90929c32c27
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void getLogId(Algorithm algo, String vre) {
|
|
|
|
public void getLogId(Algorithm algo, String vre) {
|
|
|
@ -174,8 +171,6 @@ public class RestPoolManager implements PoolManager
|
|
|
|
return null;
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public URL getURLfromWorkerLog(String logUrl) throws MalformedURLException, UnknownHostException {
|
|
|
|
public URL getURLfromWorkerLog(String logUrl) throws MalformedURLException, UnknownHostException {
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
// TODO Auto-generated method stub
|
|
|
@ -194,37 +189,31 @@ public class RestPoolManager implements PoolManager
|
|
|
|
return null;
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public List<String> updateSVN(String file, List<String> ldep) throws SVNException {
|
|
|
|
public List<String> updateSVN(String file, List<String> ldep) throws SVNException {
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
return null;
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public String addAlgorithmToHost(Algorithm algo, String host, boolean test)
|
|
|
|
public String addAlgorithmToHost(Algorithm algo, String host, boolean test)
|
|
|
|
throws IOException, InterruptedException {
|
|
|
|
throws IOException, InterruptedException {
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
return null;
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public String addAlgorithmToVRE(Algorithm algo, String vre, boolean test)
|
|
|
|
public String addAlgorithmToVRE(Algorithm algo, String vre, boolean test) throws IOException, InterruptedException {
|
|
|
|
throws IOException, InterruptedException {
|
|
|
|
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
return null;
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public String stageAlgorithm(String algorithmPackageURL) throws IOException, InterruptedException {
|
|
|
|
public String stageAlgorithm(String algorithmPackageURL) throws IOException, InterruptedException {
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
return null;
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public String publishAlgorithm(String algorithmPackageURL, String targetVREToken, String targetVRE)
|
|
|
|
public String publishAlgorithm(String algorithmPackageURL, String targetVREToken, String targetVRE)
|
|
|
|
throws IOException, InterruptedException {
|
|
|
|
throws IOException, InterruptedException {
|
|
|
@ -232,12 +221,4 @@ public class RestPoolManager implements PoolManager
|
|
|
|
return null;
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|