You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-dev@hadoop.apache.org by "Raghu Angadi (JIRA)" <ji...@apache.org> on 2007/01/03 01:35:27 UTC

[jira] Commented: (HADOOP-59) support generic command-line options

    [ https://issues.apache.org/jira/browse/HADOOP-59?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12461878 ] 

Raghu Angadi commented on HADOOP-59:
------------------------------------


I know this is very old bug.. 

Owen Wrote:

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

I think it does not need to be inheritence based. All we need is to make static member parseGenericOptions() public. This does not address other issues oven brings up.  Then it can be used like:

   String[] commandArgs = ToolBase.processGenericOptions(conf, argv); // In that case it need not be called ToolBase :)
   // rest as before.

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

Above can also be supported without changing much I guess.. with another static function.


> support generic command-line options
> ------------------------------------
>
>                 Key: HADOOP-59
>                 URL: https://issues.apache.org/jira/browse/HADOOP-59
>             Project: Hadoop
>          Issue Type: Improvement
>          Components: conf
>    Affects Versions: 0.2.0
>            Reporter: Doug Cutting
>         Assigned To: Hairong Kuang
>            Priority: Minor
>             Fix For: 0.4.0
>
>         Attachments: bashfile.patch, commons-cli-2.0-SNAPSHOT.jar, genericCommand.patch, Tool.java, ToolBase.java, 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: https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira