cancel_job
Cancel a queued or running backtest job, or retrieve its existing status when already finished. Provides a safe, idempotent way to stop jobs without data loss.
Instructions
Cancel a job, or report its existing terminal state if already finished.
Not confirm-gated (ADR-0003's explicit non-gated list): reversible, no data loss. Idempotent: cancelling an already-terminal job just returns its existing status, never an error.
This milestone implements only the state-machine transitions that don't require calling OctoBot (no HTTP/Socket.IO call happens here, or anywhere else in this module):
queued(waiting onbacktest_execution_lock, never started): cancelled directly.running: only setscancel_requested = Trueon the record. Milestone 8's watcher loop is what will actually notice the flag, tell OctoBot to stop, and transition the record tocancelledonce that's confirmed -- this tool deliberately does NOT fabricate an immediatestate="cancelled"for a running job, since nothing here is actually stopping it.
Raises JobNotFoundError for an unknown job_id (same as
get_job_status).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| job_id | Yes |