2017-05-09 18:38:15 +02:00
|
|
|
package org.gcube.dataanalysis.dataminer.poolmanager.rest;
|
|
|
|
|
2017-03-03 19:10:02 +01:00
|
|
|
***REMOVED***
|
2017-05-12 17:32:14 +02:00
|
|
|
import java.net.MalformedURLException;
|
|
|
|
***REMOVED***
|
|
|
|
import java.net.UnknownHostException;
|
2017-03-03 19:10:02 +01:00
|
|
|
***REMOVED***
|
2017-05-12 17:32:14 +02:00
|
|
|
import java.util.Set;
|
|
|
|
|
|
|
|
import javax.ws.rs.GET;
|
|
|
|
import javax.ws.rs.Path;
|
|
|
|
import javax.ws.rs.Produces;
|
|
|
|
import javax.ws.rs.QueryParam;
|
|
|
|
|
2017-05-09 18:38:15 +02:00
|
|
|
import org.gcube.dataanalysis.dataminer.poolmanager.datamodel.Algorithm;
|
|
|
|
import org.gcube.dataanalysis.dataminer.poolmanager.service.DataminerPoolManager;
|
|
|
|
import org.gcube.dataanalysis.dataminer.poolmanager.util.AlgorithmBuilder;
|
2017-03-03 19:10:02 +01:00
|
|
|
***REMOVED***
|
|
|
|
***REMOVED***
|
2017-05-09 18:38:15 +02:00
|
|
|
import org.tmatesoft.svn.core.SVNException;
|
2017-03-03 19:10:02 +01:00
|
|
|
|
|
|
|
@Path("/")
|
|
|
|
public class RestPoolManager implements PoolManager {
|
|
|
|
|
|
|
|
private static final Logger LOGGER = LoggerFactory.getLogger(RestPoolManager.class);
|
|
|
|
|
2017-05-09 18:38:15 +02:00
|
|
|
private DataminerPoolManager service = new DataminerPoolManager();
|
2017-03-03 19:10:02 +01:00
|
|
|
|
2017-05-10 11:11:17 +02:00
|
|
|
***REMOVED***TODO: for all methods accept also a callback url to send the log.
|
|
|
|
|
2017-04-06 10:59:46 +02:00
|
|
|
@GET
|
2017-05-09 18:38:15 +02:00
|
|
|
@Path("/algorithm/stage")
|
2017-04-06 10:59:46 +02:00
|
|
|
@Produces("text/plain")
|
2017-05-12 19:11:12 +02:00
|
|
|
public String stageAlgorithm(
|
|
|
|
@QueryParam("algorithmPackageURL") String algorithmPackageURL,
|
|
|
|
@QueryParam("category") String category) throws IOException, InterruptedException {
|
2017-05-12 17:32:14 +02:00
|
|
|
Algorithm algo = AlgorithmBuilder.create(algorithmPackageURL, category);
|
2017-05-09 18:38:15 +02:00
|
|
|
return this.service.stageAlgorithm(algo);
|
2017-04-06 10:59:46 +02:00
|
|
|
***REMOVED***
|
2017-05-09 18:38:15 +02:00
|
|
|
|
|
|
|
|
2017-04-06 10:59:46 +02:00
|
|
|
@GET
|
2017-05-09 18:38:15 +02:00
|
|
|
@Path("/algorithm/add")
|
2017-04-06 10:59:46 +02:00
|
|
|
@Produces("text/plain")
|
2017-05-12 19:11:12 +02:00
|
|
|
public String publishAlgorithm(
|
|
|
|
@QueryParam("algorithmPackageURL") String algorithmPackageURL,
|
|
|
|
@QueryParam("targetVREToken") String targetVREToken,
|
|
|
|
@QueryParam("targetVRE") String targetVRE,
|
|
|
|
@QueryParam("category") String category) throws IOException, InterruptedException {
|
2017-05-12 17:32:14 +02:00
|
|
|
Algorithm algo = AlgorithmBuilder.create(algorithmPackageURL, category);
|
|
|
|
return this.service.publishAlgorithm(algo, targetVREToken, targetVRE);
|
2017-04-06 10:59:46 +02:00
|
|
|
***REMOVED***
|
|
|
|
|
2017-05-09 18:38:15 +02:00
|
|
|
/*
|
|
|
|
* /scopes/<scope> POST ***REMOVED*** add an algorithm to all dataminers in the scope
|
|
|
|
* /hosts/<hostname> POST ***REMOVED*** add an algorithm to the given host
|
|
|
|
*/
|
2017-04-06 10:59:46 +02:00
|
|
|
|
2017-03-03 19:10:02 +01:00
|
|
|
@GET
|
|
|
|
@Path("/log")
|
|
|
|
@Produces("text/plain")
|
|
|
|
public String getLogById(@QueryParam("logUrl") String logUrl) throws IOException {
|
|
|
|
***REMOVED*** TODO Auto-generated method stub
|
|
|
|
LOGGER.debug("Returning Log =" + logUrl);
|
2017-05-12 17:32:14 +02:00
|
|
|
return service.getLogById(logUrl);
|
2017-03-03 19:10:02 +01:00
|
|
|
***REMOVED***
|
|
|
|
|
2017-05-15 18:44:37 +02:00
|
|
|
|
|
|
|
@Override
|
2017-03-03 19:10:02 +01:00
|
|
|
public Algorithm extractAlgorithm(String url) throws IOException {
|
|
|
|
***REMOVED*** TODO Auto-generated method stub
|
|
|
|
return null;
|
|
|
|
***REMOVED***
|
|
|
|
|
2017-04-05 17:14:18 +02:00
|
|
|
public static void main(String[] args) throws IOException, InterruptedException, SVNException {
|
2017-05-12 17:32:14 +02:00
|
|
|
***REMOVED*** ***REMOVED*** System.out.println(System.getProperty("user.home")+File.separator+"/gcube/dataminer-pool-manager");
|
|
|
|
***REMOVED*** ***REMOVED*** ProxySelector.setDefault(new
|
|
|
|
***REMOVED*** ***REMOVED*** PropertiesBasedProxySelector("/home/ngalante/.proxy-settings"));
|
|
|
|
***REMOVED***
|
|
|
|
***REMOVED*** ScopeProvider.instance.set("/d4science.research-infrastructures.eu/gCubeApps/RPrototypingLab");
|
|
|
|
***REMOVED*** ***REMOVED***SecurityTokenProvider.instance.set("3a23bfa4-4dfe-44fc-988f-194b91071dd2-843339462");
|
|
|
|
***REMOVED*** RestPoolManager a = new RestPoolManager();
|
|
|
|
***REMOVED*** a.stageAlgorithm("http:***REMOVED***data.d4science.org/MnovRjZIdGV5WlB0WXE5NVNaZnRoRVg0SU8xZWpWQlFHbWJQNStIS0N6Yz0", category);
|
|
|
|
***REMOVED*** ***REMOVED***a.publishAlgorithm("http:***REMOVED***data.d4science.org/MnovRjZIdGV5WlB0WXE5NVNaZnRoRVg0SU8xZWpWQlFHbWJQNStIS0N6Yz0", "708e7eb8-11a7-4e9a-816b-c9ed7e7e99fe-98187548","/gcube/devNext/NextNext");
|
|
|
|
***REMOVED*** ***REMOVED*** PoolManager aa = new DataminerPoolManager();
|
|
|
|
***REMOVED***
|
2017-04-06 10:59:46 +02:00
|
|
|
|
|
|
|
***REMOVED***
|
2017-05-12 18:26:58 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
***REMOVED***Production Testing
|
|
|
|
/*
|
|
|
|
stageAlgorithm(Rproto caller token,pacchetto, category)
|
2017-05-12 19:11:12 +02:00
|
|
|
http:***REMOVED***node2-d-d4s.d4science.org:8080/dataminer-pool-manager-1.0.0-SNAPSHOT/rest/algorithm/stage?gcube-token=3a23bfa4-4dfe-44fc-988f-194b91071dd2-843339462&algorithmPackageURL=http:***REMOVED***data.d4science.org/dENQTTMxdjNZcGRpK0NHd2pvU0owMFFzN0VWemw3Zy9HbWJQNStIS0N6Yz0&category=ICHTHYOP_MODEL
|
2017-05-12 18:26:58 +02:00
|
|
|
|
|
|
|
|
|
|
|
publishAlgorithm(Rproto caller token, pacchetto, category, target token, target prod vre)
|
2017-05-16 16:50:07 +02:00
|
|
|
node2-d-d4s.d4science.org:8080/dataminer-pool-manager-1.0.0-SNAPSHOT/rest/algorithm/add?gcube-token=708e7eb8-11a7-4e9a-816b-c9ed7e7e99fe-98187548&algorithmPackageURL=http:***REMOVED***data.d4science.org/dENQTTMxdjNZcGRpK0NHd2pvU0owMFFzN0VWemw3Zy9HbWJQNStIS0N6Yz0&category=ICHTHYOP_MODEL&targetVREToken=3a23bfa4-4dfe-44fc-988f-194b91071dd2-843339462&targetVRE=/d4science.research-infrastructures.eu/gCubeApps/RPrototypingLab
|
2017-05-12 18:26:58 +02:00
|
|
|
|
|
|
|
getLogById(Rproto caller token, logid)
|
2017-05-12 19:11:12 +02:00
|
|
|
http:***REMOVED***node2-d-d4s.d4science.org:8080/dataminer-pool-manager-1.0.0-SNAPSHOT/rest/log?gcube-token=3a23bfa4-4dfe-44fc-988f-194b91071dd2-843339462&logUrl=
|
2017-05-12 18:26:58 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
***REMOVED***dev Testing
|
|
|
|
/*
|
2017-05-16 16:50:07 +02:00
|
|
|
stageAlgorithm(dev_caller_vre_token,pacchetto, category)
|
|
|
|
http:***REMOVED***node2-d-d4s.d4science.org:8080/dataminer-pool-manager-1.0.0-SNAPSHOT/rest/algorithm/stage?gcube-token=708e7eb8-11a7-4e9a-816b-c9ed7e7e99fe-98187548&algorithmPackageURL=http:***REMOVED***data.d4science.org/dENQTTMxdjNZcGRpK0NHd2pvU0owMFFzN0VWemw3Zy9HbWJQNStIS0N6Yz0&category=ICHTHYOP_MODEL
|
2017-05-12 18:26:58 +02:00
|
|
|
|
2017-05-16 16:50:07 +02:00
|
|
|
publishAlgorithm(dev_caller_vre_token, pacchetto, category, target token, target prod vre)
|
|
|
|
http:***REMOVED***node2-d-d4s.d4science.org:8080/dataminer-pool-manager-1.0.0-SNAPSHOT/rest/log?gcube-token=708e7eb8-11a7-4e9a-816b-c9ed7e7e99fe-98187548&logUrl=450bb7f9-9e38-4bde-8f4d-f3296f95deba
|
2017-05-12 18:26:58 +02:00
|
|
|
|
2017-05-16 16:50:07 +02:00
|
|
|
getLogById(dev_caller_vre_token, logid)
|
|
|
|
http:***REMOVED***node2-d-d4s.d4science.org:8080/dataminer-pool-manager-1.0.0-SNAPSHOT/rest/log?gcube-token=708e7eb8-11a7-4e9a-816b-c9ed7e7e99fe-98187548&logUrl=426c8e35-a624-4710-b612-c90929c32c27 */
|
2017-05-12 18:26:58 +02:00
|
|
|
|
2017-03-29 16:06:46 +02:00
|
|
|
|
2017-03-03 19:10:02 +01:00
|
|
|
@Override
|
|
|
|
public void getLogId(Algorithm algo, String vre) {
|
|
|
|
***REMOVED*** TODO Auto-generated method stub
|
|
|
|
|
2017-04-06 10:59:46 +02:00
|
|
|
***REMOVED***
|
2017-03-03 19:10:02 +01:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public String getScriptFromURL(URL logId) throws IOException {
|
|
|
|
***REMOVED*** TODO Auto-generated method stub
|
|
|
|
return null;
|
|
|
|
***REMOVED***
|
|
|
|
|
2017-04-22 19:24:33 +02:00
|
|
|
|
|
|
|
|
2017-03-03 19:10:02 +01:00
|
|
|
@Override
|
2017-04-22 19:24:33 +02:00
|
|
|
public URL getURLfromWorkerLog(String logUrl) throws MalformedURLException, UnknownHostException {
|
2017-03-03 19:10:02 +01:00
|
|
|
***REMOVED*** TODO Auto-generated method stub
|
|
|
|
return null;
|
|
|
|
***REMOVED***
|
|
|
|
|
2017-04-06 10:59:46 +02:00
|
|
|
@Override
|
2017-04-22 19:24:33 +02:00
|
|
|
public void addAlgToIs(Algorithm algo) {
|
2017-04-06 10:59:46 +02:00
|
|
|
***REMOVED*** TODO Auto-generated method stub
|
2017-04-22 19:24:33 +02:00
|
|
|
|
2017-04-06 10:59:46 +02:00
|
|
|
***REMOVED***
|
2017-03-03 19:10:02 +01:00
|
|
|
|
|
|
|
@Override
|
2017-04-22 19:24:33 +02:00
|
|
|
public Set<Algorithm> getAlgoFromIs() {
|
2017-03-03 19:10:02 +01:00
|
|
|
***REMOVED*** TODO Auto-generated method stub
|
|
|
|
return null;
|
|
|
|
***REMOVED***
|
|
|
|
|
2017-04-22 19:24:33 +02:00
|
|
|
|
2017-03-29 16:06:46 +02:00
|
|
|
@Override
|
2017-04-22 19:24:33 +02:00
|
|
|
public List<String> updateSVN(String file, List<String> ldep) throws SVNException {
|
2017-03-29 16:06:46 +02:00
|
|
|
***REMOVED*** TODO Auto-generated method stub
|
2017-04-22 19:24:33 +02:00
|
|
|
return null;
|
2017-03-29 16:06:46 +02:00
|
|
|
***REMOVED***
|
|
|
|
|
2017-04-22 19:24:33 +02:00
|
|
|
|
2017-03-29 16:06:46 +02:00
|
|
|
@Override
|
2017-05-09 17:10:03 +02:00
|
|
|
public String addAlgorithmToHost(Algorithm algo, String host, boolean test)
|
|
|
|
throws IOException, InterruptedException {
|
2017-03-29 16:06:46 +02:00
|
|
|
***REMOVED*** TODO Auto-generated method stub
|
|
|
|
return null;
|
|
|
|
***REMOVED***
|
|
|
|
|
2017-04-06 10:59:46 +02:00
|
|
|
|
2017-04-05 17:14:18 +02:00
|
|
|
@Override
|
2017-05-09 17:10:03 +02:00
|
|
|
public String addAlgorithmToVRE(Algorithm algo, String vre, boolean test)
|
2017-04-22 19:24:33 +02:00
|
|
|
throws IOException, InterruptedException {
|
2017-04-05 17:14:18 +02:00
|
|
|
***REMOVED*** TODO Auto-generated method stub
|
|
|
|
return null;
|
|
|
|
***REMOVED***
|
2017-05-09 17:10:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
2017-03-03 19:10:02 +01:00
|
|
|
***REMOVED***
|