deleteJob
Keyword
deleteJob( jobId: uuid ): nothing | ErrorThe deleteJob function deletes a pending Job, effectively cancelling it before it runs.
Availability
| Promotion | Rule | Reactor |
|---|---|---|
| ✓ |
Return Value
Returns nothing when the job was deleted. There is no false case — every failure is reported as an Error record instead.
Error Handling
| Code | Condition |
|---|---|
NOT_FOUND | No job with the given jobId exists. |
NOT_ALLOWED | The job is currently running, is not in a pending state, or the caller lacks the jobs/<jobDefinitionId>:write permission for the job's definition. |
Only pending jobs can be deleted — a job that has already started or finished cannot be cancelled.
Examples
Cancel a scheduled job
filtrera
from deleteJob jobId match
Error |> 'Could not cancel the job'
|> 'Job cancelled'Schedule, then cancel later
filtrera
let scheduled = scheduleJob('myJobDefinition', now + 2 hours)
from scheduled match
Error |> 'Failed to schedule'
(jobId: uuid) |>
// ...later, when no longer needed:
deleteJob jobIdSee Also
- scheduleJob — create a job
- Jobs — how jobs work