> Hi,
>
> I need to execute long duration task from another task in parallel mode.
Welcome to the complex world of task scheduling. This should be easily accomplished by just setting both the parent and child to the same priority. This would cause the tasks to alternate actions unless a wait is encountered. If there is a wait then any task with any priority is allowed to run while the wait is in affect. That is how it worked several versions ago.
However several users were looking for a true subroutine out of the preform task action. IE-- Make it so the child has to be completed before the parent can continue.
So the developer added a special parent child relationship to the preform task action to ensure this. So this is where we are at for better or worse....
There are 2 work arounds for this issue.
The first is to make a profile with a 'variable set' context that will do the preform task action. So whenever you want to do a preform task action you simply set a global variable to the name of the desired task to run. This will trigger the profile and run your task free of the restriction.
The second is to start a second iteration of the child task from with the child task itself. You need to set the task collision settings to 'abort existing task' so when the second iteration runs it kills the first iteration and releases the restriction. Here is a example of how it would work.
Parent_pg (784)
<start>
A1: Anchor
A2: Flash [ Text:Parent start Long:Off ]
A3: Perform Task [ Name:Child_pg Priority:%priority Parameter 1 (%par1):1 Parameter 2 (%par2): Return Value Variable: Stop:Off ]
A4: Flash [ Text:Parent end Long:Off ]
Child_pg (785)
Abort Existing Task
A1: Flash [ Text:First iteration Long:Off ] If [ %par1 ~ 1 ]
A2: Flash [ Text:Second iteration Long:Off ] If [ %par1 ~ 2 ]
A3: Perform Task [ Name:Child_pg Priority:%priority Parameter 1 (%par1):2 Parameter 2 (%par2): Return Value Variable: Stop:Off ] If [ %par1 ~ 1 ]
A4: Flash [ Text:Starting child wait Long:Off ]
A5: Wait [ MS:0 Seconds:10 Minutes:0 Hours:0 Days:0 ]
A6: Beep [ Frequency:8000 Duration:1000 Amplitude:50 Stream:3 ]
> Big thanks! - I used the second option and it works like a charm :)
>
> It will be nice to have a option in Perform task action to control this behavior.
> Something like "Perform task as a function" (perform task and wait for result) and "Start task" (Perform task in background and immediately continue. Result will not be available)
>
Yes, I do feel this is issue that should should be addressed. The problem with either of these awkward work arounds is you can no longer use the 'Return' action. I am sure Pent will be very busy with the android N update but hopefully he will eventually be able to get a fix in place.
Rich..
It will be nice to have a option in Perform task action to control this behavior.Something like "Perform task as a function" (perform task and wait for result) and "Start task" (Perform task in background and immediately continue. Result will not be available)