This commit is contained in:
Nunzio Andrea Galante 2017-04-19 15:01:13 +00:00
parent f25ac50a25
commit 8238deb146
1 changed files with 90 additions and 160 deletions

View File

@ -1,69 +1,3 @@
***REMOVED******REMOVED***
***REMOVED***
***REMOVED***import static org.gcube.resources.discovery.icclient.ICFactory.clientFor;
***REMOVED***import static org.gcube.resources.discovery.icclient.ICFactory.queryFor;
***REMOVED***
***REMOVED***import java.util.Collection;
***REMOVED******REMOVED***
***REMOVED***import java.util.Vector;
***REMOVED***
***REMOVED***import org.gcube.common.resources.gcore.ServiceEndpoint;
***REMOVED******REMOVED***
***REMOVED***import org.gcube.dataanalysis.dataminer.poolmanager.datamodel.Domain;
***REMOVED******REMOVED***
***REMOVED***import org.gcube.resources.discovery.client.api.DiscoveryClient;
***REMOVED***import org.gcube.resources.discovery.client.queries.api.SimpleQuery;
***REMOVED***
***REMOVED***public class ISClient {
***REMOVED***
***REMOVED*** /**
***REMOVED*** * Return the list of hosts (dataminers) in a given VRE
***REMOVED*** *
***REMOVED*** * @param vreName
***REMOVED*** * @return
***REMOVED*** */
***REMOVED*** public Collection<Host> listDataminersInVRE() {
***REMOVED***
***REMOVED*** boolean remote = false;
***REMOVED***
***REMOVED*** if (!remote) {
***REMOVED*** Collection<Host> out = new Vector<>();
***REMOVED*** Host h = new Host();
***REMOVED*** ***REMOVED***h.setName("bb-dataminer.res.eng.it");
***REMOVED*** ***REMOVED***h.setName("vm101.ui.savba.sk");
***REMOVED*** h.setName("dataminer1-devnext.d4science.org");
***REMOVED*** out.add(h);
***REMOVED*** return out;
***REMOVED*** ***REMOVED*** else {
***REMOVED***
***REMOVED*** SimpleQuery query = queryFor(ServiceEndpoint.class);
***REMOVED***
***REMOVED*** ***REMOVED***old version
***REMOVED*** ***REMOVED***query.addCondition("$resource/Profile/Category/text() eq 'DataAnalysis'")
***REMOVED*** ***REMOVED***.addCondition("$resource/Profile/Name/text() eq 'DataMiner'");
***REMOVED***
***REMOVED*** query.addCondition("$resource/Profile/Platform/Name/text() eq 'DataMiner'");
***REMOVED***
***REMOVED*** DiscoveryClient<ServiceEndpoint> client = clientFor(ServiceEndpoint.class);
***REMOVED***
***REMOVED*** List<ServiceEndpoint> resources = client.submit(query);
***REMOVED***
***REMOVED*** Collection<Host> out = new Vector<>();
***REMOVED*** for (ServiceEndpoint r : resources) {
***REMOVED*** Host h = new Host();
***REMOVED*** h.setName(r.profile().runtime().hostedOn());
***REMOVED*** out.add(h);
***REMOVED*** ***REMOVED***
***REMOVED*** return out;
***REMOVED*** ***REMOVED***
***REMOVED*** ***REMOVED***
***REMOVED***
***REMOVED*** public static void main(String[] args) {
***REMOVED*** ISClient a = new ISClient();
***REMOVED*** ScopeProvider.instance.set("/gcube/devNext/NextNext");
***REMOVED*** System.out.println(a.listDataminersInVRE());
***REMOVED******REMOVED***
***REMOVED******REMOVED***
***REMOVED***
import static org.gcube.resources.discovery.icclient.ICFactory.clientFor;
@ -139,8 +73,6 @@ public class ISClient {
return h;
***REMOVED***
***REMOVED*** return the HProxy hostname in the VRE
public static String getHProxy() {
Host h = new Host();
@ -158,8 +90,10 @@ public static String getHProxy(){
***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*** query.addCondition("$resource/Profile/Platform/Name/text() eq
***REMOVED*** 'DataMiner'");
***REMOVED*** DiscoveryClient<ServiceEndpoint> client =
***REMOVED*** clientFor(ServiceEndpoint.class);
***REMOVED*** List<ServiceEndpoint> resources = client.submit(query);
***REMOVED*** cl.setName(resources.get(0).profile().runtime().hostedOn());
***REMOVED*** return null;
@ -172,16 +106,16 @@ public static String getHProxy(){
***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*** query.addCondition("$resource/Profile/Platform/Name/text() eq
***REMOVED*** 'DataMiner'");
***REMOVED*** DiscoveryClient<ServiceEndpoint> client =
***REMOVED*** 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
*
@ -199,13 +133,14 @@ public static String getHProxy(){
***REMOVED*** h.setName("vm101.ui.savba.sk");
h.setName("dataminer1-devnext.d4science.org");
out.add(h);
return out;
***REMOVED***
***REMOVED*** else {
SimpleQuery query = queryFor(ServiceEndpoint.class);
***REMOVED*** old version
***REMOVED***query.addCondition("$resource/Profile/Category/text() eq 'DataAnalysis'")
***REMOVED*** query.addCondition("$resource/Profile/Category/text() eq
***REMOVED*** 'DataAnalysis'")
***REMOVED*** .addCondition("$resource/Profile/Name/text() eq 'DataMiner'");
query.addCondition("$resource/Profile/Platform/Name/text() eq 'DataMiner'");
@ -220,7 +155,7 @@ public static String getHProxy(){
h.setName(r.profile().runtime().hostedOn());
out.add(h);
***REMOVED***
return out;
***REMOVED***
***REMOVED***
***REMOVED***
@ -232,17 +167,12 @@ public static String getHProxy(){
***REMOVED*** System.out.println(a.listDataMinersByCluster());
***REMOVED*** System.out.println(a.listDataMinersByCluster());
***REMOVED*** List<Dependency> list = new LinkedList<Dependency>();
***REMOVED*** Dependency aa = new Dependency();
***REMOVED*** aa.setName("testnunzio");
***REMOVED*** aa.setType("cran:");
***REMOVED*** list.add(aa);
***REMOVED*** a.checkSVNdep();
***REMOVED*** System.out.println(a.getDataminer("dataminer1-devnext.d4science.org").getDomain());
***REMOVED*** System.out.println(a.listDataminersInVRE());