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 4e7a4504b2
commit 304f04f9a0
1 changed files with 280 additions and 286 deletions

View File

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