diff --git a/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/ansiblebridge/AnsibleBridge.java b/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/ansiblebridge/AnsibleBridge.java index 374a114..6e84503 100644 --- a/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/ansiblebridge/AnsibleBridge.java +++ b/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/ansiblebridge/AnsibleBridge.java @@ -96,7 +96,7 @@ public class AnsibleBridge { List algoRoles = new Vector<>(); // add algorithms and dependencies to the worker - for (Role r : this.generateRoles(algorithm)) { + for (Role r : this.generateRoles(algorithm,includeAlgorithmDependencies)) { algoRoles.add(r); worker.addRole(r); } @@ -333,9 +333,10 @@ public class AnsibleBridge { return roles; } - public Collection generateRoles(Algorithm a) { - AlgorithmPackage pkg = new AlgorithmPackage(a); + public Collection generateRoles(Algorithm a,boolean includeAlgorithmDependencies) { + AlgorithmPackage pkg = new AlgorithmPackage(a,includeAlgorithmDependencies); return pkg.getRoles(this.getTemplateManager()); - } + + } } diff --git a/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/ansiblebridge/template/AlgorithmPackage.java b/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/ansiblebridge/template/AlgorithmPackage.java index 9393c8e..23a9859 100644 --- a/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/ansiblebridge/template/AlgorithmPackage.java +++ b/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/ansiblebridge/template/AlgorithmPackage.java @@ -14,11 +14,14 @@ import org.gcube.dataanalysis.dataminer.poolmanager.datamodel.Dependency; public class AlgorithmPackage { private Algorithm algorithm; - - public AlgorithmPackage(Algorithm a) { + private boolean includeAlgorithmDependencies; + public AlgorithmPackage(Algorithm a,boolean includeAlgorithmDependencies) { this.algorithm = a; + this.includeAlgorithmDependencies = includeAlgorithmDependencies; + } - + + protected Map getDictionary(Algorithm a) { Map out = new HashMap(); out.put("name", a.getName()); @@ -32,9 +35,10 @@ public class AlgorithmPackage { out.put("description", a.getDescription()); String deps = ""; + if(includeAlgorithmDependencies){ for(Dependency d:a.getDependencies()) { deps+=String.format("- { role: %s }\n", d.getType()+"-"+d.getName().replaceAll("/", "-")); - } + }} deps = deps.trim(); out.put("dependencies", deps); return out; diff --git a/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/clients/HAProxy.java b/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/clients/HAProxy.java index 858d025..81c733a 100644 --- a/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/clients/HAProxy.java +++ b/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/clients/HAProxy.java @@ -94,11 +94,11 @@ public class HAProxy { //} else { // prod - // URL stockURL = new - // URL("http://data.d4science.org/Yk4zSFF6V3JOSytNd3JkRDlnRFpDUUR5TnRJZEw2QjRHbWJQNStIS0N6Yz0"); + URL stockURL = new + URL("http://data.d4science.org/Yk4zSFF6V3JOSytNd3JkRDlnRFpDUUR5TnRJZEw2QjRHbWJQNStIS0N6Yz0"); //URL stockURL = new URL("http://"+ ISClient.getHProxy() +":8880/;csv"); - URL stockURL = new URL("http://data.d4science.org/c29KTUluTkZnRlB0WXE5NVNaZnRoR0dtYThUSmNTVlhHbWJQNStIS0N6Yz0"); - System.out.println(stockURL); + //URL stockURL = new URL("http://data.d4science.org/c29KTUluTkZnRlB0WXE5NVNaZnRoR0dtYThUSmNTVlhHbWJQNStIS0N6Yz0"); + //System.out.println(stockURL); // dev // URL stockURL = new // URL("http://data.d4science.org/c29KTUluTkZnRlB0WXE5NVNaZnRoR0dtYThUSmNTVlhHbWJQNStIS0N6Yz0"); diff --git a/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/clients/ISClient.java b/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/clients/ISClient.java index a24838c..51c64c0 100644 --- a/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/clients/ISClient.java +++ b/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/clients/ISClient.java @@ -223,7 +223,7 @@ public class ISClient { a.profile().newBody(this.getAlgoBody(algo)); try { SecurityTokenProvider.instance.set(token); - publishScopedResource(a, Arrays.asList(new String[] { ScopeProvider.instance.get() })); + publishScopedResource(a, Arrays.asList(new String[] { SecurityTokenProvider.instance.get() })); } catch (Exception e) { e.printStackTrace(); } diff --git a/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/rest/RestPoolManager.java b/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/rest/RestPoolManager.java index f3cbebb..617cbb1 100644 --- a/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/rest/RestPoolManager.java +++ b/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/rest/RestPoolManager.java @@ -69,10 +69,11 @@ public class RestPoolManager implements PoolManager { // ProxySelector.setDefault(new // PropertiesBasedProxySelector("/home/ngalante/.proxy-settings")); - //ScopeProvider.instance.set("/d4science.research-infrastructures.eu/gCubeApps/RPrototypingLab"); - SecurityTokenProvider.instance.set("3a23bfa4-4dfe-44fc-988f-194b91071dd2-843339462"); - - + ScopeProvider.instance.set("/d4science.research-infrastructures.eu/gCubeApps/RPrototypingLab"); + //SecurityTokenProvider.instance.set("3a23bfa4-4dfe-44fc-988f-194b91071dd2-843339462"); + RestPoolManager a = new RestPoolManager(); + //a.stageAlgorithm("http://data.d4science.org/MnovRjZIdGV5WlB0WXE5NVNaZnRoRVg0SU8xZWpWQlFHbWJQNStIS0N6Yz0"); + a.publishAlgorithm("http://data.d4science.org/MnovRjZIdGV5WlB0WXE5NVNaZnRoRVg0SU8xZWpWQlFHbWJQNStIS0N6Yz0", "3a23bfa4-4dfe-44fc-988f-194b91071dd2-843339462"); // PoolManager aa = new DataminerPoolManager(); // System.out.println(aa.getAlgoById("ICHTHYOP_MODEL_ONE_BY_ONE@3141d3aa-5f93-409f-b6f8-9fae0a6c0ee3")); // System.out.println(aa.getAlgoFromIs()); diff --git a/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/service/DataminerPoolManager.java b/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/service/DataminerPoolManager.java index 909fa42..626210d 100644 --- a/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/service/DataminerPoolManager.java +++ b/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/service/DataminerPoolManager.java @@ -146,7 +146,7 @@ public class DataminerPoolManager { if(retValue == 0) { updateSVNDependencies(algo, stagingVRE); - createISResource(algo, targetVREToken); + //createISResource(algo, targetVREToken); } // destroy the worker worker.destroy();