From f57eaf39898b36f4d0f711485003298b857de5f7 Mon Sep 17 00:00:00 2001 From: Arun Murthy Date: Wed, 13 Jul 2011 06:03:00 +0000 Subject: [PATCH] MAPREDUCE-2679. Minor changes to sync trunk with MR-279 branch. git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1145870 13f79535-47bb-0310-9956-ffa450edef68 --- mapreduce/CHANGES.txt | 2 ++ .../java/org/apache/hadoop/mapred/JobACLsManager.java | 7 ++++--- .../java/org/apache/hadoop/mapred/JobContextImpl.java | 4 ++-- .../apache/hadoop/mapred/TaskAttemptContextImpl.java | 2 +- .../src/java/org/apache/hadoop/mapreduce/Job.java | 10 +++++++--- .../hadoop/mapreduce/jobhistory/EventWriter.java | 3 ++- 6 files changed, 18 insertions(+), 10 deletions(-) diff --git a/mapreduce/CHANGES.txt b/mapreduce/CHANGES.txt index ee6fba9e05..1188ee677a 100644 --- a/mapreduce/CHANGES.txt +++ b/mapreduce/CHANGES.txt @@ -37,6 +37,8 @@ Trunk (unreleased changes) IMPROVEMENTS + MAPREDUCE-2679. Minor changes to sync trunk with MR-279 branch. (acmurthy) + MAPREDUCE-2400. Remove Cluster's dependency on JobTracker via a ServiceProvider for the actual implementation. (tomwhite via acmurthy) diff --git a/mapreduce/src/java/org/apache/hadoop/mapred/JobACLsManager.java b/mapreduce/src/java/org/apache/hadoop/mapred/JobACLsManager.java index 56dd1a2895..9e9ad1ea99 100644 --- a/mapreduce/src/java/org/apache/hadoop/mapred/JobACLsManager.java +++ b/mapreduce/src/java/org/apache/hadoop/mapred/JobACLsManager.java @@ -21,6 +21,7 @@ import java.util.Map; import org.apache.hadoop.classification.InterfaceAudience; +import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.mapreduce.JobACL; import org.apache.hadoop.mapreduce.MRConfig; import org.apache.hadoop.security.AccessControlException; @@ -30,9 +31,9 @@ @InterfaceAudience.Private class JobACLsManager { - JobConf conf; + Configuration conf; - public JobACLsManager(JobConf conf) { + public JobACLsManager(Configuration conf) { this.conf = conf; } @@ -47,7 +48,7 @@ boolean areACLsEnabled() { * * @return JobACL to AccessControlList map. */ - Map constructJobACLs(JobConf conf) { + Map constructJobACLs(Configuration conf) { Map acls = new HashMap(); diff --git a/mapreduce/src/java/org/apache/hadoop/mapred/JobContextImpl.java b/mapreduce/src/java/org/apache/hadoop/mapred/JobContextImpl.java index f5e2ac86c5..8e188903b7 100644 --- a/mapreduce/src/java/org/apache/hadoop/mapred/JobContextImpl.java +++ b/mapreduce/src/java/org/apache/hadoop/mapred/JobContextImpl.java @@ -33,14 +33,14 @@ public class JobContextImpl private JobConf job; private Progressable progress; - JobContextImpl(JobConf conf, org.apache.hadoop.mapreduce.JobID jobId, + public JobContextImpl(JobConf conf, org.apache.hadoop.mapreduce.JobID jobId, Progressable progress) { super(conf, jobId); this.job = conf; this.progress = progress; } - JobContextImpl(JobConf conf, org.apache.hadoop.mapreduce.JobID jobId) { + public JobContextImpl(JobConf conf, org.apache.hadoop.mapreduce.JobID jobId) { this(conf, jobId, Reporter.NULL); } diff --git a/mapreduce/src/java/org/apache/hadoop/mapred/TaskAttemptContextImpl.java b/mapreduce/src/java/org/apache/hadoop/mapred/TaskAttemptContextImpl.java index 4e064b769c..e278a8bfc9 100644 --- a/mapreduce/src/java/org/apache/hadoop/mapred/TaskAttemptContextImpl.java +++ b/mapreduce/src/java/org/apache/hadoop/mapred/TaskAttemptContextImpl.java @@ -34,7 +34,7 @@ public class TaskAttemptContextImpl implements TaskAttemptContext { private Reporter reporter; - TaskAttemptContextImpl(JobConf conf, TaskAttemptID taskid) { + public TaskAttemptContextImpl(JobConf conf, TaskAttemptID taskid) { this(conf, taskid, Reporter.NULL); } diff --git a/mapreduce/src/java/org/apache/hadoop/mapreduce/Job.java b/mapreduce/src/java/org/apache/hadoop/mapreduce/Job.java index 1011fe61bd..0be084077d 100644 --- a/mapreduce/src/java/org/apache/hadoop/mapreduce/Job.java +++ b/mapreduce/src/java/org/apache/hadoop/mapreduce/Job.java @@ -1113,13 +1113,17 @@ public boolean monitorAndPrintJob() eventCounter += events.length; printTaskEvents(events, filter, profiling, mapRanges, reduceRanges); } + boolean success = isSuccessful(); + if (success) { + LOG.info("Job " + jobId + " completed successfully"); + } else { + LOG.info("Job " + jobId + " failed with state " + status.getState()); + } Counters counters = getCounters(); if (counters != null) { LOG.info(counters.toString()); } - LOG.info("Job " + jobId + " completed with status: " - + getStatus().getState()); - return isSuccessful(); + return success; } /** diff --git a/mapreduce/src/java/org/apache/hadoop/mapreduce/jobhistory/EventWriter.java b/mapreduce/src/java/org/apache/hadoop/mapreduce/jobhistory/EventWriter.java index 2b7299fc66..400bcb2837 100644 --- a/mapreduce/src/java/org/apache/hadoop/mapreduce/jobhistory/EventWriter.java +++ b/mapreduce/src/java/org/apache/hadoop/mapreduce/jobhistory/EventWriter.java @@ -66,8 +66,9 @@ synchronized void write(HistoryEvent event) throws IOException { out.writeBytes("\n"); } - void flush() throws IOException { + void flush() throws IOException { encoder.flush(); + out.flush(); } void close() throws IOException {