Is there a way to return persisted results via the PREFECT API?
I mean the actual results, not meta data š
ā 1
s
Sahil Rangwala
03/31/2023, 7:16 PM
You are able to view the results via the api if you stream the results to logs and then query the logs via the Rest Api
r
Robin
03/31/2023, 7:17 PM
OK, thanks for the quick answer :)
n
Nate
04/02/2023, 9:24 PM
hi @Robin - results can be accessed without sending them to the logs. If the persisted result exists, you can retrieve the result attached to the state of a flow run like
Copy code
In [14]: !prefect flow-run ls | ag b99be877
ā b99be877-74c0-4522-ba75-74d102a479a9 ā Execute LLM Call ā Calling langchain.llms.openai ā COMPLETED ā 6 days a⦠ā
In [15]: from uuid import UUID
In [16]: from prefect import get_client
In [17]: async with get_client() as client:
...: flow_run = await client.read_flow_run(flow_run_id=UUID("b99be877-74c0-4522-ba75-74d102a479a9"))
...: print(flow_run.state.result())
...:
None
r
Robin
04/03/2023, 9:37 AM
Oh, that is much better š
š 1
Robin
04/03/2023, 9:39 AM
What is the most elegant way to stream task progress?
e.g. I guess "printing progress to the logs and then querying the logs via REST API" is one option, but maybe there is as well a better option for that?
Bring your towel and join one of the fastest growing data communities. Welcome to our second-generation open source orchestration platform, a completely rethought approach to dataflow automation.