MAPREDUCE-2398. MRBench: setting the baseDir parameter has no effect. Contributed by Michael Noll and Wilfred Spiegelenburg.
This commit is contained in:
parent
170c4fd4cd
commit
7da5847cf1
@ -41,10 +41,13 @@
|
|||||||
public class MRBench extends Configured implements Tool{
|
public class MRBench extends Configured implements Tool{
|
||||||
|
|
||||||
private static final Log LOG = LogFactory.getLog(MRBench.class);
|
private static final Log LOG = LogFactory.getLog(MRBench.class);
|
||||||
|
private static final String DEFAULT_INPUT_SUB = "mr_input";
|
||||||
|
private static final String DEFAULT_OUTPUT_SUB = "mr_output";
|
||||||
|
|
||||||
private static Path BASE_DIR =
|
private static Path BASE_DIR =
|
||||||
new Path(System.getProperty("test.build.data","/benchmarks/MRBench"));
|
new Path(System.getProperty("test.build.data","/benchmarks/MRBench"));
|
||||||
private static Path INPUT_DIR = new Path(BASE_DIR, "mr_input");
|
private static Path INPUT_DIR = new Path(BASE_DIR, DEFAULT_INPUT_SUB);
|
||||||
private static Path OUTPUT_DIR = new Path(BASE_DIR, "mr_output");
|
private static Path OUTPUT_DIR = new Path(BASE_DIR, DEFAULT_OUTPUT_SUB);
|
||||||
|
|
||||||
public static enum Order {RANDOM, ASCENDING, DESCENDING};
|
public static enum Order {RANDOM, ASCENDING, DESCENDING};
|
||||||
|
|
||||||
@ -243,6 +246,8 @@ public int run(String[] args) throws Exception {
|
|||||||
numRuns = Integer.parseInt(args[++i]);
|
numRuns = Integer.parseInt(args[++i]);
|
||||||
} else if (args[i].equals("-baseDir")) {
|
} else if (args[i].equals("-baseDir")) {
|
||||||
BASE_DIR = new Path(args[++i]);
|
BASE_DIR = new Path(args[++i]);
|
||||||
|
INPUT_DIR = new Path(BASE_DIR, DEFAULT_INPUT_SUB);
|
||||||
|
OUTPUT_DIR = new Path(BASE_DIR, DEFAULT_OUTPUT_SUB);
|
||||||
} else if (args[i].equals("-maps")) {
|
} else if (args[i].equals("-maps")) {
|
||||||
numMaps = Integer.parseInt(args[++i]);
|
numMaps = Integer.parseInt(args[++i]);
|
||||||
} else if (args[i].equals("-reduces")) {
|
} else if (args[i].equals("-reduces")) {
|
||||||
@ -283,14 +288,15 @@ public int run(String[] args) throws Exception {
|
|||||||
Path inputFile = new Path(INPUT_DIR, "input_" + (new Random()).nextInt() + ".txt");
|
Path inputFile = new Path(INPUT_DIR, "input_" + (new Random()).nextInt() + ".txt");
|
||||||
generateTextFile(fs, inputFile, inputLines, inputSortOrder);
|
generateTextFile(fs, inputFile, inputLines, inputSortOrder);
|
||||||
|
|
||||||
// setup test output directory
|
|
||||||
fs.mkdirs(BASE_DIR);
|
|
||||||
ArrayList<Long> execTimes = new ArrayList<Long>();
|
ArrayList<Long> execTimes = new ArrayList<Long>();
|
||||||
try {
|
try {
|
||||||
execTimes = runJobInSequence(jobConf, numRuns);
|
execTimes = runJobInSequence(jobConf, numRuns);
|
||||||
} finally {
|
} finally {
|
||||||
// delete output -- should we really do this?
|
// delete all generated data -- should we really do this?
|
||||||
fs.delete(BASE_DIR, true);
|
// we don't know how much of the path was created for the run but this
|
||||||
|
// cleans up as much as we can
|
||||||
|
fs.delete(OUTPUT_DIR, true);
|
||||||
|
fs.delete(INPUT_DIR, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
|
Loading…
Reference in New Issue
Block a user