Author: cutting
Date: Fri Sep 16 10:42:10 2005
New Revision: 289620
URL: http://svn.apache.org/viewcvs?rev=289620&view=rev
Log:
Always close child process output. Also improve logging to always include task
id & add more stack traces.
Modified:
lucene/nutch/branches/mapred/src/java/org/apache/nutch/mapred/MapTaskRunner.java
lucene/nutch/branches/mapred/src/java/org/apache/nutch/mapred/ReduceTaskRunner.java
lucene/nutch/branches/mapred/src/java/org/apache/nutch/mapred/TaskRunner.java
Modified:
lucene/nutch/branches/mapred/src/java/org/apache/nutch/mapred/MapTaskRunner.java
URL:
http://svn.apache.org/viewcvs/lucene/nutch/branches/mapred/src/java/org/apache/nutch/mapred/MapTaskRunner.java?rev=289620&r1=289619&r2=289620&view=diff
==============================================================================
---
lucene/nutch/branches/mapred/src/java/org/apache/nutch/mapred/MapTaskRunner.java
(original)
+++
lucene/nutch/branches/mapred/src/java/org/apache/nutch/mapred/MapTaskRunner.java
Fri Sep 16 10:42:10 2005
@@ -36,7 +36,7 @@
/** Delete all of the temporary map output files. */
public void close() throws IOException {
- LOG.info("Task "+getTask()+" done; removing files.");
+ LOG.info(getTask()+" done; removing files.");
MapOutputFile.removeAll(getTask().getTaskId());
}
}
Modified:
lucene/nutch/branches/mapred/src/java/org/apache/nutch/mapred/ReduceTaskRunner.java
URL:
http://svn.apache.org/viewcvs/lucene/nutch/branches/mapred/src/java/org/apache/nutch/mapred/ReduceTaskRunner.java?rev=289620&r1=289619&r2=289620&view=diff
==============================================================================
---
lucene/nutch/branches/mapred/src/java/org/apache/nutch/mapred/ReduceTaskRunner.java
(original)
+++
lucene/nutch/branches/mapred/src/java/org/apache/nutch/mapred/ReduceTaskRunner.java
Fri Sep 16 10:42:10 2005
@@ -66,7 +66,7 @@
continue;
}
- LOG.info("Got "+locs.length+" map output locations.");
+ LOG.info(task.getTaskId()+" Got "+locs.length+" map output locations.");
// try each of these locations
for (int i = 0; i < locs.length; i++) {
@@ -100,7 +100,8 @@
} catch (IOException e) { // failed: try again later
LOG.log(Level.WARNING,
- "copy failed: "+loc.getMapTaskId()+" from "+addr,
+ task.getTaskId()+" copy failed: "
+ +loc.getMapTaskId()+" from "+addr,
e);
} finally {
MapOutputFile.setProgressReporter(null);
Modified:
lucene/nutch/branches/mapred/src/java/org/apache/nutch/mapred/TaskRunner.java
URL:
http://svn.apache.org/viewcvs/lucene/nutch/branches/mapred/src/java/org/apache/nutch/mapred/TaskRunner.java?rev=289620&r1=289619&r2=289620&view=diff
==============================================================================
---
lucene/nutch/branches/mapred/src/java/org/apache/nutch/mapred/TaskRunner.java
(original)
+++
lucene/nutch/branches/mapred/src/java/org/apache/nutch/mapred/TaskRunner.java
Fri Sep 16 10:42:10 2005
@@ -100,13 +100,13 @@
}, null);
} catch (Throwable throwable) {
- LOG.log(Level.WARNING, "Child Error", throwable);
+ LOG.log(Level.WARNING, t.getTaskId()+" Child Error", throwable);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
throwable.printStackTrace(new PrintStream(baos));
try {
tracker.reportDiagnosticInfo(t.getTaskId(), baos.toString());
} catch (IOException e) {
- LOG.log(Level.WARNING, "Reporting Diagnostics", e);
+ LOG.log(Level.WARNING, t.getTaskId()+" Reporting Diagnostics", e);
}
} finally {
tracker.reportTaskFinished(t.getTaskId());
@@ -129,7 +129,7 @@
logStream(process.getInputStream()); // normally empty
if (this.process.waitFor() != 0) {
- throw new IOException("Child failed!");
+ throw new IOException("Task process exit with nonzero status.");
}
} catch (InterruptedException e) {
@@ -158,7 +158,13 @@
LOG.info(t.getTaskId()+" "+line);
}
} catch (IOException e) {
- LOG.warning(e.toString());
+ LOG.log(Level.WARNING, t.getTaskId()+" Error reading child output", e);
+ } finally {
+ try {
+ output.close();
+ } catch (IOException e) {
+ LOG.log(Level.WARNING, t.getTaskId()+" Error closing child output", e);
+ }
}
}
}