A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://hadoop.apache.org/docs/r1.2.1/api/org/apache/hadoop/util/Tool.html below:

Tool (Hadoop 1.2.1 API)

org.apache.hadoop.util
Interface Tool
All Superinterfaces:
Configurable
All Known Implementing Classes:
DBCountPageView, DistributedPentomino, DumpTypedBytes, FsShell, Grep, InputSampler, InputSampler, JobClient, Join, LoadTypedBytes, MigrationTool, MRAdmin, MultiFileWordCount, PiEstimator, RandomTextWriter, RandomWriter, SleepJob, Sort, StreamJob, Submitter, TeraGen, TeraSort, TeraValidate
public interface Tool
extends Configurable

A tool interface that supports handling of generic command-line options.

Tool, is the standard for any Map-Reduce tool/application. The tool/application should delegate the handling of standard command-line options to ToolRunner.run(Tool, String[]) and only handle its custom arguments.

Here is how a typical Tool is implemented:

     public class MyApp extends Configured implements Tool {
     
       public int run(String[] args) throws Exception {
         // Configuration processed by ToolRunner
         Configuration conf = getConf();
         
         // Create a JobConf using the processed conf
         JobConf job = new JobConf(conf, MyApp.class);
         
         // Process custom command-line options
         Path in = new Path(args[1]);
         Path out = new Path(args[2]);
         
         // Specify various job-specific parameters     
         job.setJobName("my-app");
         job.setInputPath(in);
         job.setOutputPath(out);
         job.setMapperClass(MyApp.MyMapper.class);
         job.setReducerClass(MyApp.MyReducer.class);

         // Submit the job, then poll for progress until the job is complete
         JobClient.runJob(job);
       }
       
       public static void main(String[] args) throws Exception {
         // Let ToolRunner handle generic command-line options 
         int res = ToolRunner.run(new Configuration(), new Sort(), args);
         
         System.exit(res);
       }
     }
 
See Also:
GenericOptionsParser, ToolRunner
Method Summary  int run(String[] args)
          Execute the command with the given arguments.     run
int run(String[] args)
        throws Exception
Execute the command with the given arguments.
Parameters:
args - command specific arguments.
Returns:
exit code.
Throws:
Exception
Copyright © 2009 The Apache Software Foundation

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4