change some code to rugular output format
git-svn-id: https://hyracks.googlecode.com/svn/branches/fullstack_genomix@3380 123451ca-8445-de46-9d55-352943316053
diff --git a/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/LoadGraphVertex.java b/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/LoadGraphVertex.java
index 3b2ef52..e22b20d 100644
--- a/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/LoadGraphVertex.java
+++ b/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/LoadGraphVertex.java
@@ -10,6 +10,7 @@
import edu.uci.ics.genomix.pregelix.format.BinaryLoadGraphInputFormat;
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.pregelix.api.graph.Vertex;
import edu.uci.ics.pregelix.api.job.PregelixJob;
@@ -64,7 +65,7 @@
job.setVertexInputFormatClass(BinaryLoadGraphInputFormat.class);
job.setVertexOutputFormatClass(BinaryLoadGraphOutputFormat.class);
job.setOutputKeyClass(BytesWritable.class);
- job.setOutputValueClass(ByteWritable.class);
+ job.setOutputValueClass(ValueStateWritable.class);
Client.run(args, job);
}
}
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 6b41495..19a8fcb 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
@@ -58,6 +58,7 @@
/**
* Log Algorithm for path merge graph
*/
+
@Override
public void compute(Iterator<LogAlgorithmMessageWritable> msgIterator) {
@@ -101,7 +102,6 @@
}
else{
tmpMsg = msgIterator.next();
-
if(tmpMsg.getMessage() == Message.START && tmpVal.getState() == State.MID_VERTEX){
tmpVal.setState(State.START_VERTEX);
setVertexValue(tmpVal);
@@ -113,15 +113,11 @@
}
else
voteToHalt();
-
-
}
}
}
//head node sends message to path node
else if(getSuperstep()%3 == 0){
- //tmpVal = getVertexValue();
-
if(getSuperstep() == 3){
tmpMsg = new LogAlgorithmMessageWritable();
tmpDestVertexId = KmerUtil.shiftKmerWithNextCode(GraphVertexOperation.k, tmpVertexId,
@@ -133,13 +129,12 @@
sendMsg(destVertexId, tmpMsg);
voteToHalt();
}
- else if(tmpVal.getState() != State.END_VERTEX){
+ else if(tmpVal.getState() != State.END_VERTEX && tmpVal.getState() != State.FINAL_DELETE){
tmpMsg.setMessage(Message.NON);
tmpMsg.setSourceVertexId(getVertexId().getBytes());
sendMsg(destVertexId,tmpMsg);
voteToHalt();
}
-
}
else{
if(msgIterator.hasNext()){
@@ -154,15 +149,13 @@
tmpMsg.setMessage(Message.START);
tmpMsg.setSourceVertexId(getVertexId().getBytes());
sendMsg(destVertexId, tmpMsg);
-
+ voteToHalt();
}
- else if(tmpVal.getState() != State.END_VERTEX){
+ else if(tmpVal.getState() != State.END_VERTEX && tmpVal.getState() != State.FINAL_DELETE){
tmpMsg.setMessage(Message.NON);
tmpMsg.setSourceVertexId(getVertexId().getBytes());
sendMsg(destVertexId,tmpMsg);
-
}
-
}
}
}
@@ -185,7 +178,7 @@
tmpMsg.setSourceVertexState(tmpVal.getState());
//kill Message because it has been merged by the head
- if(tmpVal.getState() == State.END_VERTEX){
+ if(tmpVal.getState() == State.END_VERTEX || tmpVal.getState() == State.FINAL_DELETE){
tmpMsg.setMessage(Message.END);
tmpVal.setState(State.FINAL_DELETE);
setVertexValue(tmpVal);
@@ -200,14 +193,11 @@
}
destVertexId.set(tmpMsg.getSourceVertexId(), 0, tmpMsg.getSourceVertexId().length);
sendMsg(destVertexId,tmpMsg);
-
}
else{
- //String source2 = Kmer.recoverKmerFrom(5, tmpVertexId, 0, tmpVertexId.length);
if(getVertexValue().getState() != State.START_VERTEX
- && getVertexValue().getState() != State.END_VERTEX){
+ && getVertexValue().getState() != State.END_VERTEX && getVertexValue().getState() != State.FINAL_DELETE)
deleteVertex(getVertexId()); //killSelf because it doesn't receive any message
- }
}
}
else if(getSuperstep()%3 == 2){
@@ -251,14 +241,11 @@
sendMsg(getVertexId(),tmpMsg);
}
}
- if(tmpVal.getState() == State.END_VERTEX)
+ if(tmpVal.getState() == State.END_VERTEX || tmpVal.getState() == State.FINAL_DELETE)
voteToHalt();
if(tmpVal.getState() == State.FINAL_VERTEX){
+ //String source = Kmer.recoverKmerFrom(tmpVal.getLengthOfMergeChain(), tmpVal.getMergeChain(), 0, tmpVal.getMergeChain().length);
voteToHalt();
- /*try {
- GraphVertexOperation.flushChainToFile(tmpVal.getMergeChain(),
- tmpVal.getLengthOfMergeChain(),tmpVertexId);
- } catch (IOException e) { e.printStackTrace(); }*/
}
}
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 d9c74d1..36dc8a1 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,5 +1,6 @@
package edu.uci.ics.genomix.pregelix;
+import java.io.IOException;
import java.util.Iterator;
import org.apache.hadoop.io.BytesWritable;
@@ -125,11 +126,11 @@
tmpVertexValue.setLengthOfMergeChain(tmpMsg.getLengthOfChain());
tmpVertexValue.setMergeChain(tmpMsg.getChainVertexId());
setVertexValue(tmpVertexValue);
- /*try {
- String source = Kmer.recoverKmerFrom(tmpMsg.getLengthOfChain(), tmpMsg.getChainVertexId(), 0, tmpMsg.getChainVertexId().length);
+ 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(); }
}
}
}
@@ -155,7 +156,6 @@
}
}
}
-
voteToHalt();
}
diff --git a/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/format/BinaryLoadGraphInputFormat.java b/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/format/BinaryLoadGraphInputFormat.java
index 09d1b6e..4cd22ac 100644
--- a/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/format/BinaryLoadGraphInputFormat.java
+++ b/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/format/BinaryLoadGraphInputFormat.java
@@ -38,19 +38,12 @@
@SuppressWarnings("rawtypes")
class BinaryLoadGraphReader extends
BinaryVertexReader<BytesWritable, ValueStateWritable, NullWritable, MessageWritable> {
- public static Logger logger = Logger.getLogger(BinaryLoadGraphReader.class.getName());
- DataLoadLogFormatter formatter = new DataLoadLogFormatter();
- FileHandler handler;
private Vertex vertex;
private BytesWritable vertexId = new BytesWritable();
private ValueStateWritable vertexValue = new ValueStateWritable();
public BinaryLoadGraphReader(RecordReader<BytesWritable,KmerCountValue> recordReader) {
super(recordReader);
- try {
- handler = new FileHandler("log/" + BinaryLoadGraphReader.class.getName() + ".log");
- } catch (SecurityException e1) { e1.printStackTrace();}
- catch (IOException e1) { e1.printStackTrace();}
}
@Override
@@ -81,14 +74,6 @@
KmerCountValue kmerCountValue = getRecordReader().getCurrentValue();
vertexValue.setValue(kmerCountValue.getAdjBitMap());
vertex.setVertexValue(vertexValue);
-
- //log
- formatter.set(vertexId, kmerCountValue, GraphVertexOperation.k);
- if(logger.getHandlers() != null)
- logger.removeHandler(handler);
- handler.setFormatter(formatter);
- logger.addHandler(handler);
- logger.info("");
}
return vertex;
diff --git a/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/format/LogAlgorithmForMergeGraphInputFormat.java b/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/format/LogAlgorithmForMergeGraphInputFormat.java
index 3fd3345..4834e56 100644
--- a/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/format/LogAlgorithmForMergeGraphInputFormat.java
+++ b/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/format/LogAlgorithmForMergeGraphInputFormat.java
@@ -73,12 +73,6 @@
vertexValue.setValue(kmerCountValue.getAdjBitMap());
vertexValue.setState(State.NON_VERTEX);
vertex.setVertexValue(vertexValue);
-
- /*String kmer = BitwiseOperation.convertBytesToBinaryStringKmer(vertexId.getBytes(),GraphVertexOperation.k);
- System.out.println("key: " + kmer);
- System.out.println("code: " + GraphVertexOperation.convertBinaryStringToGenecode(kmer));
- System.out.println("value: " + BitwiseOperation.convertByteToBinaryString(kmerCountValue.getAdjBitMap()));
- System.out.println();*/
}
return vertex;
diff --git a/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/graph/Graph.java b/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/graph/Graph.java
index fe95252..a63c307 100644
--- a/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/graph/Graph.java
+++ b/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/graph/Graph.java
@@ -53,6 +53,6 @@
public static void main(String[] args) throws Exception
{
Graph g = new Graph();
- g.start("SinglePath");
+ g.start("Path");
}
}
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 bd522a9..dac588d 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
@@ -40,7 +40,7 @@
private static final String PATH_TO_ONLY = "src/test/resources/only.txt";
private static final String FILE_EXTENSION_OF_RESULTS = "result";
- private static final String DATA_PATH = "data/result/TreePath";//sequenceShortFileMergeTest
+ private static final String DATA_PATH = "data/test_55_small/part-0";//sequenceShortFileMergeTest
private static final String HDFS_PATH = "/webmap/";
private static final String HYRACKS_APP_NAME = "pregelix";