Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Parallel Execution of Nodes in Workflows #8192

Merged
merged 148 commits into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
148 commits
Select commit Hold shift + click to select a range
8217c46
add new graph structure
takatost Jun 24, 2024
fe27c97
add runtime graph
takatost Jun 25, 2024
216910a
add runtime state of graph
takatost Jun 25, 2024
aaa98c7
optimize
takatost Jun 26, 2024
1d8ecac
save
takatost Jun 26, 2024
8375517
save
takatost Jun 29, 2024
0f19b2a
optimize graph
takatost Jul 2, 2024
1b6cd97
completed graph init test
takatost Jul 4, 2024
03f56a0
refactor graph
takatost Jul 5, 2024
fed068a
Merge branch 'refs/heads/main' into feat/workflow-parallel-support
takatost Jul 7, 2024
1adaf42
refactor graph
takatost Jul 7, 2024
0e885a3
refactor runtime
takatost Jul 8, 2024
d77b689
completed parallel tests
takatost Jul 10, 2024
821e09b
add run logics
takatost Jul 12, 2024
00fb23d
graph engine implement
takatost Jul 15, 2024
00ec36d
add graph engine test
takatost Jul 16, 2024
775e52d
merge
takatost Jul 16, 2024
4ef3d4e
optimize
takatost Jul 16, 2024
16e2d00
optimize
takatost Jul 16, 2024
cc96acd
fix bugs
takatost Jul 17, 2024
90e518b
fix bugs
takatost Jul 17, 2024
f67a88f
fix test
takatost Jul 17, 2024
7ad77e9
fix test
takatost Jul 18, 2024
dad1a96
finished answer stream output
takatost Jul 19, 2024
beaac50
fix bug
takatost Jul 19, 2024
a603e01
fix bug
takatost Jul 22, 2024
2c695de
fix bugs
takatost Jul 22, 2024
0fe5165
Merge branch 'refs/heads/main' into feat/workflow-parallel-support
takatost Jul 23, 2024
7303b53
fix bug
takatost Jul 23, 2024
e9bfeda
Merge branch 'refs/heads/main' into feat/workflow-parallel-support
takatost Jul 23, 2024
ec77607
save
takatost Jul 23, 2024
833584b
Merge branch 'refs/heads/main' into feat/workflow-parallel-support
takatost Jul 24, 2024
f4eb7cd
add end stream output test
takatost Jul 24, 2024
4097f7c
add parallel branch output
takatost Jul 25, 2024
7c67ba8
remove threadpool
takatost Jul 25, 2024
df13316
fix lint
takatost Jul 25, 2024
ae351bd
add iteration support
takatost Jul 25, 2024
a31feac
fix iteration
takatost Jul 25, 2024
38f8c45
add events in interation node
takatost Jul 26, 2024
beea1e1
fix lint
takatost Jul 26, 2024
483f71f
fix logging
takatost Jul 26, 2024
63addf8
add parallel branch events
takatost Jul 26, 2024
88dcd7b
fix bug
takatost Jul 26, 2024
0818b7b
remove iteration special logic
takatost Jul 26, 2024
917aacb
add chatflow app event convert
takatost Jul 30, 2024
c9bb366
Merge branch 'refs/heads/main' into feat/workflow-parallel-support
takatost Jul 30, 2024
8d27ec3
fix bug
takatost Jul 30, 2024
8401a11
feat(workflow): integrate workflow entry with advanced chat app
takatost Aug 13, 2024
14d020f
Merge branch 'refs/heads/main' into feat/workflow-parallel-support
takatost Aug 13, 2024
2980e31
fix issues when merging from main
takatost Aug 13, 2024
674af04
fix migration version depends
takatost Aug 13, 2024
6f6b32e
feat(workflow): integrate workflow entry with workflow app
takatost Aug 14, 2024
1da5862
feat(workflow): fix iteration single debug
takatost Aug 14, 2024
702df31
fix(workflow): fix generate issues in workflow
takatost Aug 15, 2024
c519265
fix: unit tests in workflow
takatost Aug 15, 2024
db9b0ee
Merge branch 'refs/heads/main' into feat/workflow-parallel-support
takatost Aug 15, 2024
91e51ce
fix(workflow): issues by merging main branch
takatost Aug 15, 2024
90221c0
fix: unit tests
takatost Aug 15, 2024
5b5e6e3
fix: answer node unit tests
takatost Aug 15, 2024
1973f50
feat: frontend support parallel
zxhlyh Aug 16, 2024
352c45c
feat(workflow): integrate parallel into workflow apps
takatost Aug 16, 2024
5d78657
fix(workflow): issues in workflow parallels
takatost Aug 16, 2024
755a965
fix(workflow): add parallel id into published events
takatost Aug 18, 2024
617ea4b
fix(workflow): fix parallel bug
takatost Aug 20, 2024
1d88b62
fix(workflow): fix node link to previous node issue
takatost Aug 20, 2024
412be6d
fix bug
takatost Aug 21, 2024
35be41b
Merge branch 'refs/heads/main' into feat/workflow-parallel-support
takatost Aug 21, 2024
e34497d
fix: merge issues
takatost Aug 21, 2024
92072e2
fix: ruff issues
takatost Aug 21, 2024
d6da7b0
fix dialogue_count
takatost Aug 22, 2024
ec4fc78
fix iteration start node
takatost Aug 22, 2024
fe2b300
fix lint
takatost Aug 22, 2024
5b22d8f
Merge branch 'refs/heads/main' into feat/workflow-parallel-support
takatost Aug 22, 2024
42899fb
fix bug
takatost Aug 22, 2024
85d3197
fix end node bug
takatost Aug 24, 2024
4771e85
Merge branch 'refs/heads/main' into feat/workflow-parallel-support
takatost Aug 24, 2024
6c61776
fix test
takatost Aug 25, 2024
1016db1
feat: parallel hover
zxhlyh Aug 26, 2024
76bb8d1
Merge branch 'refs/heads/main' into feat/workflow-parallel-support
takatost Aug 26, 2024
9c8144e
feat: parallel hover
zxhlyh Aug 26, 2024
b9f34f6
fix: iteration start node id
takatost Aug 26, 2024
4e3dc36
fix: workflow run edge status
zxhlyh Aug 27, 2024
4256e9d
chore(iteration): keep start_node_id using in parallel start nodes
takatost Aug 27, 2024
cd52633
fix(graph_engine): parent_parallel_id missing
takatost Aug 27, 2024
b0a81c6
fix(workflow): parallel execution after if-else that only one branch …
takatost Aug 28, 2024
8ba5673
feat: iteration support parallel
zxhlyh Aug 28, 2024
c2bb114
fix(workflow): parallel not yield
takatost Aug 28, 2024
4418fa1
fix: bug
zxhlyh Aug 28, 2024
74c8004
fix(graph_engine): fix execute loops in parallel
takatost Aug 28, 2024
6b6750b
Merge branch 'refs/heads/main' into feat/workflow-parallel-support
takatost Aug 28, 2024
5d34e08
fix: migration
takatost Aug 28, 2024
790dd3b
fix(workflow): duplicate nodes in parallel
takatost Aug 28, 2024
ae22015
fix(workflow): loop check
takatost Aug 28, 2024
f43596f
fix: parallel branch limit
zxhlyh Aug 29, 2024
3e257ae
update the workflow parallel log
YIXIAO0 Aug 29, 2024
32a11cb
update the parallel workflow log for iteration and chatflow preview
YIXIAO0 Aug 29, 2024
1bde57e
delete console logs
YIXIAO0 Aug 29, 2024
7c9081a
fix
zxhlyh Aug 30, 2024
708256e
Merge branch 'feat/workflow-parallel-support' of github.com:langgeniu…
YIXIAO0 Aug 30, 2024
e3ae529
update the onNodeFinished method for nodes being passed through more …
YIXIAO0 Aug 30, 2024
2b5b856
solve the branch issue
YIXIAO0 Aug 30, 2024
e329518
fix a typo
YIXIAO0 Aug 30, 2024
77e62f7
fix(workflow): run node in multi parallel bugs
takatost Aug 30, 2024
162e967
fix(workflow): missing parallel event in workflow app
takatost Aug 30, 2024
d7c0ca8
feat: inner parallels will be added to its corresponding branch
YIXIAO0 Aug 30, 2024
ee1587c
fix: make the End node always nested in the root
YIXIAO0 Aug 30, 2024
71a7d89
fix styling
YIXIAO0 Aug 30, 2024
29b1ce7
fix: node end status
YIXIAO0 Sep 1, 2024
0dabf79
fix(workflow): fix merge branch node id err
takatost Sep 2, 2024
52b4623
fix(workflow): fix merge branch node id err
takatost Sep 2, 2024
43240fc
fix
zxhlyh Sep 2, 2024
5bda3a3
fix(workflow): bugs
takatost Sep 2, 2024
81d09d4
Merge branch 'refs/heads/main' into feat/workflow-parallel-support
takatost Sep 2, 2024
7035f64
fix: next step
zxhlyh Sep 2, 2024
bbc922d
merge main
takatost Sep 2, 2024
35d9c59
Merge remote-tracking branch 'origin/feat/workflow-parallel-support' …
takatost Sep 2, 2024
70aced0
fix
zxhlyh Sep 2, 2024
166365a
feat(workflow): add thread pool
takatost Sep 2, 2024
5ca9df6
feat(workflow): add thread pool
takatost Sep 2, 2024
955884b
chore(workflow): max thread submit count
takatost Sep 2, 2024
f71c51c
Merge branch 'refs/heads/main' into feat/workflow-parallel-support
takatost Sep 2, 2024
d929665
fix: migration
takatost Sep 2, 2024
83343ee
update parallel log
YIXIAO0 Sep 3, 2024
b28c7b1
Merge branch 'feat/workflow-parallel-support' of github.com:langgeniu…
YIXIAO0 Sep 3, 2024
3431b19
update styling and iteration log
YIXIAO0 Sep 3, 2024
36d95e4
fix(iteration): iterator_length not correct
takatost Sep 3, 2024
6bee121
update log in web app
YIXIAO0 Sep 3, 2024
78fa1f6
fix(workflow): detached session issues
takatost Sep 3, 2024
cd42dbd
update the log for iteration nodes
YIXIAO0 Sep 4, 2024
4962b2c
check node edge
zxhlyh Sep 4, 2024
5cb018e
update the method to check if a node is in iteration
YIXIAO0 Sep 4, 2024
4f5dc82
fix
zxhlyh Sep 4, 2024
c625f42
Merge branch 'main' into feat/workflow-parallel-support
zxhlyh Sep 4, 2024
44038b9
fix: iteration copy
zxhlyh Sep 4, 2024
4663463
fix: refine the "isInIteration" for workflow
YIXIAO0 Sep 4, 2024
7e30487
feat: update dsl version
takatost Sep 4, 2024
94432a0
chore: update package versions to 0.8.0-beta1 (#7979)
laipz8200 Sep 4, 2024
4b0d2bf
chore: update build-push.yml to remove unnecessary tags
laipz8200 Sep 4, 2024
ab5bb18
fix(workflow): parent parallel logic
takatost Sep 9, 2024
351702d
fix: iteration log in debug
zxhlyh Sep 9, 2024
4071ea4
fix(workflow): add iteration_id in node start/finished event
takatost Sep 9, 2024
6140f22
fix: iteration log in webapp
zxhlyh Sep 9, 2024
aaebe8f
update the log for the parallel iterations case
YIXIAO0 Sep 10, 2024
8fb6e87
Merge branch 'refs/heads/main' into feat/workflow-parallel-support
takatost Sep 10, 2024
9b7a321
fix merge
takatost Sep 10, 2024
d531827
remove if regex
zxhlyh Sep 10, 2024
706c00c
prepare for 0.8.0
takatost Sep 10, 2024
aaae6bd
parallel tip
zxhlyh Sep 10, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore(iteration): keep start_node_id using in parallel start nodes
  • Loading branch information
takatost committed Aug 27, 2024
commit 4256e9d47f088137d795f879a20555035fad6152
37 changes: 4 additions & 33 deletions api/core/workflow/nodes/iteration/iteration_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,40 +51,11 @@ def _run(self) -> Generator[RunEvent | InNodeEvent, None, None]:
}

