Hello all! The tasks in a look are scheduled async...
# ask-the-community
x
Hello all! The tasks in a look are scheduled asynchronously, but is there a way to wait for previous task to finish before scheduling the pod for the next one? For example
Copy code
results = []
for i in range(10):
   results.append(some_task(i))
Is there way to make the task at
i=1
wait for the task at
i=0
to finish? And I’d like it to work locally as well as remotely.
t
I think you can do something like this.
Copy code
results = []
for i in range(10):
   some_task_result = some_task(i)
   if len(results) > 0:
      results[-1] >> some_task_result
   results.append(some_task_result)
I've done something similar to this before but I have not actually tested this code.
y
x
cool, I didn’t know about chaining. I’ll check it out. Thanks both!
@Thomas Newton’s code worked!