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
1a3ccdc31b
commit
bc31c95bf5
|
@ -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;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.PrintStream;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
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;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Scanner;
|
||||
import java.util.Set;
|
||||
import java.util.TreeMap;
|
||||
import java.util.TreeSet;
|
||||
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.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;
|
||||
import org.tmatesoft.svn.core.SVNException;
|
||||
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 {
|
||||
|
||||
private CSVReader reader;
|
||||
|
||||
|
||||
public Cluster getClusterByHProxy() throws IOException {
|
||||
public Cluster getClusterByHProxy() throws IOException {
|
||||
Cluster cl = new Cluster();
|
||||
String HProxy = ISClient.getHProxy();
|
||||
URL stockURL = new URL("http://data.d4science.org/Yk4zSFF6V3JOSytNd3JkRDlnRFpDUUR5TnRJZEw2QjRHbWJQNStIS0N6Yz0");
|
||||
BufferedReader in = new BufferedReader(new InputStreamReader(stockURL.openStream()));
|
||||
reader = new CSVReader(in);
|
||||
String [] nextLine;
|
||||
String[] nextLine;
|
||||
while ((nextLine = reader.readNext()) != null) {
|
||||
//rules to add
|
||||
if (HProxy.contains(nextLine[0])){
|
||||
// rules to add
|
||||
if (HProxy.contains(nextLine[0])) {
|
||||
cl.setName(nextLine[0]);
|
||||
}
|
||||
}
|
||||
return cl;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public Cluster MapCluster() throws IOException {
|
||||
public Cluster MapCluster() throws IOException {
|
||||
Cluster cl = new Cluster();
|
||||
String HProxy = ISClient.getHProxy();
|
||||
if (HProxy.equals("dataminer-cluster1.d4science.org")) {
|
||||
|
@ -109,22 +68,22 @@ public Cluster MapCluster() throws IOException {
|
|||
|
||||
}
|
||||
|
||||
|
||||
public List<Host> listDataMinersByCluster() throws IOException {
|
||||
//next op to use when Cluster info available in the IS
|
||||
//Cluster cluster = this.getClusterByHProxy();
|
||||
public List<Host> listDataMinersByCluster() throws IOException {
|
||||
// next op to use when Cluster info available in the IS
|
||||
// Cluster cluster = this.getClusterByHProxy();
|
||||
Cluster cluster = this.MapCluster();
|
||||
List<Host> out = new LinkedList<Host>();
|
||||
//prod
|
||||
// prod
|
||||
URL stockURL = new URL("http://data.d4science.org/Yk4zSFF6V3JOSytNd3JkRDlnRFpDUUR5TnRJZEw2QjRHbWJQNStIS0N6Yz0");
|
||||
|
||||
//dev
|
||||
//URL stockURL = new URL("http://data.d4science.org/c29KTUluTkZnRlB0WXE5NVNaZnRoR0dtYThUSmNTVlhHbWJQNStIS0N6Yz0");
|
||||
// dev
|
||||
// URL stockURL = new
|
||||
// URL("http://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"))){
|
||||
if (nextLine[1].equals("BACKEND") || (nextLine[1].equals("FRONTEND"))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -139,25 +98,22 @@ public List<Host> listDataMinersByCluster() throws IOException {
|
|||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static void main(String[] args) throws IOException, SVNException {
|
||||
HAProxy a = new HAProxy();
|
||||
ScopeProvider.instance.set("/gcube/devNext/NextNext");
|
||||
//System.out.println(a.getHProxy());
|
||||
//System.out.println(a.MapCluster());
|
||||
// System.out.println(a.getHProxy());
|
||||
// System.out.println(a.MapCluster());
|
||||
System.out.println(a.listDataMinersByCluster());
|
||||
//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);
|
||||
|
||||
//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());
|
||||
}
|
||||
// a.checkSVNdep();
|
||||
// System.out.println(a.getDataminer("dataminer1-devnext.d4science.org").getDomain());
|
||||
// System.out.println(a.listDataminersInVRE());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue