Merge pull request #347 from metamx/finishJob-metrics

IndexTask: Print metrics even if finishJob fails
This commit is contained in:
fjy 2014-01-07 11:03:36 -08:00
commit 6db52c8297
1 changed files with 14 additions and 11 deletions

View File

@ -368,18 +368,21 @@ public class IndexTask extends AbstractFixedIntervalTask
}
plumber.persist(firehose.commit());
plumber.finishJob();
// Output metrics
log.info(
"Task[%s] took in %,d rows (%,d processed, %,d unparseable, %,d thrown away) and output %,d rows",
getId(),
metrics.processed() + metrics.unparseable() + metrics.thrownAway(),
metrics.processed(),
metrics.unparseable(),
metrics.thrownAway(),
metrics.rowOutput()
);
try {
plumber.finishJob();
}
finally {
log.info(
"Task[%s] took in %,d rows (%,d processed, %,d unparseable, %,d thrown away) and output %,d rows",
getId(),
metrics.processed() + metrics.unparseable() + metrics.thrownAway(),
metrics.processed(),
metrics.unparseable(),
metrics.thrownAway(),
metrics.rowOutput()
);
}
// We expect a single segment to have been created.
return Iterables.getOnlyElement(pushedSegments);