-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inconsistent raise_on_failure=True
behaviour for flow_run.state.result()
when using run_deployment
#15276
Comments
Hey @benjamincerigo, I'm super excited to see you trying out 3.0! You're right that this interface could be more straightforward, and I'll do my best to shed some light on it. In most cases, we hold the task or flow's return value in memory so that when you ask for that result from the state, we can return it immediately. This works when a task or flow is run in the same memory space. When you run a flow via a deployment, that flow will run in a different memory space, so when you get the result, Prefect will need to load a persisted result from a storage location. Previously, If you don't want to pass Please let me know if you have any additional questions or suggestions for improvement in this area! |
Another thing I'm noticing about your report is that sometimes
So in your case, you have a number of |
Thanks for the explanation. Some clarifying questions and points:
Backwards-compatible stuff is tricky especially when combined with |
I think we should simplify result fetching by having explicit sync and async methods for retrieving results that consistently perform the necessary fetching. This will remove the edge case you've identified. It'll take us a little while to get there, so adding an example to this method for this edge case would be very useful. Would you be willing to submit a PR adding that example? |
To give light on the complex behaviour of `state.result` when used with `run_deployment`. Closes issue: PrefectHQ#15276
Bug summary
As documented here
raise_on_failure
is supposed to raise an exception if the flow run fails. When usingrun_deployment
this seems to have some inconsistent (and undocument) behaviour.There seems to be a number of ways to call
flow_run.state.result
, see script in additional context for the ways I tried.It seems to only work if you use
await flow_run.state.result(fetch=True, raise_on_failure=True)
with bothawait
andfetch=True
.In the additional context of this issue is a script that you can use to see the different behaviors of
state.result()
and here are the logs of that run:raise_on_failure_example_logs.csv
The important logs that show the other uses of
flow_run.state.result
don't raise the expectation in the sub flow:It seems that
state.result()
has very different behaviour depending on the async of sync contexted and can make it very difficult to userun_deployment
in a predictable way.Version info (
prefect version
output)Additional context
Example
Run this with:
pythons example.py
Then run the parent_flow
prefect prefect deployment run parent_flow/parent_flow
The text was updated successfully, but these errors were encountered: