fix: Retain execution data between partial executions (new flow) (#11828)

This commit is contained in:
Danny Martini
2024-11-26 13:32:39 +01:00
committed by GitHub
parent 75e2b6fd9e
commit 3320436a6f
11 changed files with 159 additions and 14 deletions

View File

@@ -281,7 +281,7 @@ function hookFunctionsPush(): IWorkflowExecuteHooks {
},
],
workflowExecuteBefore: [
async function (this: WorkflowHooks): Promise<void> {
async function (this: WorkflowHooks, _workflow, data): Promise<void> {
const { pushRef, executionId } = this;
const { id: workflowId, name: workflowName } = this.workflowData;
logger.debug('Executing hook (hookFunctionsPush)', {
@@ -302,6 +302,9 @@ function hookFunctionsPush(): IWorkflowExecuteHooks {
retryOf: this.retryOf,
workflowId,
workflowName,
flattedRunData: data?.resultData.runData
? stringify(data.resultData.runData)
: stringify({}),
},
pushRef,
);

View File

@@ -137,7 +137,10 @@ export class WorkflowRunner {
// Create a failed execution with the data for the node, save it and abort execution
const runData = generateFailedExecutionFromError(data.executionMode, error, error.node);
const workflowHooks = WorkflowExecuteAdditionalData.getWorkflowHooksMain(data, executionId);
await workflowHooks.executeHookFunctions('workflowExecuteBefore', []);
await workflowHooks.executeHookFunctions('workflowExecuteBefore', [
undefined,
data.executionData,
]);
await workflowHooks.executeHookFunctions('workflowExecuteAfter', [runData]);
responsePromise?.reject(error);
this.activeExecutions.finalizeExecution(executionId);
@@ -401,7 +404,7 @@ export class WorkflowRunner {
// Normally also workflow should be supplied here but as it only used for sending
// data to editor-UI is not needed.
await hooks.executeHookFunctions('workflowExecuteBefore', []);
await hooks.executeHookFunctions('workflowExecuteBefore', [undefined, data.executionData]);
} catch (error) {
// We use "getWorkflowHooksWorkerExecuter" as "getWorkflowHooksWorkerMain" does not contain the
// "workflowExecuteAfter" which we require.