https://flyte.org logo
#ask-the-community
Title
# ask-the-community
x

Xinzhou Liu

11/16/2023, 9:39 PM
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

Thomas Newton

11/16/2023, 10:04 PM
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

Yi Chiu

11/16/2023, 10:05 PM
x

Xinzhou Liu

11/16/2023, 10:21 PM
cool, I didn’t know about chaining. I’ll check it out. Thanks both!
@Thomas Newton’s code worked!
2 Views