This commit is contained in:
Nunzio Andrea Galante 2017-04-28 14:26:40 +00:00
parent 3035a8ee2f
commit 67951c80e5
3 changed files with 69 additions and 67 deletions

View File

@ -118,55 +118,54 @@ public class AnsibleWorker {
public void apply(AlgorithmSet as, PrintStream ps, boolean updateSVN) throws IOException, InterruptedException, SVNException {
// TODO execute the playbook and return output
System.out.println(this.getWorkdir());
try {
Process p = Runtime.getRuntime().exec("ansible-playbook -v -i " + this.getInventoryFile().getAbsolutePath() + " " + this.getPlaybookFile().getAbsolutePath());
public void apply(AlgorithmSet as, PrintStream ps, boolean updateSVN)
throws IOException, InterruptedException, SVNException {
// TODO execute the playbook and return output
System.out.println(this.getWorkdir());
try {
Process p = Runtime.getRuntime().exec("ansible-playbook -v -i " + this.getInventoryFile().getAbsolutePath()
+ " " + this.getPlaybookFile().getAbsolutePath());
inheritIO(p.getInputStream(), ps);
inheritIO(p.getErrorStream(), ps);
if (updateSVN){
int exitValue = p.waitFor();
if (exitValue == 0){
for (Algorithm algo : as.getAlgorithms()){
for (Dependency d : algo.getDependencies()) {
if (d.getType().equals("os")) {
List<String> ls = new LinkedList<String>();
ls.add(d.getName());
this.updateSVN("r_deb_pkgs.txt", ls);
}
if (d.getType().equals("cran")) {
List<String> ls = new LinkedList<String>();
ls.add(d.getName());
this.updateSVN("r_cran_pkgs.txt", ls);
}
if (d.getType().equals("github")) {
List<String> ls = new LinkedList<String>();
ls.add(d.getName());
this.updateSVN("r_github_pkgs.txt", ls);
}
}
}
}
}
} catch (IOException e) {
e.printStackTrace();
}
//System.out.println("TODO: execute: ansible-playbook -v -i " + this.getInventoryFile().getName() + " " + this.getPlaybookFile().getName());
}
inheritIO(p.getInputStream(), ps);
inheritIO(p.getErrorStream(), ps);
if (updateSVN) {
int exitValue = p.waitFor();
if (exitValue == 0) {
for (Algorithm algo : as.getAlgorithms()) {
for (Dependency d : algo.getDependencies()) {
if (d.getType().equals("os")) {
List<String> ls = new LinkedList<String>();
ls.add(d.getName());
this.updateSVN("r_deb_pkgs.txt", ls);
}
if (d.getType().equals("cran")) {
List<String> ls = new LinkedList<String>();
ls.add(d.getName());
this.updateSVN("r_cran_pkgs.txt", ls);
}
if (d.getType().equals("github")) {
List<String> ls = new LinkedList<String>();
ls.add(d.getName());
this.updateSVN("r_github_pkgs.txt", ls);
}
}
}
}
}
} catch (IOException e) {
e.printStackTrace();
}
// System.out.println("TODO: execute: ansible-playbook -v -i " +
// this.getInventoryFile().getName() + " " +
// this.getPlaybookFile().getName());
}

View File

@ -96,7 +96,8 @@ public class HAProxy {
// prod
// URL stockURL = new
// URL("http://data.d4science.org/Yk4zSFF6V3JOSytNd3JkRDlnRFpDUUR5TnRJZEw2QjRHbWJQNStIS0N6Yz0");
URL stockURL = new URL("http://" + ISClient.getHProxy() + ":8880/;csv");
//URL stockURL = new URL("http://"+ ISClient.getHProxy() +":8880/;csv");
URL stockURL = new URL("http://data.d4science.org/c29KTUluTkZnRlB0WXE5NVNaZnRoR0dtYThUSmNTVlhHbWJQNStIS0N6Yz0");
System.out.println(stockURL);
// dev
// URL stockURL = new
@ -109,12 +110,14 @@ public class HAProxy {
continue;
}
if (nextLine[0].equals(cluster.getName())) {
a.setName(nextLine[1]);
out.add(a);
System.out.println(a.getFullyQualifiedName());
Host b = new Host();
b.setName(nextLine[1]);
out.add(b);
System.out.println(b.getFullyQualifiedName());
}
}
}
System.out.println(out);
return out;
}

View File

@ -283,7 +283,7 @@ public class RestPoolManager implements PoolManager {
// ProxySelector.setDefault(new
// PropertiesBasedProxySelector("/home/ngalante/.proxy-settings"));
ScopeProvider.instance.set("/gcube/preprod/preVRE");
ScopeProvider.instance.set("/gcube/devNext/NextNext");
// PoolManager aa = new DataminerPoolManager();
// System.out.println(aa.getAlgoById("ICHTHYOP_MODEL_ONE_BY_ONE@3141d3aa-5f93-409f-b6f8-9fae0a6c0ee3"));
@ -291,21 +291,21 @@ public class RestPoolManager implements PoolManager {
RestPoolManager a = new RestPoolManager();
// a.addAlgorithmToVRE(
// "http://data.d4science.org/TVc0TW9Ud1FjYlppK0NHd2pvU0owNmRFWHE4OW4xSGNHbWJQNStIS0N6Yz0",
// "test",
// null,
// null,
// "N",
// "transducerers",
// true,
// false);
a.addAlgorithmToVRE(
"http://data.d4science.org/TVc0TW9Ud1FjYlppK0NHd2pvU0owNmRFWHE4OW4xSGNHbWJQNStIS0N6Yz0",
"test",
null,
null,
"N",
"transducerers",
false,
false);
a.addAlgorithmToHost(
"http://data.d4science.org/MnovRjZIdGV5WlB0WXE5NVNaZnRoRVg0SU8xZWpWQlFHbWJQNStIS0N6Yz0",
"dataminer1-pre.d4science.org",
"ICHTHYOP_MODEL_ONE_BY_ONE", null, "ICHTHYOP_MODEL", "transducerers",
"N",false, false);
// a.addAlgorithmToHost(
// "http://data.d4science.org/MnovRjZIdGV5WlB0WXE5NVNaZnRoRVg0SU8xZWpWQlFHbWJQNStIS0N6Yz0",
// "dataminer1-pre.d4science.org",
// "ICHTHYOP_MODEL_ONE_BY_ONE", null, "ICHTHYOP_MODEL", "transducerers",
// "N",false, false);