MAPREDUCE-4971. Minor extensibility enhancements to Counters & FileOutputFormat. Contributed by Arun C Murthy

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1441670 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Siddharth Seth 2013-02-02 00:47:58 +00:00
parent b1baf11fb2
commit a04bee4567
7 changed files with 36 additions and 4 deletions

View File

@ -215,6 +215,9 @@ Release 2.0.3-alpha - Unreleased
MAPREDUCE-4838. Add additional fields like Locality, Avataar to the MAPREDUCE-4838. Add additional fields like Locality, Avataar to the
JobHistory logs. (Zhijie Shen via sseth) JobHistory logs. (Zhijie Shen via sseth)
MAPREDUCE-4971. Minor extensibility enhancements to Counters &
FileOutputFormat. (Arun C Murthy via sseth)
OPTIMIZATIONS OPTIMIZATIONS
MAPREDUCE-4893. Fixed MR ApplicationMaster to do optimal assignment of MAPREDUCE-4893. Fixed MR ApplicationMaster to do optimal assignment of

View File

@ -230,6 +230,10 @@ public class Counters
public static class Group implements CounterGroupBase<Counter> { public static class Group implements CounterGroupBase<Counter> {
private CounterGroupBase<Counter> realGroup; private CounterGroupBase<Counter> realGroup;
protected Group() {
realGroup = null;
}
Group(GenericGroup group) { Group(GenericGroup group) {
this.realGroup = group; this.realGroup = group;
} }

View File

@ -92,7 +92,7 @@ public class FileOutputCommitter extends OutputCommitter {
} }
@Private @Private
Path getTaskAttemptPath(TaskAttemptContext context) throws IOException { public Path getTaskAttemptPath(TaskAttemptContext context) throws IOException {
Path out = getOutputPath(context); Path out = getOutputPath(context);
return out == null ? null : getTaskAttemptPath(context, out); return out == null ? null : getTaskAttemptPath(context, out);
} }

View File

@ -22,6 +22,7 @@ import java.io.IOException;
import java.text.NumberFormat; import java.text.NumberFormat;
import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.classification.InterfaceStability; import org.apache.hadoop.classification.InterfaceStability;
import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path; import org.apache.hadoop.fs.Path;
@ -152,8 +153,8 @@ public abstract class FileOutputFormat<K, V> implements OutputFormat<K, V> {
* @param outputDir the {@link Path} of the output directory * @param outputDir the {@link Path} of the output directory
* for the map-reduce job. * for the map-reduce job.
*/ */
@Private
static void setWorkOutputPath(JobConf conf, Path outputDir) { public static void setWorkOutputPath(JobConf conf, Path outputDir) {
outputDir = new Path(conf.getWorkingDirectory(), outputDir); outputDir = new Path(conf.getWorkingDirectory(), outputDir);
conf.set(JobContext.TASK_OUTPUT_DIR, outputDir.toString()); conf.set(JobContext.TASK_OUTPUT_DIR, outputDir.toString());
} }

View File

@ -28,6 +28,7 @@ import java.util.regex.Pattern;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.classification.InterfaceStability; import org.apache.hadoop.classification.InterfaceStability;
import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileStatus; import org.apache.hadoop.fs.FileStatus;
@ -419,7 +420,8 @@ public class JobConf extends Configuration {
return credentials; return credentials;
} }
void setCredentials(Credentials credentials) { @Private
public void setCredentials(Credentials credentials) {
this.credentials = credentials; this.credentials = credentials;
} }

View File

@ -35,6 +35,7 @@ import com.google.common.collect.Iterators;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.io.WritableUtils; import org.apache.hadoop.io.WritableUtils;
import org.apache.hadoop.mapreduce.Counter; import org.apache.hadoop.mapreduce.Counter;
import org.apache.hadoop.mapreduce.FileSystemCounter; import org.apache.hadoop.mapreduce.FileSystemCounter;
@ -73,6 +74,16 @@ public abstract class FileSystemCounterGroup<C extends Counter>
key = ref; key = ref;
} }
@Private
public String getScheme() {
return scheme;
}
@Private
public FileSystemCounter getFileSystemCounter() {
return key;
}
@Override @Override
public String getName() { public String getName() {
return NAME_JOINER.join(scheme, key.name()); return NAME_JOINER.join(scheme, key.name());

View File

@ -29,6 +29,7 @@ import java.util.Iterator;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.io.WritableUtils; import org.apache.hadoop.io.WritableUtils;
import org.apache.hadoop.mapreduce.Counter; import org.apache.hadoop.mapreduce.Counter;
import org.apache.hadoop.mapreduce.util.ResourceBundles; import org.apache.hadoop.mapreduce.util.ResourceBundles;
@ -67,6 +68,16 @@ public abstract class FrameworkCounterGroup<T extends Enum<T>,
this.groupName = groupName; this.groupName = groupName;
} }
@Private
public T getKey() {
return key;
}
@Private
public String getGroupName() {
return groupName;
}
@Override @Override
public String getName() { public String getName() {
return key.name(); return key.name();