HBASE-6455 org.apache.hadoop.hbase.PerformanceEvaluation sets the map reduce output path as a child of input path (Aditya)

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1366034 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Zhihong Yu 2012-07-26 15:12:23 +00:00
parent 1eaed9925b
commit a5bd687531
1 changed files with 12 additions and 9 deletions

View File

@ -316,6 +316,9 @@ public class PerformanceEvaluation {
List<InputSplit> splitList = new ArrayList<InputSplit>(); List<InputSplit> splitList = new ArrayList<InputSplit>();
for (FileStatus file: listStatus(job)) { for (FileStatus file: listStatus(job)) {
if (file.isDir()) {
continue;
}
Path path = file.getPath(); Path path = file.getPath();
FileSystem fs = path.getFileSystem(job.getConfiguration()); FileSystem fs = path.getFileSystem(job.getConfiguration());
FSDataInputStream fileIn = fs.open(path); FSDataInputStream fileIn = fs.open(path);
@ -644,7 +647,7 @@ public class PerformanceEvaluation {
job.setNumReduceTasks(1); job.setNumReduceTasks(1);
job.setOutputFormatClass(TextOutputFormat.class); job.setOutputFormatClass(TextOutputFormat.class);
TextOutputFormat.setOutputPath(job, new Path(inputDir,"outputs")); TextOutputFormat.setOutputPath(job, new Path(inputDir.getParent(), "outputs"));
TableMapReduceUtil.addDependencyJars(job); TableMapReduceUtil.addDependencyJars(job);
// Add a Class from the hbase.jar so it gets registered too. // Add a Class from the hbase.jar so it gets registered too.
@ -663,14 +666,14 @@ public class PerformanceEvaluation {
* @throws IOException * @throws IOException
*/ */
private Path writeInputFile(final Configuration c) throws IOException { private Path writeInputFile(final Configuration c) throws IOException {
FileSystem fs = FileSystem.get(c);
if (!fs.exists(PERF_EVAL_DIR)) {
fs.mkdirs(PERF_EVAL_DIR);
}
SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss"); SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss");
Path subdir = new Path(PERF_EVAL_DIR, formatter.format(new Date())); Path jobdir = new Path(PERF_EVAL_DIR, formatter.format(new Date()));
fs.mkdirs(subdir); Path inputDir = new Path(jobdir, "inputs");
Path inputFile = new Path(subdir, "input.txt");
FileSystem fs = FileSystem.get(c);
fs.mkdirs(inputDir);
Path inputFile = new Path(inputDir, "input.txt");
PrintStream out = new PrintStream(fs.create(inputFile)); PrintStream out = new PrintStream(fs.create(inputFile));
// Make input random. // Make input random.
Map<Integer, String> m = new TreeMap<Integer, String>(); Map<Integer, String> m = new TreeMap<Integer, String>();
@ -695,7 +698,7 @@ public class PerformanceEvaluation {
} finally { } finally {
out.close(); out.close();
} }
return subdir; return inputDir;
} }
/** /**