public static void main(String[] args) throws Exception { int res = ToolRunner.run(new Configuration(), new CredentialsTestJob(), args); System.exit(res); }
public int run(String[] args) throws Exception { Job job = createJob(); return job.waitForCompletion(true) ? 0 : 1; }
public Job createJob() throws IOException { Configuration conf = getConf(); conf.setInt(MRJobConfig.NUM_MAPS, 1); Job job = Job.getInstance(conf, "test"); job.setNumReduceTasks(1); job.setJarByClass(CredentialsTestJob.class); job.setNumReduceTasks(1); job.setMapperClass(CredentialsTestJob.CredentialsTestMapper.class); job.setMapOutputKeyClass(IntWritable.class); job.setMapOutputValueClass(NullWritable.class); job.setReducerClass(CredentialsTestJob.CredentialsTestReducer.class); job.setInputFormatClass(SleepJob.SleepInputFormat.class); job.setPartitionerClass(SleepJob.SleepJobPartitioner.class); job.setOutputFormatClass(NullOutputFormat.class); job.setSpeculativeExecution(false); job.setJobName("test job"); FileInputFormat.addInputPath(job, new Path("ignored")); return job; }
res = ToolRunner.run(jobConf, new CredentialsTestJob(), args); } catch (Exception e) { System.out.println("Job failed with" + e.getLocalizedMessage());