Exemplo n.º 1
0
  private static GraphJob createJob(String[] args, HamaConfiguration conf) throws IOException {
    //        conf.set("hama.graph.vertices.info", "org.apache.hama.graph.InMemoryVerticesInfo");

    conf.setInt("a", Integer.parseInt(args[0]));
    conf.setInt("b", Integer.parseInt(args[1]));

    GraphJob graphJob = new GraphJob(conf, Main.class);
    graphJob.setJobName("Propinquity Dynamics");
    graphJob.setVertexClass(PDVertex.class);
    graphJob.setJar("PropinquityDynamics-1.0-SNAPSHOT.jar");

    if (args.length == 5 && !args[4].isEmpty()) {
      graphJob.setNumBspTask(Integer.parseInt(args[4]));
    } else {
      graphJob.setNumBspTask(10);
    }

    graphJob.setInputPath(new Path(args[2]));
    graphJob.setOutputPath(new Path(args[3]));

    graphJob.setVertexIDClass(Text.class);
    graphJob.setVertexValueClass(MapWritable.class);
    graphJob.setEdgeValueClass(IntWritable.class);

    graphJob.setInputFormat(TextInputFormat.class);
    graphJob.setInputKeyClass(LongWritable.class);
    graphJob.setInputValueClass(Text.class);

    graphJob.setVertexInputReaderClass(PDVertexReader.class);
    graphJob.setPartitioner(HashPartitioner.class);

    graphJob.setVertexOutputWriterClass(PDVertexWriter.class);
    graphJob.setOutputFormat(TextOutputFormat.class);
    graphJob.setOutputKeyClass(Text.class);
    graphJob.setOutputValueClass(Text.class);

    return graphJob;
  }