This commit is contained in:
Nunzio Andrea Galante 2017-02-21 09:59:25 +00:00
parent 1096917cbd
commit d699f64c51
5 changed files with 32 additions and 6 deletions

View File

@ -1,7 +1,10 @@
package org.gcube.dataanalysis.dataminer.poolmanager.ansible;
***REMOVED***
import java.io.File;
***REMOVED***
***REMOVED***
import java.io.OutputStream;
import org.gcube.dataanalysis.dataminer.poolmanager.ansible.model.Inventory;
import org.gcube.dataanalysis.dataminer.poolmanager.ansible.model.Playbook;
@ -62,7 +65,7 @@ public class AnsibleWorker {
public void removeWorkStructure() {
***REMOVED*** remove the working dir
***REMOVED*** this.getWorkdir().delete();
***REMOVED***this.getWorkdir().delete();
***REMOVED***
public File getPlaybookFile() {
@ -91,9 +94,21 @@ public class AnsibleWorker {
public void apply() {
public void apply() throws IOException {
***REMOVED*** TODO execute the playbook and return output
System.out.println("TODO: execute: ansible-playbook -v -i " + this.getInventoryFile().getName() + " " + this.getPlaybookFile().getName());
try {
System.out.println("ansible-playbook -v -i " + this.getInventoryFile().getName() + " " + this.getPlaybookFile().getName());
Process p = Runtime.getRuntime().exec("ansible-playbook -v -i " + this.getInventoryFile().getName() + " " + this.getPlaybookFile().getName());
BufferedReader in = new BufferedReader(
new InputStreamReader(p.getInputStream()));
String line = null;
while ((line = in.readLine()) != null) {
System.out.println(line);
***REMOVED***
***REMOVED*** catch (IOException e) {
e.printStackTrace();
***REMOVED***
***REMOVED***System.out.println("TODO: execute: ansible-playbook -v -i " + this.getInventoryFile().getName() + " " + this.getPlaybookFile().getName());
***REMOVED***
/**

View File

@ -202,8 +202,10 @@ public class AnsibleBridge {
FileOutputStream fos = new FileOutputStream(n);
PrintStream ps = new PrintStream(fos);
System.setOut(ps);
System.setErr(ps);
worker.apply();
System.setOut(console);
System.setErr(console);
worker.apply();
System.out.println("Log stored to to " + n.getAbsolutePath());

View File

@ -9,6 +9,8 @@ import java.util.Vector;
import org.gcube.common.resources.gcore.ServiceEndpoint;
***REMOVED***
import org.gcube.dataanalysis.dataminer.poolmanager.datamodel.Domain;
***REMOVED***
import org.gcube.resources.discovery.client.api.DiscoveryClient;
import org.gcube.resources.discovery.client.queries.api.SimpleQuery;
@ -27,7 +29,8 @@ public class ISClient {
if (!remote) {
Collection<Host> out = new Vector<>();
Host h = new Host();
h.setName("bb-dataminer.res.eng.it");
***REMOVED***h.setName("bb-dataminer.res.eng.it");
h.setName("vm123.ui.savba.sk");
out.add(h);
return out;
***REMOVED*** else {
@ -51,4 +54,9 @@ public class ISClient {
***REMOVED***
***REMOVED***
***REMOVED*** public static void main(String[] args) {
***REMOVED*** ISClient a = new ISClient();
***REMOVED*** ScopeProvider.instance.set("/gcube/devNext/NextNext");
***REMOVED*** System.out.println(a.listDataminersInVRE());
***REMOVED******REMOVED***
***REMOVED***

View File

@ -10,6 +10,7 @@ import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
***REMOVED***
import org.gcube.dataanalysis.dataminer.poolmanager.datamodel.Algorithm;
import org.gcube.dataanalysis.dataminer.poolmanager.service.DataminerPoolManager;
***REMOVED***
@ -57,6 +58,7 @@ public class RestPoolManager implements PoolManager {
public static void main(String[] args) throws IOException, InterruptedException {
RestPoolManager a = new RestPoolManager();
ScopeProvider.instance.set("/gcube/devNext/NextNext");
a.addAlgorithmToVRE("http:***REMOVED***data.d4science.org/R0FqV2lNOW1jMkxuUEIrWXY4aUhvSENHSmVMQks4NjdHbWJQNStIS0N6Yz0", "/gcube/devNext/NextNext");
***REMOVED***System.out.println(a.getLogById("dadcb059-69e5-48c3-aa58-3b290ae0419d"));
***REMOVED***

View File

@ -207,7 +207,7 @@ public class DataminerPoolManager implements PoolManager {
***REMOVED***;
new Thread(r).start();
***REMOVED***this line will execute immediately, not waiting for your task to complete
System.out.println(uuid);
System.out.println(uuid);
return uuid;
***REMOVED***
@ -235,7 +235,6 @@ public class DataminerPoolManager implements PoolManager {
***REMOVED*** apply the changes
AnsibleBridge a = new AnsibleBridge();
return a.applyAlgorithmSetToCluster(algorithms, cluster,uuid).getWorkerId();
***REMOVED***