git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-analysis/dataminer-pool-manager@146965 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
f7488f8b0e
commit
1a3ccdc31b
|
@ -1,69 +1,3 @@
|
|||
//package org.gcube.dataanalysis.dataminer.poolmanager.clients;
|
||||
//
|
||||
//import static org.gcube.resources.discovery.icclient.ICFactory.clientFor;
|
||||
//import static org.gcube.resources.discovery.icclient.ICFactory.queryFor;
|
||||
//
|
||||
//import java.util.Collection;
|
||||
//import java.util.List;
|
||||
//import java.util.Vector;
|
||||
//
|
||||
//import org.gcube.common.resources.gcore.ServiceEndpoint;
|
||||
//import org.gcube.common.scope.api.ScopeProvider;
|
||||
//import org.gcube.dataanalysis.dataminer.poolmanager.datamodel.Domain;
|
||||
//import org.gcube.dataanalysis.dataminer.poolmanager.datamodel.Host;
|
||||
//import org.gcube.resources.discovery.client.api.DiscoveryClient;
|
||||
//import org.gcube.resources.discovery.client.queries.api.SimpleQuery;
|
||||
//
|
||||
//public class ISClient {
|
||||
//
|
||||
// /**
|
||||
// * Return the list of hosts (dataminers) in a given VRE
|
||||
// *
|
||||
// * @param vreName
|
||||
// * @return
|
||||
// */
|
||||
// public Collection<Host> listDataminersInVRE() {
|
||||
//
|
||||
// boolean remote = false;
|
||||
//
|
||||
// if (!remote) {
|
||||
// Collection<Host> out = new Vector<>();
|
||||
// Host h = new Host();
|
||||
// //h.setName("bb-dataminer.res.eng.it");
|
||||
// //h.setName("vm101.ui.savba.sk");
|
||||
// h.setName("dataminer1-devnext.d4science.org");
|
||||
// out.add(h);
|
||||
// return out;
|
||||
// } else {
|
||||
//
|
||||
// SimpleQuery query = queryFor(ServiceEndpoint.class);
|
||||
//
|
||||
// //old version
|
||||
// //query.addCondition("$resource/Profile/Category/text() eq 'DataAnalysis'")
|
||||
// //.addCondition("$resource/Profile/Name/text() eq 'DataMiner'");
|
||||
//
|
||||
// query.addCondition("$resource/Profile/Platform/Name/text() eq 'DataMiner'");
|
||||
//
|
||||
// DiscoveryClient<ServiceEndpoint> client = clientFor(ServiceEndpoint.class);
|
||||
//
|
||||
// List<ServiceEndpoint> resources = client.submit(query);
|
||||
//
|
||||
// Collection<Host> out = new Vector<>();
|
||||
// for (ServiceEndpoint r : resources) {
|
||||
// Host h = new Host();
|
||||
// h.setName(r.profile().runtime().hostedOn());
|
||||
// out.add(h);
|
||||
// }
|
||||
// return out;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public static void main(String[] args) {
|
||||
// ISClient a = new ISClient();
|
||||
// ScopeProvider.instance.set("/gcube/devNext/NextNext");
|
||||
// System.out.println(a.listDataminersInVRE());
|
||||
//}
|
||||
//}
|
||||
package org.gcube.dataanalysis.dataminer.poolmanager.clients;
|
||||
|
||||
import static org.gcube.resources.discovery.icclient.ICFactory.clientFor;
|
||||
|
@ -138,113 +72,109 @@ public class ISClient {
|
|||
}
|
||||
return h;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// return the HProxy hostname in the VRE
|
||||
public static String getHProxy(){
|
||||
Host h = new Host();
|
||||
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);
|
||||
h.setName(resources.get(0).profile().runtime().hostedOn());
|
||||
return h.getName();
|
||||
}
|
||||
|
||||
//return the Cluster hostname from the IS
|
||||
//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;
|
||||
//
|
||||
//}
|
||||
|
||||
//return the dataminer hostnames from the IS
|
||||
//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;
|
||||
//
|
||||
//}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Return the list of hosts (dataminers) in a given VRE
|
||||
*
|
||||
* @param vreName
|
||||
* @return
|
||||
*/
|
||||
public Collection<Host> listDataminersInVRE() {
|
||||
|
||||
boolean remote = false;
|
||||
|
||||
if (!remote) {
|
||||
Collection<Host> out = new Vector<>();
|
||||
Host h = new Host();
|
||||
//h.setName("bb-dataminer.res.eng.it");
|
||||
//h.setName("vm101.ui.savba.sk");
|
||||
h.setName("dataminer1-devnext.d4science.org");
|
||||
out.add(h);
|
||||
return out;
|
||||
} else {
|
||||
|
||||
SimpleQuery query = queryFor(ServiceEndpoint.class);
|
||||
|
||||
//old version
|
||||
//query.addCondition("$resource/Profile/Category/text() eq 'DataAnalysis'")
|
||||
//.addCondition("$resource/Profile/Name/text() eq 'DataMiner'");
|
||||
|
||||
query.addCondition("$resource/Profile/Platform/Name/text() eq 'DataMiner'");
|
||||
|
||||
DiscoveryClient<ServiceEndpoint> client = clientFor(ServiceEndpoint.class);
|
||||
|
||||
List<ServiceEndpoint> resources = client.submit(query);
|
||||
|
||||
Collection<Host> out = new Vector<>();
|
||||
for (ServiceEndpoint r : resources) {
|
||||
Host h = new Host();
|
||||
h.setName(r.profile().runtime().hostedOn());
|
||||
out.add(h);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws IOException, SVNException {
|
||||
ISClient a = new ISClient();
|
||||
ScopeProvider.instance.set("/gcube/devNext/NextNext");
|
||||
//System.out.println(a.getHProxy());
|
||||
//System.out.println(a.MapCluster());
|
||||
//System.out.println(a.listDataMinersByCluster());
|
||||
//System.out.println(a.listDataMinersByCluster());
|
||||
|
||||
|
||||
//List<Dependency> list = new LinkedList<Dependency>();
|
||||
//Dependency aa = new Dependency();
|
||||
//aa.setName("testnunzio");
|
||||
//aa.setType("cran:");
|
||||
//list.add(aa);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//a.checkSVNdep();
|
||||
//System.out.println(a.getDataminer("dataminer1-devnext.d4science.org").getDomain());
|
||||
//System.out.println(a.listDataminersInVRE());
|
||||
}
|
||||
// return the HProxy hostname in the VRE
|
||||
public static String getHProxy() {
|
||||
Host h = new Host();
|
||||
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);
|
||||
h.setName(resources.get(0).profile().runtime().hostedOn());
|
||||
return h.getName();
|
||||
}
|
||||
|
||||
// return the Cluster hostname from the IS
|
||||
// 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;
|
||||
//
|
||||
// }
|
||||
|
||||
// return the dataminer hostnames from the IS
|
||||
// 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;
|
||||
//
|
||||
// }
|
||||
|
||||
/**
|
||||
* Return the list of hosts (dataminers) in a given VRE
|
||||
*
|
||||
* @param vreName
|
||||
* @return
|
||||
*/
|
||||
public Collection<Host> listDataminersInVRE() {
|
||||
|
||||
boolean remote = false;
|
||||
|
||||
if (!remote) {
|
||||
Collection<Host> out = new Vector<>();
|
||||
Host h = new Host();
|
||||
// h.setName("bb-dataminer.res.eng.it");
|
||||
// h.setName("vm101.ui.savba.sk");
|
||||
h.setName("dataminer1-devnext.d4science.org");
|
||||
out.add(h);
|
||||
return out;
|
||||
} else {
|
||||
|
||||
SimpleQuery query = queryFor(ServiceEndpoint.class);
|
||||
|
||||
// old version
|
||||
// query.addCondition("$resource/Profile/Category/text() eq
|
||||
// 'DataAnalysis'")
|
||||
// .addCondition("$resource/Profile/Name/text() eq 'DataMiner'");
|
||||
|
||||
query.addCondition("$resource/Profile/Platform/Name/text() eq 'DataMiner'");
|
||||
|
||||
DiscoveryClient<ServiceEndpoint> client = clientFor(ServiceEndpoint.class);
|
||||
|
||||
List<ServiceEndpoint> resources = client.submit(query);
|
||||
|
||||
Collection<Host> out = new Vector<>();
|
||||
for (ServiceEndpoint r : resources) {
|
||||
Host h = new Host();
|
||||
h.setName(r.profile().runtime().hostedOn());
|
||||
out.add(h);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws IOException, SVNException {
|
||||
ISClient a = new ISClient();
|
||||
ScopeProvider.instance.set("/gcube/devNext/NextNext");
|
||||
// System.out.println(a.getHProxy());
|
||||
// System.out.println(a.MapCluster());
|
||||
// System.out.println(a.listDataMinersByCluster());
|
||||
// System.out.println(a.listDataMinersByCluster());
|
||||
|
||||
// List<Dependency> list = new LinkedList<Dependency>();
|
||||
// Dependency aa = new Dependency();
|
||||
// aa.setName("testnunzio");
|
||||
// aa.setType("cran:");
|
||||
// list.add(aa);
|
||||
|
||||
// a.checkSVNdep();
|
||||
// System.out.println(a.getDataminer("dataminer1-devnext.d4science.org").getDomain());
|
||||
// System.out.println(a.listDataminersInVRE());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue