in stresso/src/main/java/stresso/trie/Generate.java [133:173]
public int run(String[] args) throws Exception {
if (args.length != 4) {
log.error("Usage: " + this.getClass().getSimpleName()
+ " <numMappers> <numbersPerMapper> <max> <output dir>");
System.exit(-1);
}
int numMappers = Integer.parseInt(args[0]);
int numPerMapper = Integer.parseInt(args[1]);
long max = Long.parseLong(args[2]);
final Path out = new Path(args[3]);
Preconditions.checkArgument(numMappers > 0, "numMappers <= 0");
Preconditions.checkArgument(numPerMapper > 0, "numPerMapper <= 0");
Preconditions.checkArgument(max > 0, "max <= 0");
JobConf job = new JobConf(getConf());
job.setJobName(this.getClass().getName());
job.setJarByClass(Generate.class);
job.setInt(TRIE_GEN_NUM_PER_MAPPER_PROP, numPerMapper);
job.setInt(TRIE_GEN_NUM_MAPPERS_PROP, numMappers);
job.setLong(TRIE_GEN_MAX_PROP, max);
job.setInputFormat(RandomLongInputFormat.class);
job.setNumReduceTasks(0);
job.setOutputKeyClass(LongWritable.class);
job.setOutputValueClass(NullWritable.class);
job.setOutputFormat(SequenceFileOutputFormat.class);
SequenceFileOutputFormat.setOutputPath(job, out);
RunningJob runningJob = JobClient.runJob(job);
runningJob.waitForCompletion();
return runningJob.isSuccessful() ? 0 : -1;
}