Feature/24026 #3

Merged
giancarlo.panichi merged 194 commits from Feature/24026 into master 2023-11-09 19:12:54 +01:00
4 changed files with 96 additions and 14 deletions
Showing only changes of commit e95962bf38 - Show all commits

View File

@ -145,13 +145,40 @@ public class ISClient {
public String getHProxy(){
Host h = new Host();
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);
List<ServiceEndpoint> resources = client.submit(query);
h.setName(resources.get(0).profile().runtime().hostedOn());
return h.getName();
***REMOVED***
***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***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();
@ -171,14 +198,60 @@ public Cluster getClusterByHProxy() throws IOException {
***REMOVED***
public List<Host> listDataMinersByCluster() throws IOException {
Cluster cluster = this.getClusterByHProxy();
public Cluster MapCluster() throws IOException {
***REMOVED***
URL stockURL = new URL("http:***REMOVED***data.d4science.org/Yk4zSFF6V3JOSytNd3JkRDlnRFpDUUR5TnRJZEw2QjRHbWJQNStIS0N6Yz0");
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]);
@ -190,8 +263,6 @@ public Cluster getClusterByHProxy() throws IOException {
***REMOVED***
/**
* Return the list of hosts (dataminers) in a given VRE
*
@ -238,7 +309,8 @@ public Cluster getClusterByHProxy() throws IOException {
ISClient a = new ISClient();
ScopeProvider.instance.set("/gcube/devNext/NextNext");
***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());

View File

@ -32,8 +32,12 @@ public class Host {
this.domain = domain;
***REMOVED***
public String toString() {
return this.name + "@" + this.domain;
***REMOVED***
***REMOVED*** public String toString() {
***REMOVED*** return this.name + "@" + this.domain;
***REMOVED*** ***REMOVED***
public String toString() {
return this.name;
***REMOVED***
***REMOVED***

View File

@ -338,7 +338,12 @@ public class RestPoolManager implements PoolManager {
a.addAlgorithmToVRE(
"http:***REMOVED***data.d4science.org/TVc0TW9Ud1FjYlppK0NHd2pvU0owNmRFWHE4OW4xSGNHbWJQNStIS0N6Yz0",
"test",
null, null, "N", "transducerers", true, false);
null,
null,
"N",
"transducerers",
true,
false);
***REMOVED*** a.addAlgorithmToHost(
***REMOVED*** "http:***REMOVED***data.d4science.org/dENQTTMxdjNZcGRpK0NHd2pvU0owMFFzN0VWemw3Zy9HbWJQNStIS0N6Yz0",
@ -404,5 +409,6 @@ public class RestPoolManager implements PoolManager {
***REMOVED*** TODO Auto-generated method stub
return null;
***REMOVED***
***REMOVED***

View File

@ -540,8 +540,8 @@ public class DataminerPoolManager implements PoolManager {
***REMOVED*** create the cluster (dataminers in the vre)
Cluster cluster = new Cluster();
***REMOVED*** for (Host h : new ISClient().listDataMinersByCluster()) {
for (Host h : new ISClient().listDataminersInVRE()) {
for (Host h : new ISClient().listDataMinersByCluster()) {
***REMOVED***for (Host h : new ISClient().listDataminersInVRE()) {
cluster.addHost(h);
***REMOVED***