Parallel group execution optimization #14149
Nickqiaoo
started this conversation in
Suggestion
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Self Checks
1. Is this request related to a challenge you're experiencing? Tell me about your story.
#12848

I create a workflow like this, I think 5 should wait for the completion of 1 and 2 before running, but in reality, 5 ran multiple times.
I read the code related to graphs.If the graph is like this:
Since nodes 1, 2, 3, and 4 are grouped into a parallel group and node 5 is the merge node, in parallel execution, the parallel branches are (1 3), (2 3), and (4). Node 3 is executed twice. I believe the root cause of the problem is that the parallel group division is not reasonable.
2. Additional context or comments
To solve this problem, I propose this solution: if a node's parallel branches are followed by multiple merge nodes, it indicates that some branches have merged prematurely. To be compatible with the existing parallel group algorithm, I will add a segment of processing code. Before these prematurely merged branches, some virtual nodes will be inserted to ensure the normal operation of the existing parallel group algorithm, minimizing code changes.
Just like this:
Before:
After:
I wrote a piece of test code in Go, referencing the implementation of recursivelyAddParallels in the graph, reused some of the code, and implemented this logic.
The recursivelyAddVirtualNode function needs to be called before the recursivelyAddParallels function. It will modify the graph by inserting virtual nodes to match the existing parallel group execution logic. Modifying the way parallel groups are constructed could also solve the problem, but this would require more extensive code changes to both the graph and graph_engine, which is prone to errors. I believe that using the method of inserting virtual nodes is simpler to implement and only requires minor modifications to the graph_engine to handle virtual nodes specially when encountered.
3. Can you help us with this feature?
Beta Was this translation helpful? Give feedback.
All reactions