mirror of
https://github.com/labring/FastGPT.git
synced 2026-05-05 01:02:59 +08:00
fix: workflow batch repeat run (#6186)
* stop design doc * remove invalid doc * perf: auto fit * fix: icon * perf: icon * perf: icon * perf: icon * perf: icon * perf: variable disabled input ui * fix: workflow batch run * fix: tsc
This commit is contained in:
@@ -387,7 +387,7 @@ export const runWorkflow = async (data: RunWorkflowProps): Promise<DispatchFlowR
|
||||
this.processActiveNode();
|
||||
}
|
||||
// Process next active node
|
||||
private processActiveNode() {
|
||||
private async processActiveNode() {
|
||||
// Finish
|
||||
if (this.activeRunQueue.size === 0 && this.runningNodeCount === 0) {
|
||||
if (isDebugMode) {
|
||||
@@ -414,6 +414,8 @@ export const runWorkflow = async (data: RunWorkflowProps): Promise<DispatchFlowR
|
||||
return;
|
||||
}
|
||||
|
||||
// Thread avoidance
|
||||
await surrenderProcess();
|
||||
const nodeId = this.activeRunQueue.keys().next().value;
|
||||
const node = nodeId ? this.runtimeNodesMap.get(nodeId) : undefined;
|
||||
|
||||
@@ -443,7 +445,9 @@ export const runWorkflow = async (data: RunWorkflowProps): Promise<DispatchFlowR
|
||||
|
||||
this.skipNodeQueue.set(node.nodeId, { node, skippedNodeIdList: concatSkippedNodeIdList });
|
||||
}
|
||||
private processSkipNodes() {
|
||||
private async processSkipNodes() {
|
||||
// Thread avoidance
|
||||
await surrenderProcess();
|
||||
// 取一个 node,并且从队列里删除
|
||||
const skipItem = this.skipNodeQueue.values().next().value;
|
||||
if (skipItem) {
|
||||
@@ -867,9 +871,6 @@ export const runWorkflow = async (data: RunWorkflowProps): Promise<DispatchFlowR
|
||||
return;
|
||||
}
|
||||
|
||||
// Thread avoidance
|
||||
await surrenderProcess();
|
||||
|
||||
addLog.debug(`Run node`, { maxRunTimes: data.maxRunTimes, appId: data.runningAppInfo.id });
|
||||
|
||||
// Get node run status by edges
|
||||
@@ -881,6 +882,13 @@ export const runWorkflow = async (data: RunWorkflowProps): Promise<DispatchFlowR
|
||||
|
||||
const nodeRunResult = await (async () => {
|
||||
if (status === 'run') {
|
||||
// All source edges status to waiting
|
||||
runtimeEdges.forEach((item) => {
|
||||
if (item.target === node.nodeId) {
|
||||
item.status = 'waiting';
|
||||
}
|
||||
});
|
||||
|
||||
const blanceCheckResult = await this.checkTeamBlance();
|
||||
if (blanceCheckResult) {
|
||||
return {
|
||||
@@ -890,13 +898,6 @@ export const runWorkflow = async (data: RunWorkflowProps): Promise<DispatchFlowR
|
||||
};
|
||||
}
|
||||
|
||||
// All source edges status to waiting
|
||||
runtimeEdges.forEach((item) => {
|
||||
if (item.target === node.nodeId) {
|
||||
item.status = 'waiting';
|
||||
}
|
||||
});
|
||||
|
||||
addLog.debug(`[dispatchWorkFlow] nodeRunWithActive: ${node.name}`);
|
||||
return this.nodeRunWithActive(node);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user