-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Description
π§ Description:
In my current Taskflow-based task graph, I have multiple CONDITION
tasks. Each of these condition tasks may independently decide whether to proceed to a shared successor task. However, Taskflow's current behavior is such that:
If multiple CONDITION tasks are connected directly to the same successor task, and more than one condition is satisfied, the successor may be executed multiple times.
This leads to unintended duplicate execution of the shared successor.
β What I want:
I would like to implement a logical OR behavior across multiple CONDITION tasks. That is:
- As soon as one CONDITION task evaluates true, the shared successor task is triggered.
- The successor should only execute once, even if multiple conditions are satisfied in parallel.
- Ideally, this could be done elegantly within Taskflow, without managing a lot of external state or condition flags manually.
βMy question:
Is there a recommended pattern or mechanism in Taskflow to handle this situation, such as:
- Using a proxy/gate task that all CONDITION tasks jump to, which in turn ensures single execution of the successor?
- Any idiomatic way to model this OR-type fan-in logic using the existing Taskflow API?
π‘ Example Illustration (what I want):
[ condition_A ] ββ
[ condition_B ] ββ΄ββ> [gate/collector task] ββ> target_task (only if any condition == true)
Each condition runs independently, and the gate task collects the results after all condition tasks complete, decides if the target should proceed.