Class ComputeTaskSplitAdapter<TArg, TJobRes, TTaskRes>
This class defines simplified adapter for IComputeTask<TArg, TJobRes, TRes>. This adapter can be used when jobs can be randomly assigned to available Ignite nodes. This adapter is sufficient in most homogeneous environments where all nodes are equally suitable for executing grid job, see Split(Int32, TArg) method for more details.
Inheritance
Implements
Inherited Members
Namespace: Apache.Ignite.Core.Compute
Assembly: Apache.Ignite.Core.dll
Syntax
public abstract class ComputeTaskSplitAdapter<TArg, TJobRes, TTaskRes> : ComputeTaskAdapter<TArg, TJobRes, TTaskRes>, IComputeTask<TArg, TJobRes, TTaskRes>
Type Parameters
Name | Description |
---|---|
TArg | |
TJobRes | |
TTaskRes |
Methods
Map(IList<IClusterNode>, TArg)
This method is called to map or split Ignite task into multiple Ignite jobs. This is the first method that gets called when task execution starts.
Declaration
public override IDictionary<IComputeJob<TJobRes>, IClusterNode> Map(IList<IClusterNode> subgrid, TArg arg)
Parameters
Type | Name | Description |
---|---|---|
IList<IClusterNode> | subgrid | Nodes 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 Ignite nodes, the order of nodes will be random which over time should result into all nodes being used equally. |
TArg | arg | Task execution argument. Can be |
Returns
Type | Description |
---|---|
IDictionary<IComputeJob<TJobRes>, IClusterNode> | Map of Ignite jobs assigned to subgrid node. If |
Overrides
Exceptions
Type | Condition |
---|---|
IgniteException | Split returned no jobs. |
Split(Int32, TArg)
This is a simplified version of Map(IList<IClusterNode>, TArg) method.
This method basically takes given argument and splits it into a collection of Apache.Ignite.Core.Impl.Compute.IComputeJob using provided grid size as indication of how many node are available. These jobs will be randomly mapped to available Ignite nodes. Note that if number of jobs is greater than number of Ignite nodes (i.e, grid size), the grid nodes will be reused and some jobs will end up on the same Ignite nodes.
Declaration
protected abstract ICollection<IComputeJob<TJobRes>> Split(int gridSize, TArg arg)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | gridSize | Number of available Ignite nodes. Note that returned number of jobs can be less, equal or greater than this grid size. |
TArg | arg | Task execution argument. Can be |
Returns
Type | Description |
---|---|
ICollection<IComputeJob<TJobRes>> |