public int run ( final String [ ] args ) throws Exception { String input = args [ 0 ] ; String output = args [ 1 ] ; Configuration conf = super . getConf ( ) ; writeInput ( conf , new Path ( input ) ) ; setupSecondarySort ( conf ) ; Job job = new Job ( conf ) ; job . setJarByClass ( SecondarySort . class ) ; job . setMapperClass ( Map . class ) ; job . setReducerClass ( Reduce . class ) ; job . setMapOutputKeyClass ( Tuple . class ) ; job . setMapOutputValueClass ( Text . class ) ; Path outputPath = new Path ( output ) ; FileInputFormat . setInputPaths ( job , input ) ; FileOutputFormat . setOutputPath ( job , outputPath ) ; if ( job . waitForCompletion ( true ) ) { return 0 ; } return 1 ; }
The MapReduce driver - setup and launch the job .