正在加载图片...
Case study Main int main(int argc, char** argv)I / Tuning pa Parse CommandLineFlags(argc, argv)i / machines and 100 MB of memory per task spec set machines(2000)i MapReduce Specification spec; spec set_map_megabytes(100)i spec set-reduce_megabytes(100)i / Store list of input files into "spec for(nt1=1;±<argc;±++)( / Now run it MapReduceInput* input spec addinput ()i MapReduceResult resulti input->set_format("text")i if ( MapReduce( spec, &result)) abort (i input->set_filepattern(argv[])i input->set_mapper_ class("Wordcounter )i //Done: r result’ structure contains±nfo // about counters, time taken, number of / machines used, etc. / Specify the output files /gfs/test/freq-00000-of-00100 return /gfs/test/freq-00001-of-00100 MapReduce output* out spec output(i out->set_filebase("/gfs/test/fred")i out->set num tasks(100)i out->set format ("text ")i out->set reducer class("Adder")i / optional: do partial sums within map / tasks to save network bandwidth out->set combiner class("Adder")iCase Study 43 • Main
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有