This commit is contained in:
Nunzio Andrea Galante 2017-04-28 13:26:47 +00:00
parent a07d71b392
commit 8409cfde2f
2 changed files with 49 additions and 36 deletions

View File

@ -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<Host> listDataMinersByCluster() throws IOException ***REMOVED***
@ -77,26 +79,40 @@ public class HAProxy ***REMOVED***
***REMOVED*** Cluster cluster = this.getClusterByHProxy();
Cluster cluster = this.MapCluster();
List<Host> out = new LinkedList<Host>();
***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;

View File

@ -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***