You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mahout.apache.org by ad...@apache.org on 2010/03/13 18:38:05 UTC
svn commit: r922625 -
/lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/df/mapreduce/TestForest.java
Author: adeneche
Date: Sat Mar 13 17:38:05 2010
New Revision: 922625
URL: http://svn.apache.org/viewvc?rev=922625&view=rev
Log:
MAHOUT-323: TestForest check if the forest path exists
Modified:
lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/df/mapreduce/TestForest.java
Modified: lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/df/mapreduce/TestForest.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/df/mapreduce/TestForest.java?rev=922625&r1=922624&r2=922625&view=diff
==============================================================================
--- lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/df/mapreduce/TestForest.java (original)
+++ lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/df/mapreduce/TestForest.java Sat Mar 13 17:38:05 2010
@@ -151,15 +151,21 @@ public class TestForest extends Configur
}
}
+ // make sure the decision forest exists
+ FileSystem mfs = modelPath.getFileSystem(getConf());
+ if (!mfs.exists(modelPath)) {
+ throw new IllegalArgumentException("The forest path does not exist");
+ }
+
+ // load the dataset
Dataset dataset = Dataset.load(getConf(), datasetPath);
DataConverter converter = new DataConverter(dataset);
log.info("Loading the forest...");
- FileSystem fs = modelPath.getFileSystem(getConf());
- Path[] modelfiles = DFUtils.listOutputFiles(fs, modelPath);
+ Path[] modelfiles = DFUtils.listOutputFiles(mfs, modelPath);
DecisionForest forest = null;
for (Path path : modelfiles) {
- FSDataInputStream dataInput = new FSDataInputStream(fs.open(path));
+ FSDataInputStream dataInput = new FSDataInputStream(mfs.open(path));
if (forest == null) {
forest = DecisionForest.read(dataInput);
} else {