This commit is contained in:
Nunzio Andrea Galante 2017-05-11 15:03:59 +00:00
parent 3331ec29b2
commit d428b52929
6 changed files with 24 additions and 18 deletions

View File

@ -96,7 +96,7 @@ public class AnsibleBridge {
List<Role> 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<Role> generateRoles(Algorithm a) {
AlgorithmPackage pkg = new AlgorithmPackage(a);
public Collection<Role> generateRoles(Algorithm a,boolean includeAlgorithmDependencies) {
AlgorithmPackage pkg = new AlgorithmPackage(a,includeAlgorithmDependencies);
return pkg.getRoles(this.getTemplateManager());
}
}
}

View File

@ -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<String, String> getDictionary(Algorithm a) {
Map<String, String> out = new HashMap<String, String>();
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;

View File

@ -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");

View File

@ -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();
}

View File

@ -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());

View File

@ -146,7 +146,7 @@ public class DataminerPoolManager {
if(retValue == 0) {
updateSVNDependencies(algo, stagingVRE);
createISResource(algo, targetVREToken);
//createISResource(algo, targetVREToken);
}
// destroy the worker
worker.destroy();