From 8238deb146e6b54e3f1cfeff1dbcbeffcbb75b07 Mon Sep 17 00:00:00 2001 From: Nunzio Andrea Galante Date: Wed, 19 Apr 2017 15:01:13 +0000 Subject: [PATCH] git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-analysis/dataminer-pool-manager@146965 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../poolmanager/clients/ISClient.java | 250 +++++++----------- 1 file changed, 90 insertions(+), 160 deletions(-) diff --git a/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/clients/ISClient.java b/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/clients/ISClient.java index a1fa377..98699e8 100644 --- a/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/clients/ISClient.java +++ b/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/clients/ISClient.java @@ -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 listDataminersInVRE() { -***REMOVED*** -***REMOVED*** boolean remote = false; -***REMOVED*** -***REMOVED*** if (!remote) { -***REMOVED*** Collection 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 client = clientFor(ServiceEndpoint.class); -***REMOVED*** -***REMOVED*** List resources = client.submit(query); -***REMOVED*** -***REMOVED*** Collection 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; @@ -138,113 +72,109 @@ public class ISClient { ***REMOVED*** return h; ***REMOVED*** - - -***REMOVED*** 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 client = clientFor(ServiceEndpoint.class); - List resources = client.submit(query); - h.setName(resources.get(0).profile().runtime().hostedOn()); - return h.getName(); + ***REMOVED*** 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 client = clientFor(ServiceEndpoint.class); + List 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 -***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 client = clientFor(ServiceEndpoint.class); -***REMOVED*** List resources = client.submit(query); -***REMOVED*** cl.setName(resources.get(0).profile().runtime().hostedOn()); -***REMOVED*** return null; -***REMOVED*** -***REMOVED******REMOVED*** + ***REMOVED*** return the Cluster hostname from the IS + ***REMOVED*** to develop + ***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 + ***REMOVED*** 'DataMiner'"); + ***REMOVED*** DiscoveryClient client = + ***REMOVED*** clientFor(ServiceEndpoint.class); + ***REMOVED*** List 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 -***REMOVED***public List 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 client = clientFor(ServiceEndpoint.class); -***REMOVED*** List 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 + ***REMOVED*** public List 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 + ***REMOVED*** 'DataMiner'"); + ***REMOVED*** DiscoveryClient client = + ***REMOVED*** clientFor(ServiceEndpoint.class); + ***REMOVED*** List 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 + * + * @param vreName + * @return + */ + public Collection listDataminersInVRE() { - - /** - * Return the list of hosts (dataminers) in a given VRE - * - * @param vreName - * @return - */ - public Collection listDataminersInVRE() { + boolean remote = false; - boolean remote = false; + if (!remote) { + Collection out = new Vector<>(); + Host h = new Host(); + ***REMOVED*** h.setName("bb-dataminer.res.eng.it"); + ***REMOVED*** h.setName("vm101.ui.savba.sk"); + h.setName("dataminer1-devnext.d4science.org"); + out.add(h); + ***REMOVED*** + ***REMOVED*** else { - if (!remote) { - Collection out = new Vector<>(); - Host h = new Host(); - ***REMOVED***h.setName("bb-dataminer.res.eng.it"); - ***REMOVED***h.setName("vm101.ui.savba.sk"); - h.setName("dataminer1-devnext.d4science.org"); - out.add(h); - return out; - ***REMOVED*** else { + SimpleQuery query = queryFor(ServiceEndpoint.class); - SimpleQuery query = queryFor(ServiceEndpoint.class); + ***REMOVED*** old version + ***REMOVED*** query.addCondition("$resource/Profile/Category/text() eq + ***REMOVED*** 'DataAnalysis'") + ***REMOVED*** .addCondition("$resource/Profile/Name/text() eq 'DataMiner'"); - ***REMOVED***old version - ***REMOVED***query.addCondition("$resource/Profile/Category/text() eq 'DataAnalysis'") - ***REMOVED***.addCondition("$resource/Profile/Name/text() eq 'DataMiner'"); + query.addCondition("$resource/Profile/Platform/Name/text() eq 'DataMiner'"); - query.addCondition("$resource/Profile/Platform/Name/text() eq 'DataMiner'"); - - DiscoveryClient client = clientFor(ServiceEndpoint.class); + DiscoveryClient client = clientFor(ServiceEndpoint.class); - List resources = client.submit(query); + List resources = client.submit(query); - Collection out = new Vector<>(); - for (ServiceEndpoint r : resources) { - Host h = new Host(); - h.setName(r.profile().runtime().hostedOn()); - out.add(h); - ***REMOVED*** - return out; - ***REMOVED*** - ***REMOVED*** + Collection out = new Vector<>(); + for (ServiceEndpoint r : resources) { + Host h = new Host(); + h.setName(r.profile().runtime().hostedOn()); + out.add(h); + ***REMOVED*** + ***REMOVED*** + ***REMOVED*** +***REMOVED*** - public static void main(String[] args) throws IOException, SVNException { - ISClient a = new ISClient(); - ScopeProvider.instance.set("/gcube/devNext/NextNext"); - ***REMOVED***System.out.println(a.getHProxy()); - ***REMOVED***System.out.println(a.MapCluster()); - ***REMOVED***System.out.println(a.listDataMinersByCluster()); - ***REMOVED***System.out.println(a.listDataMinersByCluster()); - - - ***REMOVED***List list = new LinkedList(); - ***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()); + public static void main(String[] args) throws IOException, SVNException { + ISClient a = new ISClient(); + ScopeProvider.instance.set("/gcube/devNext/NextNext"); + ***REMOVED*** System.out.println(a.getHProxy()); + ***REMOVED*** System.out.println(a.MapCluster()); + ***REMOVED*** System.out.println(a.listDataMinersByCluster()); + ***REMOVED*** System.out.println(a.listDataMinersByCluster()); + + ***REMOVED*** List list = new LinkedList(); + ***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()); ***REMOVED*** ***REMOVED***