Skip to content
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

Improve docstring state.result for when used with run_deployment #15509

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/prefect/client/schemas/objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,9 @@ def result(

Args:
raise_on_failure: a boolean specifying whether to raise an exception
if the state is of type `FAILED` and the underlying data is an exception
if the state is of type `FAILED` and the underlying data is an exception. When flow
was run in a different memory space (using `run_deployment`), this will only raise
if `fetch` is `True`.
fetch: a boolean specifying whether to resolve references to persisted
results into data. For synchronous users, this defaults to `True`.
For asynchronous users, this defaults to `False` for backwards
Expand Down Expand Up @@ -297,6 +299,15 @@ def result(
>>> state = await my_flow(return_state=True)
>>> await state.result()
hello

Get the result with `raise_on_failure` from a flow run in a different memory space

>>> @flow
>>> async def my_flow():
>>> raise ValueError("oh no!")
>>> my_flow.deploy("my_deployment/my_flow")
>>> flow_run = run_deployment("my_deployment/my_flow")
>>> await flow_run.state.result(raise_on_failure=True, fetch=True) # Raises `ValueError("oh no!")`
"""
from prefect.states import get_state_result

Expand Down
Loading