git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-analysis/dataminer-pool-manager@144486 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
37bdea6c3e
commit
c40cec3733
|
@ -203,11 +203,12 @@ public class AnsibleBridge {
|
||||||
FileOutputStream fos = new FileOutputStream(n);
|
FileOutputStream fos = new FileOutputStream(n);
|
||||||
PrintStream ps = new PrintStream(fos);
|
PrintStream ps = new PrintStream(fos);
|
||||||
System.setOut(ps);
|
System.setOut(ps);
|
||||||
System.setErr(ps);
|
***REMOVED***System.setErr(ps);
|
||||||
worker.apply();
|
|
||||||
System.setOut(console);
|
|
||||||
System.setErr(console);
|
System.setErr(console);
|
||||||
|
|
||||||
worker.apply();
|
worker.apply();
|
||||||
|
***REMOVED***System.setOut(console);
|
||||||
|
***REMOVED***worker.apply();
|
||||||
System.out.println("Log stored to to " + n.getAbsolutePath());
|
System.out.println("Log stored to to " + n.getAbsolutePath());
|
||||||
|
|
||||||
***REMOVED*** destroy the worker
|
***REMOVED*** destroy the worker
|
||||||
|
@ -235,6 +236,8 @@ public class AnsibleBridge {
|
||||||
*/
|
*/
|
||||||
public Collection<Role> generateRoles(Dependency d) {
|
public Collection<Role> generateRoles(Dependency d) {
|
||||||
Collection<Role> roles = new Vector<>();
|
Collection<Role> roles = new Vector<>();
|
||||||
|
|
||||||
|
|
||||||
if("os".equalsIgnoreCase(d.getType())) {
|
if("os".equalsIgnoreCase(d.getType())) {
|
||||||
OSDependencyPackage pkg = new OSDependencyPackage(d);
|
OSDependencyPackage pkg = new OSDependencyPackage(d);
|
||||||
if(pkg!=null) {
|
if(pkg!=null) {
|
||||||
|
|
|
@ -30,7 +30,8 @@ public class ISClient {
|
||||||
Collection<Host> out = new Vector<>();
|
Collection<Host> out = new Vector<>();
|
||||||
Host h = new Host();
|
Host h = new Host();
|
||||||
***REMOVED***h.setName("bb-dataminer.res.eng.it");
|
***REMOVED***h.setName("bb-dataminer.res.eng.it");
|
||||||
h.setName("vm101.ui.savba.sk");
|
***REMOVED***h.setName("vm101.ui.savba.sk");
|
||||||
|
h.setName("dataminer1-devnext.d4science.org");
|
||||||
out.add(h);
|
out.add(h);
|
||||||
return out;
|
return out;
|
||||||
***REMOVED*** else {
|
***REMOVED*** else {
|
||||||
|
|
|
@ -10,6 +10,7 @@ import java.util.Vector;
|
||||||
import java.util.zip.ZipEntry;
|
import java.util.zip.ZipEntry;
|
||||||
import java.util.zip.ZipInputStream;
|
import java.util.zip.ZipInputStream;
|
||||||
|
|
||||||
|
import org.apache.commons.lang.StringEscapeUtils;
|
||||||
import org.gcube.dataanalysis.dataminer.poolmanager.datamodel.Algorithm;
|
import org.gcube.dataanalysis.dataminer.poolmanager.datamodel.Algorithm;
|
||||||
import org.gcube.dataanalysis.dataminer.poolmanager.datamodel.Dependency;
|
import org.gcube.dataanalysis.dataminer.poolmanager.datamodel.Dependency;
|
||||||
|
|
||||||
|
@ -149,24 +150,91 @@ public class AlgorithmPackageParser {
|
||||||
* @param metadata
|
* @param metadata
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private Algorithm createAlgorithm(Map<String, List<String>> metadata) {
|
***REMOVED*** private Algorithm createAlgorithm(Map<String, List<String>> metadata) {
|
||||||
Algorithm out = new Algorithm();
|
***REMOVED*** Algorithm out = new Algorithm();
|
||||||
out.setName(extractSingleValue(metadata, METADATA_ALGORITHM_NAME));
|
***REMOVED*** out.setName(extractSingleValue(metadata, METADATA_ALGORITHM_NAME));
|
||||||
out.setDescription(extractSingleValue(metadata, METADATA_ALGORITHM_DESCRIPTION));
|
***REMOVED*** out.setDescription(extractSingleValue(metadata, METADATA_ALGORITHM_DESCRIPTION));
|
||||||
out.setClazz(extractSingleValue(metadata, METADATA_CLASS_NAME));
|
***REMOVED*** out.setClazz(extractSingleValue(metadata, METADATA_CLASS_NAME));
|
||||||
List<String> dependencies = extractMultipleValues(metadata, METADATA_PACKAGES);
|
***REMOVED*** List<String> dependencies = extractMultipleValues(metadata, METADATA_PACKAGES);
|
||||||
if (dependencies != null) {
|
***REMOVED*** if (dependencies != null) {
|
||||||
for (String pkg : dependencies) {
|
***REMOVED*** for (String pkg : dependencies) {
|
||||||
Dependency dep = new Dependency();
|
***REMOVED*** Dependency dep = new Dependency();
|
||||||
dep.setName(pkg);
|
***REMOVED*** dep.setName(pkg);
|
||||||
dep.setType("os");
|
***REMOVED*** dep.setType("os");
|
||||||
out.addDependency(dep);
|
***REMOVED*** out.addDependency(dep);
|
||||||
***REMOVED***
|
***REMOVED*** ***REMOVED***
|
||||||
***REMOVED***
|
***REMOVED*** ***REMOVED***
|
||||||
return out;
|
***REMOVED*** return out;
|
||||||
***REMOVED***
|
***REMOVED*** ***REMOVED***
|
||||||
|
|
||||||
|
|
||||||
|
private Algorithm createAlgorithm(Map<String, List<String>> metadata) {
|
||||||
|
Algorithm out = new Algorithm();
|
||||||
|
out.setName(extractSingleValue(metadata, METADATA_ALGORITHM_NAME));
|
||||||
|
out.setDescription(extractSingleValue(metadata, METADATA_ALGORITHM_DESCRIPTION));
|
||||||
|
out.setClazz(extractSingleValue(metadata, METADATA_CLASS_NAME));
|
||||||
|
List<String> rdependencies = extractMultipleValues(metadata, "r");
|
||||||
|
if (rdependencies != null) {
|
||||||
|
for (String pkg : rdependencies) {
|
||||||
|
Dependency dep = new Dependency();
|
||||||
|
|
||||||
|
***REMOVED***if (pkg.startsWith("os:")){
|
||||||
|
dep.setName(pkg);
|
||||||
|
dep.setType("cran");
|
||||||
|
out.addDependency(dep);
|
||||||
|
***REMOVED***
|
||||||
|
***REMOVED***
|
||||||
|
|
||||||
|
|
||||||
|
List<String> osdependencies = extractMultipleValues(metadata, "os");
|
||||||
|
if (osdependencies != null) {
|
||||||
|
for (String pkg : osdependencies) {
|
||||||
|
Dependency dep = new Dependency();
|
||||||
|
|
||||||
|
***REMOVED***if (pkg.startsWith("os:")){
|
||||||
|
dep.setName(pkg);
|
||||||
|
dep.setType("os");
|
||||||
|
out.addDependency(dep);
|
||||||
|
***REMOVED***
|
||||||
|
***REMOVED***
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
List<String> cdependencies = extractMultipleValues(metadata, "custom");
|
||||||
|
if (cdependencies != null) {
|
||||||
|
for (String pkg : cdependencies) {
|
||||||
|
Dependency dep = new Dependency();
|
||||||
|
|
||||||
|
***REMOVED***if (pkg.startsWith("os:")){
|
||||||
|
dep.setName(pkg);
|
||||||
|
dep.setType("custom");
|
||||||
|
out.addDependency(dep);
|
||||||
|
***REMOVED***
|
||||||
|
***REMOVED***
|
||||||
|
|
||||||
|
|
||||||
|
***REMOVED*** if (pkg.startsWith("r:")){
|
||||||
|
***REMOVED*** ***REMOVED***String results = StringEscapeUtils.escapeJava(pkg);
|
||||||
|
***REMOVED*** dep.setName(pkg);
|
||||||
|
***REMOVED*** dep.setType("cran");
|
||||||
|
***REMOVED*** ***REMOVED***
|
||||||
|
***REMOVED*** if (pkg.startsWith("custom:")){
|
||||||
|
***REMOVED*** dep.setName(pkg);
|
||||||
|
***REMOVED*** dep.setType("custom");
|
||||||
|
***REMOVED*** ***REMOVED***
|
||||||
|
***REMOVED*** if (!pkg.startsWith("os:")&&!pkg.startsWith("r:")&&!pkg.startsWith("custom:")){
|
||||||
|
***REMOVED*** dep.setName(pkg);
|
||||||
|
***REMOVED*** dep.setType("os");
|
||||||
|
***REMOVED*** ***REMOVED***
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return out;
|
||||||
|
***REMOVED***
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private static String extractSingleValue(Map<String, List<String>> metadata,
|
private static String extractSingleValue(Map<String, List<String>> metadata,
|
||||||
String key) {
|
String key) {
|
||||||
List<String> l = metadata.get(key);
|
List<String> l = metadata.get(key);
|
||||||
|
@ -177,6 +245,9 @@ public class AlgorithmPackageParser {
|
||||||
***REMOVED***
|
***REMOVED***
|
||||||
***REMOVED***
|
***REMOVED***
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private static List<String> extractMultipleValues(
|
private static List<String> extractMultipleValues(
|
||||||
Map<String, List<String>> metadata, String key) {
|
Map<String, List<String>> metadata, String key) {
|
||||||
List<String> l = metadata.get(key);
|
List<String> l = metadata.get(key);
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
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;
|
||||||
|
import java.net.ProxySelector;
|
||||||
***REMOVED***
|
***REMOVED***
|
||||||
import java.net.UnknownHostException;
|
import java.net.UnknownHostException;
|
||||||
|
|
||||||
|
@ -13,12 +13,14 @@ 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;
|
import org.gcube.dataanalysis.dataminer.poolmanager.util.PropertiesBasedProxySelector;
|
||||||
***REMOVED***
|
***REMOVED***
|
||||||
***REMOVED***
|
***REMOVED***
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Path("/")
|
@Path("/")
|
||||||
public class RestPoolManager implements PoolManager {
|
public class RestPoolManager implements PoolManager {
|
||||||
|
|
||||||
|
@ -26,52 +28,46 @@ 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,
|
public String addAlgorithmToVRE(
|
||||||
@QueryParam("name") String name, @QueryParam("description") String description,
|
@QueryParam("algorithm") String algorithm,
|
||||||
@QueryParam("category") String category, @QueryParam("algorithmType") String algorithmType,
|
@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 {
|
@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) {
|
if (algo.getCategory() == null){
|
||||||
algo.setCategory(category);
|
algo.setCategory(category);
|
||||||
***REMOVED*** else
|
***REMOVED*** else category = algo.getCategory();
|
||||||
category = algo.getCategory();
|
|
||||||
System.out.println("category is: " + category);
|
if (algo.getAlgorithmType() == null){
|
||||||
|
|
||||||
if (algo.getAlgorithmType() == null) {
|
|
||||||
algo.setAlgorithmType(algorithmType);
|
algo.setAlgorithmType(algorithmType);
|
||||||
***REMOVED*** else
|
***REMOVED*** else algorithmType = algo.getCategory();
|
||||||
algorithmType = algo.getCategory();
|
|
||||||
System.out.println("algorithmType is: " + algorithmType);
|
if (algo.getSkipJava() == null){
|
||||||
|
|
||||||
if (algo.getSkipJava() == null) {
|
|
||||||
algo.setSkipJava(skipJava);
|
algo.setSkipJava(skipJava);
|
||||||
***REMOVED*** else
|
***REMOVED*** else skipJava = algo.getSkipJava();
|
||||||
skipJava = algo.getSkipJava();
|
|
||||||
System.out.println("skipJava is: " + skipJava);
|
if (algo.getName() == null){
|
||||||
|
|
||||||
if (algo.getName() == null) {
|
|
||||||
algo.setCategory(name);
|
algo.setCategory(name);
|
||||||
***REMOVED*** else
|
***REMOVED*** else name = algo.getName();
|
||||||
name = algo.getName();
|
|
||||||
System.out.println("name is: " + name);
|
if (algo.getDescription() == null){
|
||||||
|
algo.setDescription(description);;
|
||||||
if (algo.getDescription() == null) {
|
***REMOVED*** else description = algo.getDescription();
|
||||||
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")
|
||||||
|
@ -80,6 +76,10 @@ 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 {
|
||||||
|
@ -87,37 +87,58 @@ 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");
|
***REMOVED***System.out.println(System.getProperty("user.home")+File.separator+"/gcube/dataminer-pool-manager");
|
||||||
|
|
||||||
|
|
||||||
|
***REMOVED***ProxySelector.setDefault(new PropertiesBasedProxySelector("/home/ngalante/.proxy-settings"));
|
||||||
|
|
||||||
ScopeProvider.instance.set("/gcube/devNext/NextNext");
|
ScopeProvider.instance.set("/gcube/devNext/NextNext");
|
||||||
a.addAlgorithmToVRE("http:***REMOVED***data.d4science.org/am84enRYYkZ3dGRjZk9qTytQTndqaFpTOFJtT3RQeGhHbWJQNStIS0N6Yz0",
|
a.addAlgorithmToVRE(
|
||||||
"/gcube/devNext/NextNext", null, null, "ICHTHYOP_MODEL", "transducerers", "N");
|
"http:***REMOVED***data.d4science.org/cXhJV0s4b3dUN05jZk9qTytQTndqdmVUdURLOTRHeHpHbWJQNStIS0N6Yz0",
|
||||||
***REMOVED*** System.out.println(a.getLogById("dadcb059-69e5-48c3-aa58-3b290ae0419d"));
|
"/gcube/devNext/NextNext",
|
||||||
|
null, null, "test", "transducerers", "N");
|
||||||
|
|
||||||
|
***REMOVED***System.out.println(a.getLogById("34ac474d-b9df-4929-87e1-2a0ae26cf898"));
|
||||||
***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 {
|
||||||
***REMOVED*** TODO Auto-generated method stub
|
***REMOVED*** TODO Auto-generated method stub
|
||||||
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***
|
Loading…
Reference in New Issue