Пример #1
0
        /// <summary>
        /// <inheritDoc/>
        ///
        /// </summary>
        /// <exception cref="System.Exception"/>
        public int Run(string[] args)
        {
            //parse arguments
            if (args.Length != DistSum.Parameters.Count + 2)
            {
                return(Org.Apache.Hadoop.Examples.PI.Util.PrintUsage(args, GetType().FullName + " <name> <sigma> "
                                                                     + DistSum.Parameters.List + "\n  <name> The name." + "\n  <sigma> The summation."
                                                                     + DistSum.Parameters.Description));
            }
            int       i     = 0;
            string    name  = args[i++];
            Summation sigma = Summation.ValueOf(args[i++]);

            SetParameters(DistSum.Parameters.Parse(args, i));
            [email protected]();
            [email protected]("name  = " + name);
            [email protected]("sigma = " + sigma);
            [email protected](parameters);
            [email protected]();
            //run jobs
            Summation result = Execute(name, sigma);

            if (result.Equals(sigma))
            {
                sigma.SetValue(result.GetValue());
                timer.Tick("\n\nDONE\n\nsigma=" + sigma);
                return(0);
            }
            else
            {
                timer.Tick("\n\nDONE WITH ERROR\n\nresult=" + result);
                return(1);
            }
        }
Пример #2
0
 /// <summary>Read sigma from conf</summary>
 public static Summation Read(Type clazz, Configuration conf)
 {
     return(Summation.ValueOf(conf.Get(clazz.Name + ".sigma")));
 }