Hello,
On Tue, May 3, 2011 at 7:59 PM, Niels Basjes <[email protected]> wrote:
> As far as I understood implementing "Tool" is the way to go with
> hadoop 0.20 and newer.
Ah yes the standard way is ToolRunner, sorry for directly pointing to
GenericOptionsParser. I do not see where you'd have gone wrong with
the code below. Does the following not work?:
$ hadoop jar catalogloader-1.0-SNAPSHOT.jar
nl.basjes.catalogloader.Loader -libjars jar1,jar2,jar3
/user/nbasjes/Minicatalog.xml
> @Override
> public int run(String[] args) throws Exception {
> Configuration config = getConf();
> config.set(TableOutputFormat.OUTPUT_TABLE, "products");
> Job job = new Job(config, "Import product catalog");
> job.setJarByClass(this.getClass());
>
> String input = args[0];
>
> TextInputFormat.setInputPaths(job, new Path(input));
> job.setInputFormatClass(TextInputFormat.class);
> job.setMapperClass(ImportMapper.class);
> job.setNumReduceTasks(0);
>
> job.setOutputFormatClass(TableOutputFormat.class);
>
> job.waitForCompletion(true);
>
> return 0;
> }
>
> public static void main(String[] args) throws Exception {
> Configuration config = HBaseConfiguration.create();
> int result = ToolRunner.run(config, new Loader(), args);
> System.exit(result);
> }
> }
The code is fine I think, since you've used getConf() as expected by Tool :-)
--
Harsh J