Question

I need clarity in implementing reduce() and map() methods of GridTask,

How can we Pass arguments to these methods,

Map<? extends GridJob, GridNode> 
  map(List<GridNode> subgrid, T arg) throws GridException

R reduce(List<GridJobResult> results) throws GridException

Specifically, I need to know, how to pass/ invoke reduce method, or if it is invoked implicitly, then how and what arguments are passed to it.

Was it helpful?

Solution

The arguments are passed from GridProjection.execute(...) method.

Every time a GridJob completes, its result is passed to GridTask.result(...) method. The reduce() method is invoked whenever all results from GridJobs are received. You can also force to reduce sooner by returning REDUCE policy form GridTask.result(...) method.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top