This commit is contained in:
Nunzio Andrea Galante 2017-07-31 11:21:47 +00:00
parent 1738a00b84
commit 43c4be5249
3 changed files with 82 additions and 13 deletions

View File

@ -28,14 +28,14 @@ public class DataminerPoolManager ***REMOVED***
***REMOVED***
***REMOVED***Algorithm algo, String env) throws IOException, InterruptedException ***REMOVED***
***REMOVED***Algorithm algo, String env, String targetVRE) throws IOException, InterruptedException ***REMOVED***
Cluster stagingCluster = ClusterBuilder.getStagingDataminerCluster(env);
***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();
return id;
***REMOVED***

View File

@ -77,6 +77,9 @@ public class StagingJob extends DMPMJob ***REMOVED***
return;
***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"));

View File

@ -11,6 +11,7 @@ import java.util.Vector;
import javax.jms.ServerSession;
import org.apache.activemq.transport.tcp.ExceededMaximumConnectionsException;
***REMOVED***
import com.jcraft.jsch.Channel;
@ -90,7 +91,7 @@ public class CheckMethod ***REMOVED***
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());
@ -108,7 +109,62 @@ public class CheckMethod ***REMOVED***
return false;
***REMOVED***
public void deleteFiles(Algorithm a,String env) throws Exception***REMOVED***
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)))***REMOVED***
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 ***REMOVED***
JSch jsch = new JSch();
Session session = null;
@ -233,18 +289,28 @@ public class CheckMethod ***REMOVED***
***REMOVED***a.copyFromDmToSVN(aa);
if (a.checkMethod("dataminer1-devnext.d4science.org", "***REMOVED***"))***REMOVED***
System.out.println("AAA");***REMOVED***
if (a.doesExist("/home/gcube/wps_algorithms/algorithms/RBLACKBOX.jar","Dev"))***REMOVED***
System.out.println("BBBB");
***REMOVED*** if (a.checkMethod("dataminer1-devnext.d4science.org", "***REMOVED***"))***REMOVED***
***REMOVED*** System.out.println("AAA");***REMOVED***
***REMOVED***
***REMOVED*** if (a.doesExist("/home/gcube/wps_algorithms/algorithms/RBLACKBOX.jar","Dev"))***REMOVED***
***REMOVED*** System.out.println("BBBB");
***REMOVED***
***REMOVED******REMOVED***
***REMOVED*** if (a.doesExist("/home/gcube/wps_algorithms/algorithms/RBLACKBOX_interface.jar","Dev"))***REMOVED***
***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");
***REMOVED***
if (a.doesExist("/home/gcube/wps_algorithms/algorithms/RBLACKBOX_interface.jar","Dev"))***REMOVED***
System.out.println("CCCC");***REMOVED***
File aa = new File("/home/gcube/wps_algorithms/algorithms/RBLACKBOX_interface.jar");
a.copyFromDmToSVN(aa, "Dev");
***REMOVED***