https://prefect.io logo
Title
s

Shuchita Tripathi

04/21/2022, 6:12 PM
Hi, I want to capture the return value of one task and pass it in another task. I am trying to do this via Result. But when using result, my flows are not running. they are stuck. Is result the right way to do this? if not, can someone point me to a better way of doing it? also, what can be the reason for flows getting stuck?
k

Kevin Kho

04/21/2022, 6:15 PM
You can just pass it.
with Flow(..) as flow:
    a = task_a()
    b = task_b(a)
The result is more about checkpointing
s

Shuchita Tripathi

04/21/2022, 6:18 PM
when I am print the value of 'a' above, it is getting printed as a Task object. Is this expected?
k

Kevin Kho

04/21/2022, 6:23 PM
Yes if you print inside the Flow because
print
will execute during flow build time instead of runtime so the task value isn’t there yet and you print the Task object itself. If you print inside a task it should be right because the execution will take place during
flow.run()