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;
}