Jason Boorn
10/27/2021, 4:08 PMAnna Geller
from prefect import task, Flow
@task(log_stdout=True)
def hello_world():
print("hello world")
@task(log_stdout=True)
def hello_world_2():
print("hello world")
with Flow("basic-flow") as flow:
t1 = hello_world()
t2 = hello_world_2()
t1.set_downstream(t2)
if __name__ == "__main__":
flow.visualize()
Anna Geller
from prefect import task, Flow
@task(log_stdout=True)
def hello_world():
print("hello world")
@task(log_stdout=True)
def hello_world_2():
print("hello world")
flow = Flow("basic-flow", tasks=[hello_world, hello_world_2])
if __name__ == "__main__":
flow.visualize()
this should still run one after the other when using the default LocalExecutor, but I think this way you can’t guarantee that hello_world runs before hello_world_2. Does it make sense?Jason Boorn
10/27/2021, 4:30 PMKevin Kho
with Flow("basic-flow") as flow:
t1 = hello_world()
t2 = hello_world_2(upstream_tasks=[t1])