Esempio n. 1
0
 public string Run(ISandboxedJobArgs args)
 {
     Console.WriteLine("TestJob called.");
     IMapper tmp = new TestMapper();
     tmp.Map("x", "apa bpa cpa dpa", new DummyCollector());
     Console.WriteLine("TestJob done.");
     return "";
 }
Esempio n. 2
0
        public string Run(ISandboxedJobArgs args)
        {
            Console.WriteLine("Inside map job");

            string mappertype = args.Get("mapper");

            var mapper = Activator.CreateInstance(Type.GetType(mappertype)) as IMapper;
            var reader = JobUtilities.ParseAndCreateFileSource(args.Get("input"));
            var writer = JobUtilities.ParseAndCreateFileDestination(args.Get("output"));

            Mapper.Map(reader, writer, mapper);

            return "Map result.";
        }
Esempio n. 3
0
        public string Run(ISandboxedJobArgs args)
        {
            Console.WriteLine("Inside reduce job");

            string reducertype = args.Get("reducer");
            var reducer = Activator.CreateInstance(Type.GetType(reducertype)) as IReducer;

            var reader = JobUtilities.ParseAndCreateFileSource(args.Get("input"));

            var writer = JobUtilities.ParseAndCreateFileDestination(args.Get("output"));

            Reducer.Reduce(reader, writer, reducer);

            return "Reduce result.";
        }
Esempio n. 4
0
        public string Run(ISandboxedJobArgs args)
        {
            Console.WriteLine("Inside shuffle job");

            string partitionertype = args.Get("partitioner");
            var partitioner = Activator.CreateInstance(Type.GetType(partitionertype)) as IShardingPartitioner;

            bool sort = (int.Parse(args.Get("sort", "1")) == 1);

            var inputs = JobUtilities.ParseAndCreateFileSources(args.GetValues("input"));

            var outputs = JobUtilities.ParseAndCreateFileDestinations(args.GetValues("output"));

            Splitter.Split(inputs, outputs, partitioner, sort);

            return "Shuffle result.";
        }
Esempio n. 5
0
        public string RunJob(AppDomain domain, string jobtype, ISandboxedJobArgs args)
        {
            string ret = "";
            Console.WriteLine("SandboxProxy: Trying to create a " + jobtype);
            try
            {
                var aa = jobtype.Split(',');

                var t = domain.CreateInstanceAndUnwrap(aa[1].Trim(), aa[0].Trim()) as ISandboxedJob;
                // var t = Activator.CreateInstance(Type.GetType(jobtype)) as ISandboxedJob;
                Console.WriteLine("Created type " + t);
                Console.WriteLine("---------------------------------------------------------");
                ret = t.Run(args);
                Console.WriteLine("---------------------------------------------------------");
            }
            catch (Exception z)
            {
                Console.WriteLine(z);
            }
            return ret;
        }