Robin Eklund
10/04/2022, 12:51 PMfrom flytekit import task, workflow
@task
def task_a() -> None:
print("task_a")
@task
def task_b() -> None:
print("task_b")
@task
def task_c() -> None:
print("task_c")
@workflow
def my_wf() -> None:
task_a()
task_b()
task_c()
this workflow would run task_a, task_b and task_c in parallel. But i want them to run sequentially.@workflow
def my_wf() -> None:
task_a().runs_before(task_b().runs_before(task_c()))
Is there any other solution to this which is less bloaty?Ketan (kumare3)
Robin Eklund
10/04/2022, 2:51 PMpromise1 >> promise2 >> promise3 >> promise4
or even the tasks:
task1() >> task2() >> task3() >> task4()
Ketan (kumare3)
Robin Eklund
10/04/2022, 2:54 PMTypeError: unsupported operand type(s) for >>: 'NoneType' and 'VoidPromise'
from time import sleep
from flytekit import task, workflow
@task
def task_a():
sleep(4)
print("task_a")
@task
def task_b():
sleep(1)
print("task_b")
@task
def task_c():
print("task_c")
@workflow
def my_wf():
promise1 = task_a()
promise2 = task_b()
promise3 = task_c()
promise1 >> promise2 >> promise3
if __name__ == "__main__":
my_wf()
Samhita Alla
Yee
Robin Eklund
10/05/2022, 11:30 AMKevin Su
10/05/2022, 11:44 AMRobin Eklund
10/05/2022, 11:59 AMKevin Su
10/05/2022, 12:32 PM