Skip to content
getgeolens.com

Cancel Job

POST
/jobs/{job_id}/cancel
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.

job_id
required
Job Id
string format: uuid

Successful Response

Media type application/json
JobCancelResponse

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
id
required
Id
string format: uuid
status
required
Status
string
Allowed value: cancelled
run_id
required
Any of:
string format: uuid
already
Already
boolean
Example
{
"status": "cancelled",
"already": false
}

Bad request — invalid query parameters or payload

Media type application/problem+json
ProblemDetail
object
type
Type
string
default: about:blank
title
required
Title
string
status
required
Status
integer
detail
required
Any of:
string
Example
{
"detail": "Dataset not found",
"status": 404,
"title": "Not Found",
"type": "about:blank"
}

Unauthorized — missing or invalid credentials

Media type application/problem+json
ProblemDetail
object
type
Type
string
default: about:blank
title
required
Title
string
status
required
Status
integer
detail
required
Any of:
string
Example
{
"detail": "Dataset not found",
"status": 404,
"title": "Not Found",
"type": "about:blank"
}

Forbidden — caller lacks access to this resource

Media type application/problem+json
ProblemDetail
object
type
Type
string
default: about:blank
title
required
Title
string
status
required
Status
integer
detail
required
Any of:
string
Example
{
"detail": "Dataset not found",
"status": 404,
"title": "Not Found",
"type": "about:blank"
}

Not found

Media type application/problem+json
ProblemDetail
object
type
Type
string
default: about:blank
title
required
Title
string
status
required
Status
integer
detail
required
Any of:
string
Example
{
"detail": "Dataset not found",
"status": 404,
"title": "Not Found",
"type": "about:blank"
}

Conflict — resource state prevents the operation

Media type application/problem+json
ProblemDetail
object
type
Type
string
default: about:blank
title
required
Title
string
status
required
Status
integer
detail
required
Any of:
string
Example
{
"detail": "Dataset not found",
"status": 404,
"title": "Not Found",
"type": "about:blank"
}

Validation error

Media type application/problem+json
ProblemDetail
object
type
Type
string
default: about:blank
title
required
Title
string
status
required
Status
integer
detail
required
Any of:
string
Example
{
"detail": "Dataset not found",
"status": 404,
"title": "Not Found",
"type": "about:blank"
}

Too many requests — retry after the advertised interval

Media type application/problem+json
ProblemDetail
object
type
Type
string
default: about:blank
title
required
Title
string
status
required
Status
integer
detail
required
Any of:
string
Example
{
"detail": "Dataset not found",
"status": 404,
"title": "Not Found",
"type": "about:blank"
}
Retry-After
integer

Seconds until the request may be retried

Internal server error

Media type application/problem+json
ProblemDetail
object
type
Type
string
default: about:blank
title
required
Title
string
status
required
Status
integer
detail
required
Any of:
string
Example
{
"detail": "Dataset not found",
"status": 404,
"title": "Not Found",
"type": "about:blank"
}

Service unavailable — the database could not serve the request

Media type application/problem+json
ProblemDetail
object
type
Type
string
default: about:blank
title
required
Title
string
status
required
Status
integer
detail
required
Any of:
string
Example
{
"detail": "Dataset not found",
"status": 404,
"title": "Not Found",
"type": "about:blank"
}