public class FitnessTask extends ComputeTaskAdapter<List<Long>,Boolean>
Constructor and Description |
---|
FitnessTask(GAConfiguration cfg) |
Modifier and Type | Method and Description |
---|---|
Map |
map(List<ClusterNode> nodes,
List<Long> chromosomeKeys)
This method is called to map or split grid task into multiple grid jobs.
|
Boolean |
reduce(List<ComputeJobResult> list)
Reduces (or aggregates) results received so far into one compound result to be returned to
caller via
ComputeTaskFuture.get() method. |
ComputeJobResultPolicy |
result(ComputeJobResult res,
List<ComputeJobResult> rcvd)
Default implementation which will wait for all jobs to complete before
calling
ComputeTask.reduce(List) method. |
public FitnessTask(GAConfiguration cfg)
cfg
- GAConfigurationpublic Map map(List<ClusterNode> nodes, List<Long> chromosomeKeys) throws IgniteException
ComputeTask
nodes
- List of ClusterNodechromosomeKeys
- List of chromosome keysIgniteException
- If mapping could not complete successfully. This exception will be
thrown out of ComputeTaskFuture.get()
method.public Boolean reduce(List<ComputeJobResult> list) throws IgniteException
ComputeTask
ComputeTaskFuture.get()
method.
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.
list
- List of ComputeJobResultIgniteException
- If reduction or results caused an error. This exception will
be thrown out of ComputeTaskFuture.get()
method.public ComputeJobResultPolicy result(ComputeJobResult res, List<ComputeJobResult> rcvd)
ComputeTaskAdapter
ComputeTask.reduce(List)
method.
If remote job resulted in exception (ComputeJobResult.getException()
is not null
),
then ComputeJobResultPolicy.FAILOVER
policy will be returned if the exception is instance
of ClusterTopologyException
or 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.
result
in interface ComputeTask<List<Long>,Boolean>
result
in class ComputeTaskAdapter<List<Long>,Boolean>
res
- ComputeJobResultrcvd
- List of ComputeJobResult
Follow @ApacheIgnite
Ignite Database and Caching Platform : ver. 2.7.2 Release Date : February 6 2019