Skip to main content

MD_CANCEL_FLIGHT_RUN

Preview
This feature is in preview and is subject to change.

Cancels an in-progress run of a Flight. The run transitions to RUN_STATUS_CANCELLED.

Cancelling a run that's already in a terminal status (SUCCEEDED, FAILED, CANCELLED) or a run that doesn't exist returns an error.

Syntax

CALL MD_CANCEL_FLIGHT_RUN(
flight_id := '<flight_id>',
run_number := <n>
);

Parameters

ParameterTypeRequiredDescription
flight_idUUIDYesIdentifier of the Flight.
run_numberINTEGERYesThe run number to cancel.

Examples

Cancel the most recent run if it's still in progress:

WITH latest AS (
SELECT run_number, status
FROM MD_LIST_FLIGHT_RUNS(flight_id := '<flight_id>')
ORDER BY run_number DESC LIMIT 1
)
SELECT MD_CANCEL_FLIGHT_RUN(flight_id := '<flight_id>', run_number := latest.run_number)
FROM latest
WHERE latest.status IN ('RUN_STATUS_PENDING', 'RUN_STATUS_RUNNING');

Cancel a specific run:

CALL MD_CANCEL_FLIGHT_RUN(
flight_id := '80000000-0000-0000-0000-000000000001',
run_number := 42
);