https://prefect.io logo
Title
j

Jacqueline Riley Garrahan

05/18/2022, 5:51 PM
Hi, I'm wondering if someone can point me to documentation on how I can compose a flow-of-flows and map upstream flow results to parameters in downstream flows.
k

Kevin Kho

05/18/2022, 6:05 PM
You would need to use the
get_task_run_result
task to fetch the result for the specific task?
j

Jacqueline Riley Garrahan

05/18/2022, 6:21 PM
I'm struggling a bit on the retrieval of individual task results from an upstream flow. Could you comment on how task_ref is defined in this example from the docs:
>>> state.result  # the public property aliases the same API as above
{<Task: add>: <Success: "Task run succeeded.">,
 <Task: add>: <Success: "Task run succeeded.">}
>>> state.result[task_ref]._result  # a Task State's Result contains the Task's return value
<Result: 1>
k

Kevin Kho

05/18/2022, 6:24 PM
That is for using Core alone though. You don’t need that. You should just need to use
get_task_run_result
and then point that to the task slug of the upstream flow and you will get the result loaded in.
j

Jacqueline Riley Garrahan

05/18/2022, 6:27 PM
@Kevin Kho what if I'd like to access individual task results from that upstream flow?
One example: Saving different file results, each with their own designated task
k

Kevin Kho

05/18/2022, 6:30 PM
get_task_run_result
points to the
return
of a specific task in a previous flow run. You can map over this task too if you provide all of the task-slugs.
j

Jacqueline Riley Garrahan

05/18/2022, 6:41 PM
Ah okay- seeing now... The examples in this doc might also be useful to reference in the flow of flows docs: https://docs.prefect.io/orchestration/flow-runs/task-runs.html#task
k

Kevin Kho

05/18/2022, 6:41 PM
Ah I haven’t seen that page before haha