pyr0ball opened issue Circuit-Forge/avocet#9

pyr0ball
Sun, 15 Mar 2026 21:16:55 -0700

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

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