Hi, I'm using mapped tasks to run a flow locally u...
# prefect-community
Hi, I'm using mapped tasks to run a flow locally using output = flow.run(). My mapped task calls have outputs (which should be an array based on what I'm passing in). Can i please get some assistance with accessing the array outputs from each mapped task call after I've run flow.run() when my result handler looks something like this attached screenshot? The data I need is circled at the bottom but I can't work out the syntax needed to get through the <Task: Save Sim Data> section. Thanks
👀 1
Hi @Sanjay Patel! I think you can use something like this:
Copy code
is the reference to the task you defined in your flow. In a simple flow:
Copy code
import prefect
from prefect import Flow, task

def my_task()
  return [1, 2, 3]

with Flow("my-flow") as flow:
  my_task_result = my_task()

output = flow.run()

# this is the result of my_task
Let me know if I understood your question correctly!
yep, question understood exactly thanks. I'm calling it from a different location so just trying to access that my_task_result again. I'm trying it now. Thanks
👍 1
@nicholas ok, so I have two problems. 1. I don't have access to
, all I have saved is the
and I run it in a different location. Is it possible to access the
from the
object without it having been run? 2. Which may become clearer after #1 but I'm also using my_task.mapped() so I have an array
Gotcha @Sanjay Patel - you could try something like this:
Copy code
for ref in flow.get_tasks():
and then further filter out the results you don't want
got it, that worked for now. thank you so much!
Great! 😄