Hi, I'm running Prefect 1 and I'm a little lost on...
# prefect-community
r
Hi, I'm running Prefect 1 and I'm a little lost on how to have a flow end if a given condition is met. For instance, I have a Flow performing an API call that returns rows updated in the last day, and if no rows are returned I'd like the flow to end right there. Typical python code like `exit`/`quit`/`pass` just cause the flow to "hang" in the cloud UI, but I'd like it to show a completed run.
1
b
Hi Rocky, this article may be useful to you. It provides examples for how to stop a flow run conditionally in Prefect 1.0 and 2.0.
In Prefect 2.0, you would be able to stop a flow run in a more pythonic manner.
s
Any update to this? It would be nice to exit a flow without raising an error? I have a flow that performs tasks if the object exists, if it doesn't it will exit. And the flow run shouldn't be in an error state or failed state, it's still completed.