changes
This commit is contained in:
@@ -22,8 +22,8 @@ public class Launcher {
|
||||
|
||||
Properties appProps = new Properties();
|
||||
|
||||
String appConfigPath = "/Users/anil.koyuncu/projects/fixminer/fixminer_source/src/main/resource/app.properties";
|
||||
// String appConfigPath = args[0];
|
||||
// String appConfigPath = "/Users/anil.koyuncu/projects/fixminer/fixminer_source/src/main/resource/app.properties";
|
||||
String appConfigPath = args[0];
|
||||
appProps.load(new FileInputStream(appConfigPath));
|
||||
|
||||
// String portInner = appProps.getProperty("portInner","6380");
|
||||
@@ -33,17 +33,18 @@ public class Launcher {
|
||||
String actionType = appProps.getProperty("actionType","ALL");
|
||||
String eDiffTimeout = appProps.getProperty("eDiffTimeout","900");
|
||||
String parallelism = appProps.getProperty("parallelism","FORKJOIN");
|
||||
String hostname = appProps.getProperty("hostname","localhost");
|
||||
|
||||
String input = appProps.getProperty("inputPath","FORKJOIN");
|
||||
String redisPath = appProps.getProperty("redisPath","FORKJOIN");
|
||||
String srcMLPath = appProps.getProperty("srcMLPath","FORKJOIN");
|
||||
|
||||
// String parameter = args[2];
|
||||
// String parameter = null;
|
||||
String parameter = args[2];
|
||||
// String parameter = "L1";
|
||||
// String parameter = "if";
|
||||
String parameter = "add";
|
||||
// String jobType = args[1];
|
||||
String jobType = "RICHEDITSCRIPT";
|
||||
// String parameter = "add";
|
||||
String jobType = args[1];
|
||||
// String jobType = "RICHEDITSCRIPT";
|
||||
// String jobType = "LOAD";
|
||||
// String jobType = "COMPARE";
|
||||
|
||||
@@ -56,12 +57,12 @@ public class Launcher {
|
||||
//
|
||||
// log.info(parameters);
|
||||
|
||||
mainLaunch( numOfWorkers, jobType, portDumps, pjName,actionType,eDiffTimeout,parallelism,input,redisPath,parameter, srcMLPath);
|
||||
mainLaunch( numOfWorkers, jobType, portDumps, pjName,actionType,eDiffTimeout,parallelism,input,redisPath,parameter, srcMLPath,hostname);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static void mainLaunch(String numOfWorkers, String jobType, String portDumps, String pjName, String actionType, String eDiffTimeout, String parallelism,String input, String redisPath,String parameter,String srcMLPath){
|
||||
public static void mainLaunch(String numOfWorkers, String jobType, String portDumps, String pjName, String actionType, String eDiffTimeout, String parallelism,String input, String redisPath,String parameter,String srcMLPath,String hostname){
|
||||
|
||||
|
||||
String dbDir;
|
||||
@@ -106,7 +107,7 @@ public class Launcher {
|
||||
}
|
||||
|
||||
|
||||
CompareTrees.main(redisPath, portDumps,actionType+dumpsName, job);
|
||||
CompareTrees.main(redisPath, portDumps,actionType+dumpsName, job,numOfWorkers,hostname);
|
||||
break;
|
||||
case "PATTERN":
|
||||
ClusterToPattern.main(portDumps,redisPath, actionType+dumpsName, parameter);
|
||||
|
||||
@@ -14,6 +14,7 @@ import redis.clients.jedis.JedisPool;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
@@ -29,7 +30,7 @@ public class CompareTrees {
|
||||
private static Logger log = LoggerFactory.getLogger(CompareTrees.class);
|
||||
|
||||
|
||||
public static void main(String redisPath, String portDumps, String dumpsName, String job) throws Exception {
|
||||
public static void main(String redisPath, String portDumps, String dumpsName, String job,String numOfWorkers,String host) throws Exception {
|
||||
|
||||
// shape /Users/anil.koyuncu/projects/test/fixminer-core/python/data/redis ALLdumps-gumInput.rdb clusterl0-gumInputALL.rdb /Users/anil.koyuncu/projects/test/fixminer-core/python/data/richEditScript
|
||||
|
||||
@@ -47,7 +48,7 @@ public class CompareTrees {
|
||||
// cs.runShell(cmdInner, portInner);
|
||||
|
||||
// String numOfWorkers = "100000000";//args[4];
|
||||
String host = "localhost";//args[5];
|
||||
// String host = "localhost";//args[5];
|
||||
// -Djava.util.concurrent.ForkJoinPool.common.parallelism=256
|
||||
|
||||
// final JedisPool innerPool = new JedisPool(PoolBuilder.getPoolConfig(), host,Integer.valueOf(portInner),20000000);
|
||||
@@ -62,26 +63,36 @@ public class CompareTrees {
|
||||
ArrayList<String> samePairs = new ArrayList<>();
|
||||
ArrayList<String> errorPairs = new ArrayList<>();
|
||||
|
||||
Integer numberOfWorkers = Integer.valueOf(numOfWorkers);
|
||||
final ExecutorService executor = Executors.newWorkStealingPool(numberOfWorkers);
|
||||
ArrayList<Future<?>> results = new ArrayList<Future<?>>();
|
||||
for (int i = 1; i <numberOfWorkers ; i++) {
|
||||
|
||||
final ExecutorService executor = Executors.newWorkStealingPool();
|
||||
// schedule the work
|
||||
|
||||
final Future<?> future = executor.submit( new RunnableCompare( job,errorPairs,filenames,outerPool));
|
||||
|
||||
try {
|
||||
// wait for task to complete
|
||||
future.get();
|
||||
|
||||
} catch (InterruptedException e) {
|
||||
|
||||
e.printStackTrace();
|
||||
} catch (ExecutionException e) {
|
||||
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
executor.shutdownNow();
|
||||
// schedule the work
|
||||
log.info("Starting job {}",i);
|
||||
final Future<?> future = executor.submit(new RunnableCompare(job, errorPairs, filenames, outerPool, i));
|
||||
results.add(future);
|
||||
}
|
||||
|
||||
for (Future<?> future:results){
|
||||
try {
|
||||
// wait for task to complete
|
||||
future.get();
|
||||
|
||||
} catch (InterruptedException e) {
|
||||
|
||||
e.printStackTrace();
|
||||
} catch (ExecutionException e) {
|
||||
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
executor.shutdownNow();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
log.info("End process");
|
||||
@@ -93,12 +104,14 @@ public class CompareTrees {
|
||||
ArrayList<String> errorPairs;
|
||||
HashMap<String, String> filenames;
|
||||
JedisPool outerPool;
|
||||
Integer threadID;
|
||||
|
||||
public RunnableCompare(String treeType,ArrayList<String> errorPairs, HashMap<String, String> filenames,JedisPool outerPool) {
|
||||
public RunnableCompare(String treeType,ArrayList<String> errorPairs, HashMap<String, String> filenames,JedisPool outerPool,Integer threadID) {
|
||||
this.job = treeType;
|
||||
this.errorPairs = errorPairs;
|
||||
this.filenames = filenames;
|
||||
this.outerPool = outerPool;
|
||||
this.threadID = threadID;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -113,6 +126,7 @@ public class CompareTrees {
|
||||
stop = newCoreCompare(job, errorPairs, filenames, outerPool);
|
||||
// }
|
||||
}
|
||||
log.info("Completed worker {}",threadID);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -40,9 +40,9 @@ public class EDiffHunkParser extends EDiffParser {
|
||||
try {
|
||||
|
||||
String astNodeType = actionSet.getAstNodeType();
|
||||
if (astNodeType.equals(rootType)){
|
||||
|
||||
}
|
||||
// if (astNodeType.equals(rootType)){
|
||||
//
|
||||
// }
|
||||
actionSet.toString();
|
||||
int size = actionSet.getActionSize();
|
||||
|
||||
|
||||
@@ -34,16 +34,29 @@ public class EnhancedASTDiff {
|
||||
|
||||
CallShell cs = new CallShell();
|
||||
String cmd = "bash "+dbDir + "/" + "startServer.sh" +" %s %s %s";
|
||||
if (rootType == null){
|
||||
cmd = String.format(cmd, dbDir,chunkName,Integer.valueOf(portInner));
|
||||
}else{
|
||||
cmd = String.format(cmd, dbDir,rootType+chunkName,Integer.valueOf(portInner));
|
||||
}
|
||||
// if (rootType == null){
|
||||
cmd = String.format(cmd, dbDir,chunkName,Integer.valueOf(portInner));
|
||||
// }else{
|
||||
// cmd = String.format(cmd, dbDir,rootType+chunkName,Integer.valueOf(portInner));
|
||||
// }
|
||||
|
||||
cs.runShell(cmd, portInner);
|
||||
|
||||
JedisPool innerPool = new JedisPool(PoolBuilder.getPoolConfig(), "127.0.0.1",Integer.valueOf(portInner),20000000);
|
||||
|
||||
if (rootType == "add"){
|
||||
try (Jedis inner = innerPool.getResource()) {
|
||||
inner.select(2);
|
||||
inner.flushDB();
|
||||
inner.select(1);
|
||||
inner.flushDB();
|
||||
inner.select(0);
|
||||
inner.del("compare");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
File folder = new File(inputPath);
|
||||
File[] listOfFiles = folder.listFiles();
|
||||
Stream<File> stream = Arrays.stream(listOfFiles);
|
||||
@@ -79,8 +92,10 @@ public class EnhancedASTDiff {
|
||||
parsingActor = system.actorOf(EDiffActor.props(Integer.valueOf(numOfWorkers), project), "mine-fix-pattern-actor");
|
||||
parsingActor.tell(msg, ActorRef.noSender());
|
||||
} catch (Exception e) {
|
||||
system.shutdown();
|
||||
system.terminate();
|
||||
e.printStackTrace();
|
||||
}finally {
|
||||
system.terminate();
|
||||
}
|
||||
break;
|
||||
case "FORKJOIN":
|
||||
|
||||
Reference in New Issue
Block a user