release candidate

This commit is contained in:
fixminer
2018-09-17 15:40:32 +02:00
parent 2408eb159e
commit 4a9d87974e
10 changed files with 97 additions and 27 deletions
@@ -128,14 +128,14 @@ public class Launcher {
CallShell cs1 =new CallShell();
String db1 = "bash "+dbDir + "/" + "startServer.sh" +" %s %s %s";
String db11 = String.format(db1, dbDir,"level1-"+pjName+ actionType+".rdb" ,Integer.valueOf(port));
cs1.runShell(db11,serverWait);
cs1.runShell(db11,serverWait, port);
String runpy = "bash "+datasetPath + "/" + "launchPy.sh" +" %s %s %s %s %s %s";
String formatRunPy = String.format(runpy,pythonPath +"/abstractPatch.py", gumInput, datasetPath + "/cluster"+pjName+ actionType, port, "matches" + pjName + actionType, threshold);
cs1.runShell(formatRunPy);
String stopServer = "bash "+dbDir + "/" + "stopServer.sh" +" %s";
stopServer = String.format(stopServer,Integer.valueOf(port));
cs1.runShell(stopServer,serverWait);
cs1.runShell(stopServer,serverWait, port);
}
private static void level2(String serverWait, String port, String pythonPath, String datasetPath, String pjName, String actionType, String threshold, String dbDir, String dumpsName, String gumInput) throws Exception {
@@ -147,14 +147,14 @@ public class Launcher {
CallShell cs3 =new CallShell();
String db22 = "bash "+dbDir + "/" + "startServer.sh" +" %s %s %s";
String db1b = String.format(db22, dbDir,"clusterl1-"+pjName+actionType+".rdb",Integer.valueOf(port));
cs3.runShell(db1b,serverWait);
cs3.runShell(db1b,serverWait, port);
String runpy2 = "bash "+datasetPath + "/" + "launchPy.sh" +" %s %s %s %s %s %s";
String formatRunPy1a = String.format(runpy2,pythonPath +"/abstractPatchCluster.py", gumInput, datasetPath + "/cluster"+pjName+ actionType, port, datasetPath + "/cluster-2l"+pjName+ actionType,threshold);
cs3.runShell(formatRunPy1a);
String stopServer1a = "bash "+dbDir + "/" + "stopServer.sh" +" %s";
stopServer = String.format(stopServer1a,Integer.valueOf(port));
cs3.runShell(stopServer,serverWait);
cs3.runShell(stopServer,serverWait, port);
}
private static void level3(String serverWait, String port, String pythonPath, String datasetPath, String pjName, String actionType, String threshold, String dbDir, String dumpsName, String gumInput) throws Exception {
@@ -166,14 +166,14 @@ public class Launcher {
CallShell cs5 =new CallShell();
String dba = "bash "+dbDir + "/" + "startServer.sh" +" %s %s %s";
String dbaa = String.format(dba, dbDir,"clusterl2-"+pjName+actionType+".rdb",Integer.valueOf(port));
cs5.runShell(dbaa,serverWait);
cs5.runShell(dbaa,serverWait, port);
String runpya = "bash "+datasetPath + "/" + "launchPy.sh" +" %s %s %s %s %s %s";
String formatRunPya = String.format(runpya,pythonPath +"/abstractPatchClusterLevel3.py", gumInput, datasetPath + "/cluster-3l"+pjName+ actionType, port, datasetPath + "/cluster-2l"+pjName+ actionType,threshold);
cs5.runShell(formatRunPya);
String stopServera = "bash "+dbDir + "/" + "stopServer.sh" +" %s";
stopServer = String.format(stopServera,Integer.valueOf(port));
cs5.runShell(stopServer,serverWait);
cs5.runShell(stopServer,serverWait, port);
return;
}
// System.exit(1);
@@ -82,13 +82,13 @@ public class AkkaTreeLoader {
String cmd = "bash "+dbDir + "/" + "startServer.sh" +" %s %s %s";
String cmd1 = String.format(cmd, dbDir,dumpsName,Integer.valueOf(port));
//
cs.runShell(cmd1,serverWait);
cs.runShell(cmd1,serverWait,port);
String cmdInner = "bash "+dbDir + "/" + "startServer.sh" +" %s %s %s";
String cmd2 = String.format(cmdInner, dbDir,chunkName,Integer.valueOf(portInner));
log.info(cmd1);
log.info(cmd2);
//
cs.runShell(cmd2,serverWait);
cs.runShell(cmd2,serverWait, portInner);
JedisPool outerPool = new JedisPool(poolConfig, "127.0.0.1",Integer.valueOf(port),20000000);
JedisPool innerPool = new JedisPool(poolConfig, "127.0.0.1",Integer.valueOf(portInner),20000000);
@@ -150,6 +150,7 @@ public class AkkaTreeLoader {
// comparePairs(innerPool,outerPool);
Thread.sleep(Integer.valueOf(serverWait));
akkaCompare(innerPool,outerPool,numOfWorkers,cursor);
// String stopServer = "bash "+dbDir + "/" + "stopServer.sh" +" %s";
@@ -31,7 +31,7 @@ public class CalculatePairs {
String cmd = "bash "+dbDir + "/" + "startServer.sh" +" %s %s %s";
cmd = String.format(cmd, dbDir,chunkName,Integer.valueOf(port));
cs.runShell(cmd,serverWait);
cs.runShell(cmd,serverWait, port);
FileHelper.createDirectory(outputPath);
@@ -5,7 +5,10 @@ package edu.lu.uni.serval.fixminer.cluster;
*/
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.concurrent.TimeUnit;
public class CallShell {
@@ -23,7 +26,7 @@ public class CallShell {
}
public void runShell(String command,String serverWait) throws Exception {
public static void runShell(String command, String serverWait, String port) throws Exception {
Process process = Runtime.getRuntime().exec(command);
BufferedReader reader = new BufferedReader(new InputStreamReader(
@@ -32,8 +35,73 @@ public class CallShell {
while ((s = reader.readLine()) != null) {
System.out.println("Script output: " + s);
}
Thread.sleep(Integer.valueOf(serverWait));
// Thread.sleep(Integer.valueOf(serverWait));
String cmd = "redis-cli -p %s ping";
String cmd1 = String.format(cmd,Integer.valueOf(port));
runPing(cmd1);
}
public static void runPing(String command) throws Exception {
try{
StringBuffer output = new StringBuffer();
Process process = Runtime.getRuntime().exec(command);
BufferedReader reader = new BufferedReader(new InputStreamReader(
process.getInputStream()));
String s;
BufferedReader stdError = new BufferedReader(new
InputStreamReader(process.getErrorStream()));
// read the output from the command
// System.out.println("Here is the standard output of the command:\n");
// while ((s = reader.readLine()) != null && !s.equals("PONG")) {
// System.out.println(s);
// }
// while(true){
s = reader.readLine();
if(s !=null && s.equals("PONG")){
System.out.println(s);
}else{
String e;
if((e = stdError.readLine()) == null) {
TimeUnit.MINUTES.sleep(1);
runPing(command);
}else{
System.out.println(e);
}
}
// System.out.println(s);
// }
// read any errors from the attempted command
// System.out.println("Here is the standard error of the command (if any):\n");
while ((s = stdError.readLine()) != null) {
System.out.print(s);
}
// System.exit(0);
}
catch (IOException e) {
System.out.println("exception happened - here's what I know: ");
e.printStackTrace();
System.exit(-1);
}
}
public static void main(String[] args) throws Exception {
// runPing("redis-cli -p 6380 ping");
runShell("bash /Users/anilkoyuncu/bugStudy/release/code/redis/startServer.sh /Users/anilkoyuncu/bugStudy/release/code/redis Defects4JALL0.txt.rdb 6380","1","6380");
}
@@ -87,6 +87,7 @@ public class Compare {
} catch (Exception e) {
log.error(e.toString() + " {}", name);
// e.printStackTrace();
}finally {
@@ -40,7 +40,7 @@ public class ImportPairs2DB {
cmd = String.format(cmd, dbDir,pj.getName() +".rdb", portInt);
log.info(cmd);
CallShell cs = new CallShell();
cs.runShell(cmd,serverWait);
cs.runShell(cmd,serverWait, portInner);
cmd = "bash "+datasetPath + "/redisSingleImport.sh" +" %s %s";
@@ -50,7 +50,7 @@ public class ImportPairs2DB {
String stopServer = "bash "+dbDir + "/" + "stopServer.sh" +" %s";
String stopServer2 = String.format(stopServer,portInt);
cs.runShell(stopServer2,serverWait);
cs.runShell(stopServer2,serverWait, portInner);
portInt++;
@@ -34,12 +34,12 @@ public class MultiThreadTreeLoaderCluster {
String cmd1 = "bash "+dbDir + "/" + "startServer.sh" +" %s %s %s";
cmd1 = String.format(cmd1, dbDir,chunkName,Integer.valueOf(portInner));
// edu.lu.uni.serval.fixminer.cluster.AkkaTreeLoader.loadRedis(cmd1,"1000");
cs.runShell(cmd1,serverWait);
cs.runShell(cmd1,serverWait, port);
String cmd2 = "bash "+dbDir + "/" + "startServer.sh" +" %s %s %s";
cmd2 = String.format(cmd2, dbDir,dumpName,Integer.valueOf(port));
cs.runShell(cmd2,serverWait);
cs.runShell(cmd2,serverWait, port);
// edu.lu.uni.serval.fixminer.cluster.AkkaTreeLoader.loadRedis(cmd2,"10000");
@@ -105,11 +105,11 @@ public class MultiThreadTreeLoaderCluster {
String stopServer = "bash "+dbDir + "/" + "stopServer.sh" +" %s";
String stopServer1 = String.format(stopServer,Integer.valueOf(portInner));
// loadRedis(stopServer2,serverWait);
cs.runShell(stopServer1,serverWait);
cs.runShell(stopServer1,serverWait, port);
String stopServer2 = String.format(stopServer,Integer.valueOf(port));
// loadRedis(stopServer2,serverWait);
cs.runShell(stopServer2,serverWait);
cs.runShell(stopServer2,serverWait, port);
@@ -37,12 +37,12 @@ public class MultiThreadTreeLoaderCluster3 {
String cmd1 = "bash "+dbDir + "/" + "startServer.sh" +" %s %s %s";
cmd1 = String.format(cmd1, dbDir,chunkName,Integer.valueOf(portInner));
// edu.lu.uni.serval.fixminer.cluster.AkkaTreeLoader.loadRedis(cmd1,"1000");
cs.runShell(cmd1,serverWait);
cs.runShell(cmd1,serverWait, port);
String cmd2 = "bash "+dbDir + "/" + "startServer.sh" +" %s %s %s";
cmd2 = String.format(cmd2, dbDir,dumpName,Integer.valueOf(port));
// edu.lu.uni.serval.fixminer.cluster.AkkaTreeLoader.loadRedis(cmd2,"10000");
cs.runShell(cmd2,serverWait);
cs.runShell(cmd2,serverWait, port);
String cmd3;
cmd3 = "bash " + importScript +" %s %s";
@@ -104,11 +104,11 @@ public class MultiThreadTreeLoaderCluster3 {
String stopServer = "bash "+dbDir + "/" + "stopServer.sh" +" %s";
String stopServer1 = String.format(stopServer,Integer.valueOf(portInner));
// loadRedis(stopServer2,serverWait);
cs.runShell(stopServer1,serverWait);
cs.runShell(stopServer1,serverWait, port);
String stopServer2 = String.format(stopServer,Integer.valueOf(port));
// loadRedis(stopServer2,serverWait);
cs.runShell(stopServer2,serverWait);
cs.runShell(stopServer2,serverWait, port);
@@ -52,7 +52,7 @@ public class StoreFile {
String cmd = "bash "+dbDir + "/" + "startServer.sh" +" %s %s %s";
cmd = String.format(cmd, dbDir,chunkName,Integer.valueOf(portInner));
// loadRedis(cmd,serverWait);
cs.runShell(cmd,serverWait);
cs.runShell(cmd,serverWait, portInner);
File folder = new File(inputPath);
File[] subFolders = folder.listFiles();
@@ -108,7 +108,7 @@ public class StoreFile {
String stopServer = "bash "+dbDir + "/" + "stopServer.sh" +" %s";
String stopServer2 = String.format(stopServer,Integer.valueOf(portInner));
// loadRedis(stopServer2,serverWait);
cs.runShell(stopServer2,serverWait);
cs.runShell(stopServer2,serverWait, portInner);
}
public static void storeCore(JedisPool innerPool,String path,String key){
@@ -29,7 +29,7 @@ public class TreeLoaderClusterL1 {
cmd = String.format(cmd, inputPath,level1DB,Integer.valueOf(port));
CallShell cs = new CallShell();
cs.runShell(cmd,serverWait);
cs.runShell(cmd,serverWait, port);
JedisPool outerPool = new JedisPool(poolConfig, "127.0.0.1",Integer.valueOf(port),20000000);
@@ -44,7 +44,7 @@ public class TreeLoaderClusterL1 {
String cmdInner = "bash "+inputPath + "/" + "startServer.sh" +" %s %s %s";
cmdInner = String.format(cmdInner, inputPath,db.getName(),Integer.valueOf(portInner));
cs.runShell(cmdInner,serverWait);
cs.runShell(cmdInner,serverWait, port);
JedisPool innerPool = new JedisPool(poolConfig, "127.0.0.1",Integer.valueOf(portInner),20000000);
Jedis inner = null;
@@ -98,13 +98,13 @@ public class TreeLoaderClusterL1 {
String stopServer = "bash "+inputPath + "/" + "stopServer.sh" +" %s";
stopServer = String.format(stopServer,Integer.valueOf(portInner));
// loadRedis(stopServer,serverWait);
cs.runShell(stopServer,serverWait);
cs.runShell(stopServer,serverWait, port);
}
String stopServer1 = "bash "+inputPath + "/" + "stopServer.sh" +" %s";
stopServer1 = String.format(stopServer1,Integer.valueOf(port));
// loadRedis(stopServer,serverWait);
cs.runShell(stopServer1,serverWait);
cs.runShell(stopServer1,serverWait, port);