if (!cmd.hasOption('n')) {
System.out.println("Need to set the number of messages per edge (-n)");
return -1;
}
int workers = Integer.parseInt(cmd.getOptionValue('w'));
GiraphJob job = new GiraphJob(getConf(), getClass().getName());
job.getConfiguration().setInt(GiraphJob.CHECKPOINT_FREQUENCY, 0);
job.setVertexClass(RandomMessageVertex.class);
job.setVertexInputFormatClass(PseudoRandomVertexInputFormat.class);
job.setWorkerContextClass(RandomMessageBenchmarkWorkerContext.class);
job.setWorkerConfiguration(workers, workers, 100.0f);
job.getConfiguration().setLong(
PseudoRandomVertexInputFormat.AGGREGATE_VERTICES,
Long.parseLong(cmd.getOptionValue('V')));
job.getConfiguration().setLong(
PseudoRandomVertexInputFormat.EDGES_PER_VERTEX,
Long.parseLong(cmd.getOptionValue('e')));
job.getConfiguration().setInt(
SUPERSTEP_COUNT,
Integer.parseInt(cmd.getOptionValue('s')));
job.getConfiguration().setInt(
RandomMessageBenchmark.NUM_BYTES_PER_MESSAGE,
Integer.parseInt(cmd.getOptionValue('b')));
job.getConfiguration().setInt(
RandomMessageBenchmark.NUM_MESSAGES_PER_EDGE,
Integer.parseInt(cmd.getOptionValue('n')));
boolean isVerbose = false;
if (cmd.hasOption('v')) {
isVerbose = true;
}
if (cmd.hasOption('s')) {
getConf().setInt(SUPERSTEP_COUNT,
Integer.parseInt(cmd.getOptionValue('s')));
}
if (cmd.hasOption('f')) {
job.getConfiguration().setInt(GiraphJob.MSG_NUM_FLUSH_THREADS,
Integer.parseInt(cmd.getOptionValue('f')));
}
if (job.run(isVerbose) == true) {
return 0;
} else {
return -1;
}
}