fix: Run evaluations successfully when offload manual executions is true with queue mode (#16307)

Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
This commit is contained in:
Mutasem Aldmour
2025-06-13 15:33:48 +02:00
committed by GitHub
parent 879114b572
commit aa273745ec
7 changed files with 548 additions and 368 deletions

View File

@@ -4,6 +4,7 @@ import type {
INodeTypeDescription,
IExecuteFunctions,
INodeExecutionData,
NodeExecutionWithMetadata,
} from 'n8n-workflow';
import { NodeConnectionTypes, NodeOperationError } from 'n8n-workflow';
@@ -22,6 +23,8 @@ import {
export const DEFAULT_STARTING_ROW = 2;
const MAX_ROWS = 1000;
export class EvaluationTrigger implements INodeType {
description: INodeTypeDescription = {
displayName: 'Evaluation Trigger',
@@ -108,10 +111,8 @@ export class EvaluationTrigger implements INodeType {
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
const inputData = this.getInputData();
const MAX_ROWS = 1000;
const maxRows = this.getNodeParameter('limitRows', 0)
? (this.getNodeParameter('maxRows', 0) as number) + 1
const maxRows = this.getNodeParameter('limitRows', 0, false)
? (this.getNodeParameter('maxRows', 0, MAX_ROWS) as number) + 1
: MAX_ROWS;
const previousRunRowNumber = inputData?.[0]?.json?.row_number;
@@ -133,21 +134,6 @@ export class EvaluationTrigger implements INodeType {
const allRows = await getResults.call(this, [], googleSheetInstance, googleSheet, rangeOptions);
// This is for test runner which requires a different return format
if (inputData[0].json.requestDataset) {
const testRunnerResult = await getResults.call(
this,
[],
googleSheetInstance,
googleSheet,
{},
);
const result = testRunnerResult.slice(0, maxRows - 1);
return [result];
}
const hasFilter = this.getNodeParameter('filtersUI.values', 0, []) as ILookupValues[];
if (hasFilter.length > 0) {
@@ -188,4 +174,28 @@ export class EvaluationTrigger implements INodeType {
return [[currentRow]];
}
}
customOperations = {
dataset: {
async getRows(
this: IExecuteFunctions,
): Promise<INodeExecutionData[][] | NodeExecutionWithMetadata[][] | null> {
try {
const maxRows = this.getNodeParameter('limitRows', 0, false)
? (this.getNodeParameter('maxRows', 0, MAX_ROWS) as number) + 1
: MAX_ROWS;
const googleSheetInstance = getGoogleSheet.call(this);
const googleSheet = await getSheet.call(this, googleSheetInstance);
const results = await getResults.call(this, [], googleSheetInstance, googleSheet, {});
const result = results.slice(0, maxRows - 1);
return [result];
} catch (error) {
throw new NodeOperationError(this.getNode(), error);
}
},
},
};
}