FEAT: add endpoint to cancel running pipeline runs and update Elasticsearch status

This commit is contained in:
viniciusgadea
2026-03-26 10:47:17 -03:00
committed by marcos-silva-rodrigues
parent 71b3f278a5
commit 4aedb91941
3 changed files with 1479 additions and 1313 deletions
@@ -834,6 +834,41 @@ export class PlatformApiController {
);
}
@Post('pipeline/:pipelineId/pipeline_run/:runId/cancel')
@ApiOperation({ summary: 'Cancel a running pipeline run' })
@RequireAllPermissions(PERMISSIONS_GROUPS.PIPELINE.permissions.UPDATE)
async cancelPipelineRun(
@Param('pipelineId') pipelineId: string,
@Param('runId') runId: string,
@User() user: RequestUser,
) {
const normalizedPipelineId = this.normalizePipelineId(pipelineId);
const normalizedRunId = this.normalizePipelineId(runId);
const result = await this.platformApiService.proxy(
'POST',
`/pipeline/${normalizedPipelineId}/pipeline_run/${normalizedRunId}/cancel`,
user,
);
// Update Elasticsearch to reflect the canceled run status
try {
await this.elasticsearchService.updateLastRunStatus(
user.customer_name,
pipelineId,
'CANCELED',
);
} catch (esError) {
this.logger.warn('Failed to update Elasticsearch after pipeline run cancel', {
pipelineId,
runId,
error: esError.message,
});
}
return result;
}
// ==================== JOBS - COLUMN EDITING ROUTES ====================
@Put('jobs/:jobId/input')