Search Results for

Show / Hide Table of Contents

# Interface IComputeJob<TRes>

Defines executable unit for IComputeTask<TArg, TJobRes, TRes>. Ignite task gets split into jobs when Map(IList<IClusterNode>, TArg) method is called. This method returns all jobs for the task mapped to their corresponding Ignite nodes for execution. Grid will then serialize this jobs and send them to requested nodes for execution.

Once job execution is complete, the return value will be sent back to parent task and will be passed into OnResult(IComputeJobResult<TJobRes>, IList<IComputeJobResult<TJobRes>>) method via IComputeJobResult<TRes> instance.

Ignite job implementation can be injected with IIgnite using InstanceResourceAttribute attribute.

###### Namespace: Apache.Ignite.Core.Compute

###### Assembly: Apache.Ignite.Core.dll

##### Syntax

    public interface IComputeJob<out TRes>

##### Type Parameters

Name | Description
--- | ---
TRes |

### Methods

#### Cancel()

This method is called when system detects that completion of this job can no longer alter the overall outcome (for example, when parent task has already reduced the results).

Note that job cancellation is only a hint, and it is really up to the actual job instance to gracefully finish execution and exit.

##### Declaration

    void Cancel()

#### Execute()

Executes this job.

##### Declaration

    TRes Execute()

##### Returns

Type | Description
--- | ---
TRes | Job execution result (possibly `null`). This result will be returned in IComputeJobResult<TRes> object passed into OnResult(IComputeJobResult<TJobRes>, IList<IComputeJobResult<TJobRes>>) on caller node.