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; private String dpmRoot;
public AnsibleBridge() { public AnsibleBridge() {
this("/tmp/dataminer-pool-manager"); this(System.getProperty("user.home")+File.separator+"/gcube/dataminer-pool-manager");
***REMOVED*** ***REMOVED***
public AnsibleBridge(String root) { public AnsibleBridge(String root) {

View File

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

View File

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

View File

@ -214,7 +214,7 @@ public class DataminerPoolManager implements PoolManager {
public URL getURLfromWorkerLog(String a) throws MalformedURLException, UnknownHostException{ 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(); path.mkdirs();
File n = new File(path + File.separator +a); File n = new File(path + File.separator +a);

View File

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

View File

@ -13,7 +13,7 @@ import org.gcube.dataanalysis.dataminer.poolmanager.ansible.model.RoleFile;
public class AnsibleWorkerTest { public class AnsibleWorkerTest {
public static void main(String[] args) throws IOException { 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()); System.out.println("created worker named " + worker.getWorkerId());

View File

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