May
03/28/2024, 10:12 AMJeff Hale
03/28/2024, 1:28 PMfrom prefect import flow, task
@task
def task1(input1, input2):
print("task 1 executed")
@task
def task2(input1, input2):
print("task 2 executed")
@flow()
def controller(x, z):
if x == "y" and z == "w":
result = task1(x, z)
if x == "a" and z == "b":
result = task2(x, z)
return result
if __name__ == "__main__":
controller(x="y", z="w")
# controller(x="a", z="b")
Or with match/case if using Python 3.10 and you have a bunch of potential branches?