This commit is contained in:
Nunzio Andrea Galante 2017-04-19 14:59:36 +00:00
parent e95962bf38
commit f25ac50a25
2 changed files with 28 additions and 108 deletions

View File

@ -142,7 +142,7 @@ public class ISClient {
***REMOVED*** return the HProxy hostname in the VRE
public String getHProxy(){
public static String getHProxy(){
Host h = new Host();
SimpleQuery query = queryFor(ServiceEndpoint.class);
query.addCondition("$resource/Profile/Platform/Name/text() eq 'DataMiner'");
@ -154,115 +154,34 @@ public String getHProxy(){
***REMOVED***return the Cluster hostname from the IS
***REMOVED***to develop
public Cluster getCluster(){
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***public Cluster getCluster(){
***REMOVED*** Cluster cl = new Cluster();
***REMOVED*** String HProxy = this.getHProxy();
***REMOVED*** SimpleQuery query = queryFor(ServiceEndpoint.class);
***REMOVED*** query.addCondition("$resource/Profile/Platform/Name/text() eq 'DataMiner'");
***REMOVED*** DiscoveryClient<ServiceEndpoint> client = clientFor(ServiceEndpoint.class);
***REMOVED*** List<ServiceEndpoint> resources = client.submit(query);
***REMOVED*** cl.setName(resources.get(0).profile().runtime().hostedOn());
***REMOVED*** return null;
***REMOVED***
***REMOVED******REMOVED***
***REMOVED***return the dataminer hostnames from the IS
***REMOVED***to develop
public List<Host> getDM(){
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 {
Cluster cl = new Cluster();
String HProxy = this.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***rules to add
if (HProxy.contains(nextLine[0])){
cl.setName(nextLine[0]);
***REMOVED***
***REMOVED***
return cl;
***REMOVED***
public Cluster MapCluster() throws IOException {
***REMOVED***
String HProxy = this.getHProxy();
***REMOVED***
***REMOVED***
***REMOVED***
***REMOVED***
***REMOVED***
***REMOVED***
***REMOVED***
***REMOVED***
***REMOVED***
***REMOVED***
***REMOVED***
***REMOVED***
***REMOVED***
***REMOVED***
***REMOVED***
***REMOVED***
***REMOVED***
***REMOVED***
***REMOVED***
***REMOVED***
***REMOVED***
***REMOVED***
***REMOVED***
***REMOVED***
if (HProxy.equals("dataminer-d-workers.d4science.org")) {
***REMOVED***
***REMOVED***
***REMOVED***
***REMOVED***
public List<Host> listDataMinersByCluster() throws IOException {
***REMOVED***next op to use when Cluster info available in the IS
***REMOVED***Cluster cluster = this.getClusterByHProxy();
***REMOVED***
***REMOVED***
***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()));
reader = new CSVReader(in, ',');
String[] nextLine;
while ((nextLine = reader.readNext()) != null) {
if (nextLine[1].equals("BACKEND")||(nextLine[1].equals("FRONTEND"))){
continue;
***REMOVED***
if (nextLine[0].equals(cluster.getName())) {
***REMOVED***
a.setName(nextLine[1]);
***REMOVED***
System.out.println(a.getFullyQualifiedName());
***REMOVED***
***REMOVED***
***REMOVED***
***REMOVED***public List<Host> getDM(){
***REMOVED*** Cluster cl = new Cluster();
***REMOVED*** String HProxy = this.getHProxy();
***REMOVED*** SimpleQuery query = queryFor(ServiceEndpoint.class);
***REMOVED*** query.addCondition("$resource/Profile/Platform/Name/text() eq 'DataMiner'");
***REMOVED*** DiscoveryClient<ServiceEndpoint> client = clientFor(ServiceEndpoint.class);
***REMOVED*** List<ServiceEndpoint> resources = client.submit(query);
***REMOVED*** cl.setName(resources.get(0).profile().runtime().hostedOn());
***REMOVED*** return null;
***REMOVED***
***REMOVED******REMOVED***
/**
* Return the list of hosts (dataminers) in a given VRE
*
@ -310,7 +229,7 @@ public List<Host> listDataMinersByCluster() throws IOException {
ScopeProvider.instance.set("/gcube/devNext/NextNext");
***REMOVED***System.out.println(a.getHProxy());
***REMOVED***System.out.println(a.MapCluster());
System.out.println(a.listDataMinersByCluster());
***REMOVED***System.out.println(a.listDataMinersByCluster());
***REMOVED***System.out.println(a.listDataMinersByCluster());

View File

@ -292,6 +292,7 @@ import org.gcube.common.resources.gcore.Resources;
import org.gcube.common.resources.gcore.Software.Profile.Dependency;
***REMOVED***
import org.gcube.dataanalysis.dataminer.poolmanager.ansiblebridge.AnsibleBridge;
import org.gcube.dataanalysis.dataminer.poolmanager.clients.HAProxy;
import org.gcube.dataanalysis.dataminer.poolmanager.clients.ISClient;
import org.gcube.dataanalysis.dataminer.poolmanager.datamodel.Algorithm;
import org.gcube.dataanalysis.dataminer.poolmanager.datamodel.AlgorithmSet;
@ -540,7 +541,7 @@ public class DataminerPoolManager implements PoolManager {
***REMOVED*** create the cluster (dataminers in the vre)
Cluster cluster = new Cluster();
for (Host h : new ISClient().listDataMinersByCluster()) {
for (Host h : new HAProxy().listDataMinersByCluster()) {
***REMOVED***for (Host h : new ISClient().listDataminersInVRE()) {
cluster.addHost(h);
***REMOVED***