示例#1
0
 public static void main(String[] args)
     throws IOException, InterruptedException, ClassNotFoundException {
   if (args.length < 4) {
     printUsage();
   }
   HamaConfiguration conf = new HamaConfiguration(new Configuration());
   GraphJob graphJob = createJob(args, conf);
   long startTime = System.currentTimeMillis();
   if (graphJob.waitForCompletion(true)) {
     System.out.println(
         "Job Finished in " + (System.currentTimeMillis() - startTime) / 1000.0 + " seconds");
   }
 }
示例#2
0
  public void testMindistSearch() throws Exception {
    generateTestData();
    try {
      GraphJob job = MindistSearch.getJob(INPUT, OUTPUT, Optional.of(3), Optional.of(30));
      job.setInputFormat(SequenceFileInputFormat.class);
      job.setInputKeyClass(LongWritable.class);
      job.setInputValueClass(Text.class);
      assertTrue(job.waitForCompletion(true));

      verifyResult();
    } finally {
      deleteTempDirs();
    }
  }
示例#3
0
  public static void main(String[] args)
      throws IOException, InterruptedException, ClassNotFoundException {
    if (args.length < 3) printUsage();

    // Graph job configuration
    HamaConfiguration conf = new HamaConfiguration();
    GraphJob ssspJob = new GraphJob(conf, SSSP.class);
    // Set the job name
    ssspJob.setJobName("Single Source Shortest Path");

    conf.set(START_VERTEX, args[0]);
    ssspJob.setInputPath(new Path(args[1]));
    ssspJob.setOutputPath(new Path(args[2]));

    if (args.length == 4) {
      ssspJob.setNumBspTask(Integer.parseInt(args[3]));
    }

    ssspJob.setVertexClass(ShortestPathVertex.class);
    ssspJob.setInputFormat(TextInputFormat.class);
    ssspJob.setInputKeyClass(LongWritable.class);
    ssspJob.setInputValueClass(Text.class);

    ssspJob.setPartitioner(HashPartitioner.class);
    ssspJob.setOutputFormat(TextOutputFormat.class);
    ssspJob.setVertexInputReaderClass(SSSPTextReader.class);
    ssspJob.setOutputKeyClass(IntWritable.class);
    ssspJob.setOutputValueClass(IntIntPairWritable.class);
    // Iterate until all the nodes have been reached.
    ssspJob.setMaxIteration(Integer.MAX_VALUE);

    ssspJob.setVertexIDClass(IntWritable.class);
    ssspJob.setVertexValueClass(IntIntPairWritable.class);
    ssspJob.setEdgeValueClass(IntWritable.class);

    long startTime = System.currentTimeMillis();
    if (ssspJob.waitForCompletion(true)) {
      System.out.println(
          "Job Finished in " + (System.currentTimeMillis() - startTime) / 1000.0 + " seconds");
    }
  }