mirror of
https://github.com/dadosfera/maestro.git
synced 2026-09-30 10:29:09 +00:00
FEAT: add endpoint to cancel running pipeline runs and update Elasticsearch status
This commit is contained in:
committed by
marcos-silva-rodrigues
parent
71b3f278a5
commit
4aedb91941
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user