Hi, I want to capture the return value of one task...
# prefect-community
s
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
You can just pass it.
Copy code
with Flow(..) as flow:
    a = task_a()
    b = task_b(a)
The result is more about checkpointing
s
when I am print the value of 'a' above, it is getting printed as a Task object. Is this expected?
k
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()