Skip to main content
function Cancellation.force
def Cancellation.force() -> bool
Forcefully cancel the invocation. Sends the 2nd and 3rd SIGINT to the Bazel client, following Bazel’s 3-stage cancellation protocol (the 1st SIGINT was already sent by cancel_invocation()). The 3rd SIGINT triggers Bazel’s built-in KillServerProcess which kills the server and exits the client. If the client doesn’t exit within 5 seconds, falls back to SIGKILL on both the client and server. If no client is found holding the lock (e.g. the client crashed), sends SIGKILL directly to the server daemon. Returns True if a signal was sent, False if neither the client nor server could be found (the build may have already finished). function Cancellation.wait
def Cancellation.wait(
*,
poll_ms: int = 200,
timeout_ms: int = 0
) -> bool
Block until the cancelled invocation finishes. Polls until the server is no longer busy. If the force_kill_after_ms deadline (set on cancel_invocation) is reached while still busy, automatically escalates by calling force(). Returns True if the server became free (either gracefully or after force-kill). Returns False only if timeout_ms is set and reached before the server became free (in this case no automatic escalation occurs — use force() manually). property Cancellation.busy
Cancellation.busy: bool
Whether the bazel server is currently busy (lock held by another client). Queries in real time via bazel --noblock_for_lock info.