hadoop-common-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Doug Cutting (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HADOOP-1425) Rework the various programs in 'examples' to extend ToolBase
Date Thu, 24 May 2007 21:36:17 GMT

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

Doug Cutting commented on HADOOP-1425:
--------------------------------------

Owen, your example is not equivalent.  In particular, it doesn't pass remaining command line
parameters to the application, nor does it handle exeptions.

Here's an attempt at making an equivalent example in the style you seem to propose:
{code}
public class Foo {
  public static void runMyCommand(Options options) throws Exception{
     Foo foo = new Foo(Options.getConfiguration());
     ...
  }
  public static void main(String[] argv) throws Exception {
     try {
       Foo.runMyCommand(new OptionParser().parse(argv));
     } catch (Exception e) {
        System.exit(-1);
     }
  }
}
{code}

Is the problem simply that 'doMain' is poorly named?  Would the example be less confusing
if things were named analagously with Thread?
{code}
public class Foo extends ToolBase {
  public run(String[] args) { ... }
  public static void main(String[] argv) throws Exception {
    System.exit(new Foo().start(argv));
  }
}
{code}
The real shame, it seems to me, is that a boilerplate static main is required.  It would be
much simpler if things just implemented Tool.  But then we'd always have to run things through
a framework.  It'd be 'java org.apache.hadoop.util.RunTool org.apache.hadoop.foo.FooTool ...'.
 However if we adopted something like HADOOP-435, where we always used an executable jar,
this could be reduced to 'java -jar hadoop.jar org.apache.hadoop.foo.FooTool ...', or, if
the tool was registered, it could just be ''java -jar hadoop.jar foo ...'.  Or we could simply
change bin/hadoop to always run things with RunTool, so it'd be 'bin/hadoop foo ...' as today.

> Rework the various programs in 'examples' to extend ToolBase 
> -------------------------------------------------------------
>
>                 Key: HADOOP-1425
>                 URL: https://issues.apache.org/jira/browse/HADOOP-1425
>             Project: Hadoop
>          Issue Type: Improvement
>          Components: examples
>            Reporter: Arun C Murthy
>         Assigned To: Enis Soztutar
>            Priority: Minor
>             Fix For: 0.14.0
>
>
> Ensuring all 'examples' extend ToolBase will make it easy to tweak various config params
(via -D switches for e.g.) while running the programs... 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message