Cancel Job
const url = 'https://example.com/jobs/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/cancel';const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/jobs/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/cancel \ --header 'Authorization: Bearer <token>'Cancel a pending or running ingest job (imports, refreshes, and every other IngestJob-shaped run — feat(#1677)).
The DB compare-and-swap here is the correctness mechanism: the job row
(fenced on the attempt id read pre-CAS) and its bound refresh run flip to
cancelled and COMMIT before anything touches the queue. A worker that
never hears the abort still cannot install data afterwards, because every
finalize site runs its fenced job update inside the swap transaction and
require_ingest_job_update raises on the cancelled row, rolling the
swap back. The Procrastinate abort=True request afterwards is
best-effort acceleration only.
Authorization: the job’s creator, a holder of the cross-user job capability (same arm view/retry use), or — wider than retry, on purpose — anyone with write access to the job’s dataset, so a dataset’s owner can always unblock their own dataset from a run someone else started.
Authorizations
Section titled “ Authorizations ”Parameters
Section titled “ Parameters ”Path Parameters
Section titled “ Path Parameters ”Responses
Section titled “ Responses ”Successful Response
Outcome of POST /jobs/{id}/cancel (#1677).
run_id is the dataset_refresh_runs row this cancel finalized, when
the job had one bound (refreshes and reuploads do; plain imports don’t).
already is True when the job was cancelled before this request — the
repeat is idempotent and nothing was written.
object
Example
{ "status": "cancelled", "already": false}Bad request — invalid query parameters or payload
Unauthorized — missing or invalid credentials
Forbidden — caller lacks access to this resource
Not found
Conflict — resource state prevents the operation
Validation error
Too many requests — retry after the advertised interval
Headers
Section titled “ Headers ”Seconds until the request may be retried
Internal server error
Service unavailable — the database could not serve the request