git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-analysis/dataminer-pool-manager@146962 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
899299f7ec
commit
0002e935e8
|
@ -145,13 +145,40 @@ public class ISClient ***REMOVED***
|
||||||
public String getHProxy()***REMOVED***
|
public String getHProxy()***REMOVED***
|
||||||
Host h = new Host();
|
Host h = new Host();
|
||||||
SimpleQuery query = queryFor(ServiceEndpoint.class);
|
SimpleQuery query = queryFor(ServiceEndpoint.class);
|
||||||
query.addCondition("$resource/Profile/Platform/Name/text() eq 'DataMinerAlone'");
|
query.addCondition("$resource/Profile/Platform/Name/text() eq 'DataMiner'");
|
||||||
DiscoveryClient<ServiceEndpoint> client = clientFor(ServiceEndpoint.class);
|
DiscoveryClient<ServiceEndpoint> client = clientFor(ServiceEndpoint.class);
|
||||||
List<ServiceEndpoint> resources = client.submit(query);
|
List<ServiceEndpoint> resources = client.submit(query);
|
||||||
h.setName(resources.get(0).profile().runtime().hostedOn());
|
h.setName(resources.get(0).profile().runtime().hostedOn());
|
||||||
return h.getName();
|
return h.getName();
|
||||||
***REMOVED***
|
***REMOVED***
|
||||||
|
|
||||||
|
***REMOVED***return the Cluster hostname from the IS
|
||||||
|
***REMOVED***to develop
|
||||||
|
public Cluster getCluster()***REMOVED***
|
||||||
|
Cluster cl = new Cluster();
|
||||||
|
String HProxy = this.getHProxy();
|
||||||
|
SimpleQuery query = queryFor(ServiceEndpoint.class);
|
||||||
|
query.addCondition("$resource/Profile/Platform/Name/text() eq 'DataMiner'");
|
||||||
|
DiscoveryClient<ServiceEndpoint> client = clientFor(ServiceEndpoint.class);
|
||||||
|
List<ServiceEndpoint> resources = client.submit(query);
|
||||||
|
cl.setName(resources.get(0).profile().runtime().hostedOn());
|
||||||
|
return null;
|
||||||
|
|
||||||
|
***REMOVED***
|
||||||
|
|
||||||
|
***REMOVED***return the dataminer hostnames from the IS
|
||||||
|
***REMOVED***to develop
|
||||||
|
public List<Host> getDM()***REMOVED***
|
||||||
|
Cluster cl = new Cluster();
|
||||||
|
String HProxy = this.getHProxy();
|
||||||
|
SimpleQuery query = queryFor(ServiceEndpoint.class);
|
||||||
|
query.addCondition("$resource/Profile/Platform/Name/text() eq 'DataMiner'");
|
||||||
|
DiscoveryClient<ServiceEndpoint> client = clientFor(ServiceEndpoint.class);
|
||||||
|
List<ServiceEndpoint> resources = client.submit(query);
|
||||||
|
cl.setName(resources.get(0).profile().runtime().hostedOn());
|
||||||
|
return null;
|
||||||
|
|
||||||
|
***REMOVED***
|
||||||
|
|
||||||
public Cluster getClusterByHProxy() throws IOException ***REMOVED***
|
public Cluster getClusterByHProxy() throws IOException ***REMOVED***
|
||||||
Cluster cl = new Cluster();
|
Cluster cl = new Cluster();
|
||||||
|
@ -171,14 +198,60 @@ public Cluster getClusterByHProxy() throws IOException ***REMOVED***
|
||||||
***REMOVED***
|
***REMOVED***
|
||||||
|
|
||||||
|
|
||||||
|
public Cluster MapCluster() throws IOException ***REMOVED***
|
||||||
|
Cluster cl = new Cluster();
|
||||||
|
String HProxy = this.getHProxy();
|
||||||
|
if (HProxy.equals("dataminer-cluster1.d4science.org")) ***REMOVED***
|
||||||
|
cl.setName("dataminer_cluster1");
|
||||||
|
***REMOVED***
|
||||||
|
if (HProxy.equals("dataminer-bigdata.d4science.org")) ***REMOVED***
|
||||||
|
cl.setName("bigdata");
|
||||||
|
***REMOVED***
|
||||||
|
if (HProxy.equals("dataminer-cluster1.d4science.org")) ***REMOVED***
|
||||||
|
cl.setName("dataminer_cluster1");
|
||||||
|
***REMOVED***
|
||||||
|
if (HProxy.equals("dataminer-cloud1.d4science.org")) ***REMOVED***
|
||||||
|
cl.setName("dataminer_cloud1");
|
||||||
|
***REMOVED***
|
||||||
|
if (HProxy.equals("dataminer-prototypes.d4science.org")) ***REMOVED***
|
||||||
|
cl.setName("prototypes");
|
||||||
|
***REMOVED***
|
||||||
|
if (HProxy.equals("dataminer.d4science.org")) ***REMOVED***
|
||||||
|
cl.setName("gcubeapps");
|
||||||
|
***REMOVED***
|
||||||
|
if (HProxy.equals("dataminer-genericworkers.d4science.org")) ***REMOVED***
|
||||||
|
cl.setName("genericworkers");
|
||||||
|
***REMOVED***
|
||||||
|
if (HProxy.equals("dataminer-genericworkers-proto.d4science.org")) ***REMOVED***
|
||||||
|
cl.setName("genericworkers_proto");
|
||||||
|
***REMOVED***
|
||||||
|
if (HProxy.equals("dataminer-d-workers.d4science.org")) ***REMOVED***
|
||||||
|
cl.setName("devnext_backend");
|
||||||
|
***REMOVED***
|
||||||
|
|
||||||
|
return cl;
|
||||||
|
|
||||||
|
***REMOVED***
|
||||||
|
|
||||||
|
|
||||||
public List<Host> listDataMinersByCluster() throws IOException ***REMOVED***
|
public List<Host> listDataMinersByCluster() throws IOException ***REMOVED***
|
||||||
Cluster cluster = this.getClusterByHProxy();
|
***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>();
|
List<Host> out = new LinkedList<Host>();
|
||||||
URL stockURL = new URL("http:***REMOVED***data.d4science.org/Yk4zSFF6V3JOSytNd3JkRDlnRFpDUUR5TnRJZEw2QjRHbWJQNStIS0N6Yz0");
|
***REMOVED***prod
|
||||||
|
***REMOVED***URL stockURL = new URL("http:***REMOVED***data.d4science.org/Yk4zSFF6V3JOSytNd3JkRDlnRFpDUUR5TnRJZEw2QjRHbWJQNStIS0N6Yz0");
|
||||||
|
|
||||||
|
***REMOVED***dev
|
||||||
|
URL stockURL = new URL("http:***REMOVED***data.d4science.org/c29KTUluTkZnRlB0WXE5NVNaZnRoR0dtYThUSmNTVlhHbWJQNStIS0N6Yz0");
|
||||||
BufferedReader in = new BufferedReader(new InputStreamReader(stockURL.openStream()));
|
BufferedReader in = new BufferedReader(new InputStreamReader(stockURL.openStream()));
|
||||||
reader = new CSVReader(in, ',');
|
reader = new CSVReader(in, ',');
|
||||||
String[] nextLine;
|
String[] nextLine;
|
||||||
while ((nextLine = reader.readNext()) != null) ***REMOVED***
|
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***
|
if (nextLine[0].equals(cluster.getName())) ***REMOVED***
|
||||||
Host a = new Host();
|
Host a = new Host();
|
||||||
a.setName(nextLine[1]);
|
a.setName(nextLine[1]);
|
||||||
|
@ -190,8 +263,6 @@ public Cluster getClusterByHProxy() throws IOException ***REMOVED***
|
||||||
|
|
||||||
***REMOVED***
|
***REMOVED***
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the list of hosts (dataminers) in a given VRE
|
* Return the list of hosts (dataminers) in a given VRE
|
||||||
*
|
*
|
||||||
|
@ -238,7 +309,8 @@ public Cluster getClusterByHProxy() throws IOException ***REMOVED***
|
||||||
ISClient a = new ISClient();
|
ISClient a = new ISClient();
|
||||||
ScopeProvider.instance.set("/gcube/devNext/NextNext");
|
ScopeProvider.instance.set("/gcube/devNext/NextNext");
|
||||||
***REMOVED***System.out.println(a.getHProxy());
|
***REMOVED***System.out.println(a.getHProxy());
|
||||||
***REMOVED***System.out.println(a.getClusterByHProxy());
|
***REMOVED***System.out.println(a.MapCluster());
|
||||||
|
System.out.println(a.listDataMinersByCluster());
|
||||||
***REMOVED***System.out.println(a.listDataMinersByCluster());
|
***REMOVED***System.out.println(a.listDataMinersByCluster());
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -32,8 +32,12 @@ public class Host ***REMOVED***
|
||||||
this.domain = domain;
|
this.domain = domain;
|
||||||
***REMOVED***
|
***REMOVED***
|
||||||
|
|
||||||
|
***REMOVED*** public String toString() ***REMOVED***
|
||||||
|
***REMOVED*** return this.name + "@" + this.domain;
|
||||||
|
***REMOVED*** ***REMOVED***
|
||||||
|
|
||||||
public String toString() ***REMOVED***
|
public String toString() ***REMOVED***
|
||||||
return this.name + "@" + this.domain;
|
return this.name;
|
||||||
***REMOVED***
|
***REMOVED***
|
||||||
|
|
||||||
***REMOVED***
|
***REMOVED***
|
||||||
|
|
|
@ -540,8 +540,8 @@ public class DataminerPoolManager implements PoolManager ***REMOVED***
|
||||||
|
|
||||||
***REMOVED*** create the cluster (dataminers in the vre)
|
***REMOVED*** create the cluster (dataminers in the vre)
|
||||||
Cluster cluster = new Cluster();
|
Cluster cluster = new Cluster();
|
||||||
***REMOVED*** for (Host h : new ISClient().listDataMinersByCluster()) ***REMOVED***
|
for (Host h : new ISClient().listDataMinersByCluster()) ***REMOVED***
|
||||||
for (Host h : new ISClient().listDataminersInVRE()) ***REMOVED***
|
***REMOVED***for (Host h : new ISClient().listDataminersInVRE()) ***REMOVED***
|
||||||
cluster.addHost(h);
|
cluster.addHost(h);
|
||||||
***REMOVED***
|
***REMOVED***
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue