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

This class defines simplified adapter for IComputeTask<A,T,R>. This adapter can be used when jobs can be randomly assigned to available grid nodes. This adapter is sufficient in most homogeneous environments where all nodes are equally suitable for executing grid job, see Split method for more details. More...

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

Public Member Functions

override 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...
 
- Public Member Functions inherited from GridGain.Compute.ComputeTaskAdapter< A, T, R >
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 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...
 

Protected Member Functions

abstract ICollection< IComputeJob< T > > Split (int gridSize, A arg)
 This is a simplified version of IComputeTask<A,T,R>.Map method. This method basically takes given argument and splits it into a collection of GridGain.Compute.IComputeJob using provided grid size as indication of how many node are available. These jobs will be randomly mapped to available grid nodes. Note that if number of jobs is greater than number of grid nodes (i.e, grid size), the grid nodes will be reused and some jobs will end up on the same grid nodes. More...
 

Detailed Description

Member Function Documentation

override IDictionary<IComputeJob<T>, IClusterNode> GridGain.Compute.ComputeTaskSplitAdapter< A, T, R >.Map ( IList< IClusterNode >  subgrid,
A  arg 
)
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.
Exceptions
GridGain.Common.GridExceptionSplit returned no jobs.

Implements GridGain.Compute.ComputeTaskAdapter< A, T, R >.

abstract ICollection<IComputeJob<T> > GridGain.Compute.ComputeTaskSplitAdapter< A, T, R >.Split ( int  gridSize,
A  arg 
)
protectedpure virtual
Parameters
gridSizeNumber of available grid nodes. Note that returned number of jobs can be less, equal or greater than this grid size.
argTask execution argument. Can be null.