This commit is contained in:
Nunzio Andrea Galante 2017-02-21 09:59:25 +00:00
parent 3b76c592e3
commit 1c77915423
4 changed files with 30 additions and 6 deletions

View File

@ -1,7 +1,10 @@
package org.gcube.dataanalysis.dataminer.poolmanager.ansible;
import java.io.BufferedReader;
import java.io.File;
***REMOVED***
import java.io.InputStreamReader;
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 ***REMOVED***
public void removeWorkStructure() ***REMOVED***
***REMOVED*** remove the working dir
***REMOVED*** this.getWorkdir().delete();
***REMOVED***this.getWorkdir().delete();
***REMOVED***
public File getPlaybookFile() ***REMOVED***
@ -91,9 +94,21 @@ public class AnsibleWorker ***REMOVED***
public void apply() ***REMOVED***
public void apply() throws IOException ***REMOVED***
***REMOVED*** TODO execute the playbook and return output
System.out.println("TODO: execute: ansible-playbook -v -i " + this.getInventoryFile().getName() + " " + this.getPlaybookFile().getName());
try ***REMOVED***
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) ***REMOVED***
System.out.println(line);
***REMOVED***
***REMOVED*** catch (IOException e) ***REMOVED***
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 ***REMOVED***
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

@ -8,6 +8,8 @@ import java.util.Collection;
import java.util.Vector;
import org.gcube.common.resources.gcore.ServiceEndpoint;
***REMOVED***
import org.gcube.dataanalysis.dataminer.poolmanager.datamodel.Domain;
import org.gcube.dataanalysis.dataminer.poolmanager.datamodel.Host;
import org.gcube.resources.discovery.client.api.DiscoveryClient;
import org.gcube.resources.discovery.client.queries.api.SimpleQuery;
@ -27,7 +29,8 @@ public class ISClient ***REMOVED***
if (!remote) ***REMOVED***
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 ***REMOVED***
@ -51,4 +54,9 @@ public class ISClient ***REMOVED***
***REMOVED***
***REMOVED***
***REMOVED*** public static void main(String[] args) ***REMOVED***
***REMOVED*** ISClient a = new ISClient();
***REMOVED*** ScopeProvider.instance.set("/gcube/devNext/NextNext");
***REMOVED*** System.out.println(a.listDataminersInVRE());
***REMOVED******REMOVED***
***REMOVED***

View File

@ -207,7 +207,7 @@ public class DataminerPoolManager implements PoolManager ***REMOVED***
***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***
***REMOVED*** apply the changes
AnsibleBridge a = new AnsibleBridge();
return a.applyAlgorithmSetToCluster(algorithms, cluster,uuid).getWorkerId();
***REMOVED***