Public Member Functions | List of all members
GridGain.Compute.ComputeTaskAdapter< A, T, R > Class Template Referenceabstract

Convenience adapter for GridGain.Compute.IComputeTask<A, T, R> interface More...

Inherits GridGain.Compute.IComputeTask< A, T, R >.

Inherited by GridGain.Compute.ComputeTaskSplitAdapter< A, T, R >.

Public Member Functions

virtual ComputeJobResultPolicy Result (IComputeJobResult< T > res, IList< IComputeJobResult< T >> rcvd)
 Default implementation which will wait for all jobs to complete before calling GridGain.Compute.IComputeTask<A, T, R>.Reduce method. If remote job resulted in exception GridGain.Compute.IComputeJobResult<T>.Exception() is not null), then GridGain.Compute.ComputeJobResultPolicy.FAILOVER policy will be returned if the exception is instance of ClusterTopologyException or GridGain.Compute.ComputeExecutionRejectedException, which means that remote node either failed or job execution was rejected before it got a chance to start. In all other cases the exception will be rethrown which will ultimately cause task to fail. More...
 
abstract IDictionary< IComputeJob< T >, IClusterNode > Map (IList< IClusterNode > subgrid, A arg)
 This method is called to map or split grid task into multiple grid jobs. This is the first method that gets called when task execution starts. More...
 
abstract R Reduce (IList< IComputeJobResult< T >> results)
 Reduces (or aggregates) results received so far into one compound result to be returned to caller via future. More...
 

Detailed Description

Member Function Documentation

abstract IDictionary<IComputeJob<T>, IClusterNode> GridGain.Compute.ComputeTaskAdapter< A, T, R >.Map ( IList< IClusterNode >  subgrid,
A  arg 
)
pure virtual
Parameters
subgridNodes available for this task execution. Note that order of nodes is guaranteed to be randomized by container. This ensures that every time you simply iterate through grid nodes, the order of nodes will be random which over time should result into all nodes being used equally.
argTask execution argument. Can be null. This is the same argument as the one passed into ICompute.Execute() methods.
Returns
Map of grid jobs assigned to subgrid node. If null or empty map is returned, exception will be thrown.

Implemented in GridGain.Compute.ComputeTaskSplitAdapter< A, T, R >.

abstract R GridGain.Compute.ComputeTaskAdapter< A, T, R >.Reduce ( IList< IComputeJobResult< T >>  results)
pure virtual

Note, that if some jobs did not succeed and could not be failed over then the list of results passed into this method will include the failed results. Otherwise, failed results will not be in the list.

Parameters
resultsReceived job results. Note that if task class has ComputeTaskNoResultCacheAttribute attribute, then this list will be empty.
Returns
Task result constructed from results of remote executions.
virtual ComputeJobResultPolicy GridGain.Compute.ComputeTaskAdapter< A, T, R >.Result ( IComputeJobResult< T >  res,
IList< IComputeJobResult< T >>  rcvd 
)
virtual
Parameters
resReceived remote grid executable result.
rcvdAll previously received results.
Returns
Result policy that dictates how to process further upcoming job results.