Search Results for

    Show / Hide Table of Contents

    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
    System.Object
    ComputeTaskAdapter<TArg, TJobRes, TTaskRes>
    ComputeTaskSplitAdapter<TArg, TJobRes, TTaskRes>
    Implements
    IComputeTask<TArg, TJobRes, TTaskRes>
    Inherited Members
    ComputeTaskAdapter<TArg, TJobRes, TTaskRes>.OnResult(IComputeJobResult<TJobRes>, IList<IComputeJobResult<TJobRes>>)
    ComputeTaskAdapter<TArg, TJobRes, TTaskRes>.Map(IList<IClusterNode>, TArg)
    ComputeTaskAdapter<TArg, TJobRes, TTaskRes>.Reduce(IList<IComputeJobResult<TJobRes>>)
    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 null. This is the same argument as the one passed into ICompute.Execute() methods.

    Returns
    Type Description
    IDictionary<IComputeJob<TJobRes>, IClusterNode>

    Map of Ignite jobs assigned to subgrid node. If null or empty map is returned, exception will be thrown.

    Overrides
    Apache.Ignite.Core.Compute.ComputeTaskAdapter<TArg, TJobRes, TTaskRes>.Map(IList<Apache.Ignite.Core.Cluster.IClusterNode>, TArg)
    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 null.

    Returns
    Type Description
    ICollection<IComputeJob<TJobRes>>

    Implements

    IComputeTask<TArg, TJobRes, TRes>
    In This Article
    Back to top © 2015 - 2019 The Apache Software Foundation