Hi sheikhar The deprecated job constructor is actually deprecated according to the job source code . There is another constructor witch is not deprecated ,you can find in the hint raised by eclipse .
发自我的 iPhone 在 2013-4-24,13:53,Chandrashekhar Kotekar <shekhar.kote...@gmail.com> 写道: > Hi, > > > I have observed that there are multiple ways to write driver method of Hadoop > program. > > Following method is given in Hadoop Tutorial by Yahoo > > > public void run(String inputPath, String outputPath) throws Exception { > JobConf conf = new JobConf(WordCount.class); > conf.setJobName("wordcount"); > > // the keys are words (strings) > conf.setOutputKeyClass(Text.class); > // the values are counts (ints) > conf.setOutputValueClass(IntWritable.class); > > conf.setMapperClass(MapClass.class); > conf.setReducerClass(Reduce.class); > > FileInputFormat.addInputPath(conf, new Path(inputPath)); > FileOutputFormat.setOutputPath(conf, new Path(outputPath)); > > JobClient.runJob(conf); > } > and this method is given in Hadoop The Definitive Guide 2012 book by Oreilly. > > > public static void main(String[] args) throws Exception { > if (args.length != 2) { > System.err.println("Usage: MaxTemperature <input path> <output path>"); > System.exit(-1); > } > Job job = new Job(); > job.setJarByClass(MaxTemperature.class); > job.setJobName("Max temperature"); > FileInputFormat.addInputPath(job, new Path(args[0])); > FileOutputFormat.setOutputPath(job, new Path(args[1])); > job.setMapperClass(MaxTemperatureMapper.class); > job.setReducerClass(MaxTemperatureReducer.class); > job.setOutputKeyClass(Text.class); > job.setOutputValueClass(IntWritable.class); > System.exit(job.waitForCompletion(true) ? 0 : 1); > } > While trying program given in Oreilly book I found that constructors of Job > class are deprecated. As Oreilly book is based on Hadoop 2 (yarn) I was > surprised to see that they have used deprecated class. > > I would like to know which method everyone uses? > > > > > > > > > Regards, > Chandrash3khar K0tekar > Mobile - 8884631122 >