Author: srowen
Date: Wed Dec 22 14:29:00 2010
New Revision: 1051915

URL: http://svn.apache.org/viewvc?rev=1051915&view=rev
Log:
Remove more use of JobConf

Modified:
    
mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/DistributedRowMatrix.java
    
mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/MatrixMultiplicationJob.java
    
mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/TimesSquaredJob.java
    
mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/TransposeJob.java

Modified: 
mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/DistributedRowMatrix.java
URL: 
http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/DistributedRowMatrix.java?rev=1051915&r1=1051914&r2=1051915&view=diff
==============================================================================
--- 
mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/DistributedRowMatrix.java
 (original)
+++ 
mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/DistributedRowMatrix.java
 Wed Dec 22 14:29:00 2010
@@ -153,8 +153,9 @@ public class DistributedRowMatrix implem
       throw new CardinalityException(numRows, other.numRows());
     }
     Path outPath = new Path(outputTmpBasePath.getParent(), "productWith-" + 
(System.nanoTime() & 0xFF));
-    JobConf conf = 
MatrixMultiplicationJob.createMatrixMultiplyJobConf(rowPath, other.rowPath, 
outPath, other.numCols);
-    JobClient.runJob(conf);
+    Configuration conf =
+        MatrixMultiplicationJob.createMatrixMultiplyJobConf(rowPath, 
other.rowPath, outPath, other.numCols);
+    JobClient.runJob(new JobConf(conf));
     DistributedRowMatrix out = new DistributedRowMatrix(outPath, 
outputTmpPath, numCols, other.numCols());
     out.setConf(conf);
     return out;
