How to pass data between flow runs created from deployments (with the run_deployment utility)?

  1. Set PREFECT_RESULTS_PERSIST_BY_DEFAULT='True' on the agent (e.g. in the CLI before starting an agent, or as environment variable on the agent’s K8s job or containerized service)
  2. Create a new block for result storage e.g. S3 or GCS
  3. Point a flow to that storage on the decorator @flow(result_storage='gcs/<my-block>')

Now, within a flow, task or script that calls a flow run from that deployment, you should be able to retrieve the results using .state.result():

a = run_deployment('<my-flow>/<my-deployment') 
a.state.result()
1 Like