Package hipi.imagebundle.mapreduce

Examples of hipi.imagebundle.mapreduce.HipiJob


      fs.mkdirs(output_path);
  }

  public int runMeanCompute(String[] args) throws Exception {

    HipiJob job = new HipiJob(getConf(), "Covariance");
    job.setJarByClass(Covariance.class);
    job.setOutputKeyClass(IntWritable.class);
    job.setOutputValueClass(FloatImage.class);

    job.setMapperClass(MeanMap.class);
    job.setCombinerClass(MeanReduce.class);
    job.setReducerClass(MeanReduce.class);

    String inputFileType = args[2];
    if(inputFileType.equals("hib"))
      job.setInputFormatClass(ImageBundleInputFormat.class);
    else {
      System.out.println("Usage: covariance <inputdir> <outputdir> <filetype>");
      System.exit(0);     
    }
    job.setOutputFormatClass(BinaryOutputFormat.class);
    job.setCompressMapOutput(true);
    job.setMapSpeculativeExecution(true);
    job.setReduceSpeculativeExecution(true);

    FileInputFormat.setInputPaths(job, new Path(args[0]));
    mkdir(args[1], job.getConfiguration());
    rmdir(args[1] + "/mean-output/", job.getConfiguration());
    FileOutputFormat.setOutputPath(job, new Path(args[1] + "/mean-output/"));

    boolean success = job.waitForCompletion(true);
    return success ? 0 : 1;
  }
View Full Code Here


    boolean success = job.waitForCompletion(true);
    return success ? 0 : 1;
  }
 
  public int runCovariance(String[] args) throws Exception {
    HipiJob job = new HipiJob(getConf(), "Covariance");
    job.setJarByClass(Covariance.class);

    /* DistributedCache will be deprecated in 0.21 */
    DistributedCache.addCacheFile(new URI("hdfs://" + args[1] + "/mean-output/part-r-00000"), job.getConfiguration());

    job.setOutputKeyClass(IntWritable.class);
    job.setOutputValueClass(FloatImage.class);

    job.setMapperClass(CovarianceMap.class);
    job.setCombinerClass(CovarianceReduce.class);
    job.setReducerClass(CovarianceReduce.class);

    String inputFileType = args[2];
    if(inputFileType.equals("hib"))
      job.setInputFormatClass(ImageBundleInputFormat.class);
    else{
      System.out.println("Usage: covariance <inputdir> <outputdir> <filetype>");
      System.exit(0);     
    }
    job.setOutputFormatClass(BinaryOutputFormat.class);
    job.setCompressMapOutput(true);
    job.setMapSpeculativeExecution(true);
    job.setReduceSpeculativeExecution(true);

    FileInputFormat.setInputPaths(job, new Path(args[0]));
    mkdir(args[1], job.getConfiguration());
    rmdir(args[1] + "/covariance-output/", job.getConfiguration());
    FileOutputFormat.setOutputPath(job, new Path(args[1] + "/covariance-output/"));

    boolean success = job.waitForCompletion(true);
    return success ? 0 : 1;
  }
View Full Code Here

  private HipiJob job;
 
  @Before
  public void setUp() throws Exception {
    Configuration conf = new Configuration();
    job = new HipiJob(conf);
  }
View Full Code Here

TOP

Related Classes of hipi.imagebundle.mapreduce.HipiJob

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.