This commit is contained in:
Nunzio Andrea Galante 2017-04-19 16:20:29 +00:00
parent 0fe614bbe8
commit 0f98fe90b9
2 changed files with 24 additions and 19 deletions

View File

@ -16,26 +16,27 @@ public class HAProxy ***REMOVED***
private CSVReader reader;
public Cluster getClusterByHProxy() throws IOException ***REMOVED***
Cluster cl = new Cluster();
String HProxy = ISClient.getHProxy();
URL stockURL = new URL("http:***REMOVED***data.d4science.org/Yk4zSFF6V3JOSytNd3JkRDlnRFpDUUR5TnRJZEw2QjRHbWJQNStIS0N6Yz0");
BufferedReader in = new BufferedReader(new InputStreamReader(stockURL.openStream()));
reader = new CSVReader(in);
String[] nextLine;
while ((nextLine = reader.readNext()) != null) ***REMOVED***
***REMOVED*** rules to add
if (HProxy.contains(nextLine[0])) ***REMOVED***
cl.setName(nextLine[0]);
***REMOVED***
***REMOVED***
return cl;
***REMOVED*** public Cluster getClusterByHProxy() throws IOException ***REMOVED***
***REMOVED*** Cluster cl = new Cluster();
***REMOVED*** String HProxy = ISClient.getHProxy();
***REMOVED*** URL stockURL = new URL("http:***REMOVED***data.d4science.org/Yk4zSFF6V3JOSytNd3JkRDlnRFpDUUR5TnRJZEw2QjRHbWJQNStIS0N6Yz0");
***REMOVED*** BufferedReader in = new BufferedReader(new InputStreamReader(stockURL.openStream()));
***REMOVED*** reader = new CSVReader(in);
***REMOVED*** String[] nextLine;
***REMOVED*** while ((nextLine = reader.readNext()) != null) ***REMOVED***
***REMOVED*** ***REMOVED*** rules to add
***REMOVED*** if (HProxy.contains(nextLine[0])) ***REMOVED***
***REMOVED*** cl.setName(nextLine[0]);
***REMOVED*** ***REMOVED***
***REMOVED*** ***REMOVED***
***REMOVED*** return cl;
***REMOVED***
***REMOVED******REMOVED***
public Cluster MapCluster() throws IOException ***REMOVED***
Cluster cl = new Cluster();
String HProxy = ISClient.getHProxy();
***REMOVED***Prod HAproxy
if (HProxy.equals("dataminer-cluster1.d4science.org")) ***REMOVED***
cl.setName("dataminer_cluster1");
***REMOVED***
@ -60,6 +61,7 @@ public class HAProxy ***REMOVED***
if (HProxy.equals("dataminer-genericworkers-proto.d4science.org")) ***REMOVED***
cl.setName("genericworkers_proto");
***REMOVED***
***REMOVED***dev HAProxy
if (HProxy.equals("dataminer-d-workers.d4science.org")) ***REMOVED***
cl.setName("devnext_backend");
***REMOVED***
@ -68,14 +70,17 @@ public class HAProxy ***REMOVED***
***REMOVED***
public List<Host> listDataMinersByCluster() throws IOException ***REMOVED***
***REMOVED*** next op to use when Cluster info available in the IS
***REMOVED*** Cluster cluster = this.getClusterByHProxy();
Cluster cluster = this.MapCluster();
List<Host> out = new LinkedList<Host>();
***REMOVED*** prod
URL stockURL = new URL("http:***REMOVED***data.d4science.org/Yk4zSFF6V3JOSytNd3JkRDlnRFpDUUR5TnRJZEw2QjRHbWJQNStIS0N6Yz0");
***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");
@ -101,6 +106,7 @@ public class HAProxy ***REMOVED***
public static void main(String[] args) throws IOException, SVNException ***REMOVED***
HAProxy a = new HAProxy();
ScopeProvider.instance.set("/gcube/devNext/NextNext");
***REMOVED***ScopeProvider.instance.set("/d4science.research-infrastructures.eu/gCubeApps/RPrototypingLab");
***REMOVED*** System.out.println(a.getHProxy());
***REMOVED*** System.out.println(a.MapCluster());
System.out.println(a.listDataMinersByCluster());

View File

@ -53,7 +53,6 @@ import au.com.bytecode.opencsv.CSVReader;
public class ISClient ***REMOVED***
private CSVReader reader;
public Host getDataminer(String hostname) ***REMOVED***
Host h = new Host();
@ -77,7 +76,7 @@ public class ISClient ***REMOVED***
public static String getHProxy() ***REMOVED***
Host h = new Host();
SimpleQuery query = queryFor(ServiceEndpoint.class);
query.addCondition("$resource/Profile/Platform/Name/text() eq 'DataMiner'");
query.addCondition("$resource/Profile/Name/text() eq 'DataMiner'");
DiscoveryClient<ServiceEndpoint> client = clientFor(ServiceEndpoint.class);
List<ServiceEndpoint> resources = client.submit(query);
h.setName(resources.get(0).profile().runtime().hostedOn());