delete log
git-svn-id: https://hyracks.googlecode.com/svn/branches/fullstack_genomix@3376 123451ca-8445-de46-9d55-352943316053
diff --git a/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/LogAlgorithmForMergeGraphVertex.java b/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/LogAlgorithmForMergeGraphVertex.java
index d84020a..6b41495 100644
--- a/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/LogAlgorithmForMergeGraphVertex.java
+++ b/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/LogAlgorithmForMergeGraphVertex.java
@@ -1,8 +1,6 @@
package edu.uci.ics.genomix.pregelix;
import java.util.Iterator;
-import java.util.logging.FileHandler;
-import java.util.logging.Logger;
import org.apache.hadoop.io.BytesWritable;
import org.apache.hadoop.io.NullWritable;
@@ -14,7 +12,6 @@
import edu.uci.ics.genomix.pregelix.format.LogAlgorithmForMergeGraphOutputFormat;
import edu.uci.ics.genomix.pregelix.io.LogAlgorithmMessageWritable;
import edu.uci.ics.genomix.pregelix.io.ValueStateWritable;
-import edu.uci.ics.genomix.pregelix.log.LogAlgorithmLogFormatter;
import edu.uci.ics.genomix.pregelix.type.Message;
import edu.uci.ics.genomix.pregelix.type.State;
import edu.uci.ics.genomix.type.Kmer;
@@ -49,10 +46,7 @@
* The details about message are in edu.uci.ics.pregelix.example.io.MessageWritable.
*/
public class LogAlgorithmForMergeGraphVertex extends Vertex<BytesWritable, ValueStateWritable, NullWritable, LogAlgorithmMessageWritable>{
- public static Logger logger = Logger.getLogger(LogAlgorithmForMergeGraphVertex.class.getName());
- LogAlgorithmLogFormatter formatter = new LogAlgorithmLogFormatter();
- public static FileHandler handler;
-
+
private byte[] tmpVertexId;
private byte[] tmpDestVertexId;
private BytesWritable destVertexId = new BytesWritable();
@@ -64,14 +58,6 @@
/**
* Log Algorithm for path merge graph
*/
- public LogAlgorithmForMergeGraphVertex(){
- if(handler == null){
- try {
- handler = new FileHandler("log/" + LogAlgorithmForMergeGraphVertex.class.getName() + ".log");
- } catch (Exception e) { e.printStackTrace();}
- }
- }
-
@Override
public void compute(Iterator<LogAlgorithmMessageWritable> msgIterator) {
@@ -86,13 +72,6 @@
tmpDestVertexId = KmerUtil.shiftKmerWithNextCode(GraphVertexOperation.k, tmpVertexId, x);
destVertexId.set(tmpDestVertexId, 0, tmpDestVertexId.length);
sendMsg(destVertexId,tmpMsg);
- //log
- formatter.set(getSuperstep(), tmpVertexId, tmpDestVertexId, tmpMsg, tmpVal.getState(), GraphVertexOperation.k);
- if(logger.getHandlers() != null)
- logger.removeHandler(handler);
- handler.setFormatter(formatter);
- logger.addHandler(handler);
- logger.info("##### It is the head! #####");
}
}
voteToHalt();
@@ -105,14 +84,6 @@
tmpDestVertexId = KmerUtil.shiftKmerWithPreCode(GraphVertexOperation.k, tmpVertexId, x);
destVertexId.set(tmpDestVertexId, 0, tmpDestVertexId.length);
sendMsg(destVertexId,tmpMsg);
-
- //log
- formatter.set(getSuperstep(), tmpVertexId, tmpDestVertexId, tmpMsg, tmpVal.getState(), GraphVertexOperation.k);
- if(logger.getHandlers() != null)
- logger.removeHandler(handler);
- handler.setFormatter(formatter);
- logger.addHandler(handler);
- logger.info("##### It is the rear! #####");
}
}
voteToHalt();
@@ -120,14 +91,6 @@
if(GraphVertexOperation.isPathVertex(tmpVal.getValue())){
tmpVal.setState(State.MID_VERTEX);
setVertexValue(tmpVal);
-
- //log
- formatter.set(getSuperstep(), tmpVertexId, tmpDestVertexId, tmpMsg, tmpVal.getState(), GraphVertexOperation.k);
- if(logger.getHandlers() != null)
- logger.removeHandler(handler);
- handler.setFormatter(formatter);
- logger.addHandler(handler);
- logger.info("##### It is the path! #####");
}
}
else if(getSuperstep() == 2){
@@ -142,25 +105,11 @@
if(tmpMsg.getMessage() == Message.START && tmpVal.getState() == State.MID_VERTEX){
tmpVal.setState(State.START_VERTEX);
setVertexValue(tmpVal);
- //log
- formatter.set(getSuperstep(), tmpVertexId, tmpDestVertexId, tmpMsg, tmpVal.getState(), GraphVertexOperation.k);
- if(logger.getHandlers() != null)
- logger.removeHandler(handler);
- handler.setFormatter(formatter);
- logger.addHandler(handler);
- logger.info("##### Set state! #####");
}
else if(tmpMsg.getMessage() == Message.END && tmpVal.getState() == State.MID_VERTEX){
tmpVal.setState(State.END_VERTEX);
setVertexValue(tmpVal);
voteToHalt();
- //log
- formatter.set(getSuperstep(), tmpVertexId, tmpDestVertexId, tmpMsg, tmpVal.getState(), GraphVertexOperation.k);
- if(logger.getHandlers() != null)
- logger.removeHandler(handler);
- handler.setFormatter(formatter);
- logger.addHandler(handler);
- logger.info("##### Set state! #####");
}
else
voteToHalt();
@@ -191,14 +140,6 @@
voteToHalt();
}
- //log
- formatter.set(getSuperstep(), tmpVertexId, tmpDestVertexId, tmpMsg, tmpVal.getState(), GraphVertexOperation.k);
- if(logger.getHandlers() != null)
- logger.removeHandler(handler);
- handler.setFormatter(formatter);
- logger.addHandler(handler);
- logger.info("##### head node sends message to path node! #####");
-
}
else{
if(msgIterator.hasNext()){
@@ -213,27 +154,13 @@
tmpMsg.setMessage(Message.START);
tmpMsg.setSourceVertexId(getVertexId().getBytes());
sendMsg(destVertexId, tmpMsg);
- //log
- formatter.set(getSuperstep(), tmpVertexId, tmpDestVertexId, tmpMsg, tmpVal.getState(), GraphVertexOperation.k);
- if(logger.getHandlers() != null)
- logger.removeHandler(handler);
- handler.setFormatter(formatter);
- logger.addHandler(handler);
- logger.info("##### head node sends message to path node! #####");
- voteToHalt();
+
}
else if(tmpVal.getState() != State.END_VERTEX){
tmpMsg.setMessage(Message.NON);
tmpMsg.setSourceVertexId(getVertexId().getBytes());
sendMsg(destVertexId,tmpMsg);
- //log
- formatter.set(getSuperstep(), tmpVertexId, tmpDestVertexId, tmpMsg, tmpVal.getState(), GraphVertexOperation.k);
- if(logger.getHandlers() != null)
- logger.removeHandler(handler);
- handler.setFormatter(formatter);
- logger.addHandler(handler);
- logger.info("##### head node sends message to path node! #####");
}
}
@@ -260,8 +187,8 @@
//kill Message because it has been merged by the head
if(tmpVal.getState() == State.END_VERTEX){
tmpMsg.setMessage(Message.END);
- //tmpVal.setState(State.FINAL_DELETE);
- //setVertexValue(tmpVal);
+ tmpVal.setState(State.FINAL_DELETE);
+ setVertexValue(tmpVal);
//deleteVertex(getVertexId());
}
else
@@ -274,45 +201,18 @@
destVertexId.set(tmpMsg.getSourceVertexId(), 0, tmpMsg.getSourceVertexId().length);
sendMsg(destVertexId,tmpMsg);
- //log
- formatter.set(getSuperstep(), tmpVertexId, tmpMsg.getSourceVertexId(), tmpMsg, tmpVal.getState(), GraphVertexOperation.k);
- if(logger.getHandlers() != null)
- logger.removeHandler(handler);
- handler.setFormatter(formatter);
- logger.addHandler(handler);
- logger.info("##### path node sends message back to head node! #####");
-
}
else{
//String source2 = Kmer.recoverKmerFrom(5, tmpVertexId, 0, tmpVertexId.length);
if(getVertexValue().getState() != State.START_VERTEX
&& getVertexValue().getState() != State.END_VERTEX){
-
- //log
- formatter.set(getSuperstep(), tmpVertexId, null, tmpMsg, tmpVal.getState(), GraphVertexOperation.k);
- formatter.setOperation(1);
- if(logger.getHandlers() != null)
- logger.removeHandler(handler);
- handler.setFormatter(formatter);
- logger.addHandler(handler);
- logger.info("##### Delete! Not receive message! #####");
deleteVertex(getVertexId()); //killSelf because it doesn't receive any message
}
}
}
else if(getSuperstep()%3 == 2){
- if(tmpVal.getState() == State.TODELETE){
- //log
- formatter.set(getSuperstep(), tmpVertexId, tmpDestVertexId, tmpMsg, tmpVal.getState(), GraphVertexOperation.k);
- if(logger.getHandlers() != null)
- logger.removeHandler(handler);
- handler.setFormatter(formatter);
- logger.addHandler(handler);
- logger.info("##### Delete! Already merge by head! #####");
- formatter.setOperation(0);
-
+ if(tmpVal.getState() == State.TODELETE)
deleteVertex(getVertexId()); //killSelf
- }
else{
if(msgIterator.hasNext()){
tmpMsg = msgIterator.next();
@@ -341,14 +241,6 @@
- GraphVertexOperation.k + 1;
tmpVal.setLengthOfMergeChain(lengthOfMergeChainVertex);
tmpVal.setMergeChain(mergeChainVertexId);
-
- //log
- formatter.setMergeChain(getSuperstep(), tmpVertexId, lengthOfMergeChainVertex, mergeChainVertexId, GraphVertexOperation.k);
- if(logger.getHandlers() != null)
- logger.removeHandler(handler);
- handler.setFormatter(formatter);
- logger.addHandler(handler);
- logger.info("##### Merge Chain INFO #####");
tmpVertexValue = GraphVertexOperation.updateRightNeighber(getVertexValue().getValue(),tmpMsg.getNeighberInfo());
tmpVal.setValue(tmpVertexValue);
@@ -357,28 +249,10 @@
tmpMsg = new LogAlgorithmMessageWritable(); //reset
tmpMsg.setNeighberInfo(tmpVertexValue);
sendMsg(getVertexId(),tmpMsg);
-
- //log
- formatter.set(getSuperstep(), tmpVertexId, tmpDestVertexId, tmpMsg, tmpVal.getState(), GraphVertexOperation.k);
- if(logger.getHandlers() != null)
- logger.removeHandler(handler);
- handler.setFormatter(formatter);
- logger.addHandler(handler);
- logger.info("##### head node sends message to path node! #####");
}
}
- if(tmpVal.getState() == State.END_VERTEX){
+ if(tmpVal.getState() == State.END_VERTEX)
voteToHalt();
-
- //log
- formatter.setVotoToHalt(getSuperstep(), tmpVertexId, GraphVertexOperation.k);
- if(logger.getHandlers() != null)
- logger.removeHandler(handler);
- handler.setFormatter(formatter);
- logger.addHandler(handler);
- logger.info("##### Because it's rear! #####");
- formatter.setOperation(0);
- }
if(tmpVal.getState() == State.FINAL_VERTEX){
voteToHalt();
/*try {
diff --git a/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/MergeGraphVertex.java b/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/MergeGraphVertex.java
index a5c40ad..d9c74d1 100644
--- a/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/MergeGraphVertex.java
+++ b/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/MergeGraphVertex.java
@@ -1,9 +1,6 @@
package edu.uci.ics.genomix.pregelix;
-import java.io.IOException;
import java.util.Iterator;
-import java.util.logging.FileHandler;
-import java.util.logging.Logger;
import org.apache.hadoop.io.BytesWritable;
import org.apache.hadoop.io.NullWritable;
@@ -17,7 +14,6 @@
import edu.uci.ics.genomix.pregelix.format.BinaryLoadGraphOutputFormat;
import edu.uci.ics.genomix.pregelix.io.MessageWritable;
import edu.uci.ics.genomix.pregelix.io.ValueStateWritable;
-import edu.uci.ics.genomix.pregelix.log.NaiveAlgorithmLogFormatter;
import edu.uci.ics.genomix.pregelix.type.State;
/*
@@ -50,10 +46,6 @@
*/
public class MergeGraphVertex extends Vertex<BytesWritable, ValueStateWritable, NullWritable, MessageWritable>{
- public static Logger logger = Logger.getLogger(MergeGraphVertex.class.getName());
- NaiveAlgorithmLogFormatter formatter = new NaiveAlgorithmLogFormatter();
- public static FileHandler handler;
-
private byte[] tmpVertexId;
private byte[] tmpDestVertexId;
private BytesWritable destVertexId = new BytesWritable();
@@ -65,13 +57,6 @@
* @throws Exception
* @throws
*/
- public MergeGraphVertex(){
- if(handler == null){
- try {
- handler = new FileHandler("log/" + MergeGraphVertex.class.getName() + ".log");
- } catch (Exception e) { e.printStackTrace();}
- }
- }
@Override
public void compute(Iterator<MessageWritable> msgIterator) {
@@ -88,14 +73,6 @@
tmpDestVertexId = KmerUtil.shiftKmerWithNextCode(GraphVertexOperation.k, tmpVertexId, x);
destVertexId.set(tmpDestVertexId, 0, tmpDestVertexId.length);
sendMsg(destVertexId,tmpMsg);
-
- //log
- formatter.set(getSuperstep(), tmpVertexId, tmpDestVertexId, tmpMsg, GraphVertexOperation.k);
- if(logger.getHandlers() != null)
- logger.removeHandler(handler);
- handler.setFormatter(formatter);
- logger.addHandler(handler);
- logger.info("##### It is the head! #####");
}
}
}
@@ -128,14 +105,6 @@
}
destVertexId.set(tmpDestVertexId, 0, tmpDestVertexId.length);
sendMsg(destVertexId,tmpMsg);
-
- //log
- formatter.set(getSuperstep(), tmpVertexId, tmpDestVertexId, tmpMsg, GraphVertexOperation.k);
- if(logger.getHandlers() != null)
- logger.removeHandler(handler);
- handler.setFormatter(formatter);
- logger.addHandler(handler);
- logger.info("##### It is the path! #####");
}
else if(GraphVertexOperation.isRearVertex(getVertexValue().getValue())){
if(getSuperstep() == 2)
@@ -146,14 +115,6 @@
tmpMsg.setRear(true);
destVertexId.set(tmpDestVertexId, 0, tmpDestVertexId.length);
sendMsg(destVertexId,tmpMsg);
-
- //log
- formatter.set(getSuperstep(), tmpVertexId, tmpDestVertexId, tmpMsg, GraphVertexOperation.k);
- if(logger.getHandlers() != null)
- logger.removeHandler(handler);
- handler.setFormatter(formatter);
- logger.addHandler(handler);
- logger.info("##### It is the rear! #####!");
}
}
}
@@ -164,11 +125,11 @@
tmpVertexValue.setLengthOfMergeChain(tmpMsg.getLengthOfChain());
tmpVertexValue.setMergeChain(tmpMsg.getChainVertexId());
setVertexValue(tmpVertexValue);
- try {
+ /*try {
String source = Kmer.recoverKmerFrom(tmpMsg.getLengthOfChain(), tmpMsg.getChainVertexId(), 0, tmpMsg.getChainVertexId().length);
GraphVertexOperation.flushChainToFile(tmpMsg.getChainVertexId(),
tmpMsg.getLengthOfChain(),tmpVertexId);
- } catch (IOException e) { e.printStackTrace(); }
+ } catch (IOException e) { e.printStackTrace(); }*/
}
}
}
@@ -186,27 +147,11 @@
tmpMsg.setSourceVertexId(tmpVertexId);
destVertexId.set(tmpDestVertexId, 0, tmpDestVertexId.length);
sendMsg(destVertexId,tmpMsg);
-
- //log
- formatter.set(getSuperstep(), tmpVertexId, tmpDestVertexId, tmpMsg, GraphVertexOperation.k);
- if(logger.getHandlers() != null)
- logger.removeHandler(handler);
- handler.setFormatter(formatter);
- logger.addHandler(handler);
- logger.info("");
}
else{
tmpDestVertexId = tmpMsg.getHead();
destVertexId.set(tmpDestVertexId, 0, tmpDestVertexId.length);
sendMsg(destVertexId,tmpMsg);
-
- //log
- formatter.set(getSuperstep(), tmpVertexId, tmpDestVertexId, tmpMsg, GraphVertexOperation.k);
- if(logger.getHandlers() != null)
- logger.removeHandler(handler);
- handler.setFormatter(formatter);
- logger.addHandler(handler);
- logger.info("##### Rear is sent back! #####");
}
}
}
diff --git a/genomix/genomix-pregelix/src/test/java/edu/uci/ics/genomix/pregelix/JobRun/RunJobTestCase.java b/genomix/genomix-pregelix/src/test/java/edu/uci/ics/genomix/pregelix/JobRun/RunJobTestCase.java
index 62deaff..a5ddce3 100644
--- a/genomix/genomix-pregelix/src/test/java/edu/uci/ics/genomix/pregelix/JobRun/RunJobTestCase.java
+++ b/genomix/genomix-pregelix/src/test/java/edu/uci/ics/genomix/pregelix/JobRun/RunJobTestCase.java
@@ -158,16 +158,6 @@
}
private void compareResults() throws Exception {
- /*FileSystem.getLocal(new Configuration()).mkdirs(new Path("actual"));
- //File filePathTo = new File(CONVERT_RESULT);
- //BufferedWriter bw = new BufferedWriter(new FileWriter(filePathTo));
- for (int i = 0; i < 1 * 2; i++) {
- String partname = "/part-" + i;
- FileUtil.copy(FileSystem.get(job.getConfiguration()), new Path(HDFS_OUTPUTPAH
- + partname), FileSystem.getLocal(new Configuration()),
- new Path("actual/test" + partname), false, job.getConfiguration());
- }
- */
TestUtils.compareWithResult(new File(resultFileName), new File(expectedFileName));
}
diff --git a/genomix/genomix-pregelix/src/test/java/edu/uci/ics/genomix/pregelix/JobRun/RunJobTestSuite.java b/genomix/genomix-pregelix/src/test/java/edu/uci/ics/genomix/pregelix/JobRun/RunJobTestSuite.java
index e7589e3..bd522a9 100644
--- a/genomix/genomix-pregelix/src/test/java/edu/uci/ics/genomix/pregelix/JobRun/RunJobTestSuite.java
+++ b/genomix/genomix-pregelix/src/test/java/edu/uci/ics/genomix/pregelix/JobRun/RunJobTestSuite.java
@@ -7,7 +7,6 @@
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
-import java.io.OutputStreamWriter;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Logger;