From 09b8241e6e369ee00241efcc2e048e710dbcccd1 Mon Sep 17 00:00:00 2001 From: Devaraj K Date: Fri, 5 Jun 2015 21:22:47 +0530 Subject: [PATCH] MAPREDUCE-6383. Pi job (QuasiMonteCarlo) should not try to read the results file if its job fails. Contributed by Harsh J. --- hadoop-mapreduce-project/CHANGES.txt | 3 +++ .../main/java/org/apache/hadoop/examples/QuasiMonteCarlo.java | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/hadoop-mapreduce-project/CHANGES.txt b/hadoop-mapreduce-project/CHANGES.txt index 2ffa541701..1813c31fc4 100644 --- a/hadoop-mapreduce-project/CHANGES.txt +++ b/hadoop-mapreduce-project/CHANGES.txt @@ -337,6 +337,9 @@ Release 2.8.0 - UNRELEASED MAPREDUCE-6174. Combine common stream code into parent class for InMemoryMapOutput and OnDiskMapOutput. (Eric Payne via gera) + MAPREDUCE-6383. Pi job (QuasiMonteCarlo) should not try to read the + results file if its job fails. (Harsh J via devaraj) + OPTIMIZATIONS BUG FIXES diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-examples/src/main/java/org/apache/hadoop/examples/QuasiMonteCarlo.java b/hadoop-mapreduce-project/hadoop-mapreduce-examples/src/main/java/org/apache/hadoop/examples/QuasiMonteCarlo.java index 25dee6bf5f..1a0c3726c9 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-examples/src/main/java/org/apache/hadoop/examples/QuasiMonteCarlo.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-examples/src/main/java/org/apache/hadoop/examples/QuasiMonteCarlo.java @@ -304,6 +304,10 @@ public static BigDecimal estimatePi(int numMaps, long numPoints, System.out.println("Starting Job"); final long startTime = System.currentTimeMillis(); job.waitForCompletion(true); + if (!job.isSuccessful()) { + System.out.println("Job " + job.getJobID() + " failed!"); + System.exit(1); + } final double duration = (System.currentTimeMillis() - startTime)/1000.0; System.out.println("Job Finished in " + duration + " seconds");