Jan07/11/2022, 11:56 AM
The output is: 13:54:51.255 | INFO | prefect.engine - Created flow run 'brainy-parakeet' for flow 'mijn-flow' 13:54:51.271 | INFO | Flow run 'brainy-parakeet' - Using task runner 'ConcurrentTaskRunner' 13:54:51.302 | WARNING | Flow run 'brainy-parakeet' - No default storage is configured on the server. Results from this flow run will be stored in a temporary directory in its runtime environment. 13:54:51.443 | INFO | Flow run 'brainy-parakeet' - Finished in state Completed() Completed() Can you point me into the correct direction? I'm trying to access the return object of my flow (which is a string in this case).
from prefect import task, flow import time @flow def mijn_flow (): return("just a string") print(mijn_flow())
Anna Geller07/11/2022, 12:31 PM
Jan07/11/2022, 12:33 PM
But this gives me this: <bound method State.result of Completed(message=None, type=COMPLETED, result='just a string')>
result = mijn_flow() print(result.result)
Is working fine, it just feels sloppy for some reason.
from prefect import task, flow import time @flow def mijn_flow (): return("just a string") result = mijn_flow() print(result.result('Completed()'))
Anna Geller07/11/2022, 12:48 PM
but we are aware that adding .result() anytime you want to access the actual data may be a bit cumbersome and Michael is currently looking into it
@flow def mijn_flow(): return "just a string" if __name__ == "__main__": flow_state = mijn_flow() string = flow_state.result() print(string)
Jan07/11/2022, 12:50 PM