From the flow run page in the UI, copy the flow run ID:
Now, paste the ID into this script and run it to change the state to Cancelled
(or any other state):
import asyncio
from prefect.client import get_client
from prefect.orion.schemas.states import Cancelled
async def main():
async with get_client() as client:
id_ = "7a5a454a-98ba-49d4-978e-9f566d735c0a"
response = await client.set_flow_run_state(flow_run_id=id_, state=Cancelled())
print(response)
if __name__ == "__main__":
asyncio.run(main())
You should see the result similar to this:
state=Cancelled(message=None, type=CANCELLED, result=None, flow_run_id=7a5a454a-98ba-49d4-978e-9f566d735c0a) status=SetStateStatus.ACCEPT details=StateAcceptDetails(type='accept_details')
And in the UI we can confirm that the amazing alligator got cancelled!