How to create a conditional flow? #3545
Answered
by
jcrist
newskooler
asked this question in
Q&A
-
I have the following flow below, but I cannot get the if / else (
|
Beta Was this translation helpful? Give feedback.
Answered by
jcrist
Oct 20, 2020
Replies: 1 comment 1 reply
-
Hi @snenkov When posting issues, please:
Doing these things makes it much easier for people to help you. From a quick glance over, it looks like you expect import prefect
from perfect import task, case, Flow, Parameter
@task
def check_task(input) -> bool:
if input == 2:
raise prefect.engine.signals.SKIP()
else:
return (1, 2, 3)
@task
def main_task(input_tuple) -> tuple:
# do some task
@task
def is_tuple(x):
return isinstance(x, tuple)
with Flow("example") as flow:
input = Parameter("input", required=True)
check_result = check_task(input)
with case(is_tuple(check_result), True):
raw_data_info = main_task(check_result) |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
newskooler
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @snenkov
When posting issues, please:
thomasfrederikhoeck
isn't a valid decorator :))Doing these things makes it much easier for people to help you.
From a quick glance over, it looks like you expect
case
to match on the type of the value (tuple
).case
matches on equality - you probably want something like: