capabilities.work

Run a Script with a Cancel Guard

A 4-step recipe with Windmill. We can help you get access.

Recipe · 4 steps

Run a Script with a Cancel Guard

Run a script and cancel the job if it has not completed when inspected.

  1. Submit an asynchronous run of the script by path. The response body is the new job UUID.
  2. Read the job record. The type field discriminates a CompletedJob from a still-pending QueuedJob, which drives the cancel-or-read branch.
  3. Read the completed job record when the run already finished.
  4. Cancel the still-queued or running job with the supplied reason. The response body is a confirmation string.
What you'll need to have ready
  • token: Windmill API token presented as a Bearer credential.
  • workspace: The Windmill workspace id.
  • path: The script path to run.
  • args: The argument map passed to the script.
  • cancelReason: Reason recorded if the job has to be cancelled.
For your developer

Arazzo workflow windmill:run-script-with-cancel-guard, 4 operations: runScriptByPath → getJob → getCompletedJob → cancelQueuedJob. Specs on APIs.io.