Hey team - is there a way to have local flow runs ...
# ask-community
m
Hey team - is there a way to have local flow runs NOT show up in the UI on prefect cloud? We are doing a lot of testing and there are a crazy amount of flows which are showing up in our console. Also, at times when we close the debugger (spins up docker container with prefect in it) or even running with virtual env, the flow run on the UI shows running still and does not exit. Any help would be greatly appreciated 🙂
I also have another question about starting flows: What is the difference between referencing another flow (subflow) using an import
from x import myflow
and then calling
myflow(params)
vs doing
run_deployment(name="myflow/mydeployment")
?
r
For question #1, one way might just be to create a profile for local runs by running
prefect profile create local
and then
prefect profile use local
. The downside is that if your testing on blocks saved in Prefect Cloud, they won't work. My guess with the debugger shutdown is that it's terminating the container without giving the flow a chance to shut down cleanly. If the Prefect engine can't stop the flow cleanly and make the API call to update the flow state to crashed/cancelled, the bank end won't know if the flow crashed or is just a long-running flow that hasn't completed yet.
For your other question,
from x import myflow
and then
myflow(params)
will run the flow as a subflow in-process in the same Python interpreter as your main flow is running. In contrast,
run_deployment(name="myflow/mydeployment")
submits the run to your flow run infrastructure, where an agent or worker will pick it up and run it independently. At the very least, it'll be in its own process, and depending on your infrastructure setup it might even run in a different container/VM/server than the flow from which you called
run_deployment
.
Actually, for #1 you might find this solution more useful than a separate profile: https://prefect-community.slack.com/archives/C04DZJC94DC/p1683553550963779?thread_ts=1683538802.450849&cid=C04DZJC94DC
🙌 1