Marc-Antoine Bélanger
08/31/2022, 6:31 PM@flow
def my_flow():
return "hola"
Using the OrionClient I am able to read the states of a flow run using orion_client.read_flow_run_states(flow_run_id)
. The last state is COMPLETED
and has a data
attribute that is NOT None
. For example the data attribute value is:
state.data = _Result(key='b1fd11041ae54cfcbb9b41ec938ff0cf', filesystem_document_id=UUID('bd1ed851-82d2-4f87-b11c-be04a80634af'))
What does this represents? Why don't I have state.data = "hola"
instead? How do I get my flow return data from the OrionClient?
Thanks a lot!Zanie
08/31/2022, 6:48 PMprefect.results._retrieve_result
that retrieves the result for a given state. In the near future, we will allow you to configure different file systems to persist results to (currently it is always local to the flow run, so its in your container’s file syste) and update the State.result()
method to automatically pull from that location.Marc-Antoine Bélanger
08/31/2022, 7:00 PMIn the near future, we will allow you to configure different file systems to persist results to (currently it is always local to the flow run, so its in your container’s file systemWith that feature, the flows return could be directed towards a blob
azure
gcs
, etc file system instead? When is that feature be available?
For now my only solution would be to do something like:
@flow
def my_flow():
my_return = "hola".encode()
azure_block = Azure.load("azureblobblock")
azure_blob.write_path("flow-result-{os.environ['PREFECT__FLOW_RUN_ID']}.json", my_return)
return my_return
right?Zanie
08/31/2022, 7:18 PM