示例#1
0
        public override void InnerRun()
        {
            // kör, bara kör!
            Console.WriteLine("WorkerJob: Started, JobType: " + JobType);

            try
            {
                var sandboxargs = new SandboxedJobArgs();
                foreach (var k in JobArgs.GetKeys())
                    foreach (var v in JobArgs.GetValues(k))
                        sandboxargs.Add(k, v);

                var sandboxtool = Sandbox.CreateInstanceAndUnwrap("Possan.Distributed.Sandbox", "Possan.Distributed.Sandbox.SandboxProxy") as ISandboxProxy;
                if (sandboxtool != null)
                    sandboxtool.RunJob(Sandbox, JobType, sandboxargs);
            }
            catch (Exception z)
            {
                Console.WriteLine("Creating mapper failed: " + z);
            }

            var wc = new WebClient();
            var postdata = "{\"url\":\"" + MyUrl + "\",\"job\":\"" + ID + "\"}";
            wc.UploadString(CallbackUrl, postdata);

            Console.WriteLine("WorkerJob: All done, clean up.");

            // delete folder...
        }
示例#2
0
        public static SandboxedJobArgs Parse(IEnumerable<string> args)
        {
            // Dictionary<string,List<string>> ret = new Dictionary<string, List<string>>();
            // return ret;

            var ret = new SandboxedJobArgs();
            foreach (var a in args)
            {
                var splitindex = a.IndexOf(":=");
                if (splitindex == -1)
                    continue;

                ret.Add(a.Substring(0, splitindex), a.Substring(splitindex + 2));
            }

            return ret;
        }