[Feature] Cancel in-progress benchmark and fine-tune jobs #9

Closed
opened 2026-03-15 21:16:55 -07:00 by pyr0ball · 0 comments
Owner

Summary

Allow users to abort a running benchmark or fine-tune job from the UI without refreshing the page.

Changes (feat/vue-label-tab)

Backend (app/api.py)

  • Module-level _running_procs: dict and _cancelled_jobs: set track the live subprocess per job type
  • Both run_benchmark and run_finetune_endpoint generators register/deregister their Popen object; emit {"type":"cancelled"} (not error) when cancelled
  • _cancelled_jobs.discard(key) on new run start prevents stale-flag false positives
  • POST /api/benchmark/cancel and POST /api/finetune/cancel — SIGTERM → wait 3 s → SIGKILL; 404 if nothing running

Tests (tests/test_api.py)

  • 7 new cancel tests: 404-when-not-running ×2, terminate-on-cancel ×2, kill-on-timeout ×1, cancelled-event ×2

Frontend (web/src/views/BenchmarkView.vue)

  • runCancelled / ftCancelled refs, cancelBenchmark() / cancelFinetune() functions
  • Cancel buttons (neutral gray, not red) appear only while running
  • ⏹ Cancelled status in log headers; Clear buttons reset the state

Resolved in

feat/vue-label-tab @ 1fa5b9e

## Summary Allow users to abort a running benchmark or fine-tune job from the UI without refreshing the page. ## Changes (feat/vue-label-tab) ### Backend (`app/api.py`) - Module-level `_running_procs: dict` and `_cancelled_jobs: set` track the live subprocess per job type - Both `run_benchmark` and `run_finetune_endpoint` generators register/deregister their `Popen` object; emit `{"type":"cancelled"}` (not error) when cancelled - `_cancelled_jobs.discard(key)` on new run start prevents stale-flag false positives - `POST /api/benchmark/cancel` and `POST /api/finetune/cancel` — SIGTERM → wait 3 s → SIGKILL; 404 if nothing running ### Tests (`tests/test_api.py`) - 7 new cancel tests: 404-when-not-running ×2, terminate-on-cancel ×2, kill-on-timeout ×1, cancelled-event ×2 ### Frontend (`web/src/views/BenchmarkView.vue`) - `runCancelled` / `ftCancelled` refs, `cancelBenchmark()` / `cancelFinetune()` functions - Cancel buttons (neutral gray, not red) appear only while running - `⏹ Cancelled` status in log headers; Clear buttons reset the state ## Resolved in feat/vue-label-tab @ 1fa5b9e
pyr0ball added this to the Beta — Benchmark Harness milestone 2026-04-04 16:33:20 -07:00
Sign in to join this conversation.
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: Circuit-Forge/avocet#9
No description provided.