super basic question but how do I access the result of a mapped task from the
state = flow.run()
object? I always get a
KeyError
when trying to do
state.result[mapped_task].result
but
state.result[not_mapped_task].result
works fine
z
Zach Angell
09/08/2021, 4:59 PM
Hi @An Hoang this has to do with the internals of
flow.run()
. In general, we haven't had users ask to include mapped task states in the return value of
flow.run()
.
If this is essential to your workflow, I'd suggest opening a GitHub issue for an enhancement.
Is there something specific you're trying to do in accessing the mapped result? Happy to help out with workarounds
a
An Hoang
09/08/2021, 5:27 PM
Hi @Zach Angell ! For me checking the
state.result
for each task is just bread and butter in developing and debugging flows, even more so when they are mapped. When I have a downstream reducing task that gathers mapped results into a list, I would like to see what the gathered input looks like since alot of the times the error happen when what I expect doesn't match what the result is.
I usually have to do
list(state.result.items())[-2][1]
(-2 is the index from manually looking at
state.result
), which is a bit cumbersome. It'd be great if we can do the same introspection as unmapped tasks!
👍 1
z
Zach Angell
09/08/2021, 8:03 PM
@Marvin open "Add mapped tasks to the return state of flow.run()"
Makes sense, thanks for bringing this up! I've opened a GitHub issue for this. The change actually should be pretty straightforward, happy to point you in the right direction if you want to take a shot at contributing 🙂
Bring your towel and join one of the fastest growing data communities. Welcome to our second-generation open source orchestration platform, a completely rethought approach to dataflow automation.