git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-analysis/dataminer-pool-manager@151456 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
d2f5e9d963
commit
2c4ee18a2b
|
@ -50,11 +50,12 @@ public class RestPoolManager implements PoolManager {
|
||||||
@Path("/algorithm/stage")
|
@Path("/algorithm/stage")
|
||||||
@Produces("text/plain")
|
@Produces("text/plain")
|
||||||
public String stageAlgorithm(
|
public String stageAlgorithm(
|
||||||
@QueryParam("algorithmPackageURL") String algorithmPackageURL
|
@QueryParam("algorithmPackageURL") String algorithmPackageURL,
|
||||||
|
@QueryParam("targetVRE") String targetVRE
|
||||||
/*@QueryParam("category") String category*/) throws IOException, InterruptedException {
|
/*@QueryParam("category") String category*/) throws IOException, InterruptedException {
|
||||||
Algorithm algo = AlgorithmBuilder.create(algorithmPackageURL);
|
Algorithm algo = AlgorithmBuilder.create(algorithmPackageURL);
|
||||||
String env = context.application().getInitParameter("Environment");
|
String env = context.application().getInitParameter("Environment");
|
||||||
return this.service.stageAlgorithm(algo,env);
|
return this.service.stageAlgorithm(algo,env,targetVRE);
|
||||||
***REMOVED***
|
***REMOVED***
|
||||||
|
|
||||||
|
|
||||||
|
@ -217,6 +218,13 @@ public class RestPoolManager implements PoolManager {
|
||||||
***REMOVED***
|
***REMOVED***
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String stageAlgorithm(String algorithmPackageURL) throws IOException, InterruptedException {
|
||||||
|
***REMOVED*** TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
***REMOVED***
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -28,14 +28,14 @@ public class DataminerPoolManager {
|
||||||
***REMOVED***
|
***REMOVED***
|
||||||
|
|
||||||
|
|
||||||
public String stageAlgorithm(Algorithm algo, String env) throws IOException, InterruptedException {
|
public String stageAlgorithm(Algorithm algo, String env, String targetVRE) throws IOException, InterruptedException {
|
||||||
|
|
||||||
Cluster stagingCluster = ClusterBuilder.getStagingDataminerCluster(env);
|
Cluster stagingCluster = ClusterBuilder.getStagingDataminerCluster(env);
|
||||||
|
|
||||||
|
|
||||||
***REMOVED***Cluster rProtoCluster = ClusterBuilder.getRProtoCluster();
|
***REMOVED***Cluster rProtoCluster = ClusterBuilder.getRProtoCluster();
|
||||||
|
|
||||||
DMPMJob job = new StagingJob(this.svnUpdater, algo, stagingCluster, /*rProtoCluster,*/ ScopeProvider.instance.get(), env);
|
DMPMJob job = new StagingJob(this.svnUpdater, algo, stagingCluster, /*rProtoCluster,*/ targetVRE, env);
|
||||||
String id = job.start();
|
String id = job.start();
|
||||||
return id;
|
return id;
|
||||||
***REMOVED***
|
***REMOVED***
|
||||||
|
|
|
@ -77,6 +77,9 @@ public class StagingJob extends DMPMJob {
|
||||||
return;
|
return;
|
||||||
***REMOVED***
|
***REMOVED***
|
||||||
|
|
||||||
|
***REMOVED***before the installation to check if the files exist
|
||||||
|
b.deleteFiles(this.algorithm, env);;
|
||||||
|
|
||||||
int ret = this.executeAnsibleWorker(createWorker(this.algorithm, this.stagingCluster, false, "root"));
|
int ret = this.executeAnsibleWorker(createWorker(this.algorithm, this.stagingCluster, false, "root"));
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@ import java.util.Vector;
|
||||||
|
|
||||||
import javax.jms.ServerSession;
|
import javax.jms.ServerSession;
|
||||||
|
|
||||||
|
import org.apache.activemq.transport.tcp.ExceededMaximumConnectionsException;
|
||||||
import org.gcube.dataanalysis.dataminer.poolmanager.datamodel.Algorithm;
|
import org.gcube.dataanalysis.dataminer.poolmanager.datamodel.Algorithm;
|
||||||
|
|
||||||
import com.jcraft.jsch.Channel;
|
import com.jcraft.jsch.Channel;
|
||||||
|
@ -109,6 +110,61 @@ public class CheckMethod {
|
||||||
***REMOVED***
|
***REMOVED***
|
||||||
|
|
||||||
|
|
||||||
|
public void deleteFiles(Algorithm a,String env) throws Exception{
|
||||||
|
JSch jsch = new JSch();
|
||||||
|
Session session = null;
|
||||||
|
Channel channel = null;
|
||||||
|
ChannelSftp c = null;
|
||||||
|
ServiceConfiguration p = new ServiceConfiguration();
|
||||||
|
System.out.println("checking existing in env: "+ env + " " + p.getHost(env));
|
||||||
|
|
||||||
|
File file = new File("/home/gcube/wps_algorithms/algorithms/"+a.getName()+".jar");
|
||||||
|
File file2 = new File("/home/gcube/wps_algorithms/algorithms/"+a.getName()+"_interface.jar");
|
||||||
|
|
||||||
|
|
||||||
|
System.out.println("First file is located to: "+file.getPath());
|
||||||
|
System.out.println("Second file is located to: "+file2.getPath());
|
||||||
|
|
||||||
|
|
||||||
|
jsch.setKnownHosts("~/.ssh/known_hosts");
|
||||||
|
String privateKey = "~/.ssh/id_rsa";
|
||||||
|
|
||||||
|
jsch.addIdentity(privateKey);
|
||||||
|
System.out.println("Private Key Added.");
|
||||||
|
|
||||||
|
session = jsch.getSession("root", p.getHost(env));
|
||||||
|
System.out.println("session created.");
|
||||||
|
|
||||||
|
java.util.Properties config = new java.util.Properties();
|
||||||
|
config.put("StrictHostKeyChecking", "no");
|
||||||
|
|
||||||
|
session.setConfig(config);
|
||||||
|
session.connect();
|
||||||
|
|
||||||
|
channel = session.openChannel("sftp");
|
||||||
|
channel.connect();
|
||||||
|
System.out.println("shell channel connected....");
|
||||||
|
|
||||||
|
c = (ChannelSftp) channel;
|
||||||
|
|
||||||
|
if(doesExist(file.getPath(),env)&&(doesExist(file2.getPath(),env))){
|
||||||
|
|
||||||
|
c.rm(file.getPath());
|
||||||
|
c.rm(file2.getPath());
|
||||||
|
System.out.println("Both the files have been deleted");
|
||||||
|
***REMOVED***
|
||||||
|
else System.out.println("Files not found");
|
||||||
|
channel.disconnect();
|
||||||
|
c.disconnect();
|
||||||
|
session.disconnect();
|
||||||
|
|
||||||
|
***REMOVED***
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public boolean doesExist(String path, String env) throws Exception {
|
public boolean doesExist(String path, String env) throws Exception {
|
||||||
JSch jsch = new JSch();
|
JSch jsch = new JSch();
|
||||||
Session session = null;
|
Session session = null;
|
||||||
|
@ -233,18 +289,28 @@ public class CheckMethod {
|
||||||
|
|
||||||
|
|
||||||
***REMOVED***a.copyFromDmToSVN(aa);
|
***REMOVED***a.copyFromDmToSVN(aa);
|
||||||
if (a.checkMethod("dataminer1-devnext.d4science.org", "708e7eb8-11a7-4e9a-816b-c9ed7e7e99fe-98187548")){
|
***REMOVED*** if (a.checkMethod("dataminer1-devnext.d4science.org", "708e7eb8-11a7-4e9a-816b-c9ed7e7e99fe-98187548")){
|
||||||
System.out.println("AAA");***REMOVED***
|
***REMOVED*** System.out.println("AAA");***REMOVED***
|
||||||
|
|
||||||
if (a.doesExist("/home/gcube/wps_algorithms/algorithms/RBLACKBOX.jar","Dev")){
|
|
||||||
System.out.println("BBBB");
|
|
||||||
|
|
||||||
***REMOVED***
|
***REMOVED***
|
||||||
if (a.doesExist("/home/gcube/wps_algorithms/algorithms/RBLACKBOX_interface.jar","Dev")){
|
***REMOVED*** if (a.doesExist("/home/gcube/wps_algorithms/algorithms/RBLACKBOX.jar","Dev")){
|
||||||
System.out.println("CCCC");***REMOVED***
|
***REMOVED*** System.out.println("BBBB");
|
||||||
|
***REMOVED***
|
||||||
|
***REMOVED******REMOVED***
|
||||||
|
***REMOVED*** if (a.doesExist("/home/gcube/wps_algorithms/algorithms/RBLACKBOX_interface.jar","Dev")){
|
||||||
|
***REMOVED*** System.out.println("CCCC");***REMOVED***
|
||||||
|
***REMOVED***
|
||||||
|
***REMOVED*** File aa = new File("/home/gcube/wps_algorithms/algorithms/RBLACKBOX_interface.jar");
|
||||||
|
***REMOVED*** a.copyFromDmToSVN(aa, "Dev");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Algorithm al = new Algorithm();
|
||||||
|
al.setName("RBLACKBOX");
|
||||||
|
a.deleteFiles(al, "Dev");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
File aa = new File("/home/gcube/wps_algorithms/algorithms/RBLACKBOX_interface.jar");
|
|
||||||
a.copyFromDmToSVN(aa, "Dev");
|
|
||||||
|
|
||||||
|
|
||||||
***REMOVED***
|
***REMOVED***
|
||||||
|
|
Loading…
Reference in New Issue