Hi team! I have some code that runs a for loop ove...
# ask-community
a
Hi team! I have some code that runs a for loop over run_deployment, takes output prefect future and feeds that is the input to another task. Expected behaviour Prefect would schedule all the jobs (i.e not blocking) and when the result was available from each run_deployment in the 1st for loop, the relevant task woul be triggered Actual behaviour all the runs in the first loop need to be finished before the 2nd loop starts Am i wrong about the expected behaviour? Or am i missing something
Copy code
futures=[]
for i in list:
  future= run_deployment(name=deployment1)
  futures.append(future)
for future in futures:
   result = task(future)
s
normally to get a future instead of the return value youd use
.submit(name=deployment)
a
Ah sure. so if i don't do
.submit
, i return the output of the function directly, not a future, and the 2nd task shouldn't be blocked?
s
yeah, swap to submit abd it should work
a
magic, worked exactly as you say. thanks!
🙏 1