graph_config = self.graph_config

if not self.node_data.start_node_id:
raise ValueError(f'field start_node_id in iteration {self.node_id} not found')

# find nodes in current iteration and donot have source and have have start_node_in_iteration flag
# these nodes are the start nodes of the iteration (in version of parallel support)
start_node_ids = []
for node_config in graph_config['nodes']:
if (
node_config.get('data', {}).get('iteration_id')
and node_config.get('data', {}).get('iteration_id') == self.node_id
and not node_config.get('source')
and node_config.get('data', {}).get('start_node_in_iteration', False)
):
start_node_ids.append(node_config.get('id'))

if len(start_node_ids) > 0:
# add new fake iteration start node that connect to all start nodes
root_node_id = f"{self.node_id}-start"
graph_config['nodes'].append({
"id": root_node_id,
"data": {
"title": "iteration start",
"type": NodeType.ITERATION_START.value,
}
})

for start_node_id in start_node_ids:
graph_config['edges'].append({
"source": root_node_id,
"target": start_node_id
})
else:
if not self.node_data.start_node_id:
raise ValueError(f'field start_node_id in iteration {self.node_id} not found')

root_node_id = self.node_data.start_node_id
root_node_id = self.node_data.start_node_id

# init graph
iteration_graph = Graph.init(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,16 @@ def test_run_parallel():
"source": "iteration-1",
"target": "answer-3",
},
{
"id": "iteration-start-source-tt-target",
"source": "iteration-start",
"target": "tt",
},
{
"id": "iteration-start-source-tt-2-target",
"source": "iteration-start",
"target": "tt-2",
},
{
"id": "tt-source-if-else-target",
"source": "tt",
Expand Down Expand Up @@ -250,7 +260,7 @@ def test_run_parallel():
"output_selector": ["tt", "output"],
"output_type": "array[string]",
"startNodeType": "template-transform",
"start_node_id": "tt",
"start_node_id": "iteration-start",
"title": "iteration",
"type": "iteration",
},
Expand All @@ -268,7 +278,14 @@ def test_run_parallel():
{
"data": {
"iteration_id": "iteration-1",
"start_node_in_iteration": True,
"title": "iteration-start",
"type": "iteration-start",
},
"id": "iteration-start",
},
{
"data": {
"iteration_id": "iteration-1",
"template": "{{ arg1 }} 123",
"title": "template transform",
"type": "template-transform",
Expand All @@ -279,7 +296,6 @@ def test_run_parallel():
{
"data": {
"iteration_id": "iteration-1",
"start_node_in_iteration": True,
"template": "{{ arg1 }} 321",
"title": "template transform",
"type": "template-transform",
Expand Down Expand Up @@ -372,6 +388,7 @@ def test_run_parallel():
"output_selector": ["tt", "output"],
"output_type": "array[string]",
"startNodeType": "template-transform",
"start_node_id": "iteration-start",
"title": "迭代",
"type": "iteration",
},
Expand Down