예제 #1
0
        public JObject Main(JObject args)
        {
            try
            {
                var size = args.ContainsKey("size") ? int.Parse(args["size"].ToString()) : 50;
                var max  = args.ContainsKey("max") ? int.Parse(args["max"].ToString()) : 5000;
                var seed = args.ContainsKey("seed") ? int.Parse(args["seed"].ToString()) : -1;
                args["hasCallback"]    = args.ContainsKey("callback");
                args["startTimestamp"] = Util.GetUnixTimestamp();

                var repo  = new CloudObjectStorageRepository(args);
                var hndlr = new FunctionHandler(repo);

                var id = hndlr.CreateMatrix(size, max, seed);

                args["id"]   = id;
                args["size"] = size;
                args["max"]  = max;

                Console.WriteLine(args.ToString());

                return(args);
            }
            catch (Exception e)
            {
                var j = new JObject();
                j["error"] = e.ToString();
                return(j);
            }
        }
예제 #2
0
        public JObject Main(JObject args)
        {
            try
            {
                var repo  = new CloudObjectStorageRepository(args);
                var hndlr = new FunctionHandler(repo);

                hndlr.BuildResultMatrix(args["id"].ToString(), int.Parse(args["worker_count"].ToString()));

                Console.WriteLine(args.ToString());
                return(args);
            }
            catch (Exception e)
            {
                var j = new JObject();
                j["error"] = e.ToString();
                return(j);
            }
        }
예제 #3
0
        public JObject Main(JObject args)
        {
            try
            {
                var repo  = new CloudObjectStorageRepository(args);
                var hndlr = new FunctionHandler(repo);

                hndlr.SerialMultiply(args["id"].ToString());

                Console.WriteLine(args.ToString());
                return(args);
            }
            catch (Exception e)
            {
                var j = new JObject();
                j["error"] = e.ToString();
                return(j);
            }
        }
예제 #4
0
        public JObject Main(JObject args)
        {
            try
            {
                var repo  = new CloudObjectStorageRepository(args);
                var hndlr = new FunctionHandler(repo);

                Console.WriteLine("Generating Report");

                var callback = "";
                if (args.ContainsKey("hasCallback") && args["hasCallback"].ToString() == "true")
                {
                    Console.WriteLine("Using Callback");
                    callback = args["callback"].ToString();
                }
                else
                {
                    callback = null;
                }

                Console.WriteLine("Reading Start Timestamp");
                var start = long.Parse(args["startTimestamp"].ToString());

                var report = hndlr.GenerateReport(callback, start, args["id"].ToString(),
                                                  int.Parse(args["worker_count"].ToString()));

                var l = JsonConvert.SerializeObject(report);

                Console.WriteLine(l);
                return(JObject.Parse(l));
            }
            catch (Exception e)
            {
                var j = new JObject();
                j["error"] = e.ToString();
                return(j);
            }
        }