This commit is contained in:
Nunzio Andrea Galante 2017-02-23 14:28:31 +00:00
parent 31a64d5d4d
commit 73ce6a00c5
7 changed files with 55 additions and 33 deletions

View File

@ -43,7 +43,7 @@ public class AnsibleBridge {
private String dpmRoot;
public AnsibleBridge() {
this("/tmp/dataminer-pool-manager");
this(System.getProperty("user.home")+File.separator+"/gcube/dataminer-pool-manager");
***REMOVED***
public AnsibleBridge(String root) {

View File

@ -18,7 +18,7 @@ public class Algorithm {
private String skipJava;
private String packageURL;
private Collection<Action> actions;
private Collection<Dependency> dependencies;
@ -113,4 +113,6 @@ public class Algorithm {
this.skipJava = skipJava;
***REMOVED***
***REMOVED***

View File

@ -1,5 +1,6 @@
package org.gcube.dataanalysis.dataminer.poolmanager.rest;
import java.io.File;
***REMOVED***
import java.net.MalformedURLException;
***REMOVED***
@ -12,11 +13,12 @@ import javax.ws.rs.QueryParam;
***REMOVED***
import org.gcube.dataanalysis.dataminer.poolmanager.datamodel.Algorithm;
import org.gcube.dataanalysis.dataminer.poolmanager.process.AddAlgorithmCommand;
import org.gcube.dataanalysis.dataminer.poolmanager.service.DataminerPoolManager;
import org.gcube.dataanalysis.dataminerpoolmanager.AlgorithmPackageParserTest;
***REMOVED***
***REMOVED***
@Path("/")
public class RestPoolManager implements PoolManager {
@ -24,18 +26,52 @@ public class RestPoolManager implements PoolManager {
private PoolManager service = new DataminerPoolManager();
@GET
@Path("/add")
@Produces("text/plain")
public String addAlgorithmToVRE(@QueryParam("algorithm") String algorithm, @QueryParam("vre") String vre) throws IOException, InterruptedException {
public String addAlgorithmToVRE(@QueryParam("algorithm") String algorithm, @QueryParam("vre") String vre,
@QueryParam("name") String name, @QueryParam("description") String description,
@QueryParam("category") String category, @QueryParam("algorithmType") String algorithmType,
@QueryParam("skipJava") String skipJava) throws IOException, InterruptedException {
***REMOVED*** TODO Auto-generated method stub
LOGGER.debug("Adding algorithm =" + algorithm + " to VRE =" + vre);
Algorithm algo = service.extractAlgorithm(algorithm);
if (algo.getCategory() == null) {
algo.setCategory(category);
***REMOVED*** else
category = algo.getCategory();
System.out.println("category is: " + category);
if (algo.getAlgorithmType() == null) {
algo.setAlgorithmType(algorithmType);
***REMOVED*** else
algorithmType = algo.getCategory();
System.out.println("algorithmType is: " + algorithmType);
if (algo.getSkipJava() == null) {
algo.setSkipJava(skipJava);
***REMOVED*** else
skipJava = algo.getSkipJava();
System.out.println("skipJava is: " + skipJava);
if (algo.getName() == null) {
algo.setCategory(name);
***REMOVED*** else
name = algo.getName();
System.out.println("name is: " + name);
if (algo.getDescription() == null) {
algo.setDescription(description);
;
***REMOVED*** else
description = algo.getDescription();
System.out.println("description is: " + description);
return service.addAlgorithmToVRE(algo, vre);
***REMOVED***
@GET
@Path("/log")
@Produces("text/plain")
@ -44,10 +80,6 @@ public class RestPoolManager implements PoolManager {
LOGGER.debug("Returning Log =" + logUrl);
return service.getScriptFromURL(service.getURLfromWorkerLog(logUrl));
***REMOVED***
@Override
public Algorithm extractAlgorithm(String url) throws IOException {
@ -55,21 +87,20 @@ public class RestPoolManager implements PoolManager {
return null;
***REMOVED***
public static void main(String[] args) throws IOException, InterruptedException {
RestPoolManager a = new RestPoolManager();
***REMOVED*** System.out.println(System.getProperty("user.home")+File.separator+"/gcube/dataminer-pool-manager");
ScopeProvider.instance.set("/gcube/devNext/NextNext");
a.addAlgorithmToVRE("http:***REMOVED***data.d4science.org/am84enRYYkZ3dGRjZk9qTytQTndqaFpTOFJtT3RQeGhHbWJQNStIS0N6Yz0", "/gcube/devNext/NextNext");
***REMOVED***System.out.println(a.getLogById("dadcb059-69e5-48c3-aa58-3b290ae0419d"));
a.addAlgorithmToVRE("http:***REMOVED***data.d4science.org/am84enRYYkZ3dGRjZk9qTytQTndqaFpTOFJtT3RQeGhHbWJQNStIS0N6Yz0",
"/gcube/devNext/NextNext", null, null, "ICHTHYOP_MODEL", "transducerers", "N");
***REMOVED*** System.out.println(a.getLogById("dadcb059-69e5-48c3-aa58-3b290ae0419d"));
***REMOVED***
@Override
public void getLogId(Algorithm algo, String vre) {
***REMOVED*** TODO Auto-generated method stub
***REMOVED***
***REMOVED***
@Override
public String getScriptFromURL(URL logId) throws IOException {
@ -77,27 +108,16 @@ public class RestPoolManager implements PoolManager {
return null;
***REMOVED***
@Override
public String addAlgorithmToVRE(Algorithm algo, String vre) throws IOException, InterruptedException {
***REMOVED*** TODO Auto-generated method stub
return null;
***REMOVED***
@Override
public URL getURLfromWorkerLog(String logUrl) throws MalformedURLException, UnknownHostException {
***REMOVED*** TODO Auto-generated method stub
return null;
***REMOVED***
***REMOVED***

View File

@ -214,7 +214,7 @@ public class DataminerPoolManager implements PoolManager {
public URL getURLfromWorkerLog(String a) throws MalformedURLException, UnknownHostException{
File path = new File("/tmp/dataminer-pool-manager/work/" + File.separator + a+File.separator +"logs");
File path = new File(System.getProperty("user.home")+File.separator+"/gcube/dataminer-pool-manager/work");
path.mkdirs();
File n = new File(path + File.separator +a);

View File

@ -17,7 +17,7 @@ public class AlgorithmPackageParserTest {
private static int BUFFER_SIZE = 2048;
private void extractAllAlgorithms() throws IOException {
public void extractAllAlgorithms() throws IOException {
String url = "http:***REMOVED***svn.research-infrastructures.eu/public/d4science/gcube/trunk/data-analysis/DataMinerConfiguration/algorithms/dev/algorithms";
List<String> commands = this.extractAddAlgorithmCommands(url);
AlgorithmSet algorithms = new AlgorithmSet();
@ -110,8 +110,8 @@ public class AlgorithmPackageParserTest {
***REMOVED***
public static void main(String[] args) throws Exception {
ProxySelector.setDefault(new PropertiesBasedProxySelector(
"/home/ngalante/.proxy-settings"));
***REMOVED*** ProxySelector.setDefault(new PropertiesBasedProxySelector(
***REMOVED*** "/home/ngalante/.proxy-settings"));
new AlgorithmPackageParserTest().extractAllAlgorithms();
***REMOVED***

View File

@ -13,7 +13,7 @@ import org.gcube.dataanalysis.dataminer.poolmanager.ansible.model.RoleFile;
public class AnsibleWorkerTest {
public static void main(String[] args) throws IOException {
AnsibleWorker worker = new AnsibleWorker(new File("/tmp/dataminer-pool-manager/work/"+UUID.randomUUID().toString()));
AnsibleWorker worker = new AnsibleWorker(new File("/home/nagalante/gcube/dataminer-pool-manager/work/"+UUID.randomUUID().toString()));
System.out.println("created worker named " + worker.getWorkerId());

View File

@ -211,7 +211,7 @@ public class DataminerPoolManagerTest {
ensemble.setAlgorithmType("transducerers");
ensemble.setPackageURL("http:***REMOVED***data.d4science.org/R0FqV2lNOW1jMkxuUEIrWXY4aUhvSENHSmVMQks4NjdHbWJQNStIS0N6Yz0");
ensemble.setClazz("org.gcube.dataanalysis.executor.rscripts.Ichthyopmodelonebyone");
ensemble.setSkipJava("test");
ensemble.setSkipJava("N");
ensemble.setDescription("test");
Dependency d = new Dependency();