Skip to content

armgit / nutch

Public Imported from GitHub
0

Apache Nutch is an extensible and scalable web crawler

NUTCH-392 - OutputFormat implementations should pass on Progressable.

Andrzej Bialecki78b0f9cad6b1
diff --git a/CHANGES.txt b/CHANGES.txt
index a9bda3cb1..d098d0393 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -26,6 +26,10 @@ Unreleased changes (1.0-dev)
9. NUTCH-61 - Support for adaptive re-fetch interval and detection of
unmodified content. (ab)
+
+10. NUTCH-392 - OutputFormat implementations should pass on Progressable.
+ (cutting via ab)
+
Release 0.9 - 2007-04-02
diff --git a/src/java/org/apache/nutch/fetcher/FetcherOutputFormat.java b/src/java/org/apache/nutch/fetcher/FetcherOutputFormat.java
index ed86cb2ed..5ba889743 100644
--- a/src/java/org/apache/nutch/fetcher/FetcherOutputFormat.java
+++ b/src/java/org/apache/nutch/fetcher/FetcherOutputFormat.java
@@ -28,6 +28,7 @@ import org.apache.hadoop.io.ObjectWritable;
import org.apache.hadoop.io.WritableComparable;
import org.apache.hadoop.io.Writable;
import org.apache.hadoop.io.Text;
+import org.apache.hadoop.io.SequenceFile.CompressionType;
import org.apache.hadoop.mapred.OutputFormat;
import org.apache.hadoop.mapred.RecordWriter;
@@ -58,7 +59,8 @@ public class FetcherOutputFormat implements OutputFormat {
new Path(new Path(job.getOutputPath(), Content.DIR_NAME), name);
final MapFile.Writer fetchOut =
- new MapFile.Writer(job, fs, fetch.toString(), Text.class, CrawlDatum.class);
+ new MapFile.Writer(job, fs, fetch.toString(), Text.class, CrawlDatum.class,
+ CompressionType.NONE, progress);
return new RecordWriter() {
private MapFile.Writer contentOut;
@@ -67,11 +69,12 @@ public class FetcherOutputFormat implements OutputFormat {
{
if (Fetcher.isStoringContent(job)) {
contentOut = new MapFile.Writer(job, fs, content.toString(),
- Text.class, Content.class);
+ Text.class, Content.class,
+ CompressionType.NONE, progress);
}
if (Fetcher.isParsing(job)) {
- parseOut = new ParseOutputFormat().getRecordWriter(fs, job, name, null);
+ parseOut = new ParseOutputFormat().getRecordWriter(fs, job, name, progress);
}
}
diff --git a/src/java/org/apache/nutch/indexer/Indexer.java b/src/java/org/apache/nutch/indexer/Indexer.java
index b6171f3e9..062ead1eb 100644
--- a/src/java/org/apache/nutch/indexer/Indexer.java
+++ b/src/java/org/apache/nutch/indexer/Indexer.java
@@ -60,7 +60,7 @@ public class Indexer extends ToolBase implements Reducer, Mapper {
public static class OutputFormat
extends org.apache.hadoop.mapred.OutputFormatBase {
public RecordWriter getRecordWriter(final FileSystem fs, JobConf job,
- String name, Progressable progress) throws IOException {
+ String name, final Progressable progress) throws IOException {
final Path perm = new Path(job.getOutputPath(), name);
final Path temp =
job.getLocalPath("index/_"+Integer.toString(new Random().nextInt()));
@@ -95,6 +95,7 @@ public class Indexer extends ToolBase implements Reducer, Mapper {
" (" + doc.get("lang") + ")");
}
writer.addDocument(doc, analyzer);
+ progress.progress();
}
public void close(final Reporter reporter) throws IOException {
diff --git a/src/java/org/apache/nutch/parse/ParseOutputFormat.java b/src/java/org/apache/nutch/parse/ParseOutputFormat.java
index a121db04d..f4417e108 100644
--- a/src/java/org/apache/nutch/parse/ParseOutputFormat.java
+++ b/src/java/org/apache/nutch/parse/ParseOutputFormat.java
@@ -68,13 +68,16 @@ public class ParseOutputFormat implements OutputFormat {
new Path(new Path(job.getOutputPath(), CrawlDatum.PARSE_DIR_NAME), name);
final MapFile.Writer textOut =
- new MapFile.Writer(job, fs, text.toString(), Text.class, ParseText.class, CompressionType.RECORD);
+ new MapFile.Writer(job, fs, text.toString(), Text.class, ParseText.class,
+ CompressionType.RECORD, progress);
final MapFile.Writer dataOut =
- new MapFile.Writer(job, fs, data.toString(), Text.class,ParseData.class);
+ new MapFile.Writer(job, fs, data.toString(), Text.class, ParseData.class,
+ CompressionType.RECORD, progress);
final SequenceFile.Writer crawlOut =
- SequenceFile.createWriter(fs, job, crawl, Text.class, CrawlDatum.class);
+ SequenceFile.createWriter(fs, job, crawl, Text.class, CrawlDatum.class,
+ CompressionType.NONE, progress);
return new RecordWriter() {
diff --git a/src/java/org/apache/nutch/segment/SegmentMerger.java b/src/java/org/apache/nutch/segment/SegmentMerger.java
index 9cfa0d390..1ee1fc753 100644
--- a/src/java/org/apache/nutch/segment/SegmentMerger.java
+++ b/src/java/org/apache/nutch/segment/SegmentMerger.java
@@ -36,6 +36,7 @@ import org.apache.hadoop.io.Text;
import org.apache.hadoop.io.UTF8;
import org.apache.hadoop.io.Writable;
import org.apache.hadoop.io.WritableComparable;
+import org.apache.hadoop.io.SequenceFile.CompressionType;
import org.apache.hadoop.mapred.FileSplit;
import org.apache.hadoop.mapred.InputSplit;
import org.apache.hadoop.mapred.JobClient;
@@ -237,7 +238,7 @@ public class SegmentMerger extends Configured implements Mapper, Reducer {
} else {
wname = new Path(new Path(new Path(job.getOutputPath(), segmentName + "-" + slice), dirName), name);
}
- res = new SequenceFile.Writer(fs, job, wname, Text.class, CrawlDatum.class);
+ res = new SequenceFile.Writer(fs, job, wname, Text.class, CrawlDatum.class, progress, new SequenceFile.Metadata());
sliceWriters.put(slice + dirName, res);
return res;
}
@@ -253,7 +254,7 @@ public class SegmentMerger extends Configured implements Mapper, Reducer {
} else {
wname = new Path(new Path(new Path(job.getOutputPath(), segmentName + "-" + slice), dirName), name);
}
- res = new MapFile.Writer(job, fs, wname.toString(), Text.class, clazz);
+ res = new MapFile.Writer(job, fs, wname.toString(), Text.class, clazz, CompressionType.RECORD, progress);
sliceWriters.put(slice + dirName, res);
return res;
}
diff --git a/src/java/org/apache/nutch/segment/SegmentReader.java b/src/java/org/apache/nutch/segment/SegmentReader.java
index 2a31e2263..2d1170625 100644
--- a/src/java/org/apache/nutch/segment/SegmentReader.java
+++ b/src/java/org/apache/nutch/segment/SegmentReader.java
@@ -94,7 +94,7 @@ public class SegmentReader extends Configured implements Reducer {
/** Implements a text output format */
public static class TextOutputFormat extends org.apache.hadoop.mapred.OutputFormatBase {
- public RecordWriter getRecordWriter(final FileSystem fs, JobConf job, String name, Progressable progress) throws IOException {
+ public RecordWriter getRecordWriter(final FileSystem fs, JobConf job, String name, final Progressable progress) throws IOException {
final Path segmentDumpFile = new Path(job.getOutputPath(), name);