-
Notifications
You must be signed in to change notification settings - Fork 849
Open
Description
Background
From the source code, I'm not sure whether the current pocketflow mechanism supports heterogeneous downstream nodes to be executed in parallel. Therefore, I proposed two ways of implementing it:
- Method one is like add the nodes one by one in a flat way
- I personally fond of method two, where we need to hack pocketflow to accept a list for multiple downstream nodes.
Method 1
def create_fanout_flow():
"""Create and configure the fan-out test flow."""
# Create nodes
print_one = PrintOneNode()
fanout_print = [PrintTwoPointOneNode(), PrintTwoPointTwoNode()]
print_three = PrintThreeNode()
# Configure transitions
print_one - "fanout" >> fanout_print[0]
print_one - "fanout" >> fanout_print[1]
fanout_print[0] - "final" >> print_three
fanout_print[1] - "final" >> print_three
Method 2
def create_fanout_flow():
"""Create and configure the fan-out test flow."""
# Create nodes
print_one = PrintOneNode()
fanout_print = [PrintTwoPointOneNode(), PrintTwoPointTwoNode()]
print_three = PrintThreeNode()
# Configure transitions
print_one - "fanout" >> fanout_print
fanout_print - "final" >> print_three
Metadata
Metadata
Assignees
Labels
No labels