MCPcopy Create free account
hub / github.com/ChunelFeng/CGraph / example_map_reduce

Function example_map_reduce

example/E04-MapReduce.cpp:83–101  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

81
82
83void example_map_reduce() {
84 auto pipeline = GPipelineFactory::create();
85 GElementPtr a, b0, b1, b2, b3, c = nullptr;
86
87 CStatus status;
88 status += pipeline->registerGElement<GenerateGNode>(&a, {});
89 status += pipeline->registerGElement<MapGNode<0>>(&b0, {a});
90 status += pipeline->registerGElement<MapGNode<1>>(&b1, {a});
91 status += pipeline->registerGElement<MapGNode<2>>(&b2, {a});
92 status += pipeline->registerGElement<MapGNode<3>>(&b3, {a});
93 status += pipeline->registerGElement<ReduceGNode>(&c, {b0, b1, b2, b3});
94
95 status += pipeline->process();
96 if (status.isErr()) {
97 CGRAPH_ECHO("example_map_reduce error info is : %s", status.getInfo().c_str());
98 }
99
100 GPipelineFactory::clear();
101}
102
103
104int main() {

Callers 1

mainFunction · 0.85

Calls 5

createFunction · 0.85
CGRAPH_ECHOFunction · 0.85
isErrMethod · 0.80
clearFunction · 0.50
processMethod · 0.45

Tested by

no test coverage detected