docs/snippets/final-flow-state.mdx
The final state of a flow is determined by its return value. The following rules apply:
FAILED.FAILED state will cause the run to be marked as FAILED.In any other situation in which the flow returns without error, it will be marked as COMPLETED.
@task def add_one(x): return x + 1
@flow
def my_flow():
# avoided raising an exception via return_state=True
state = add_one("1", return_state=True)
assert state.is_failed()
# the flow function returns successfully!
return
If `state` were returned from the flow function, the run would be marked as `FAILED`.
</ Warning>