https://prefect.io logo
#prefect-community
Title
# prefect-community
r

Romain

07/19/2019, 8:17 AM
Hi everyone, I am trying to use a conditional flow with a mapped results.Here is an example of what I would like to do :
Copy code
conditions = is_true.map(input_data)
as = do_a.map(input_data)
bs = do_b.map(input_data)
ifelse(conditions, as, bs)
It does not work out because the ifelse function expect the condition to be a boolean, not a list of boolean. Is there a way to do it differently?
c

Chris White

07/19/2019, 3:39 PM
is your goal to do many if/else conditions (one for each mapped result) or a single if/else condition? If it’s the former, you might try:
Copy code
results = ifelse.map(conditions, as, bs)
👍 1
r

Romain

07/22/2019, 6:10 AM
As far as I know, this does not work out. "ifelse" is a function, not a task. Or do you mean I could try to decorate the ifelse function with a "task" decorator?