ref 12742: DataMiner - Support Python 3.6

https://support.d4science.org/issues/12742

Python3.6 added

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-analysis/dataminer-pool-manager@173874 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2018-10-30 10:04:46 +00:00
parent a731eab88a
commit 69315db179
1 changed files with 280 additions and 286 deletions

View File

@ -31,9 +31,8 @@ import org.gcube.dataanalysis.dataminer.poolmanager.datamodel.Dependency;
import org.gcube.dataanalysis.dataminer.poolmanager.datamodel.comparator.HostComparator; import org.gcube.dataanalysis.dataminer.poolmanager.datamodel.comparator.HostComparator;
public class AnsibleBridge { public class AnsibleBridge {
***REMOVED***private static final org.slf4j.Logger LOGGER = LoggerFactory.getLogger(AnsibleBridge.class); ***REMOVED*** private static final org.slf4j.Logger LOGGER =
***REMOVED*** LoggerFactory.getLogger(AnsibleBridge.class);
private String dpmRoot; private String dpmRoot;
@ -65,24 +64,21 @@ public class AnsibleBridge {
***REMOVED*** private String getTemplatesDir() { ***REMOVED*** private String getTemplatesDir() {
***REMOVED*** String input = null; ***REMOVED*** String input = null;
***REMOVED*** input = AnsibleBridge.class.getClassLoader().getResource("templates").getPath(); ***REMOVED*** input =
***REMOVED*** AnsibleBridge.class.getClassLoader().getResource("templates").getPath();
***REMOVED*** return input; ***REMOVED*** return input;
***REMOVED*** ***REMOVED*** ***REMOVED*** ***REMOVED***
***REMOVED*** ***REMOVED***
***REMOVED*** ***REMOVED***
***REMOVED*** private String getCustomDir() { ***REMOVED*** private String getCustomDir() {
***REMOVED*** String input = null; ***REMOVED*** String input = null;
***REMOVED*** input = AnsibleBridge.class.getClassLoader().getResource("custom").getPath(); ***REMOVED*** input =
***REMOVED*** AnsibleBridge.class.getClassLoader().getResource("custom").getPath();
***REMOVED*** return input; ***REMOVED*** return input;
***REMOVED*** ***REMOVED*** ***REMOVED*** ***REMOVED***
public AnsibleWorker createWorker(Algorithm algorithm, Cluster dataminerCluster,
boolean includeAlgorithmDependencies, String user) throws IOException {
public AnsibleWorker createWorker(Algorithm algorithm, Cluster dataminerCluster, boolean includeAlgorithmDependencies, String user) throws IOException {
File workerRoot = new File(this.getWorkDir(), UUID.randomUUID().toString()); File workerRoot = new File(this.getWorkDir(), UUID.randomUUID().toString());
AnsibleWorker worker = new AnsibleWorker(workerRoot); AnsibleWorker worker = new AnsibleWorker(workerRoot);
@ -103,7 +99,6 @@ public class AnsibleBridge {
***REMOVED*** ***REMOVED***
***REMOVED*** ***REMOVED***
***REMOVED*** add static roles ***REMOVED*** add static roles
for (Role r : this.getStaticRoleManager().getStaticRoles()) { for (Role r : this.getStaticRoleManager().getStaticRoles()) {
worker.addRole(r); worker.addRole(r);
@ -134,7 +129,6 @@ public class AnsibleBridge {
return worker; return worker;
***REMOVED*** ***REMOVED***
public void printInventoryByDomainAndSets(Collection<Cluster> clusters) { public void printInventoryByDomainAndSets(Collection<Cluster> clusters) {
Map<String, Set<Host>> inventory = new TreeMap<>(); Map<String, Set<Host>> inventory = new TreeMap<>();
for (Cluster cluster : clusters) { for (Cluster cluster : clusters) {
@ -163,7 +157,6 @@ public class AnsibleBridge {
***REMOVED*** ***REMOVED***
***REMOVED*** ***REMOVED***
public void printInventoryBySets(Collection<Cluster> clusters) { public void printInventoryBySets(Collection<Cluster> clusters) {
Map<String, Set<Host>> inventory = new TreeMap<>(); Map<String, Set<Host>> inventory = new TreeMap<>();
for (Cluster cluster : clusters) { for (Cluster cluster : clusters) {
@ -191,14 +184,20 @@ public class AnsibleBridge {
***REMOVED*** ***REMOVED***
***REMOVED*** ***REMOVED***
***REMOVED*** public AnsibleWorker applyAlgorithmSetToCluster(AlgorithmSet as, Cluster cluster, /*boolean updateSVN,*/ boolean test) throws IOException, InterruptedException, SVNException { ***REMOVED*** public AnsibleWorker applyAlgorithmSetToCluster(AlgorithmSet as, Cluster
***REMOVED*** cluster, /*boolean updateSVN,*/ boolean test) throws IOException,
***REMOVED*** InterruptedException, SVNException {
***REMOVED*** ***REMOVED***
***REMOVED*** ***REMOVED***
***REMOVED*** return applyAlgorithmSetToCluster (as,cluster,UUID.randomUUID().toString(),/*updateSVN,*/ test); ***REMOVED*** return applyAlgorithmSetToCluster
***REMOVED*** (as,cluster,UUID.randomUUID().toString(),/*updateSVN,*/ test);
***REMOVED*** ***REMOVED*** ***REMOVED*** ***REMOVED***
***REMOVED*** public AnsibleWorker applyAlgorithmSetToCluster(AlgorithmSet as, Cluster cluster,String uuid, /*boolean updateSVN,*/ boolean test) throws IOException, InterruptedException, SVNException { ***REMOVED*** public AnsibleWorker applyAlgorithmSetToCluster(AlgorithmSet as, Cluster
***REMOVED*** AnsibleWorker worker = new AnsibleWorker(new File(this.getWorkDir(), uuid)); ***REMOVED*** cluster,String uuid, /*boolean updateSVN,*/ boolean test) throws
***REMOVED*** IOException, InterruptedException, SVNException {
***REMOVED*** AnsibleWorker worker = new AnsibleWorker(new File(this.getWorkDir(),
***REMOVED*** uuid));
***REMOVED*** ***REMOVED***
***REMOVED*** ***REMOVED***
***REMOVED*** List<Role> algoRoles = new Vector<>(); ***REMOVED*** List<Role> algoRoles = new Vector<>();
@ -268,8 +267,6 @@ public class AnsibleBridge {
***REMOVED*** return worker; ***REMOVED*** return worker;
***REMOVED*** ***REMOVED*** ***REMOVED*** ***REMOVED***
private TemplateManager getTemplateManager() { private TemplateManager getTemplateManager() {
return new TemplateManager(); return new TemplateManager();
***REMOVED*** ***REMOVED***
@ -284,13 +281,14 @@ public class AnsibleBridge {
/** /**
* Generate all roles for this dependency * Generate all roles for this dependency
* @param dep Dependency *
* @param dep
* Dependency
* @return Collection of Roles * @return Collection of Roles
*/ */
public Collection<Role> generateRoles(Dependency dep) { public Collection<Role> generateRoles(Dependency dep) {
Collection<Role> roles = new Vector<>(); Collection<Role> roles = new Vector<>();
if ("os".equalsIgnoreCase(dep.getType())) { if ("os".equalsIgnoreCase(dep.getType())) {
OSDependencyPackage pkg = new OSDependencyPackage(dep); OSDependencyPackage pkg = new OSDependencyPackage(dep);
if (pkg != null) { if (pkg != null) {
@ -302,21 +300,17 @@ public class AnsibleBridge {
if (pkg != null) { if (pkg != null) {
roles.addAll(pkg.getRoles(this.getCustomRoleManager())); roles.addAll(pkg.getRoles(this.getCustomRoleManager()));
***REMOVED*** ***REMOVED***
***REMOVED*** ***REMOVED*** else if ("github".equalsIgnoreCase(dep.getType())) {
else if("github".equalsIgnoreCase(dep.getType())) {
CranDependencyPackage pkg = new CranDependencyPackage(dep); CranDependencyPackage pkg = new CranDependencyPackage(dep);
if (pkg != null) { if (pkg != null) {
roles.addAll(pkg.getRoles(this.getTemplateManager())); roles.addAll(pkg.getRoles(this.getTemplateManager()));
***REMOVED*** ***REMOVED***
***REMOVED*** ***REMOVED*** else if ("cran".equalsIgnoreCase(dep.getType())) {
else if("cran".equalsIgnoreCase(dep.getType())) {
CranDependencyPackage pkg = new CranDependencyPackage(dep); CranDependencyPackage pkg = new CranDependencyPackage(dep);
if (pkg != null) { if (pkg != null) {
roles.addAll(pkg.getRoles(this.getTemplateManager())); roles.addAll(pkg.getRoles(this.getTemplateManager()));
***REMOVED*** ***REMOVED***
***REMOVED*** ***REMOVED***
return roles; return roles;
***REMOVED*** ***REMOVED***