You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ignite.apache.org by Yakov Zhdanov <yz...@apache.org> on 2017/05/30 09:57:37 UTC

Re: How to return ID of Ignite task to stop this task in the future?

Couple of questions to Igniters (cross-posting to dev list).

1. Why IgniteCompute does not return ComputeTaskFuture from all methods?

2. In GridGain 6.x and earlier there was a method
GridComputeImpl#cancelTask(GridUuid sesId) -
https://github.com/gridgain/gridgain/blob/cf56a35cbae442d11181f58004505d6b00fc2f59/modules/core/src/main/java/org/gridgain/grid/kernal/GridComputeImpl.java,
but I cannot find it in Ignite. Who does know anything on this?

Vadim, it seems that you have 2 options now:
1. You can get future from IgniteCompute#broadcastAsync() and call
Future#cancel() - this works if you do not restart client and cancel your
task from its master node.
2. If you want to restart client node and then somehow manage the spawned
tasks (broadcast() is still a task deep inside Ignite) then first of all
you need to implement org.apache.ignite.compute.ComputeJobMasterLeaveAware
on your Runnables so they do not get automatically cancelled on master
leave. Second, I think you will have to use distributed cache and put some
job related data to it and periodically poll that cache for changes from
your jobs and support job's automatic exit if its data changes accordingly.
Then you can iterate over cache entry set and cancel jobs you want by
changing their data.

--Yakov

Re: How to return ID of Ignite task to stop this task in the future?

Posted by Vladimir Ozerov <vo...@gridgain.com>.
Yakov,

q.1 is answered in separate dev-list topic "IgniteCompute async methods do
not return ComputeTaskFuture".

On Tue, May 30, 2017 at 12:57 PM, Yakov Zhdanov <yz...@apache.org> wrote:

> Couple of questions to Igniters (cross-posting to dev list).
>
> 1. Why IgniteCompute does not return ComputeTaskFuture from all methods?
>
> 2. In GridGain 6.x and earlier there was a method
> GridComputeImpl#cancelTask(GridUuid sesId) - https://github.com/gridgain/
> gridgain/blob/cf56a35cbae442d11181f58004505d6b00fc2f59/modules/core/src/
> main/java/org/gridgain/grid/kernal/GridComputeImpl.java, but I cannot
> find it in Ignite. Who does know anything on this?
>
> Vadim, it seems that you have 2 options now:
> 1. You can get future from IgniteCompute#broadcastAsync() and call
> Future#cancel() - this works if you do not restart client and cancel your
> task from its master node.
> 2. If you want to restart client node and then somehow manage the spawned
> tasks (broadcast() is still a task deep inside Ignite) then first of all
> you need to implement org.apache.ignite.compute.ComputeJobMasterLeaveAware
> on your Runnables so they do not get automatically cancelled on master
> leave. Second, I think you will have to use distributed cache and put some
> job related data to it and periodically poll that cache for changes from
> your jobs and support job's automatic exit if its data changes accordingly.
> Then you can iterate over cache entry set and cancel jobs you want by
> changing their data.
>
> --Yakov
>

Re: How to return ID of Ignite task to stop this task in the future?

Posted by Vladimir Ozerov <vo...@gridgain.com>.
Yakov,

q.1 is answered in separate dev-list topic "IgniteCompute async methods do
not return ComputeTaskFuture".

On Tue, May 30, 2017 at 12:57 PM, Yakov Zhdanov <yz...@apache.org> wrote:

> Couple of questions to Igniters (cross-posting to dev list).
>
> 1. Why IgniteCompute does not return ComputeTaskFuture from all methods?
>
> 2. In GridGain 6.x and earlier there was a method
> GridComputeImpl#cancelTask(GridUuid sesId) - https://github.com/gridgain/
> gridgain/blob/cf56a35cbae442d11181f58004505d6b00fc2f59/modules/core/src/
> main/java/org/gridgain/grid/kernal/GridComputeImpl.java, but I cannot
> find it in Ignite. Who does know anything on this?
>
> Vadim, it seems that you have 2 options now:
> 1. You can get future from IgniteCompute#broadcastAsync() and call
> Future#cancel() - this works if you do not restart client and cancel your
> task from its master node.
> 2. If you want to restart client node and then somehow manage the spawned
> tasks (broadcast() is still a task deep inside Ignite) then first of all
> you need to implement org.apache.ignite.compute.ComputeJobMasterLeaveAware
> on your Runnables so they do not get automatically cancelled on master
> leave. Second, I think you will have to use distributed cache and put some
> job related data to it and periodically poll that cache for changes from
> your jobs and support job's automatic exit if its data changes accordingly.
> Then you can iterate over cache entry set and cancel jobs you want by
> changing their data.
>
> --Yakov
>