Martin T
06/07/2022, 1:48 PMfrom prefect import Flow, Parameter, case, task
@task
def mytask(p2):
print(p2)
with Flow("case-demo") as flow:
p1 = Parameter("p1", default=False)
p2 = Parameter("p2", default="good")
with case(p1, True):
p2 = "bad"
mytask(p2)
print(flow.tasks)
$ prefect build -p flow.py
UserWarning: Tasks were created but not added to the flow: {<Parameter: p1>, <Parameter: p2>}.
$ prefect run -p flow.py
...bad...
Anna Geller
06/07/2022, 1:49 PMMartin T
06/07/2022, 1:52 PMAnna Geller
06/07/2022, 1:57 PMKevin Kho
06/07/2022, 10:33 PM