Пример #1
0
 protected internal static int PrintUsage()
 {
     System.Console.Error.WriteLine("Usage: [-m <maps>] [-r <reduces>]\n" + "       [-keepmap <percent>] [-keepred <percent>]\n"
                                    + "       [-indir <path>] [-outdir <path]\n" + "       [-inFormat[Indirect] <InputFormat>] [-outFormat <OutputFormat>]\n"
                                    + "       [-outKey <WritableComparable>] [-outValue <Writable>]\n");
     GenericOptionsParser.PrintGenericCommandUsage(System.Console.Error);
     return(-1);
 }
Пример #2
0
 private static void PrintUsage(TextWriter err)
 {
     err.WriteLine("fetchdt retrieves delegation tokens from the NameNode");
     err.WriteLine();
     err.WriteLine("fetchdt <opts> <token file>");
     err.WriteLine("Options:");
     err.WriteLine("  --webservice <url>  Url to contact NN on");
     err.WriteLine("  --renewer <name>    Name of the delegation token renewer");
     err.WriteLine("  --cancel            Cancel the delegation token");
     err.WriteLine("  --renew             Renew the delegation token.  Delegation " +
                   "token must have been fetched using the --renewer <name> option.");
     err.WriteLine("  --print             Print the delegation token");
     err.WriteLine();
     GenericOptionsParser.PrintGenericCommandUsage(err);
     ExitUtil.Terminate(1);
 }
Пример #3
0
 internal virtual void PrintUsage()
 {
     // The CLI package should do this for us, but I can't figure out how
     // to make it print something reasonable.
     System.Console.Out.WriteLine("bin/hadoop pipes");
     System.Console.Out.WriteLine("  [-input <path>] // Input directory");
     System.Console.Out.WriteLine("  [-output <path>] // Output directory");
     System.Console.Out.WriteLine("  [-jar <jar file> // jar filename");
     System.Console.Out.WriteLine("  [-inputformat <class>] // InputFormat class");
     System.Console.Out.WriteLine("  [-map <class>] // Java Map class");
     System.Console.Out.WriteLine("  [-partitioner <class>] // Java Partitioner");
     System.Console.Out.WriteLine("  [-reduce <class>] // Java Reduce class");
     System.Console.Out.WriteLine("  [-writer <class>] // Java RecordWriter");
     System.Console.Out.WriteLine("  [-program <executable>] // executable URI");
     System.Console.Out.WriteLine("  [-reduces <num>] // number of reduces");
     System.Console.Out.WriteLine("  [-lazyOutput <true/false>] // createOutputLazily"
                                  );
     System.Console.Out.WriteLine();
     GenericOptionsParser.PrintGenericCommandUsage(System.Console.Out);
 }
Пример #4
0
        /// <summary>Create an Aggregate based map/reduce job.</summary>
        /// <param name="args">
        /// the arguments used for job creation. Generic hadoop
        /// arguments are accepted.
        /// </param>
        /// <param name="caller">the the caller class.</param>
        /// <returns>a JobConf object ready for submission.</returns>
        /// <exception cref="System.IO.IOException"/>
        /// <seealso cref="Org.Apache.Hadoop.Util.GenericOptionsParser"/>
        public static JobConf CreateValueAggregatorJob(string[] args, Type caller)
        {
            Configuration        conf          = new Configuration();
            GenericOptionsParser genericParser = new GenericOptionsParser(conf, args);

            args = genericParser.GetRemainingArgs();
            if (args.Length < 2)
            {
                System.Console.Out.WriteLine("usage: inputDirs outDir " + "[numOfReducer [textinputformat|seq [specfile [jobName]]]]"
                                             );
                GenericOptionsParser.PrintGenericCommandUsage(System.Console.Out);
                System.Environment.Exit(1);
            }
            string inputDir      = args[0];
            string outputDir     = args[1];
            int    numOfReducers = 1;

            if (args.Length > 2)
            {
                numOfReducers = System.Convert.ToInt32(args[2]);
            }
            Type theInputFormat = typeof(TextInputFormat);

            if (args.Length > 3 && args[3].CompareToIgnoreCase("textinputformat") == 0)
            {
                theInputFormat = typeof(TextInputFormat);
            }
            else
            {
                theInputFormat = typeof(SequenceFileInputFormat);
            }
            Path specFile = null;

            if (args.Length > 4)
            {
                specFile = new Path(args[4]);
            }
            string jobName = string.Empty;

            if (args.Length > 5)
            {
                jobName = args[5];
            }
            JobConf theJob = new JobConf(conf);

            if (specFile != null)
            {
                theJob.AddResource(specFile);
            }
            string userJarFile = theJob.Get("user.jar.file");

            if (userJarFile == null)
            {
                theJob.SetJarByClass(caller != null ? caller : typeof(ValueAggregatorJob));
            }
            else
            {
                theJob.SetJar(userJarFile);
            }
            theJob.SetJobName("ValueAggregatorJob: " + jobName);
            FileInputFormat.AddInputPaths(theJob, inputDir);
            theJob.SetInputFormat(theInputFormat);
            theJob.SetMapperClass(typeof(ValueAggregatorMapper));
            FileOutputFormat.SetOutputPath(theJob, new Path(outputDir));
            theJob.SetOutputFormat(typeof(TextOutputFormat));
            theJob.SetMapOutputKeyClass(typeof(Text));
            theJob.SetMapOutputValueClass(typeof(Text));
            theJob.SetOutputKeyClass(typeof(Text));
            theJob.SetOutputValueClass(typeof(Text));
            theJob.SetReducerClass(typeof(ValueAggregatorReducer));
            theJob.SetCombinerClass(typeof(ValueAggregatorCombiner));
            theJob.SetNumMapTasks(1);
            theJob.SetNumReduceTasks(numOfReducers);
            return(theJob);
        }