@@ -162,8 +163,8 @@ public class DistributedRowMatrix implem
 
   public DistributedRowMatrix transpose() throws IOException {
     Path outputPath = new Path(rowPath.getParent(), "transpose-" + 
(System.nanoTime() & 0xFF));
-    JobConf conf = TransposeJob.buildTransposeJobConf(rowPath, outputPath, 
numRows);
-    JobClient.runJob(conf);
+    Configuration conf = TransposeJob.buildTransposeJobConf(rowPath, 
outputPath, numRows);
+    JobClient.runJob(new JobConf(conf));
     DistributedRowMatrix m = new DistributedRowMatrix(outputPath, 
outputTmpPath, numCols, numRows);
     m.setConf(this.conf);
     return m;
@@ -172,12 +173,12 @@ public class DistributedRowMatrix implem
   @Override
   public Vector times(Vector v) {
     try {
-      JobConf conf = TimesSquaredJob.createTimesJobConf(v,
-                                                        numRows,
-                                                        rowPath,
-                                                        new Path(outputTmpPath,
-                                                                 
Long.toString(System.nanoTime())));
-      JobClient.runJob(conf);
+      Configuration conf =
+          TimesSquaredJob.createTimesJobConf(v,
+                                             numRows,
+                                             rowPath,
+                                             new Path(outputTmpPath, 
Long.toString(System.nanoTime())));
+      JobClient.runJob(new JobConf(conf));
       return TimesSquaredJob.retrieveTimesSquaredOutputVector(conf);
     } catch (IOException ioe) {
       throw new IllegalStateException(ioe);
@@ -187,11 +188,12 @@ public class DistributedRowMatrix implem
   @Override
   public Vector timesSquared(Vector v) {
     try {
-      JobConf conf = TimesSquaredJob.createTimesSquaredJobConf(v,
-                                                               rowPath,
-                                                               new 
Path(outputTmpBasePath,
-                                                                        new 
Path(Long.toString(System.nanoTime()))));
-      JobClient.runJob(conf);
+      Configuration conf =
+          TimesSquaredJob.createTimesSquaredJobConf(v,
+                                                    rowPath,
+                                                    new Path(outputTmpBasePath,
+                                                             new 
Path(Long.toString(System.nanoTime()))));
+      JobClient.runJob(new JobConf(conf));
       return TimesSquaredJob.retrieveTimesSquaredOutputVector(conf);
     } catch (IOException ioe) {
       throw new IllegalStateException(ioe);

Modified: 
mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/MatrixMultiplicationJob.java
URL: 
http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/MatrixMultiplicationJob.java?rev=1051915&r1=1051914&r2=1051915&view=diff
==============================================================================
--- 
mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/MatrixMultiplicationJob.java
 (original)
+++ 
mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/MatrixMultiplicationJob.java
 Wed Dec 22 14:29:00 2010
@@ -46,7 +46,7 @@ public class MatrixMultiplicationJob ext
 
   private static final String OUT_CARD = "output.vector.cardinality";
 
-  public static JobConf createMatrixMultiplyJobConf(Path aPath, Path bPath, 
Path outPath, int outCardinality) {
+  public static Configuration createMatrixMultiplyJobConf(Path aPath, Path 
bPath, Path outPath, int outCardinality) {
     JobConf conf = new JobConf(MatrixMultiplicationJob.class);
     conf.setInputFormat(CompositeInputFormat.class);
     conf.set("mapred.join.expr", CompositeInputFormat.compose(

Modified: 
mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/TimesSquaredJob.java
URL: 
http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/TimesSquaredJob.java?rev=1051915&r1=1051914&r2=1051915&view=diff
==============================================================================
--- 
mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/TimesSquaredJob.java
 (original)
+++ 
mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/TimesSquaredJob.java
 Wed Dec 22 14:29:00 2010
@@ -17,6 +17,7 @@
 
 package org.apache.mahout.math.hadoop;
 
+import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.filecache.DistributedCache;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
@@ -58,9 +59,9 @@ public final class TimesSquaredJob {
 
   private TimesSquaredJob() { }
 
-  public static JobConf createTimesSquaredJobConf(Vector v, 
-                                                  Path matrixInputPath, 
-                                                  Path outputVectorPath) 
throws IOException {
+  public static Configuration createTimesSquaredJobConf(Vector v,
+                                                        Path matrixInputPath,
+                                                        Path outputVectorPath) 
throws IOException {
     return createTimesSquaredJobConf(v,
                                      matrixInputPath,
                                      outputVectorPath,
@@ -68,10 +69,10 @@ public final class TimesSquaredJob {
                                      VectorSummingReducer.class);
   }
 
-  public static JobConf createTimesJobConf(Vector v,
-                                           int outDim,
-                                           Path matrixInputPath,
-                                           Path outputVectorPath) throws 
IOException {
+  public static Configuration createTimesJobConf(Vector v,
+                                                 int outDim,
+                                                 Path matrixInputPath,
+                                                 Path outputVectorPath) throws 
IOException {
     return createTimesSquaredJobConf(v,
                                      outDim,
                                      matrixInputPath,
@@ -81,20 +82,22 @@ public final class TimesSquaredJob {
   }
 
 
-  public static JobConf createTimesSquaredJobConf(Vector v,
-                                                  Path matrixInputPath,
-                                                  Path outputVectorPathBase,
-                                                  Class<? extends 
TimesSquaredMapper> mapClass,
-                                                  Class<? extends 
VectorSummingReducer> redClass) throws IOException {
+  public static Configuration createTimesSquaredJobConf(Vector v,
+                                                        Path matrixInputPath,
+                                                        Path 
outputVectorPathBase,
+                                                        Class<? extends 
TimesSquaredMapper> mapClass,
+                                                        Class<? extends 
VectorSummingReducer> redClass)
+    throws IOException {
     return createTimesSquaredJobConf(v, v.size(), matrixInputPath, 
outputVectorPathBase, mapClass, redClass);
   }
 
-  public static JobConf createTimesSquaredJobConf(Vector v,
-                                                  int outputVectorDim,
-                                                  Path matrixInputPath,
-                                                  Path outputVectorPathBase,
-                                                  Class<? extends 
TimesSquaredMapper> mapClass,
-                                                  Class<? extends 
VectorSummingReducer> redClass) throws IOException {
+  public static Configuration createTimesSquaredJobConf(Vector v,
+                                                        int outputVectorDim,
+                                                        Path matrixInputPath,
+                                                        Path 
outputVectorPathBase,
+                                                        Class<? extends 
TimesSquaredMapper> mapClass,
+                                                        Class<? extends 
VectorSummingReducer> redClass)
+    throws IOException {
     JobConf conf = new JobConf(TimesSquaredJob.class);
     conf.setJobName("TimesSquaredJob: " + matrixInputPath);
     FileSystem fs = FileSystem.get(conf);
@@ -129,8 +132,8 @@ public final class TimesSquaredJob {
     return conf;
   }
 
-  public static Vector retrieveTimesSquaredOutputVector(JobConf conf) throws 
IOException {
-    Path outputPath = FileOutputFormat.getOutputPath(conf);
+  public static Vector retrieveTimesSquaredOutputVector(Configuration conf) 
throws IOException {
+    Path outputPath = FileOutputFormat.getOutputPath(new JobConf(conf));
     FileSystem fs = FileSystem.get(conf);
     Path outputFile = new Path(outputPath, "part-00000");
     SequenceFile.Reader reader = new SequenceFile.Reader(fs, outputFile, conf);

Modified: 
mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/TransposeJob.java
URL: 
http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/TransposeJob.java?rev=1051915&r1=1051914&r2=1051915&view=diff
==============================================================================
--- 
mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/TransposeJob.java 
(original)
+++ 
mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/TransposeJob.java 
Wed Dec 22 14:29:00 2010
@@ -75,9 +75,9 @@ public class TransposeJob extends Abstra
     return 0;
   }
 
-  public static JobConf buildTransposeJobConf(Path matrixInputPath,
-                                              Path matrixOutputPath,
-                                              int numInputRows) throws 
IOException {
+  public static Configuration buildTransposeJobConf(Path matrixInputPath,
+                                                    Path matrixOutputPath,
+                                                    int numInputRows) throws 
IOException {
     JobConf conf = new JobConf(TransposeJob.class);
     conf.setJobName("TransposeJob: " + matrixInputPath + " transpose -> " + 
matrixOutputPath);
     FileSystem fs = FileSystem.get(conf);


Reply via email to