If I cancel a flow `A` which is run via `run_deplo...
# ask-community
g
If I cancel a flow
A
which is run via
run_deployment
, and that flow has a number of subflows also triggered via
run_deployment
, will those subflows also be cancelled?
1
a
Hey @Gabe Villasana! Yes, sub-flow runs of a canceled flow run will also be canceled.
🙌 1
g
Great thanks! Also I saw in the docs that you can cancel a flow run via the python SDK, though I'm not sure where that lives? I know both the flow name and the flow_run_name
@alex, is there a way I can retrieve the UUID for a flow run from within the flow run itself in python?
j
@Gabe Villasana, if this helps: I had to do cancel operation through prefect CLI with python
subprocess
library
Copy code
command = f"prefect flow-run cancel     '{running_flow_id}'"

        process = subprocess.Popen(
            command,
            shell=True,
            stdout=subprocess.PIPE,
            stderr=subprocess.PIPE,
        )

output, error = process.communicate()

        if output:
            print(f"Output: {output.decode()}")
        if error:
            print(f"Error: {error.decode()}")
indent is all whacked out sorry
g
Thanks Jack! I managed to find a workaround using redis and the prefect runtime context 😄
🦜 1