Hey, I am executing a flow run from a deployment via client. Everything runs locally, with default storage configuration. After the flow finished succesfully, I request the state and try to access the result but
. I tried different return value types for the flow (str, dict). What am I missing here? How can I easily access the return value of a succesful flow run? Thank you
How would we use it to access flow run results?
In the end, we used
from prefect.results._retrieve_result(state)
to access the result objects. It works for us but does not seem to be right.
k
Khuyen Tran
08/17/2022, 3:39 PM
When you say results, do you mean a Python object or your mean a Prefect Future object?
Khuyen Tran
08/17/2022, 3:42 PM
by default, a task run will return a Python object. You can get the result of the last task run in a flow by adding
return
at the end:
Copy code
@task
def my_task():
return 2
@flow
def my_flow():
a = my_task()
return a
a = my_flow()
print(a) # 2
h
Hanno Küpers
08/17/2022, 5:49 PM
Sorry, by result I mean the python object that is returned by the flow. It seemed to work when the flow was executed directly similarly to what you show here, but I had problems accessing the objects from flow runs originating from deployments.
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.