From 8409cfde2fb6b9e4ab8a35ad7c92c3cef07c02bc Mon Sep 17 00:00:00 2001 From: Nunzio Andrea Galante Date: Fri, 28 Apr 2017 13:26:47 +0000 Subject: [PATCH] git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-analysis/dataminer-pool-manager@147247 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../poolmanager/clients/HAProxy.java | 62 ++++++++++++------- .../service/DataminerPoolManager.java | 23 +++---- 2 files changed, 49 insertions(+), 36 deletions(-) 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 8890c36..091cc67 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 @@ -62,14 +62,16 @@ public class HAProxy ***REMOVED*** cl.setName("genericworkers_proto"); ***REMOVED*** ***REMOVED***dev HAProxy - if (HProxy.equals("dataminer-d-workers.d4science.org")) ***REMOVED*** + if (HProxy.equals("dataminer-d-workers.d4science.org")||(HProxy.equals("dataminer-d-d4s.d4science.org"))) ***REMOVED*** cl.setName("devnext_backend"); - ***REMOVED*** - + ***REMOVED*** + ***REMOVED***preProd HAProxy +***REMOVED*** if (HProxy.equals("dataminer1-pre.d4science.org")) ***REMOVED*** +***REMOVED*** cl.setName("dataminer1-pre.d4science.org"); +***REMOVED*** ***REMOVED*** return cl; ***REMOVED*** - public List listDataMinersByCluster() throws IOException ***REMOVED*** @@ -77,26 +79,40 @@ public class HAProxy ***REMOVED*** ***REMOVED*** Cluster cluster = this.getClusterByHProxy(); Cluster cluster = this.MapCluster(); List out = new LinkedList(); - ***REMOVED*** prod - ***REMOVED***URL stockURL = new URL("http:***REMOVED***data.d4science.org/Yk4zSFF6V3JOSytNd3JkRDlnRFpDUUR5TnRJZEw2QjRHbWJQNStIS0N6Yz0"); - URL stockURL = new URL("http:***REMOVED***"+ ISClient.getHProxy() +":8880/;csv"); - System.out.println(stockURL); - ***REMOVED*** dev - ***REMOVED*** URL stockURL = new - ***REMOVED*** URL("http:***REMOVED***data.d4science.org/c29KTUluTkZnRlB0WXE5NVNaZnRoR0dtYThUSmNTVlhHbWJQNStIS0N6Yz0"); - BufferedReader in = new BufferedReader(new InputStreamReader(stockURL.openStream())); - reader = new CSVReader(in, ','); - String[] nextLine; - while ((nextLine = reader.readNext()) != null) ***REMOVED*** - if (nextLine[1].equals("BACKEND") || (nextLine[1].equals("FRONTEND"))) ***REMOVED*** - continue; - ***REMOVED*** + Host a = new Host(); - if (nextLine[0].equals(cluster.getName())) ***REMOVED*** - Host a = new Host(); - a.setName(nextLine[1]); - out.add(a); - System.out.println(a.getFullyQualifiedName()); + ***REMOVED***no proxy dataminer (preprod) + if (cluster.getName() == null)***REMOVED*** + a.setName(ISClient.getHProxy()); + out.add(a); + ***REMOVED*** + + ***REMOVED*** if preprod, just one dm available +***REMOVED*** if (cluster.getName().equals("dataminer1-pre.d4science.org")) ***REMOVED*** +***REMOVED*** a.setName("dataminer1-pre.d4science.org"); +***REMOVED*** out.add(a); + ***REMOVED******REMOVED*** + else ***REMOVED*** + ***REMOVED*** prod + ***REMOVED*** URL stockURL = new + ***REMOVED*** URL("http:***REMOVED***data.d4science.org/Yk4zSFF6V3JOSytNd3JkRDlnRFpDUUR5TnRJZEw2QjRHbWJQNStIS0N6Yz0"); + URL stockURL = new URL("http:***REMOVED***" + ISClient.getHProxy() + ":8880/;csv"); + System.out.println(stockURL); + ***REMOVED*** dev + ***REMOVED*** URL stockURL = new + ***REMOVED*** URL("http:***REMOVED***data.d4science.org/c29KTUluTkZnRlB0WXE5NVNaZnRoR0dtYThUSmNTVlhHbWJQNStIS0N6Yz0"); + BufferedReader in = new BufferedReader(new InputStreamReader(stockURL.openStream())); + reader = new CSVReader(in, ','); + String[] nextLine; + while ((nextLine = reader.readNext()) != null) ***REMOVED*** + if (nextLine[1].equals("BACKEND") || (nextLine[1].equals("FRONTEND"))) ***REMOVED*** + continue; + ***REMOVED*** + if (nextLine[0].equals(cluster.getName())) ***REMOVED*** + a.setName(nextLine[1]); + out.add(a); + System.out.println(a.getFullyQualifiedName()); + ***REMOVED*** ***REMOVED*** ***REMOVED*** return out; 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 f44a061..72ba304 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 @@ -566,30 +566,27 @@ public class DataminerPoolManager implements PoolManager ***REMOVED*** ***REMOVED*** - public String addAlgorithmsToHost(AlgorithmSet algorithms, String hostname, String uuid, boolean updateSVN) throws IOException, InterruptedException, SVNException ***REMOVED*** + public String addAlgorithmsToHost(AlgorithmSet algorithms, String hostname, String uuid, boolean updateSVN) + throws IOException, InterruptedException, SVNException ***REMOVED*** ***REMOVED*** create the cluster (dataminers in the vre) Cluster cluster = new Cluster(); - cluster.addHost(new ISClient().getDataminer(hostname)); - ***REMOVED*** for(Host h:new ISClient().listDataminersInVRE()) ***REMOVED*** - ***REMOVED*** cluster.addHost(h); + for (Host h : new HAProxy().listDataMinersByCluster()) ***REMOVED*** + if (h.getName().equals(hostname)) ***REMOVED*** + cluster.addHost(h); + ***REMOVED*** + ***REMOVED*** + ***REMOVED*** if(ISClient.getHProxy().equals(hostname))***REMOVED*** + ***REMOVED*** cluster.addHost(new ISClient().getDataminer(hostname)); ***REMOVED*** ***REMOVED*** - ***REMOVED*** apply the changes AnsibleBridge a = new AnsibleBridge(); - return a.applyAlgorithmSetToCluster(algorithms, cluster, uuid,updateSVN ).getWorkerId(); + return a.applyAlgorithmSetToCluster(algorithms, cluster, uuid, updateSVN).getWorkerId(); ***REMOVED*** - - - - - - - public Algorithm extractAlgorithm(String url) throws IOException ***REMOVED*** return new AlgorithmPackageParser().parsePackage(url); ***REMOVED***