Implementing dynamic task activation
- Last UpdatedDec 04, 2023
- 1 minute read
TaskManager supports multiple active tasks.
-
A task can exist in four different states: waiting, running, success, and fail.
-
At the beginning of the procedure, only a few tasks should be active.
-
As activities proceed, the success or failed completion of tasks triggers other tasks to activate.
-
Starting a task does not mean to start its children. Each task must be directly activated.
-
Similarly, completing all the children tasks does not automatically trigger the success state of the parent task. This means that there must be at least one end condition for each task.
Activating tasks
There are two way to activate a task from another task.
Activating tasks on entering
Usually a parent task starts one or more child tasks when it becomes active (passes from waiting to running state). To do this, add a list of tasks to be started inside startTask field.
<task name="t2" startTasks="t2_1,t2_2,t2_3">
<task name="t2_1" >
</task>
<task name="t2_2" >
</task>
<task name="t2_3" >
</task>
</task>
A task can automatically start not only its children tasks, but any needed task. For example, the root missione task must start at least one of the high-level tasks.
Activating tasks on exiting
Use this kind of activation when you want to bind a task start to the end of another one.
<task name="t4_1" >
<end condition="@skip.keyDown.isModified@==true" startTasks="t4_2" />
</task>