A
- Task argument type.R
- Task result type.J
- Job result typepublic abstract class VisorMultiNodeTask<A,R,J> extends Object implements ComputeTask<VisorTaskArgument<A>,R>
Modifier and Type | Field and Description |
---|---|
protected boolean |
debug
Debug flag.
|
protected IgniteEx |
ignite
Auto-injected grid instance.
|
protected long |
start
Task start time.
|
protected A |
taskArg
Task argument.
|
Constructor and Description |
---|
VisorMultiNodeTask() |
Modifier and Type | Method and Description |
---|---|
protected abstract VisorJob<A,J> |
job(A arg) |
protected Collection<UUID> |
jobNodes(VisorTaskArgument<A> arg) |
Map<? extends ComputeJob,ClusterNode> |
map(List<ClusterNode> subgrid,
VisorTaskArgument<A> arg)
This method is called to map or split grid task into multiple grid jobs.
|
protected Map<? extends ComputeJob,ClusterNode> |
map0(List<ClusterNode> subgrid,
VisorTaskArgument<A> arg)
Actual map logic.
|
R |
reduce(List<ComputeJobResult> results)
Reduces (or aggregates) results received so far into one compound result to be returned to
caller via
ComputeTaskFuture.get() method. |
protected abstract R |
reduce0(List<ComputeJobResult> results)
Actual reduce logic.
|
ComputeJobResultPolicy |
result(ComputeJobResult res,
List<ComputeJobResult> rcvd)
Asynchronous callback invoked every time a result from remote execution is
received.
|
@IgniteInstanceResource protected transient IgniteEx ignite
protected boolean debug
protected A taskArg
protected long start
public Map<? extends ComputeJob,ClusterNode> map(List<ClusterNode> subgrid, VisorTaskArgument<A> arg)
map
in interface ComputeTask<VisorTaskArgument<A>,R>
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 grid nodes, the order of nodes will be random which
over time should result into all nodes being used equally.arg
- Task execution argument. Can be null
. This is the same argument
as the one passed into Grid#execute(...)
methods.ComputeTaskContinuousMapper
is
injected into task, if null
or empty map is returned, exception will be thrown.protected Collection<UUID> jobNodes(VisorTaskArgument<A> arg)
protected Map<? extends ComputeJob,ClusterNode> map0(List<ClusterNode> subgrid, VisorTaskArgument<A> arg)
arg
- Task execution argument.subgrid
- Nodes available for this task execution.IgniteException
- If mapping could not complete successfully.public ComputeJobResultPolicy result(ComputeJobResult res, List<ComputeJobResult> rcvd)
ComputeJobResultPolicy
for more information about result policies.result
in interface ComputeTask<VisorTaskArgument<A>,R>
res
- Received remote grid executable result.rcvd
- All previously received results. Note that if task class has
ComputeTaskNoResultCache
annotation, then this list will be empty.@Nullable protected abstract R reduce0(List<ComputeJobResult> results) throws IgniteException
results
- Job results.IgniteException
- If reduction or results caused an error.@Nullable public final R reduce(List<ComputeJobResult> results)
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.
reduce
in interface ComputeTask<VisorTaskArgument<A>,R>
results
- Received results of broadcasted remote executions. Note that if task class has
ComputeTaskNoResultCache
annotation, then this list will be empty.
Follow @ApacheIgnite
Ignite Fabric : ver. 2.3.0 Release Date : October 28 2017