multi
This commit is contained in:
+22
-22
@@ -88,12 +88,16 @@ public class MultiThreadTreeLoader {
|
|||||||
String pairsCompletedPath;
|
String pairsCompletedPath;
|
||||||
String serverWait;
|
String serverWait;
|
||||||
String option;
|
String option;
|
||||||
|
String dbDir;
|
||||||
|
String chunkName;
|
||||||
if (args.length > 0) {
|
if (args.length > 0) {
|
||||||
inputPath = args[0];
|
inputPath = args[0];
|
||||||
port = args[1];
|
port = args[1];
|
||||||
portInner = args[2];
|
portInner = args[2];
|
||||||
serverWait = args[3];
|
serverWait = args[3];
|
||||||
option = args[4];
|
option = args[4];
|
||||||
|
chunkName = args[5];
|
||||||
|
dbDir = args[6];
|
||||||
// pairsCSVPath = args[3];
|
// pairsCSVPath = args[3];
|
||||||
// importScript = args[4];
|
// importScript = args[4];
|
||||||
// pairsCompletedPath = args[3];
|
// pairsCompletedPath = args[3];
|
||||||
@@ -107,51 +111,47 @@ public class MultiThreadTreeLoader {
|
|||||||
pairsCSVPath = "/Users/anilkoyuncu/bugStudy/dataset/pairs/test";
|
pairsCSVPath = "/Users/anilkoyuncu/bugStudy/dataset/pairs/test";
|
||||||
importScript = "/Users/anilkoyuncu/bugStudy/dataset/pairs/test2.sh";
|
importScript = "/Users/anilkoyuncu/bugStudy/dataset/pairs/test2.sh";
|
||||||
pairsCompletedPath = "/Users/anilkoyuncu/bugStudy/dataset/pairs_completed";
|
pairsCompletedPath = "/Users/anilkoyuncu/bugStudy/dataset/pairs_completed";
|
||||||
|
chunkName ="chunk0.rdb";
|
||||||
|
dbDir = "/Users/anilkoyuncu/bugStudy/dataset/redis";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (option.equals("CALC")) {
|
if (option.equals("CALC")) {
|
||||||
calculatePairs(inputPath, port);
|
calculatePairs(inputPath, port);
|
||||||
log.info("Calculate pairs done");
|
log.info("Calculate pairs done");
|
||||||
}else {
|
}else {
|
||||||
comparePairs(port, inputPath, portInner, serverWait);
|
comparePairs(port, inputPath, portInner, serverWait,chunkName,dbDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void comparePairs(String port,String inputPath, String innerPort,String serverWait){
|
public static void comparePairs(String port,String inputPath, String innerPort,String serverWait,String chunkName, String dbDir){
|
||||||
// String cmd;
|
// String cmd;
|
||||||
// cmd = "bash " + importScript +" %s";
|
// cmd = "bash " + importScript +" %s";
|
||||||
|
|
||||||
JedisPool jedisPool = new JedisPool(poolConfig, "127.0.0.1",Integer.valueOf(port),20000000);
|
|
||||||
|
|
||||||
List<String> dir;
|
List<String> dir;
|
||||||
List<String> path;
|
List<String> path;
|
||||||
File[] files;
|
|
||||||
String orgDbname;
|
String orgDbname;
|
||||||
File dbDir;
|
|
||||||
try (Jedis jedis = jedisPool.getResource()) {
|
|
||||||
|
|
||||||
|
|
||||||
dir = jedis.configGet("dir");
|
File files = new File(dbDir);
|
||||||
path = jedis.configGet("dbfilename");
|
File[] listFiles = files.listFiles();
|
||||||
dbDir = new File(dir.get(1));
|
|
||||||
orgDbname = path.get(1);
|
|
||||||
files = dbDir.listFiles();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Stream<File> stream = Arrays.stream(files);
|
Stream<File> stream = Arrays.stream(listFiles);
|
||||||
List<File> folders = stream
|
List<File> folders = stream
|
||||||
.filter(x -> !x.getName().startsWith(orgDbname)).filter(x -> x.getName().endsWith(".rdb"))
|
.filter(x -> x.getName().equals(chunkName))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
for (File folder : folders) {
|
for (File folder : folders) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
String cmd = "bash "+dir.get(1) + "/" + "startServer.sh" +" %s %s %s";
|
String cmd = "bash "+dbDir + "/" + "startServer.sh" +" %s %s %s";
|
||||||
cmd = String.format(cmd, dbDir,folder.getName(),Integer.valueOf(innerPort));
|
cmd = String.format(cmd, dbDir,folder.getName(),Integer.valueOf(innerPort));
|
||||||
loadRedis(cmd,serverWait);
|
loadRedis(cmd,serverWait);
|
||||||
|
|
||||||
@@ -172,10 +172,10 @@ public class MultiThreadTreeLoader {
|
|||||||
log.info("Scanning " + String.valueOf(size));
|
log.info("Scanning " + String.valueOf(size));
|
||||||
}
|
}
|
||||||
scan.getResult().parallelStream()
|
scan.getResult().parallelStream()
|
||||||
.forEach(m -> coreCompare(m, inputPath, port,innerPort));
|
.forEach(m -> coreCompare(m, inputPath, innerPort));
|
||||||
|
|
||||||
|
|
||||||
String stopServer = "bash "+dir.get(1) + "/" + "stopServer.sh" +" %s";
|
String stopServer = "bash "+dbDir + "/" + "stopServer.sh" +" %s";
|
||||||
stopServer = String.format(stopServer,Integer.valueOf(innerPort));
|
stopServer = String.format(stopServer,Integer.valueOf(innerPort));
|
||||||
loadRedis(stopServer,serverWait);
|
loadRedis(stopServer,serverWait);
|
||||||
|
|
||||||
@@ -186,7 +186,7 @@ public class MultiThreadTreeLoader {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void coreCompare(String name , String inputPath, String port,String innerPort) {
|
private static void coreCompare(String name , String inputPath, String innerPort) {
|
||||||
JedisPool pool = new JedisPool(new JedisPoolConfig(), "127.0.0.1", Integer.valueOf(innerPort), 20000000);
|
JedisPool pool = new JedisPool(new JedisPoolConfig(), "127.0.0.1", Integer.valueOf(innerPort), 20000000);
|
||||||
Map<String, String> resultMap;
|
Map<String, String> resultMap;
|
||||||
try (Jedis jedis = pool.getResource()) {
|
try (Jedis jedis = pool.getResource()) {
|
||||||
@@ -243,10 +243,10 @@ public class MultiThreadTreeLoader {
|
|||||||
if (((Double) chawatheSimilarity1).equals(1.0) || ((Double) diceSimilarity1).equals(1.0)
|
if (((Double) chawatheSimilarity1).equals(1.0) || ((Double) diceSimilarity1).equals(1.0)
|
||||||
|| ((Double) jaccardSimilarity1).equals(1.0) || actions.size() == 0) {
|
|| ((Double) jaccardSimilarity1).equals(1.0) || actions.size() == 0) {
|
||||||
String matchKey = "match_" + (String.valueOf(i)) + "_" + String.valueOf(j);
|
String matchKey = "match_" + (String.valueOf(i)) + "_" + String.valueOf(j);
|
||||||
JedisPool jedisPool = new JedisPool(new JedisPoolConfig(), "127.0.0.1", Integer.valueOf(port), 20000000);
|
|
||||||
try (Jedis outer = jedisPool.getResource()) {
|
try (Jedis jedis = pool.getResource()) {
|
||||||
outer.select(1);
|
jedis.select(1);
|
||||||
outer.set(matchKey, result);
|
jedis.set(matchKey, result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user