Prefect 2.0
You can store the flow run object into a variable and inspect its properties as follows:
from prefect import task, flow
@task
def say_hi():
result = "Hi!"
print(result)
return result
@flow
def hello_world():
say_hi()
if __name__ == "__main__":
flow_run_state = hello_world()
print(flow_run_state)
print(flow_run_state.message)
print(flow_run_state.is_completed())
print(flow_run_state.result())
print(flow_run_state.state_details)
Prefect 1.0
See the following documentation pages: