You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by Anil <an...@gmail.com> on 2017/03/07 04:53:23 UTC

Running a IgniteRunnable on local node using compute

Hi,

Are there any settings to use ignite.compute().run() to run the task on
local node ?

i am try to schedule the task on each node using Rx Scheduler. so I am
broadcasting a runnable which initiates the scheduler on each node.

As I know, we cannot run a task on local node using ignite.compute().run().
this will run the task on one of the nodes. correct ?

we can start the thread for runnable instance and this will run the task on
local node. Bu this cannot inject ignite instance into runnable instance.

Do you have any suggestions to achieve this ?

Thanks

Re: Running a IgniteRunnable on local node using compute

Posted by Anil <an...@gmail.com>.
sorry. that was incomplete email. that is working.

On 7 March 2017 at 16:49, Andrey Mashenkov <am...@gridgain.com> wrote:

> Hi Anil,
>
> Do you mean this is not work for you?
>
> new IgniteRunnable() {
>       @IgniteInstanceResource
>       Ignite ignite;
> @Override
> public void run() {
>
> ignite....
>
>         }
> }
>
>
>
>
>
> On Tue, Mar 7, 2017 at 8:43 AM, Anil <an...@gmail.com> wrote:
>
>>
>> ignite.compute(ignite..cluster().forLocal()).run() will run the ignite
>> runnble on local node.
>>
>> final pseudo code -
>>
>> ignite.compute().broadcast(new IgniteRunnable() {
>> @Override
>> public void run() {
>>
>> Observable<Long> o = Observable.timer(((CommonUtils.getCurrentDayTime()
>> + 24 * 60 * 60 * 1000) - System.currentTimeMillis()), 24 * 60 * 60 * 1000, TimeUnit.MILLISECONDS,
>> scheduler);
>> o.subscribe(item -> {
>> ignite.compute(ignite..cluster().forLocal()).run(new
>> IgniteRunnableTask());
>> });
>> }
>> });
>>
>>
>>
>> On 7 March 2017 at 10:23, Anil <an...@gmail.com> wrote:
>>
>>> Hi,
>>>
>>> Are there any settings to use ignite.compute().run() to run the task on
>>> local node ?
>>>
>>> i am try to schedule the task on each node using Rx Scheduler. so I am
>>> broadcasting a runnable which initiates the scheduler on each node.
>>>
>>> As I know, we cannot run a task on local node using
>>> ignite.compute().run(). this will run the task on one of the nodes. correct
>>> ?
>>>
>>> we can start the thread for runnable instance and this will run the task
>>> on local node. Bu this cannot inject ignite instance into runnable instance.
>>>
>>> Do you have any suggestions to achieve this ?
>>>
>>> Thanks
>>>
>>>
>>>
>>
>

Re: Running a IgniteRunnable on local node using compute

Posted by Andrey Mashenkov <am...@gridgain.com>.
Hi Anil,

Do you mean this is not work for you?

new IgniteRunnable() {
      @IgniteInstanceResource
      Ignite ignite;
@Override
public void run() {

ignite....

        }
}





On Tue, Mar 7, 2017 at 8:43 AM, Anil <an...@gmail.com> wrote:

>
> ignite.compute(ignite..cluster().forLocal()).run() will run the ignite
> runnble on local node.
>
> final pseudo code -
>
> ignite.compute().broadcast(new IgniteRunnable() {
> @Override
> public void run() {
>
> Observable<Long> o = Observable.timer(((CommonUtils.getCurrentDayTime() +
> 24 * 60 * 60 * 1000) - System.currentTimeMillis()), 24 * 60 * 60 * 1000, TimeUnit.MILLISECONDS,
> scheduler);
> o.subscribe(item -> {
> ignite.compute(ignite..cluster().forLocal()).run(new
> IgniteRunnableTask());
> });
> }
> });
>
>
>
> On 7 March 2017 at 10:23, Anil <an...@gmail.com> wrote:
>
>> Hi,
>>
>> Are there any settings to use ignite.compute().run() to run the task on
>> local node ?
>>
>> i am try to schedule the task on each node using Rx Scheduler. so I am
>> broadcasting a runnable which initiates the scheduler on each node.
>>
>> As I know, we cannot run a task on local node using
>> ignite.compute().run(). this will run the task on one of the nodes. correct
>> ?
>>
>> we can start the thread for runnable instance and this will run the task
>> on local node. Bu this cannot inject ignite instance into runnable instance.
>>
>> Do you have any suggestions to achieve this ?
>>
>> Thanks
>>
>>
>>
>

Re: Running a IgniteRunnable on local node using compute

Posted by Anil <an...@gmail.com>.
ignite.compute(ignite..cluster().forLocal()).run() will run the ignite
runnble on local node.

final pseudo code -

ignite.compute().broadcast(new IgniteRunnable() {
@Override
public void run() {

Observable<Long> o = Observable.timer(((CommonUtils.getCurrentDayTime() +
24 * 60 * 60 * 1000) - System.currentTimeMillis()), 24 * 60 * 60 *
1000, TimeUnit.MILLISECONDS,
scheduler);
o.subscribe(item -> {
ignite.compute(ignite..cluster().forLocal()).run(new IgniteRunnableTask());
});
}
});



On 7 March 2017 at 10:23, Anil <an...@gmail.com> wrote:

> Hi,
>
> Are there any settings to use ignite.compute().run() to run the task on
> local node ?
>
> i am try to schedule the task on each node using Rx Scheduler. so I am
> broadcasting a runnable which initiates the scheduler on each node.
>
> As I know, we cannot run a task on local node using
> ignite.compute().run(). this will run the task on one of the nodes. correct
> ?
>
> we can start the thread for runnable instance and this will run the task
> on local node. Bu this cannot inject ignite instance into runnable instance.
>
> Do you have any suggestions to achieve this ?
>
> Thanks
>
>
>