🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
feat(batch-export): add CANCELLED status to BatchExportStatus and handle cancellation in job processing (#10843)
marliessophie92bed0fa4763
diff --git a/packages/shared/src/features/batchExport/types.ts b/packages/shared/src/features/batchExport/types.tsindex 98511aa268..ebabc57bb2 100644--- a/packages/shared/src/features/batchExport/types.ts+++ b/packages/shared/src/features/batchExport/types.ts@@ -12,6 +12,7 @@ export enum BatchExportStatus {PROCESSING = "PROCESSING", // eslint-disable-line no-unused-varsCOMPLETED = "COMPLETED", // eslint-disable-line no-unused-varsFAILED = "FAILED", // eslint-disable-line no-unused-vars+ CANCELLED = "CANCELLED", // eslint-disable-line no-unused-vars}export enum BatchExportFileFormat {diff --git a/worker/src/features/batchExport/handleBatchExportJob.ts b/worker/src/features/batchExport/handleBatchExportJob.tsindex 438191c163..93ad2cff8c 100644--- a/worker/src/features/batchExport/handleBatchExportJob.ts+++ b/worker/src/features/batchExport/handleBatchExportJob.ts@@ -57,6 +57,14 @@ export const handleBatchExportJob = async ();}+ // Check if the batch export has been cancelled+ if (jobDetails.status === BatchExportStatus.CANCELLED) {+ logger.info(+ `Batch export ${batchExportId} has been cancelled. Skipping processing.`,+ );+ return; // Exit early without processing+ }+// Check if the batch export is older than 30 daysconst thirtyDaysAgo = new Date();thirtyDaysAgo.setDate(thirtyDaysAgo.getDate() - 30);