dataminer-pool-manager/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/util/ClusterBuilder.java

54 lines
1.5 KiB
Java

package org.gcube.dataanalysis.dataminer.poolmanager.util;
import java.io.FileNotFoundException;
***REMOVED***
***REMOVED***
***REMOVED***
import org.gcube.dataanalysis.dataminer.poolmanager.clients.HAProxy;
import org.gcube.dataanalysis.dataminer.poolmanager.datamodel.Cluster;
import org.gcube.dataanalysis.dataminer.poolmanager.datamodel.Host;
public class ClusterBuilder ***REMOVED***
***REMOVED***1. to complete
public static Cluster getStagingDataminerCluster(String env) throws FileNotFoundException***REMOVED***
Cluster cluster = new Cluster();
ServiceConfiguration p = new ServiceConfiguration();
Host h = new Host();
if (env.equals("Dev"))***REMOVED***
h.setName(p.getDevStagingHost());
cluster.addHost(h);
***REMOVED***
if ((env.equals("Prod")||(env.equals("Proto"))))***REMOVED***
h.setName(p.getProtoProdStagingHost());
cluster.addHost(h);
***REMOVED***
return cluster;
***REMOVED***
public static Cluster getVRECluster(String targetVREToken, String targetVRE) throws IOException***REMOVED***
Cluster cluster = new Cluster();
for (Host h : new HAProxy().listDataMinersByCluster(targetVREToken,targetVRE)) ***REMOVED***
cluster.addHost(h);
***REMOVED***
return cluster;
***REMOVED***
public static Cluster getRProtoCluster() throws IOException***REMOVED***
***REMOVED***Assumes the service is running in RPrototypingLab
String token = SecurityTokenProvider.instance.get();
String targetVRE = ScopeProvider.instance.get();
return getVRECluster(token, targetVRE);
***REMOVED***
***REMOVED***