git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-analysis/dataminer-pool-manager@146966 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
7ee72afa7e
commit
4c277d5b80
|
@ -1,80 +1,39 @@
|
|||
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.io.BufferedReader;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
***REMOVED***
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.PrintStream;
|
||||
***REMOVED***
|
||||
***REMOVED***
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedList;
|
||||
***REMOVED***
|
||||
import java.util.Map;
|
||||
import java.util.Scanner;
|
||||
***REMOVED***
|
||||
import java.util.TreeMap;
|
||||
import java.util.TreeSet;
|
||||
import java.util.Vector;
|
||||
|
||||
import org.gcube.common.resources.gcore.ServiceEndpoint;
|
||||
***REMOVED***
|
||||
import org.gcube.dataanalysis.dataminer.poolmanager.datamodel.Cluster;
|
||||
import org.gcube.dataanalysis.dataminer.poolmanager.datamodel.Dependency;
|
||||
import org.gcube.dataanalysis.dataminer.poolmanager.datamodel.Domain;
|
||||
import org.gcube.dataanalysis.dataminer.poolmanager.datamodel.Host;
|
||||
import org.gcube.dataanalysis.dataminer.poolmanager.datamodel.comparator.HostComparator;
|
||||
import org.gcube.resources.discovery.client.api.DiscoveryClient;
|
||||
import org.gcube.resources.discovery.client.queries.api.SimpleQuery;
|
||||
import org.tmatesoft.svn.core.SVNDepth;
|
||||
***REMOVED***
|
||||
import org.tmatesoft.svn.core.SVNURL;
|
||||
import org.tmatesoft.svn.core.auth.ISVNAuthenticationManager;
|
||||
import org.tmatesoft.svn.core.internal.io.dav.DAVRepositoryFactory;
|
||||
import org.tmatesoft.svn.core.io.SVNRepository;
|
||||
import org.tmatesoft.svn.core.io.SVNRepositoryFactory;
|
||||
import org.tmatesoft.svn.core.wc.ISVNOptions;
|
||||
import org.tmatesoft.svn.core.wc.SVNClientManager;
|
||||
import org.tmatesoft.svn.core.wc.SVNRevision;
|
||||
import org.tmatesoft.svn.core.wc.SVNUpdateClient;
|
||||
import org.tmatesoft.svn.core.wc.SVNWCUtil;
|
||||
|
||||
import au.com.bytecode.opencsv.CSVReader;
|
||||
|
||||
public class HAProxy ***REMOVED***
|
||||
|
||||
private CSVReader reader;
|
||||
|
||||
public Cluster getClusterByHProxy() throws IOException ***REMOVED***
|
||||
Cluster cl = new Cluster();
|
||||
String HProxy = ISClient.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***
|
||||
***REMOVED*** rules to add
|
||||
if (HProxy.contains(nextLine[0])) ***REMOVED***
|
||||
cl.setName(nextLine[0]);
|
||||
***REMOVED***
|
||||
***REMOVED***
|
||||
return cl;
|
||||
|
||||
public Cluster getClusterByHProxy() throws IOException ***REMOVED***
|
||||
Cluster cl = new Cluster();
|
||||
String HProxy = ISClient.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***
|
||||
***REMOVED***rules to add
|
||||
if (HProxy.contains(nextLine[0]))***REMOVED***
|
||||
cl.setName(nextLine[0]);
|
||||
***REMOVED***
|
||||
***REMOVED***
|
||||
return cl;
|
||||
|
||||
***REMOVED***
|
||||
|
||||
|
||||
public Cluster MapCluster() throws IOException ***REMOVED***
|
||||
public Cluster MapCluster() throws IOException ***REMOVED***
|
||||
Cluster cl = new Cluster();
|
||||
String HProxy = ISClient.getHProxy();
|
||||
if (HProxy.equals("dataminer-cluster1.d4science.org")) ***REMOVED***
|
||||
|
@ -104,27 +63,27 @@ public Cluster MapCluster() throws IOException ***REMOVED***
|
|||
if (HProxy.equals("dataminer-d-workers.d4science.org")) ***REMOVED***
|
||||
cl.setName("devnext_backend");
|
||||
***REMOVED***
|
||||
|
||||
|
||||
return cl;
|
||||
|
||||
***REMOVED***
|
||||
|
||||
|
||||
public List<Host> listDataMinersByCluster() throws IOException ***REMOVED***
|
||||
***REMOVED***next op to use when Cluster info available in the IS
|
||||
***REMOVED***Cluster cluster = this.getClusterByHProxy();
|
||||
public List<Host> listDataMinersByCluster() throws IOException ***REMOVED***
|
||||
***REMOVED*** next op to use when Cluster info available in the IS
|
||||
***REMOVED*** Cluster cluster = this.getClusterByHProxy();
|
||||
Cluster cluster = this.MapCluster();
|
||||
List<Host> out = new LinkedList<Host>();
|
||||
***REMOVED***prod
|
||||
***REMOVED*** prod
|
||||
URL stockURL = new URL("http:***REMOVED***data.d4science.org/Yk4zSFF6V3JOSytNd3JkRDlnRFpDUUR5TnRJZEw2QjRHbWJQNStIS0N6Yz0");
|
||||
|
||||
***REMOVED***dev
|
||||
***REMOVED***URL stockURL = new URL("http:***REMOVED***data.d4science.org/c29KTUluTkZnRlB0WXE5NVNaZnRoR0dtYThUSmNTVlhHbWJQNStIS0N6Yz0");
|
||||
|
||||
***REMOVED*** dev
|
||||
***REMOVED*** URL stockURL = new
|
||||
***REMOVED*** 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) ***REMOVED***
|
||||
if (nextLine[1].equals("BACKEND")||(nextLine[1].equals("FRONTEND")))***REMOVED***
|
||||
if (nextLine[1].equals("BACKEND") || (nextLine[1].equals("FRONTEND"))) ***REMOVED***
|
||||
continue;
|
||||
***REMOVED***
|
||||
|
||||
|
@ -137,27 +96,24 @@ public List<Host> listDataMinersByCluster() throws IOException ***REMOVED***
|
|||
***REMOVED***
|
||||
return out;
|
||||
|
||||
***REMOVED***
|
||||
|
||||
|
||||
***REMOVED***
|
||||
|
||||
public static void main(String[] args) throws IOException, SVNException ***REMOVED***
|
||||
HAProxy a = new HAProxy();
|
||||
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***List<Dependency> list = new LinkedList<Dependency>();
|
||||
***REMOVED***Dependency aa = new Dependency();
|
||||
***REMOVED***aa.setName("testnunzio");
|
||||
***REMOVED***aa.setType("cran:");
|
||||
***REMOVED***list.add(aa);
|
||||
public static void main(String[] args) throws IOException, SVNException ***REMOVED***
|
||||
HAProxy a = new HAProxy();
|
||||
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***a.checkSVNdep();
|
||||
***REMOVED***System.out.println(a.getDataminer("dataminer1-devnext.d4science.org").getDomain());
|
||||
***REMOVED***System.out.println(a.listDataminersInVRE());
|
||||
***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());
|
||||
***REMOVED***
|
||||
***REMOVED***
|
||||
|
|
Loading…
Reference in New Issue