hadoop-common-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Owen O'Malley (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HADOOP-59) support generic command-line options
Date Tue, 27 Jun 2006 05:35:30 GMT
    [ http://issues.apache.org/jira/browse/HADOOP-59?page=comments#action_12417960 ] 

Owen O'Malley commented on HADOOP-59:

I'm sorry that I didn't pay paid attention to this issue earlier. 

I think that it is confusing having the cli options segregated. For example, I have a patch
for distcp (aka CopyFiles) that adds a "-i" option to ignore read errors. With this setup,
the user needs to specify the -i *last*.  It implies that the user need to remember what is
a generic option versus what is a command option. (Ok, raise your hand if you can tell me
the difference between "cvs -d foo co bar" and "cvs co -d foo bar". The sad thing is that
I do know and I'm sure a few of you do too. But it certainly does confuse non-experts.)

Furthermore, each application needs to handle --help themselves (and as a side effect adding
a new generic option means updating the usage string in each application).

I haven't used the commons cli library, but I would have prefered something less inhertiance-based,
more like::

Parser cliParser = new GenericOptionsParser();
cliParser.addOption("i", false, "ignore read errors");
cliParser.parse(args, conf);
boolean ignoreErrors = cliParser.hasOption("i");

> support generic command-line options
> ------------------------------------
>          Key: HADOOP-59
>          URL: http://issues.apache.org/jira/browse/HADOOP-59
>      Project: Hadoop
>         Type: Improvement

>   Components: conf
>     Versions: 0.2.0
>     Reporter: Doug Cutting
>     Assignee: Hairong Kuang
>     Priority: Minor
>      Fix For: 0.4.0
>  Attachments: Tool.java, ToolBase.java, bashfile.patch, commons-cli-2.0-SNAPSHOT.jar,
genericCommand.patch, toolbase.patch
> Hadoop commands should all support some common options.  For example, it should be possible
to specify the namenode, datanode, and, for that matter, any config option, in a generic way.
> This could be implemented with code like:
> public interface Tool extends Configurable {
>   void run(String[] args) throws Exception;
> }
> public class ToolBase implements Tool extends Configured {
>   public final void main(String[] args) throws Exception {
>     Configuration conf = new Configuration();
>     ... parse config options from args into conf ...
>     this.configure(conf);
>     this.run();
>   }
> }
> public MyTool extends ExcecutableBase {
>   public static void main(String[] args) throws Exception {
>     new MyTool().main(args);
>   }
> }
> The general command line syntax could be:
> bin/hadoop [generalOptions] command [commandOptions]
> Where generalOptions are things that ToolBase handles, and only the commandOptions are
passed to Tool.run().  The most important generalOption would be '-D', which would define
name/value pairs that are set in the configuration.  This alone would permit folks to set
the namenode, datanode, etc.

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
For more information on JIRA, see:

View raw message