@Marvin in python i can call a flow in a flow which creates a subflow. what i really want is to queue a flow in code, how can i do this so that it does not become a subflow
m
Marvin
11/20/2024, 3:41 PM
If you want to queue a Prefect flow without it becoming a subflow (meaning running it independently rather than as part of another flow run), you should deploy the flow separately and then execute it using the
run_deployment
method. This way, you avoid canceling it when the parent flow is canceled, which is something that happens with nested flows.
Here's a snippet from the documentation that aligns with your need: "A nested flow run cannot be cancelled without cancelling its parent flow run. If you need to be able to cancel a nested flow run independent of its parent flow run, we recommend deploying it separately and starting it with the run_deployment method" (source: Prefect Documentation).
So, in your case, deploying the flow independently and using
run_deployment
will give you the autonomy you need for running the flow separately. Hopefully, it's not as complicated as learning Vogon poetry.
If you have further questions about this, feel free to reach out!
Bring your towel and join one of the fastest growing data communities. Welcome to our second-generation open source orchestration platform, a completely rethought approach to dataflow automation.