Cyclic Event - 3 Tasks

Discuss RoboTask here
Post Reply
Helix78
Posts: 11
Joined: Tue May 27, 2014 9:17 am

Cyclic Event - 3 Tasks

Post by Helix78 »

I have to run 3 similar tasks frequently. The interval is not crucial but should be all 5-10 minutes.
During the operation of 1 task the other 2 tasks shall pause or not operate to not interfere with each other.
With 2 tasks it is easy, I would disable the other task or wait for finish.
I don't know the exact runtime of each task so I cannot set cyclic events of starting each 5 minutes the next task. Maybe one task hasn't finished within these 5 minutes.
If I disable the other tasks ans enable after finishing the 1st task they start immediately simultaneously...

Does someone have a brain input for me?
Oleg
Site Admin
Posts: 3202
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Re: Cyclic Event - 3 Tasks

Post by Oleg »

I think that the best way to solve this is to run the tasks sequentially.

suppose you have 3 tasks:
Task1
Task2
Task3

You need to run these tasks periodically but you need to guarantee that each task is being executed when other tasks are stopped.

You can make 4-th task with such actions :
start task1 and wait for finish
start task2 and wait for finish
start task3 and wait for finish


See action Start Task
Attach cyclic event to this task and remove triggering events from task1, task2, task3

This garantees that these tasks will not be overlapped.

2-nd way
Put the action "Wait for Task" in the beginning of each task.
If you have 3 tasks you need to wait 2 other tasks (you have to make 2 steps)
Pay attention that that you need to avoid "Infinity" parameter because you can to get "deadlock"
Oleg Yershov
Helix78
Posts: 11
Joined: Tue May 27, 2014 9:17 am

Re: Cyclic Event - 3 Tasks

Post by Helix78 »

Method 1 works perfectly! Thank you

Method 2 won't work because during waiting for task 2, task 1 could start in between. The waiting for tasks works sequentially not cummulative.
Post Reply