Hey, I am executing a flow run from a deployment v...
# prefect-community
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
only returns
_Result(key='82ecff4d3a454e77b08b5ce93e1dd418', filesystem_document_id=UUID('af2119c0-c631-45ed-af6a-0cff1cf396a5'))
. 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
You can return a state from a task run by adding
: https://docs.prefect.io/concepts/states/#return-prefect-state
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.
When you say results, do you mean a Python object or your mean a Prefect Future object?
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
at the end:
Copy code
def my_task():
  return 2

def my_flow():
  a = my_task()
  return a

a = my_flow()
print(a) # 2
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.