Add cancelTask to SchedulerService for cancelling running tasks

Adds the ability to cancel currently running scheduled tasks via a new
cancelTask method on the SchedulerService interface. For global (distributed)
tasks, the database lock is released and a periodic liveness check detects
the lost ticket and aborts the task function's AbortSignal. For local tasks,
the abort signal is triggered directly. Also adds a REST endpoint at
POST /.backstage/scheduler/v1/tasks/:id/cancel.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Fredrik Adelöw <freben@spotify.com>
This commit is contained in:
Fredrik
2026-03-09 21:54:22 +01:00
committed by Fredrik Adelöw
parent f3f99b811e
commit 015668c5d2
8 changed files with 329 additions and 5 deletions
+6
View File
@@ -0,0 +1,6 @@
---
'@backstage/backend-plugin-api': minor
'@backstage/backend-defaults': patch
---
Added `cancelTask` method to the `SchedulerService` interface and implementation, allowing cancellation of currently running scheduled tasks. For global tasks, the database lock is released and a periodic liveness check aborts the running task function. For local tasks, the task's abort signal is triggered directly. A new `POST /.backstage/scheduler/v1/tasks/:id/cancel` endpoint is also available.