git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-analysis/dataminer-pool-manager@146971 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
61829e2530
commit
77ab004ea2
|
@ -16,26 +16,27 @@ public class HAProxy {
|
|||
|
||||
private CSVReader reader;
|
||||
|
||||
public Cluster getClusterByHProxy() throws IOException {
|
||||
Cluster cl = new Cluster();
|
||||
String HProxy = ISClient.getHProxy();
|
||||
URL stockURL = new URL("http://data.d4science.org/Yk4zSFF6V3JOSytNd3JkRDlnRFpDUUR5TnRJZEw2QjRHbWJQNStIS0N6Yz0");
|
||||
BufferedReader in = new BufferedReader(new InputStreamReader(stockURL.openStream()));
|
||||
reader = new CSVReader(in);
|
||||
String[] nextLine;
|
||||
while ((nextLine = reader.readNext()) != null) {
|
||||
// rules to add
|
||||
if (HProxy.contains(nextLine[0])) {
|
||||
cl.setName(nextLine[0]);
|
||||
}
|
||||
}
|
||||
return cl;
|
||||
|
||||
}
|
||||
// public Cluster getClusterByHProxy() throws IOException {
|
||||
// Cluster cl = new Cluster();
|
||||
// String HProxy = ISClient.getHProxy();
|
||||
// URL stockURL = new URL("http://data.d4science.org/Yk4zSFF6V3JOSytNd3JkRDlnRFpDUUR5TnRJZEw2QjRHbWJQNStIS0N6Yz0");
|
||||
// BufferedReader in = new BufferedReader(new InputStreamReader(stockURL.openStream()));
|
||||
// reader = new CSVReader(in);
|
||||
// String[] nextLine;
|
||||
// while ((nextLine = reader.readNext()) != null) {
|
||||
// // rules to add
|
||||
// if (HProxy.contains(nextLine[0])) {
|
||||
// cl.setName(nextLine[0]);
|
||||
// }
|
||||
// }
|
||||
// return cl;
|
||||
//
|
||||
// }
|
||||
|
||||
public Cluster MapCluster() throws IOException {
|
||||
Cluster cl = new Cluster();
|
||||
String HProxy = ISClient.getHProxy();
|
||||
//Prod HAproxy
|
||||
if (HProxy.equals("dataminer-cluster1.d4science.org")) {
|
||||
cl.setName("dataminer_cluster1");
|
||||
}
|
||||
|
@ -60,6 +61,7 @@ public class HAProxy {
|
|||
if (HProxy.equals("dataminer-genericworkers-proto.d4science.org")) {
|
||||
cl.setName("genericworkers_proto");
|
||||
}
|
||||
//dev HAProxy
|
||||
if (HProxy.equals("dataminer-d-workers.d4science.org")) {
|
||||
cl.setName("devnext_backend");
|
||||
}
|
||||
|
@ -68,14 +70,17 @@ public class HAProxy {
|
|||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public List<Host> listDataMinersByCluster() throws IOException {
|
||||
// next op to use when Cluster info available in the IS
|
||||
// Cluster cluster = this.getClusterByHProxy();
|
||||
Cluster cluster = this.MapCluster();
|
||||
List<Host> out = new LinkedList<Host>();
|
||||
// prod
|
||||
URL stockURL = new URL("http://data.d4science.org/Yk4zSFF6V3JOSytNd3JkRDlnRFpDUUR5TnRJZEw2QjRHbWJQNStIS0N6Yz0");
|
||||
|
||||
//URL stockURL = new URL("http://data.d4science.org/Yk4zSFF6V3JOSytNd3JkRDlnRFpDUUR5TnRJZEw2QjRHbWJQNStIS0N6Yz0");
|
||||
URL stockURL = new URL("http://"+ ISClient.getHProxy() +":8880/;csv");
|
||||
System.out.println(stockURL);
|
||||
// dev
|
||||
// URL stockURL = new
|
||||
// URL("http://data.d4science.org/c29KTUluTkZnRlB0WXE5NVNaZnRoR0dtYThUSmNTVlhHbWJQNStIS0N6Yz0");
|
||||
|
@ -101,6 +106,7 @@ public class HAProxy {
|
|||
public static void main(String[] args) throws IOException, SVNException {
|
||||
HAProxy a = new HAProxy();
|
||||
ScopeProvider.instance.set("/gcube/devNext/NextNext");
|
||||
//ScopeProvider.instance.set("/d4science.research-infrastructures.eu/gCubeApps/RPrototypingLab");
|
||||
// System.out.println(a.getHProxy());
|
||||
// System.out.println(a.MapCluster());
|
||||
System.out.println(a.listDataMinersByCluster());
|
||||
|
|
|
@ -53,7 +53,6 @@ import au.com.bytecode.opencsv.CSVReader;
|
|||
|
||||
public class ISClient {
|
||||
|
||||
private CSVReader reader;
|
||||
|
||||
public Host getDataminer(String hostname) {
|
||||
Host h = new Host();
|
||||
|
@ -77,7 +76,7 @@ public class ISClient {
|
|||
public static String getHProxy() {
|
||||
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());
|
||||
|
|
|
@ -227,6 +227,8 @@ public class RestPoolManager implements PoolManager {
|
|||
return service.addAlgorithmToVRE(algo, ScopeProvider.instance.get());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@GET
|
||||
@Path("/hosts/add")
|
||||
@Produces("text/plain")
|
||||
|
|
Loading…
Reference in New Issue