Erik Osinga
08/14/2025, 4:48 PMMarvin
08/14/2025, 4:48 PMMarvin
08/14/2025, 4:51 PMprefect flow-run ls --flow-name "YOUR_FLOW_NAME" --state RUNNING --limit 20
2) Cancel the run by ID:
prefect flow-run cancel <FLOW_RUN_ID>
Tips if the button is greyed out:
- Only runs in active states (e.g., RUNNING, sometimes PENDING/SCHEDULED) can be cancelled.
- If it’s already CANCELLING/CANCELLED/COMPLETED/FAILED/CRASHED, the button will be disabled.
- In Cloud, you may need sufficient permissions to cancel runs.
- Cancellation is best-effort. If the infra is hung, you may need to kill the process/pod/container directly (e.g., delete the Kubernetes pod or Docker container).Erik Osinga
08/14/2025, 4:56 PMMarvin
08/14/2025, 4:56 PMMarvin
08/14/2025, 4:59 PMexport PREFECT_API_URL=<http://localhost:4200/api>
- Or persist it in your Prefect profile:
prefect config set PREFECT_API_URL=<http://localhost:4200/api>
- Double-check:
prefect config view
Then list and cancel by ID:
prefect flow-run ls --flow-name "YOUR_FLOW_NAME" --state RUNNING --limit 50
prefect flow-run cancel <FLOW_RUN_ID>
If the UI cancel button is still greyed out:
- The run likely isn’t in a cancellable state (already finished or already cancelling).
- If it’s genuinely stuck, cancellation is best-effort. Kill the underlying process/container:
- Local process: terminate the Python process.
- Docker: docker kill <container>
- Kubernetes: kubectl delete pod <pod>
And if things feel out of sync, you can restart your local server (disruptive, obviously):
prefect server stop
prefect server start
If you want, tell me the flow name and I’ll give you an exact command sequence to target the latest RUNNING run.