Skip to content

Instantly share code, notes, and snippets.

@danbri
Created September 7, 2011 12:30
Show Gist options
  • Save danbri/1200439 to your computer and use it in GitHub Desktop.
Save danbri/1200439 to your computer and use it in GitHub Desktop.
Index: core/src/main/java/org/apache/mahout/clustering/spectral/common/VectorMatrixMultiplicationJob.java
===================================================================
--- core/src/main/java/org/apache/mahout/clustering/spectral/common/VectorMatrixMultiplicationJob.java (revision 1163723)
+++ core/src/main/java/org/apache/mahout/clustering/spectral/common/VectorMatrixMultiplicationJob.java (working copy)
@@ -78,6 +78,9 @@
FileInputFormat.addInputPath(job, markovPath);
FileOutputFormat.setOutputPath(job, outputPath);
+
+ job.setJarByClass(VectorMatrixMultiplicationJob.class);
+
job.waitForCompletion(true);
// build the resulting DRM from the results
Index: core/src/main/java/org/apache/mahout/clustering/spectral/common/AffinityMatrixInputMapper.java
===================================================================
--- core/src/main/java/org/apache/mahout/clustering/spectral/common/AffinityMatrixInputMapper.java (revision 1163723)
+++ core/src/main/java/org/apache/mahout/clustering/spectral/common/AffinityMatrixInputMapper.java (working copy)
@@ -57,7 +57,7 @@
if (elements.length != 3) {
throw new IOException("Expected input of length 3, received "
+ elements.length + ". Please make sure you adhere to "
- + "the structure of (i,j,value) for representing a graph in text.");
+ + "the structure of (i,j,value) for representing a graph in text. Input line was: '"+value+"'.");
} else if (elements[0].length() == 0 || elements[1].length() == 0 || elements[2].length() == 0) {
throw new IOException("Found an element of 0 length. Please be sure you adhere to the structure of "
+ "(i,j,value) for representing a graph in text.");
Index: core/src/main/java/org/apache/mahout/clustering/spectral/common/MatrixDiagonalizeJob.java
===================================================================
--- core/src/main/java/org/apache/mahout/clustering/spectral/common/MatrixDiagonalizeJob.java (revision 1163723)
+++ core/src/main/java/org/apache/mahout/clustering/spectral/common/MatrixDiagonalizeJob.java (working copy)
@@ -67,6 +67,8 @@
FileInputFormat.addInputPath(job, affInput);
FileOutputFormat.setOutputPath(job, diagOutput);
+ job.setJarByClass(MatrixDiagonalizeJob.class);
+
job.waitForCompletion(true);
// read the results back from the path
Index: core/src/main/java/org/apache/mahout/clustering/spectral/common/VectorCache.java
===================================================================
--- core/src/main/java/org/apache/mahout/clustering/spectral/common/VectorCache.java (revision 1163723)
+++ core/src/main/java/org/apache/mahout/clustering/spectral/common/VectorCache.java (working copy)
@@ -32,7 +32,10 @@
import org.apache.mahout.common.iterator.sequencefile.SequenceFileValueIterator;
import org.apache.mahout.math.Vector;
import org.apache.mahout.math.VectorWritable;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
/**
* This class handles reading and writing vectors to the Hadoop
* distributed cache. Created as a result of Eigencuts' liberal use
@@ -40,6 +43,8 @@
*/
public final class VectorCache {
+ private static final Logger log = LoggerFactory.getLogger(VectorCache.class);
+
private VectorCache() {
}
@@ -90,10 +95,18 @@
* Loads the vector from {@link DistributedCache}. Returns null if no vector exists.
*/
public static Vector load(Configuration conf) throws IOException {
+
+
URI[] files = DistributedCache.getCacheFiles(conf);
if (files == null || files.length < 1) {
return null;
}
+ // danbri
+ log.info("Files are: ");
+ for (URI f: files) {
+ log.info("file: "+f);
+ }
+ // end danbri
return load(conf, new Path(files[0].getPath()));
}
@@ -101,6 +114,7 @@
* Loads a Vector from the specified path. Returns null if no vector exists.
*/
public static Vector load(Configuration conf, Path input) throws IOException {
+ log.info("Loading vector from: "+input); // danbri
SequenceFileValueIterator<VectorWritable> iterator =
new SequenceFileValueIterator<VectorWritable>(input, true, conf);
try {
Index: core/src/main/java/org/apache/mahout/clustering/spectral/common/UnitVectorizerJob.java
===================================================================
--- core/src/main/java/org/apache/mahout/clustering/spectral/common/UnitVectorizerJob.java (revision 1163723)
+++ core/src/main/java/org/apache/mahout/clustering/spectral/common/UnitVectorizerJob.java (working copy)
@@ -61,6 +61,8 @@
FileInputFormat.addInputPath(job, input);
FileOutputFormat.setOutputPath(job, output);
+ job.setJarByClass(UnitVectorizerJob.class);
+
job.waitForCompletion(true);
}
Index: core/src/main/java/org/apache/mahout/clustering/spectral/common/AffinityMatrixInputJob.java
===================================================================
--- core/src/main/java/org/apache/mahout/clustering/spectral/common/AffinityMatrixInputJob.java (revision 1163723)
+++ core/src/main/java/org/apache/mahout/clustering/spectral/common/AffinityMatrixInputJob.java (working copy)
@@ -59,6 +59,8 @@
FileInputFormat.addInputPath(job, input);
FileOutputFormat.setOutputPath(job, output);
+ job.setJarByClass(AffinityMatrixInputJob.class);
+
job.waitForCompletion(true);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment