backtests

Cancel Backtest

Cancel a backtest (Q-1220, consume-at-scale O.21 / doc 10 §3).

The durable request is a status, and which status depends on who holds the run:

  • QUEUED -- no worker holds it. The row goes straight to CANCELLED here, with every cancellation stamp; the SQS message still arrives at a worker, whose atomic claim (WHERE status = 'QUEUED') refuses it -- that refusal IS the "re-check at claim". The compute-seconds spend entry is zeroed (nothing ran); the run unit stays consumed (a cancellation is the user's act -- the worker's cancelled arm makes the same choice, and the founder ruling on it is doc 30 §4's).
  • RUNNING -- a worker is executing. The row becomes CANCEL_REQUESTED and the worker honours it at its next phase boundary (backtest-worker/src/cancellation.py): the response says cancel_requested, the client polls, and the row reaches CANCELLED within one phase -- or completes anyway if the request landed after the worker's last checkpoint (cancel_requested_at is kept as the evidence either way).
  • CANCEL_REQUESTED -- already asked. Idempotent: the current row.
  • anything else -- terminal. 409 BACKTEST_ALREADY_TERMINAL.

Every write is guarded on the status it read, so a race with the worker (a claim landing between the read and the QUEUED write, a completion landing before the RUNNING write) re-reads and falls through to the truthful branch instead of overwriting a terminal row.

post/v1/backtests/{job_id}/cancel

Request

  • Base URL: https://api.usekeel.io (the document declares no server; this is the origin it was published from)
  • URL: https://api.usekeel.io/v1/backtests/{job_id}/cancel
  • Auth: none declared

Path parameters

job_idstring required

Headers

Authorizationstring nullable
X-Org-Idstring nullable

Response

Successful Response

idstring required
strategy_idstring required
statusstring required
commit_idstring nullable
sequence_numberinteger nullable
commit_messagestring nullable
source_hashstring nullable
data_fingerprintstring nullable
start_datestring nullable
end_datestring nullable
enginestring nullable
backtest_configobject nullable
experiment_idstring nullable
trial_idstring nullable
progressnumber nullable
metricsobject nullable
queued_atstring nullable
started_atstring nullable
completed_atstring nullable
error_messagestring nullable
execution_timenumber nullable
cancel_requested_atstring nullable
cancelled_atstring nullable
remainingobject nullable
quotaobject[] nullable
warningsobject[] nullable
org_idstring nullable
strategy_namestring nullable
window_policystring nullable
coverage_notesobject[] nullable
windowobject nullable

Changes

No recorded changes to this operation across all 1 revision of this API.