public class CrossOverTask extends ComputeTaskAdapter<List<Long>,Boolean>
CrossOverTask leverages Ignite's data affinity capabilities for routing CrossOverJobs to primary
IgniteNode
where 'parent' chromosomes reside.
Constructor and Description |
---|
CrossOverTask(GAConfiguration cfg) |
Modifier and Type | Method and Description |
---|---|
Map |
map(List<ClusterNode> nodes,
List<Long> chromosomeKeys)
Map Jobs to nodes using data affinity.
|
Boolean |
reduce(List<ComputeJobResult> list)
We return TRUE if success, else Exection is thrown.
|
ComputeJobResultPolicy |
result(ComputeJobResult res,
List<ComputeJobResult> rcvd)
Default implementation which will wait for all jobs to complete before
calling
ComputeTask.reduce(List) method. |
public CrossOverTask(GAConfiguration cfg)
cfg
- GAConfigurationpublic Map map(List<ClusterNode> nodes, List<Long> chromosomeKeys) throws IgniteException
nodes
- Cluster NodeschromosomeKeys
- Primary keys for respective chromosomesIgniteException
- If mapping could not complete successfully. This exception will be
thrown out of ComputeTaskFuture.get()
method.public Boolean reduce(List<ComputeJobResult> list) throws IgniteException
list
- 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