This commit is contained in:
Nunzio Andrea Galante 2017-04-26 15:39:24 +00:00
parent c381af3416
commit 24c7b210a6
23 changed files with 149 additions and 27 deletions

View File

@ -174,7 +174,7 @@ public class AnsibleWorker {
SVNRepository repository = SVNRepositoryFactory.create(SVNURL.parseURIEncoded(url));
ISVNAuthenticationManager authManager = SVNWCUtil.createDefaultAuthenticationManager();
repository.setAuthenticationManager(authManager);
System.out.println(repository.getLocation());
//System.out.println(repository.getLocation());
return repository;
}

View File

@ -3,6 +3,7 @@ package org.gcube.dataanalysis.dataminer.poolmanager.ansiblebridge;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Collection;
import java.util.List;
@ -44,7 +45,7 @@ public class AnsibleBridge {
private String dpmRoot;
public AnsibleBridge() {
this(System.getProperty("user.home")+File.separator+"/gcube/dataminer-pool-manager");
this(System.getProperty("user.home")+File.separator+"dataminer-pool-manager");
//this(System.getProperty("/home/gcube/dataminer-pool-manager"));
}
@ -58,9 +59,9 @@ public class AnsibleBridge {
// generate root
new File(dpmRoot).mkdirs();
// 'template' is for template roles
this.getTemplatesDir().mkdirs();
//this.getTemplatesDir().mkdirs();
// 'static' is for custom roles
this.getCustomDir().mkdirs();
//this.getCustomDir().mkdirs();
// 'work' is for temporary working directories
this.getWorkDir().mkdirs();
}
@ -69,13 +70,24 @@ public class AnsibleBridge {
return new File(this.dpmRoot, "work");
}
private File getTemplatesDir() {
return new File(this.dpmRoot, "templates");
}
// private String getTemplatesDir() {
// String input = null;
// input = AnsibleBridge.class.getClassLoader().getResource("templates").getPath();
// return input;
// }
//
//
// private String getCustomDir() {
// String input = null;
// input = AnsibleBridge.class.getClassLoader().getResource("custom").getPath();
// return input;
// }
private File getCustomDir() {
return new File(this.dpmRoot, "custom");
}
public AnsibleWorker createWorker() {
File workerRoot = new File(this.getWorkDir(), UUID.randomUUID().toString());
@ -221,15 +233,15 @@ public class AnsibleBridge {
private TemplateManager getTemplateManager() {
return new TemplateManager(this.dpmRoot+"/templates");
return new TemplateManager();
}
private CustomRoleManager getCustomRoleManager() {
return new CustomRoleManager(this.dpmRoot+"/custom");
return new CustomRoleManager();
}
private StaticRoleManager getStaticRoleManager() {
return new StaticRoleManager(this.dpmRoot+"/static");
return new StaticRoleManager();
}
/**

View File

@ -5,18 +5,21 @@ import java.io.IOException;
import java.util.NoSuchElementException;
import org.gcube.dataanalysis.dataminer.poolmanager.ansible.model.Role;
import org.gcube.dataanalysis.dataminer.poolmanager.ansiblebridge.AnsibleBridge;
import org.gcube.dataanalysis.dataminer.poolmanager.ansiblebridge.AnsibleSerializeHelper;
public class CustomRoleManager {
private String root;
public CustomRoleManager(String root) {
this.root = root;
public CustomRoleManager() {
}
public String getRoot() {
return this.root;
String input = AnsibleBridge.class.getClassLoader().getResource("custom").getPath();
return input;
}
public Role getRole(String roleName) throws NoSuchElementException {

View File

@ -2,28 +2,30 @@ package org.gcube.dataanalysis.dataminer.poolmanager.ansiblebridge.template;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.Collection;
import java.util.Vector;
import org.gcube.dataanalysis.dataminer.poolmanager.ansible.model.Role;
import org.gcube.dataanalysis.dataminer.poolmanager.ansiblebridge.AnsibleBridge;
import org.gcube.dataanalysis.dataminer.poolmanager.ansiblebridge.AnsibleSerializeHelper;
public class StaticRoleManager {
private String root;
public StaticRoleManager(String root) {
this.root = root;
public StaticRoleManager() {
}
public String getRoot() {
return this.root;
String input = AnsibleBridge.class.getClassLoader().getResource("static").getPath();
return input;
}
public Collection<Role> getStaticRoles() {
Collection<Role> out = new Vector<>();
for(File f: new File(this.getRoot()).listFiles()) {
try {
try {
out.add(AnsibleSerializeHelper.deserializeRoleFromFilesystem(f));
} catch(IOException e) {
e.printStackTrace();

View File

@ -7,19 +7,19 @@ import java.util.NoSuchElementException;
import org.gcube.dataanalysis.dataminer.poolmanager.ansible.model.Role;
import org.gcube.dataanalysis.dataminer.poolmanager.ansible.model.RoleFile;
import org.gcube.dataanalysis.dataminer.poolmanager.ansiblebridge.AnsibleBridge;
import org.gcube.dataanalysis.dataminer.poolmanager.ansiblebridge.AnsibleSerializeHelper;
import org.stringtemplate.v4.ST;
public class TemplateManager {
private String root;
public TemplateManager(String root) {
this.root = root;
public TemplateManager() {
}
public String getTemplateRoot() {
return this.root;
String input = AnsibleBridge.class.getClassLoader().getResource("templates").getPath();
return input;
}
/**

View File

@ -542,7 +542,7 @@ public class DataminerPoolManager implements PoolManager {
public URL getURLfromWorkerLog(String a) throws MalformedURLException, UnknownHostException {
File path = new File(System.getProperty("user.home") + File.separator + "/gcube/dataminer-pool-manager/work/"
File path = new File(System.getProperty("user.home") + File.separator + "dataminer-pool-manager/work/"
+ a + File.separator + "logs");
path.mkdirs();
File n = new File(path + File.separator + a);

View File

@ -0,0 +1,4 @@
#---
#dependencies:
# <dependencies>
# - { role: digest }

View File

@ -0,0 +1,4 @@
# tasks file for r
---
- name: Install custom algorithm <name>
command: Rscript --slave --no-save --no-restore-history -e "require(devtools); require(methods); install_github('<name>');"

View File

@ -0,0 +1,4 @@
dependencies:
# - { role: gcube-dataminer }
# - { role: os-unzip }
# - { role: os-java-1.7.0 }

View File

@ -0,0 +1,31 @@
---
- name: remove previous installer (if any)
file:
path: /home/gcube/algorithmInstaller
state: absent
#- name: remove previous installer.zip (if any)
# file:
# path: /home/dpm/algorithmInstaller.zip
# state: absent
#- name: download the installer zip
# get_url:
# url: https://svn.research-infrastructures.eu/public/d4science/gcube/trunk/data-analysis/DataminerAlgorithmsInstaller/package/algorithmInstaller.zip
# dest: /home/dpm/algorithmInstaller.zip
# validate_certs: no
- name: download and unzip the package
unarchive:
src: https://svn.research-infrastructures.eu/public/d4science/gcube/trunk/data-analysis/DataminerAlgorithmsInstaller/package/algorithmInstaller.zip
dest: /home/gcube
remote_src: yes
validate_certs: no
- name: change flags
file:
path: /home/gcube/algorithmInstaller
mode: 0777
state: directory
recurse: yes

View File

@ -0,0 +1,2 @@
dependencies:
- { role: gcube-ghn }

View File

@ -0,0 +1,4 @@
---
- name: Install the 'DATAMINER' package
shell: echo 'installing DATAMINER'

View File

@ -0,0 +1,7 @@
---
- name: Install the 'GHN' package
shell: echo 'installing GHN'
# TODO: handler to start container
# TODO: handler to stop container

View File

@ -0,0 +1,7 @@
---
- name: adding OS Package java-1.7.0
package:
name: java-1.7.0-openjdk
state: "{{os_package_state}}"
become: true

View File

@ -0,0 +1 @@
#to fill with R installation steps

View File

@ -0,0 +1,7 @@
---
- name: adding OS Package unzip
package:
name: unzip
state: "{{os_package_state}}"
become: true

View File

@ -0,0 +1,4 @@
---
#dependencies:
# <dependencies>
# - { role: os-r }

View File

@ -0,0 +1,4 @@
# tasks file for r
---
- name: Install algorithm <name>
command: Rscript -e "install.packages('<name>', repos=c('http://ftp.heanet.ie/mirrors/cran.r-project.org/'))"

View File

@ -0,0 +1,4 @@
---
dependencies:
<dependencies>
- { role: gcube-algorithm-installer }

View File

@ -0,0 +1,6 @@
---
- name: Install algorithm <name>
shell: /home/gcube/algorithmInstaller/addAlgorithm.sh <name> <category> <class> <vre> <atype> <skipjava> <packageurl> "<description>"
args:
chdir: /home/gcube/algorithmInstaller

View File

@ -0,0 +1,4 @@
---
#dependencies:
# <dependencies>
# - { role: os-r }

View File

@ -0,0 +1,4 @@
# tasks file for r
---
- name: Install algorithm <name>
command: Rscript --slave --no-save --no-restore-history -e "require(devtools); require(methods); install_github('<name>');"

View File

@ -0,0 +1,8 @@
---
- name: adding OS Package <name>
package:
name: <name>
state: "{{os_package_state}}"
become: true