https://prefect.io logo
#best-practices
Title
# best-practices
k

Kun Yin

07/26/2022, 9:13 AM
Version:
prefect==2.0b12
Problem: when I run the code
a, b= task.submit(c, d)
the error occurs:`cannot unpack non-iterable PrefectFuture object` I can use
task(nout=2)
in Prefect 1.0+ when my task has multiple return values. What shall I do in Prefect 2.0+ in the same situation? Maybe
a, b= task.submit(c, d).result()
can work but I think it is not a good way.
1
a

Anna Geller

07/26/2022, 12:21 PM
Try returning a list of objects instead We don't do tuple unpacking when submitting to task runner However, if you run the task without .submit() i.e. running it in the main flow run process without task runners, then you should be able to do
Copy code
a, b = task()
as it returns data rather than future
11 Views