Cancellation semantics
- A queued or delayed job is removed from the queue and will never run.
- An in-flight job receives a cooperative cancellation signal. The worker stops dispatching further work at its next checkpoint. Work already dispatched when the signal is observed is not rolled back.
- Repeated cancels are idempotent: calling
cancel()on an already-cancelled job still returnsstate='cancelled'rather than raising an error.
Usage
Parameters
The ID of the job to cancel. Returned as
jobId in the response from evaluations.run().Returns
AJobCancelResponse object:
The job ID.
Always
"cancelled" on a successful response, whether this was the first or a repeated cancel request.Errors
| Error | Cause |
|---|---|
EntityNotFoundException | The job does not exist, or belongs to a different organization (404). |
JobAlreadyTerminalException | The job has already reached completed or failed state and cannot be cancelled (409). |
JobAlreadyTerminalException is only raised for jobs that finished (completed or failed). Jobs that were already cancelled return state='cancelled' with a 200 response — repeated cancels are safe to call without checking status first.